aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.0/libstdc++-v3/include
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2009-11-05 15:11:04 -0800
committerJing Yu <jingyu@google.com>2009-11-05 15:11:04 -0800
commitdf62c1c110e8532b995b23540b7e3695729c0779 (patch)
treedbbd4cbdb50ac38011e058a2533ee4c3168b0205 /gcc-4.4.0/libstdc++-v3/include
parent8d401cf711539af5a2f78d12447341d774892618 (diff)
downloadtoolchain_gcc-df62c1c110e8532b995b23540b7e3695729c0779.tar.gz
toolchain_gcc-df62c1c110e8532b995b23540b7e3695729c0779.tar.bz2
toolchain_gcc-df62c1c110e8532b995b23540b7e3695729c0779.zip
Check in gcc sources for prebuilt toolchains in Eclair.
Diffstat (limited to 'gcc-4.4.0/libstdc++-v3/include')
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/Makefile.am1239
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/Makefile.in1641
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/auto_ptr.h292
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/backward_warning.h56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/binders.h168
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/hash_fun.h167
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/hash_map591
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/hash_set559
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/hashtable.h1148
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/backward/strstream176
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/algorithmfwd.h805
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/allocator.h181
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/atomic_0.h463
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/atomic_2.h449
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_c.h174
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_cxx.h109
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.h474
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.tcc187
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/basic_string.h2692
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/basic_string.tcc1144
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/boost_concept_check.h787
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/c++config317
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/char_traits.h575
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/codecvt.h497
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/concept_check.h80
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/cpp_type_traits.h419
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/deque.tcc863
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/forward_list.h1306
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/forward_list.tcc478
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/fstream.tcc926
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/functexcept.h93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/functional_hash.h68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/gslice.h182
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/gslice_array.h216
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/hashtable.h58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/indirect_array.h210
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/ios_base.h982
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/istream.tcc1022
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/list.tcc416
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.h812
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.tcc271
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.h2602
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.tcc1344
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.h1914
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.tcc1330
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/localefwd.h183
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/mask_array.h206
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/move.h98
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/ostream.tcc407
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/ostream_insert.h127
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/postypes.h241
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/shared_ptr.h1591
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/slice_array.h272
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/sstream.tcc273
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_algo.h6139
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_algobase.h1153
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_bvector.h1024
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_construct.h129
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_deque.h1819
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_function.h715
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_heap.h578
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator.h1041
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_funcs.h197
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_types.h168
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_list.h1533
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_map.h871
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_multimap.h800
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_multiset.h697
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_numeric.h373
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_pair.h261
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_queue.h586
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_raw_storage_iter.h106
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_relops.h131
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_set.h708
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_stack.h299
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_tempbuf.h206
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_tree.h1523
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_uninitialized.h478
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stl_vector.h1249
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stream_iterator.h211
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/streambuf.tcc174
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/streambuf_iterator.h392
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/stringfwd.h77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/unique_ptr.h450
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/valarray_after.h549
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.h699
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.tcc241
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/valarray_before.h730
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/bits/vector.tcc681
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cassert33
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cctype36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cerrno50
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cfloat36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/ciso64632
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/climits36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/clocale36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cmath119
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/csetjmp44
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/csignal36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cstdarg37
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cstddef40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cstdio79
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cstdlib36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cstring36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/ctime36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cwchar57
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c/cwctype40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/assert.h29
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/complex.h42
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/ctype.h50
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/errno.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/fenv.h58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/float.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/inttypes.h76
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/iso646.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/limits.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/locale.h40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/math.h77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/setjmp.h39
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/signal.h40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdarg.h38
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdatomic.h218
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdbool.h42
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stddef.h39
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdint.h84
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdio.h86
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdlib.h68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/string.h59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/tgmath.h42
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/time.h61
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/wchar.h116
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_compatibility/wctype.h56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cassert45
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/ccomplex44
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cctype101
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cerrno53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cfenv61
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cfloat60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cinttypes71
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/ciso64633
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/climits60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/clocale61
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cmath631
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cmath.tcc55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/csetjmp64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/csignal60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstdarg60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstdatomic848
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstdbool44
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstddef56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstdint79
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstdio205
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstdlib242
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cstring123
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/ctgmath41
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/ctime78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cwchar291
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_global/cwctype126
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cassert44
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cctype81
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cerrno52
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cfloat47
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/ciso64633
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/climits47
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/clocale60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cmath591
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cmath.tcc55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/csetjmp63
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/csignal59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cstdarg59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cstddef55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cstdio186
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cstdlib222
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cstring122
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/ctime77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cwchar272
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/c_std/cwctype107
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/bitset369
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/debug.h130
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/deque515
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/formatter.h392
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/functions.h383
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/list653
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/macros.h246
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/map37
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/map.h412
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/multimap.h400
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/multiset.h396
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/safe_base.h220
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.h643
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.tcc143
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/safe_sequence.h183
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/set37
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/set.h401
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/string1074
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/unordered_map608
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/unordered_set601
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/debug/vector551
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/algorithm524
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/array_allocator.h154
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/atomicity.h113
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/bitmap_allocator.h1145
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/cast.h113
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/codecvt_specializations.h507
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/concurrence.h322
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/debug_allocator.h124
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/enc_filebuf.h62
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/extptr_allocator.h176
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/functional425
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/iterator113
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/malloc_allocator.h134
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/memory195
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/mt_allocator.h751
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/new_allocator.h130
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/numeric146
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/numeric_traits.h135
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp683
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp173
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp67
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp85
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp211
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp497
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp70
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp81
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp218
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp272
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp120
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp182
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp211
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp136
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp237
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp381
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp120
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp156
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp146
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp250
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp357
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp152
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp144
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp159
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp72
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp246
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp91
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp183
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp72
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp253
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp172
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp116
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp61
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp49
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp234
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp97
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp98
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp192
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp73
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp216
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp232
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp636
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp83
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp117
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp191
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp49
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp91
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp103
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp101
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp95
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp71
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp41
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp100
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp43
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp70
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp71
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp83
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp88
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp133
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp46
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp72
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp125
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp103
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp332
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp360
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp179
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp223
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp71
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp100
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp85
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp86
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp70
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp46
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp677
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp43
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp111
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp118
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp83
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp100
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp137
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp72
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp107
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp108
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp359
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp327
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp73
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp162
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp154
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp152
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp141
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp150
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp175
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp88
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp349
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp123
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp52
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp95
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp141
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp57
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp135
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp90
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp57
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp106
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp80
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp359
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp86
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp51
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp273
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp84
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp193
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp63
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp103
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp292
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp522
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp51
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp137
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp183
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp91
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp236
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp50
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp101
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp216
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp140
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp79
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp111
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp214
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp117
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp319
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp269
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp124
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp465
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp599
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp120
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp171
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp128
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp338
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp86
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp515
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp484
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp63
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp103
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp150
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp254
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp229
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp113
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp350
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp91
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp100
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp289
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp39
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp46
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp115
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp138
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp280
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp313
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp124
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp88
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp121
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp107
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp154
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp262
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp198
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp81
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp211
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp90
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp289
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp94
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp161
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp249
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp125
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp137
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp73
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp102
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp157
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp99
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp39
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp125
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp283
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp298
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp112
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp113
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp136
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp106
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp112
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp296
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp51
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp326
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp126
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp351
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp55
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp116
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp50
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp141
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp72
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp209
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp116
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp50
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp183
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp151
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp89
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp72
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp99
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp249
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp167
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp82
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp129
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp151
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp150
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp143
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/exception.hpp103
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp604
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp136
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp125
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp363
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp162
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp355
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pod_char_traits.h182
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pointer.h551
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/pool_allocator.h263
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/rb_tree93
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/rc_string_base.h718
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/rope2958
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/ropeimpl.h1701
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/slist1077
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/sso_string_base.h575
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/stdio_filebuf.h157
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/stdio_sync_filebuf.h279
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/string_conversions.h94
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/throw_allocator.h448
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/type_traits.h204
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/typelist.h544
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/vstring.h2596
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/vstring.tcc696
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/vstring_fwd.h87
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/ext/vstring_util.h180
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/algo.h2364
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/algobase.h281
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/algorithm40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/algorithmfwd.h898
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/balanced_quicksort.h477
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/base.h471
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/basic_iterator.h42
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/checkers.h154
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/compatibility.h350
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/compiletime_settings.h75
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/equally_split.h87
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/features.h104
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/find.h401
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/find_selectors.h192
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/for_each.h97
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/for_each_selectors.h360
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/iterator.h200
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/list_partition.h176
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/losertree.h1021
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/merge.h261
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/multiseq_selection.h633
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/multiway_merge.h2145
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/multiway_mergesort.h475
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/numeric500
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/numericfwd.h203
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop.h118
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop_static.h117
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/par_loop.h135
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/parallel.h42
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/partial_sum.h220
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/partition.h429
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/queue.h149
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/quicksort.h179
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/random_number.h124
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/random_shuffle.h519
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/search.h172
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/set_operations.h524
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/settings.h281
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/sort.h229
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/tags.h191
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/types.h155
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/unique_copy.h192
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/parallel/workstealing.h306
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/precompiled/extc++.h69
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/precompiled/stdc++.h111
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/precompiled/stdtr1c++.h53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/algorithm68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/array60
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/bitset1396
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/c++0x_warning.h36
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/chrono672
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/complex1587
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/condition_variable225
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/deque75
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/forward_list46
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/fstream918
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/functional78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/iomanip296
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/ios47
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/iosfwd160
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/iostream76
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/istream833
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/iterator70
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/limits1256
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/list74
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/locale45
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/map68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/memory100
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/mutex771
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/numeric78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/ostream568
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/queue67
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/random70
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/ratio303
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/regex68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/set68
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/sstream576
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/stack64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/stdexcept150
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/streambuf799
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/string59
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/system_error360
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/thread284
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/tuple697
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/type_traits605
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/unordered_map78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/unordered_set78
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/utility94
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/valarray1086
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/std/vector77
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/array54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/bessel_function.tcc627
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/beta_function.tcc197
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/ccomplex34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cctype49
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cfenv53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cfloat42
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cinttypes63
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/climits46
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cmath507
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/complex91
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/complex.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cstdarg34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cstdbool40
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cstdint76
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cstdio54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cstdlib54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/ctgmath34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/ctime34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/ctype.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cwchar54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/cwctype54
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/ell_integral.tcc750
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/exp_integral.tcc524
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/fenv.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/float.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/functional63
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/functional_hash.h53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/gamma.tcc471
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/hashtable.h53
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/hypergeometric.tcc774
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/inttypes.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/legendre_function.tcc305
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/limits.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/math.h186
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/memory67
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/modified_bessel_func.tcc436
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/poly_hermite.tcc124
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/poly_laguerre.tcc329
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/random66
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/regex64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/riemann_zeta.tcc435
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/shared_ptr.h1020
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/special_function_util.h144
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/stdarg.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/stdbool.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/stdint.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/stdio.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/stdlib.h52
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/tgmath.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/tuple422
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/type_traits249
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/unordered_map61
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/unordered_set61
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/utility56
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/wchar.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1/wctype.h34
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/array287
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h239
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cctype43
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cfenv70
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cinttypes64
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cmath902
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/complex370
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdint75
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdio44
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdlib65
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwchar58
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwctype43
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional2130
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional_hash.h183
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable1266
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable_policy.h865
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/random2407
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/random.tcc1577
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/regex2708
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/type_traits501
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_map370
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_set360
-rw-r--r--gcc-4.4.0/libstdc++-v3/include/tr1_impl/utility120
670 files changed, 190944 insertions, 0 deletions
diff --git a/gcc-4.4.0/libstdc++-v3/include/Makefile.am b/gcc-4.4.0/libstdc++-v3/include/Makefile.am
new file mode 100644
index 000000000..02f450052
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/Makefile.am
@@ -0,0 +1,1239 @@
+## Makefile for the include subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+## Free Software Foundation, Inc.
+##
+## This file is part of the libstdc++ version 3 distribution.
+## Process this file with automake to produce Makefile.in.
+
+## This file is part of the GNU ISO C++ Library. This library is free
+## software; you can redistribute it and/or modify it under the
+## terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 3, or (at your option)
+## any later version.
+
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License along
+## with this library; see the file COPYING3. If not see
+## <http://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/fragment.am
+
+# Standard C++ includes.
+std_srcdir = ${glibcxx_srcdir}/include/std
+std_builddir = .
+std_headers = \
+ ${std_srcdir}/algorithm \
+ ${std_srcdir}/array \
+ ${std_srcdir}/bitset \
+ ${std_srcdir}/c++0x_warning.h \
+ ${std_srcdir}/chrono \
+ ${std_srcdir}/complex \
+ ${std_srcdir}/condition_variable \
+ ${std_srcdir}/deque \
+ ${std_srcdir}/forward_list \
+ ${std_srcdir}/fstream \
+ ${std_srcdir}/functional \
+ ${std_srcdir}/iomanip \
+ ${std_srcdir}/ios \
+ ${std_srcdir}/iosfwd \
+ ${std_srcdir}/iostream \
+ ${std_srcdir}/istream \
+ ${std_srcdir}/iterator \
+ ${std_srcdir}/limits \
+ ${std_srcdir}/list \
+ ${std_srcdir}/locale \
+ ${std_srcdir}/map \
+ ${std_srcdir}/memory \
+ ${std_srcdir}/mutex \
+ ${std_srcdir}/numeric \
+ ${std_srcdir}/ostream \
+ ${std_srcdir}/queue \
+ ${std_srcdir}/random \
+ ${std_srcdir}/ratio \
+ ${std_srcdir}/regex \
+ ${std_srcdir}/set \
+ ${std_srcdir}/sstream \
+ ${std_srcdir}/stack \
+ ${std_srcdir}/stdexcept \
+ ${std_srcdir}/streambuf \
+ ${std_srcdir}/string \
+ ${std_srcdir}/system_error \
+ ${std_srcdir}/thread \
+ ${std_srcdir}/tuple \
+ ${std_srcdir}/type_traits \
+ ${std_srcdir}/unordered_map \
+ ${std_srcdir}/unordered_set \
+ ${std_srcdir}/utility \
+ ${std_srcdir}/valarray \
+ ${std_srcdir}/vector
+
+bits_srcdir = ${glibcxx_srcdir}/include/bits
+bits_builddir = ./bits
+bits_headers = \
+ ${bits_srcdir}/algorithmfwd.h \
+ ${bits_srcdir}/allocator.h \
+ ${bits_srcdir}/atomicfwd_c.h \
+ ${bits_srcdir}/atomicfwd_cxx.h \
+ ${bits_srcdir}/atomic_0.h \
+ ${bits_srcdir}/atomic_2.h \
+ ${bits_srcdir}/basic_ios.h \
+ ${bits_srcdir}/basic_ios.tcc \
+ ${bits_srcdir}/basic_string.h \
+ ${bits_srcdir}/basic_string.tcc \
+ ${bits_srcdir}/boost_concept_check.h \
+ ${bits_srcdir}/char_traits.h \
+ ${bits_srcdir}/codecvt.h \
+ ${bits_srcdir}/concept_check.h \
+ ${bits_srcdir}/cpp_type_traits.h \
+ ${bits_srcdir}/deque.tcc \
+ ${bits_srcdir}/forward_list.h \
+ ${bits_srcdir}/forward_list.tcc \
+ ${bits_srcdir}/fstream.tcc \
+ ${bits_srcdir}/functexcept.h \
+ ${bits_srcdir}/functional_hash.h \
+ ${bits_srcdir}/gslice.h \
+ ${bits_srcdir}/gslice_array.h \
+ ${bits_srcdir}/hashtable.h \
+ ${bits_srcdir}/indirect_array.h \
+ ${bits_srcdir}/ios_base.h \
+ ${bits_srcdir}/istream.tcc \
+ ${bits_srcdir}/list.tcc \
+ ${bits_srcdir}/locale_classes.h \
+ ${bits_srcdir}/locale_classes.tcc \
+ ${bits_srcdir}/locale_facets.h \
+ ${bits_srcdir}/locale_facets.tcc \
+ ${bits_srcdir}/locale_facets_nonio.h \
+ ${bits_srcdir}/locale_facets_nonio.tcc \
+ ${bits_srcdir}/localefwd.h \
+ ${bits_srcdir}/mask_array.h \
+ ${bits_srcdir}/move.h \
+ ${bits_srcdir}/ostream.tcc \
+ ${bits_srcdir}/ostream_insert.h \
+ ${bits_srcdir}/postypes.h \
+ ${bits_srcdir}/stream_iterator.h \
+ ${bits_srcdir}/streambuf_iterator.h \
+ ${bits_srcdir}/shared_ptr.h \
+ ${bits_srcdir}/slice_array.h \
+ ${bits_srcdir}/sstream.tcc \
+ ${bits_srcdir}/stl_algo.h \
+ ${bits_srcdir}/stl_algobase.h \
+ ${bits_srcdir}/stl_bvector.h \
+ ${bits_srcdir}/stl_construct.h \
+ ${bits_srcdir}/stl_deque.h \
+ ${bits_srcdir}/stl_function.h \
+ ${bits_srcdir}/stl_heap.h \
+ ${bits_srcdir}/stl_iterator.h \
+ ${bits_srcdir}/stl_iterator_base_funcs.h \
+ ${bits_srcdir}/stl_iterator_base_types.h \
+ ${bits_srcdir}/stl_list.h \
+ ${bits_srcdir}/stl_map.h \
+ ${bits_srcdir}/stl_multimap.h \
+ ${bits_srcdir}/stl_multiset.h \
+ ${bits_srcdir}/stl_numeric.h \
+ ${bits_srcdir}/stl_pair.h \
+ ${bits_srcdir}/stl_queue.h \
+ ${bits_srcdir}/stl_raw_storage_iter.h \
+ ${bits_srcdir}/stl_relops.h \
+ ${bits_srcdir}/stl_set.h \
+ ${bits_srcdir}/stl_stack.h \
+ ${bits_srcdir}/stl_tempbuf.h \
+ ${bits_srcdir}/stl_tree.h \
+ ${bits_srcdir}/stl_uninitialized.h \
+ ${bits_srcdir}/stl_vector.h \
+ ${bits_srcdir}/streambuf.tcc \
+ ${bits_srcdir}/stringfwd.h \
+ ${bits_srcdir}/unique_ptr.h \
+ ${bits_srcdir}/valarray_array.h \
+ ${bits_srcdir}/valarray_array.tcc \
+ ${bits_srcdir}/valarray_before.h \
+ ${bits_srcdir}/valarray_after.h \
+ ${bits_srcdir}/vector.tcc
+
+backward_srcdir = ${glibcxx_srcdir}/include/backward
+backward_builddir = ./backward
+backward_headers = \
+ ${backward_srcdir}/auto_ptr.h \
+ ${backward_srcdir}/backward_warning.h \
+ ${backward_srcdir}/binders.h \
+ ${backward_srcdir}/hash_map \
+ ${backward_srcdir}/hash_set \
+ ${backward_srcdir}/hash_fun.h \
+ ${backward_srcdir}/hashtable.h \
+ ${backward_srcdir}/strstream
+
+pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds
+pb_builddir = ./ext/pb_ds
+
+pb_subdirs = \
+ ${pb_builddir}/detail \
+ ${pb_builddir}/detail/pairing_heap_ \
+ ${pb_builddir}/detail/splay_tree_ \
+ ${pb_builddir}/detail/list_update_map_ \
+ ${pb_builddir}/detail/basic_tree_policy \
+ ${pb_builddir}/detail/trie_policy \
+ ${pb_builddir}/detail/gp_hash_table_map_ \
+ ${pb_builddir}/detail/tree_policy \
+ ${pb_builddir}/detail/binomial_heap_base_ \
+ ${pb_builddir}/detail/resize_policy \
+ ${pb_builddir}/detail/bin_search_tree_ \
+ ${pb_builddir}/detail/binomial_heap_ \
+ ${pb_builddir}/detail/thin_heap_ \
+ ${pb_builddir}/detail/pat_trie_ \
+ ${pb_builddir}/detail/cc_hash_table_map_ \
+ ${pb_builddir}/detail/rc_binomial_heap_ \
+ ${pb_builddir}/detail/left_child_next_sibling_heap_ \
+ ${pb_builddir}/detail/unordered_iterator \
+ ${pb_builddir}/detail/binary_heap_ \
+ ${pb_builddir}/detail/ov_tree_map_ \
+ ${pb_builddir}/detail/hash_fn \
+ ${pb_builddir}/detail/eq_fn \
+ ${pb_builddir}/detail/rb_tree_map_ \
+ ${pb_builddir}/detail/list_update_policy
+
+# The ability for make and the underlying host to deal with this
+# unwieldy list as one entire entity is not a sure thing, and may
+# cause build errors. Thus, split one list into many smaller
+# mini-lists, with the maximum size per mini-list of no more than 42.
+
+pb_headers1 = \
+ ${pb_srcdir}/assoc_container.hpp \
+ ${pb_srcdir}/exception.hpp \
+ ${pb_srcdir}/hash_policy.hpp \
+ ${pb_srcdir}/list_update_policy.hpp \
+ ${pb_srcdir}/priority_queue.hpp \
+ ${pb_srcdir}/tag_and_trait.hpp \
+ ${pb_srcdir}/tree_policy.hpp \
+ ${pb_srcdir}/trie_policy.hpp \
+ ${pb_srcdir}/detail/basic_tree_policy/basic_tree_policy_base.hpp \
+ ${pb_srcdir}/detail/basic_tree_policy/null_node_metadata.hpp \
+ ${pb_srcdir}/detail/basic_tree_policy/traits.hpp \
+ ${pb_srcdir}/detail/basic_types.hpp \
+ ${pb_srcdir}/detail/binary_heap_/binary_heap_.hpp \
+ ${pb_srcdir}/detail/binary_heap_/const_iterator.hpp \
+ ${pb_srcdir}/detail/binary_heap_/const_point_iterator.hpp \
+ ${pb_srcdir}/detail/binary_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/entry_cmp.hpp \
+ ${pb_srcdir}/detail/binary_heap_/entry_pred.hpp \
+ ${pb_srcdir}/detail/binary_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/resize_policy.hpp \
+ ${pb_srcdir}/detail/binary_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/binomial_heap_base_.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_/binomial_heap_.hpp \
+ ${pb_srcdir}/detail/binomial_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
+
+pb_headers2 = \
+ ${pb_srcdir}/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/node_iterators.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/point_iterators.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/r_erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/rotate_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/traits.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/cc_ht_map_.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/cmp_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/entry_list_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/resize_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/size_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/standard_policies.hpp
+
+pb_headers3 = \
+ ${pb_srcdir}/detail/cc_hash_table_map_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/cond_dealtor.hpp \
+ ${pb_srcdir}/detail/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/container_base_dispatch.hpp \
+ ${pb_srcdir}/detail/eq_fn/eq_by_less.hpp \
+ ${pb_srcdir}/detail/eq_fn/hash_eq_fn.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/gp_ht_map_.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/iterator_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/resize_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/standard_policies.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/hash_fn/direct_mask_range_hashing_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/direct_mod_range_hashing_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/linear_probe_fn_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/mask_based_range_hashing.hpp \
+ ${pb_srcdir}/detail/hash_fn/mod_based_range_hashing.hpp \
+ ${pb_srcdir}/detail/hash_fn/probe_fn_base.hpp \
+ ${pb_srcdir}/detail/hash_fn/quadratic_probe_fn_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/ranged_hash_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/ranged_probe_fn.hpp
+
+pb_headers4 = \
+ ${pb_srcdir}/detail/hash_fn/sample_probe_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/sample_ranged_hash_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/sample_ranged_probe_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/sample_range_hashing.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_iterator.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_point_iterator.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/node.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/null_metadata.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/constructor_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/entry_metadata_base.hpp \
+ ${pb_srcdir}/detail/list_update_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/lu_map_.hpp \
+ ${pb_srcdir}/detail/list_update_map_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_policy/counter_lu_metadata.hpp \
+ ${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \
+ ${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \
+ ${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \
+ ${pb_srcdir}/detail/debug_map_base.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/node_iterators.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/ov_tree_map_.hpp
+
+pb_headers5 = \
+ ${pb_srcdir}/detail/ov_tree_map_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/traits.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/pairing_heap_.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/child_iterator.hpp \
+ ${pb_srcdir}/detail/pat_trie_/cond_dtor_entry_dealtor.hpp \
+ ${pb_srcdir}/detail/pat_trie_/const_child_iterator.hpp \
+ ${pb_srcdir}/detail/pat_trie_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/head.hpp \
+ ${pb_srcdir}/detail/pat_trie_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/insert_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/internal_node.hpp \
+ ${pb_srcdir}/detail/pat_trie_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/leaf.hpp \
+ ${pb_srcdir}/detail/pat_trie_/node_base.hpp \
+ ${pb_srcdir}/detail/pat_trie_/node_iterators.hpp \
+ ${pb_srcdir}/detail/pat_trie_/node_metadata_base.hpp \
+ ${pb_srcdir}/detail/pat_trie_/pat_trie_.hpp \
+ ${pb_srcdir}/detail/pat_trie_/point_iterators.hpp \
+ ${pb_srcdir}/detail/pat_trie_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/r_erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/rotate_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/split_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/split_join_branch_bag.hpp \
+ ${pb_srcdir}/detail/pat_trie_/synth_e_access_traits.hpp \
+ ${pb_srcdir}/detail/pat_trie_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/traits.hpp \
+ ${pb_srcdir}/detail/pat_trie_/update_fn_imps.hpp \
+ ${pb_srcdir}/detail/priority_queue_base_dispatch.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/debug_fn_imps.hpp
+
+pb_headers6 = \
+ ${pb_srcdir}/detail/rb_tree_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/node.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/rb_tree_.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/traits.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/rc_binomial_heap_.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/rc.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_exponential_size_policy_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_prime_size_policy_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_standard_resize_policy_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/sample_resize_policy.hpp \
+ ${pb_srcdir}/detail/resize_policy/sample_resize_trigger.hpp \
+ ${pb_srcdir}/detail/resize_policy/sample_size_policy.hpp \
+ ${pb_srcdir}/detail/splay_tree_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/node.hpp \
+ ${pb_srcdir}/detail/splay_tree_/splay_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/splay_tree_.hpp \
+ ${pb_srcdir}/detail/splay_tree_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/traits.hpp \
+ ${pb_srcdir}/detail/standard_policies.hpp \
+ ${pb_srcdir}/detail/thin_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/erase_fn_imps.hpp
+
+pb_headers7 = \
+ ${pb_srcdir}/detail/thin_heap_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/thin_heap_.hpp \
+ ${pb_srcdir}/detail/thin_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/tree_policy/node_metadata_selector.hpp \
+ ${pb_srcdir}/detail/tree_policy/null_node_update_imp.hpp \
+ ${pb_srcdir}/detail/tree_policy/order_statistics_imp.hpp \
+ ${pb_srcdir}/detail/tree_policy/sample_tree_node_update.hpp \
+ ${pb_srcdir}/detail/tree_trace_base.hpp \
+ ${pb_srcdir}/detail/trie_policy/node_metadata_selector.hpp \
+ ${pb_srcdir}/detail/trie_policy/null_node_update_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/order_statistics_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/prefix_search_node_update_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/sample_trie_e_access_traits.hpp \
+ ${pb_srcdir}/detail/trie_policy/sample_trie_node_update.hpp \
+ ${pb_srcdir}/detail/trie_policy/string_trie_e_access_traits_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/trie_policy_base.hpp \
+ ${pb_srcdir}/detail/types_traits.hpp \
+ ${pb_srcdir}/detail/type_utils.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/const_iterator.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/const_point_iterator.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/iterator.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp
+
+
+ext_srcdir = ${glibcxx_srcdir}/include/ext
+ext_builddir = ./ext
+ext_headers = \
+ ${ext_srcdir}/algorithm \
+ ${ext_srcdir}/atomicity.h \
+ ${ext_srcdir}/array_allocator.h \
+ ${ext_srcdir}/bitmap_allocator.h \
+ ${ext_srcdir}/cast.h \
+ ${ext_srcdir}/codecvt_specializations.h \
+ ${ext_srcdir}/concurrence.h \
+ ${ext_srcdir}/debug_allocator.h \
+ ${ext_srcdir}/enc_filebuf.h \
+ ${ext_srcdir}/extptr_allocator.h \
+ ${ext_srcdir}/stdio_filebuf.h \
+ ${ext_srcdir}/stdio_sync_filebuf.h \
+ ${ext_srcdir}/functional \
+ ${ext_srcdir}/iterator \
+ ${ext_srcdir}/malloc_allocator.h \
+ ${ext_srcdir}/memory \
+ ${ext_srcdir}/mt_allocator.h \
+ ${ext_srcdir}/new_allocator.h \
+ ${ext_srcdir}/numeric \
+ ${ext_srcdir}/numeric_traits.h \
+ ${ext_srcdir}/pod_char_traits.h \
+ ${ext_srcdir}/pointer.h \
+ ${ext_srcdir}/pool_allocator.h \
+ ${ext_srcdir}/rb_tree \
+ ${ext_srcdir}/rope \
+ ${ext_srcdir}/ropeimpl.h \
+ ${ext_srcdir}/slist \
+ ${ext_srcdir}/string_conversions.h \
+ ${ext_srcdir}/throw_allocator.h \
+ ${ext_srcdir}/typelist.h \
+ ${ext_srcdir}/type_traits.h \
+ ${ext_srcdir}/rc_string_base.h \
+ ${ext_srcdir}/sso_string_base.h \
+ ${ext_srcdir}/vstring.h \
+ ${ext_srcdir}/vstring.tcc \
+ ${ext_srcdir}/vstring_fwd.h \
+ ${ext_srcdir}/vstring_util.h \
+ ${ext_compat_headers}
+
+ext_compat_headers = \
+ ${backward_srcdir}/hash_set \
+ ${backward_srcdir}/hash_map
+
+tr1_srcdir = ${glibcxx_srcdir}/include/tr1
+tr1_builddir = ./tr1
+tr1_headers = \
+ ${tr1_srcdir}/array \
+ ${tr1_srcdir}/bessel_function.tcc \
+ ${tr1_srcdir}/beta_function.tcc \
+ ${tr1_srcdir}/ccomplex \
+ ${tr1_srcdir}/cctype \
+ ${tr1_srcdir}/cfenv \
+ ${tr1_srcdir}/cfloat \
+ ${tr1_srcdir}/cinttypes \
+ ${tr1_srcdir}/climits \
+ ${tr1_srcdir}/cmath \
+ ${tr1_srcdir}/complex \
+ ${tr1_srcdir}/complex.h \
+ ${tr1_srcdir}/cstdarg \
+ ${tr1_srcdir}/cstdbool \
+ ${tr1_srcdir}/cstdint \
+ ${tr1_srcdir}/cstdio \
+ ${tr1_srcdir}/cstdlib \
+ ${tr1_srcdir}/ctgmath \
+ ${tr1_srcdir}/ctime \
+ ${tr1_srcdir}/ctype.h \
+ ${tr1_srcdir}/cwchar \
+ ${tr1_srcdir}/cwctype \
+ ${tr1_srcdir}/ell_integral.tcc \
+ ${tr1_srcdir}/exp_integral.tcc \
+ ${tr1_srcdir}/fenv.h \
+ ${tr1_srcdir}/float.h \
+ ${tr1_srcdir}/functional \
+ ${tr1_srcdir}/functional_hash.h \
+ ${tr1_srcdir}/gamma.tcc \
+ ${tr1_srcdir}/hypergeometric.tcc \
+ ${tr1_srcdir}/hashtable.h \
+ ${tr1_srcdir}/inttypes.h \
+ ${tr1_srcdir}/limits.h \
+ ${tr1_srcdir}/math.h \
+ ${tr1_srcdir}/memory \
+ ${tr1_srcdir}/modified_bessel_func.tcc \
+ ${tr1_srcdir}/poly_hermite.tcc \
+ ${tr1_srcdir}/poly_laguerre.tcc \
+ ${tr1_srcdir}/legendre_function.tcc \
+ ${tr1_srcdir}/random \
+ ${tr1_srcdir}/regex \
+ ${tr1_srcdir}/riemann_zeta.tcc \
+ ${tr1_srcdir}/shared_ptr.h \
+ ${tr1_srcdir}/special_function_util.h \
+ ${tr1_srcdir}/stdarg.h \
+ ${tr1_srcdir}/stdbool.h \
+ ${tr1_srcdir}/stdint.h \
+ ${tr1_srcdir}/stdio.h \
+ ${tr1_srcdir}/stdlib.h \
+ ${tr1_srcdir}/tgmath.h \
+ ${tr1_srcdir}/tuple \
+ ${tr1_srcdir}/type_traits \
+ ${tr1_srcdir}/unordered_set \
+ ${tr1_srcdir}/unordered_map \
+ ${tr1_srcdir}/utility \
+ ${tr1_srcdir}/wchar.h \
+ ${tr1_srcdir}/wctype.h
+
+
+tr1_impl_srcdir = ${glibcxx_srcdir}/include/tr1_impl
+tr1_impl_builddir = ./tr1_impl
+tr1_impl_headers = \
+ ${tr1_impl_srcdir}/array \
+ ${tr1_impl_srcdir}/boost_sp_counted_base.h \
+ ${tr1_impl_srcdir}/cctype \
+ ${tr1_impl_srcdir}/cfenv \
+ ${tr1_impl_srcdir}/cinttypes \
+ ${tr1_impl_srcdir}/cmath \
+ ${tr1_impl_srcdir}/complex \
+ ${tr1_impl_srcdir}/cstdint \
+ ${tr1_impl_srcdir}/cstdio \
+ ${tr1_impl_srcdir}/cstdlib \
+ ${tr1_impl_srcdir}/cwchar \
+ ${tr1_impl_srcdir}/cwctype \
+ ${tr1_impl_srcdir}/functional \
+ ${tr1_impl_srcdir}/functional_hash.h \
+ ${tr1_impl_srcdir}/hashtable \
+ ${tr1_impl_srcdir}/hashtable_policy.h \
+ ${tr1_impl_srcdir}/random \
+ ${tr1_impl_srcdir}/random.tcc \
+ ${tr1_impl_srcdir}/regex \
+ ${tr1_impl_srcdir}/type_traits \
+ ${tr1_impl_srcdir}/unordered_map \
+ ${tr1_impl_srcdir}/unordered_set \
+ ${tr1_impl_srcdir}/utility
+
+
+# This is the common subset of C++ files that all three "C" header models use.
+c_base_srcdir = $(C_INCLUDE_DIR)
+c_base_builddir = .
+c_base_headers = \
+ ${c_base_srcdir}/cassert \
+ ${c_base_srcdir}/ccomplex \
+ ${c_base_srcdir}/cctype \
+ ${c_base_srcdir}/cerrno \
+ ${c_base_srcdir}/cfenv \
+ ${c_base_srcdir}/cfloat \
+ ${c_base_srcdir}/cinttypes \
+ ${c_base_srcdir}/ciso646 \
+ ${c_base_srcdir}/climits \
+ ${c_base_srcdir}/clocale \
+ ${c_base_srcdir}/cmath \
+ ${c_base_srcdir}/csetjmp \
+ ${c_base_srcdir}/csignal \
+ ${c_base_srcdir}/cstdarg \
+ ${c_base_srcdir}/cstdatomic \
+ ${c_base_srcdir}/cstdbool \
+ ${c_base_srcdir}/cstddef \
+ ${c_base_srcdir}/cstdint \
+ ${c_base_srcdir}/cstdio \
+ ${c_base_srcdir}/cstdlib \
+ ${c_base_srcdir}/cstring \
+ ${c_base_srcdir}/ctgmath \
+ ${c_base_srcdir}/ctime \
+ ${c_base_srcdir}/cwchar \
+ ${c_base_srcdir}/cwctype
+
+# "C" compatibility headers.
+c_compatibility_srcdir = ${glibcxx_srcdir}/include/c_compatibility
+c_compatibility_builddir = .
+
+if GLIBCXX_C_HEADERS_C_STD
+c_compatibility_headers =
+endif
+
+if GLIBCXX_C_HEADERS_C_GLOBAL
+c_compatibility_headers = \
+ ${c_compatibility_srcdir}/complex.h \
+ ${c_compatibility_srcdir}/fenv.h \
+ ${c_compatibility_srcdir}/tgmath.h \
+ ${c_compatibility_srcdir}/stdatomic.h
+endif
+
+if GLIBCXX_C_HEADERS_C
+c_compatibility_headers = \
+ ${c_compatibility_srcdir}/assert.h \
+ ${c_compatibility_srcdir}/complex.h \
+ ${c_compatibility_srcdir}/ctype.h \
+ ${c_compatibility_srcdir}/errno.h \
+ ${c_compatibility_srcdir}/fenv.h \
+ ${c_compatibility_srcdir}/float.h \
+ ${c_compatibility_srcdir}/inttypes.h \
+ ${c_compatibility_srcdir}/iso646.h \
+ ${c_compatibility_srcdir}/limits.h \
+ ${c_compatibility_srcdir}/locale.h \
+ ${c_compatibility_srcdir}/math.h \
+ ${c_compatibility_srcdir}/setjmp.h \
+ ${c_compatibility_srcdir}/signal.h \
+ ${c_compatibility_srcdir}/stdarg.h \
+ ${c_compatibility_srcdir}/stdbool.h \
+ ${c_compatibility_srcdir}/stddef.h \
+ ${c_compatibility_srcdir}/stdint.h \
+ ${c_compatibility_srcdir}/stdio.h \
+ ${c_compatibility_srcdir}/stdlib.h \
+ ${c_compatibility_srcdir}/string.h \
+ ${c_compatibility_srcdir}/tgmath.h \
+ ${c_compatibility_srcdir}/time.h \
+ ${c_compatibility_srcdir}/wchar.h \
+ ${c_compatibility_srcdir}/wctype.h
+endif
+
+# Debug mode headers
+debug_srcdir = ${glibcxx_srcdir}/include/debug
+debug_builddir = ./debug
+debug_headers = \
+ ${debug_srcdir}/bitset \
+ ${debug_srcdir}/debug.h \
+ ${debug_srcdir}/deque \
+ ${debug_srcdir}/formatter.h \
+ ${debug_srcdir}/functions.h \
+ ${debug_srcdir}/list \
+ ${debug_srcdir}/map \
+ ${debug_srcdir}/macros.h \
+ ${debug_srcdir}/map.h \
+ ${debug_srcdir}/multimap.h \
+ ${debug_srcdir}/multiset.h \
+ ${debug_srcdir}/safe_base.h \
+ ${debug_srcdir}/safe_iterator.h \
+ ${debug_srcdir}/safe_iterator.tcc \
+ ${debug_srcdir}/safe_sequence.h \
+ ${debug_srcdir}/set \
+ ${debug_srcdir}/set.h \
+ ${debug_srcdir}/string \
+ ${debug_srcdir}/unordered_map \
+ ${debug_srcdir}/unordered_set \
+ ${debug_srcdir}/vector
+
+# Parallel mode headers
+parallel_srcdir = ${glibcxx_srcdir}/include/parallel
+parallel_builddir = ./parallel
+if ENABLE_PARALLEL
+parallel_headers = \
+ ${parallel_srcdir}/algo.h \
+ ${parallel_srcdir}/algobase.h \
+ ${parallel_srcdir}/algorithm \
+ ${parallel_srcdir}/algorithmfwd.h \
+ ${parallel_srcdir}/balanced_quicksort.h \
+ ${parallel_srcdir}/base.h \
+ ${parallel_srcdir}/basic_iterator.h \
+ ${parallel_srcdir}/checkers.h \
+ ${parallel_srcdir}/compatibility.h \
+ ${parallel_srcdir}/compiletime_settings.h \
+ ${parallel_srcdir}/equally_split.h \
+ ${parallel_srcdir}/features.h \
+ ${parallel_srcdir}/find.h \
+ ${parallel_srcdir}/find_selectors.h \
+ ${parallel_srcdir}/for_each.h \
+ ${parallel_srcdir}/for_each_selectors.h \
+ ${parallel_srcdir}/iterator.h \
+ ${parallel_srcdir}/list_partition.h \
+ ${parallel_srcdir}/losertree.h \
+ ${parallel_srcdir}/merge.h \
+ ${parallel_srcdir}/multiseq_selection.h \
+ ${parallel_srcdir}/multiway_merge.h \
+ ${parallel_srcdir}/multiway_mergesort.h \
+ ${parallel_srcdir}/numeric \
+ ${parallel_srcdir}/numericfwd.h \
+ ${parallel_srcdir}/omp_loop.h \
+ ${parallel_srcdir}/omp_loop_static.h \
+ ${parallel_srcdir}/par_loop.h \
+ ${parallel_srcdir}/parallel.h \
+ ${parallel_srcdir}/partial_sum.h \
+ ${parallel_srcdir}/partition.h \
+ ${parallel_srcdir}/queue.h \
+ ${parallel_srcdir}/quicksort.h \
+ ${parallel_srcdir}/random_number.h \
+ ${parallel_srcdir}/random_shuffle.h \
+ ${parallel_srcdir}/search.h \
+ ${parallel_srcdir}/set_operations.h \
+ ${parallel_srcdir}/settings.h \
+ ${parallel_srcdir}/sort.h \
+ ${parallel_srcdir}/tags.h \
+ ${parallel_srcdir}/types.h \
+ ${parallel_srcdir}/unique_copy.h \
+ ${parallel_srcdir}/workstealing.h
+else
+parallel_headers =
+endif
+
+
+# Some of the different "C" header models need extra files.
+# Some "C" header schemes require the "C" compatibility headers.
+# For --enable-cheaders=c_std
+if GLIBCXX_C_HEADERS_EXTRA
+c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
+else
+c_base_headers_extra =
+endif
+
+if GLIBCXX_C_HEADERS_COMPATIBILITY
+c_compatibility_headers_extra = ${c_compatibility_headers}
+else
+c_compatibility_headers_extra =
+endif
+
+host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
+host_builddir = ./${host_alias}/bits
+host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
+host_headers = \
+ ${host_srcdir}/ctype_base.h \
+ ${host_srcdir}/ctype_inline.h \
+ ${host_srcdir}/ctype_noninline.h \
+ ${host_srcdir}/os_defines.h \
+ ${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
+ ${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
+ ${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h \
+ ${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
+ ${glibcxx_srcdir}/include/precompiled/stdc++.h \
+ ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
+ ${glibcxx_srcdir}/include/precompiled/extc++.h
+
+# Non-installed host_header files.
+COMPATIBILITY_H = config/abi/compatibility.h
+host_headers_noinst = \
+ ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) \
+ ${glibcxx_srcdir}/$(COMPATIBILITY_H)
+
+# These host_headers_extra files are all built with ad hoc naming rules.
+host_headers_extra = \
+ ${host_builddir}/basic_file.h \
+ ${host_builddir}/c++config.h \
+ ${host_builddir}/c++allocator.h \
+ ${host_builddir}/c++io.h \
+ ${host_builddir}/c++locale.h \
+ ${host_builddir}/messages_members.h \
+ ${host_builddir}/time_members.h
+
+thread_host_headers = \
+ ${host_builddir}/gthr.h \
+ ${host_builddir}/gthr-single.h \
+ ${host_builddir}/gthr-posix.h \
+ ${host_builddir}/gthr-tpf.h \
+ ${host_builddir}/gthr-default.h
+
+
+pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
+pch1_output_builddir = ${host_builddir}/stdc++.h.gch
+pch1_output_anchor = ${host_builddir}/stdc++.h
+pch1_output_installdir = ${host_installdir}/stdc++.h.gch
+pch1a_output = ${pch1_output_builddir}/O0g.gch
+pch1b_output = ${pch1_output_builddir}/O2g.gch
+pch1_output = ${pch1a_output} ${pch1b_output}
+
+pch2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
+pch2_output_builddir = ${host_builddir}/stdtr1c++.h.gch
+pch2_output_anchor = ${host_builddir}/stdtr1c++.h
+pch2_output_installdir = ${host_installdir}/stdtr1c++.h.gch
+pch2_output = ${pch2_output_builddir}/O2g.gch
+
+pch3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
+pch3_output_builddir = ${host_builddir}/extc++.h.gch
+pch3_output_anchor = ${host_builddir}/extc++.h
+pch3_output_installdir = ${host_installdir}/extc++.h.gch
+pch3_output = ${pch3_output_builddir}/O2g.gch
+
+
+pch_output = ${pch1_output} ${pch2_output} ${pch3_output}
+pch_output_dirs = \
+ ${pch1_output_builddir} ${pch2_output_builddir} ${pch3_output_builddir}
+pch_output_anchors = \
+ ${pch1_output_anchor} ${pch2_output_anchor} ${pch3_output_anchor}
+PCHFLAGS=-Winvalid-pch -x c++-header $(CXXFLAGS)
+if GLIBCXX_BUILD_PCH
+pch_build = ${pch_output}
+else
+pch_build =
+endif
+
+# List of all timestamp files. By keeping only one copy of this list, both
+# CLEANFILES and all-local are kept up-to-date.
+allstamped = \
+ stamp-std stamp-bits stamp-c_base stamp-c_base_extra \
+ stamp-c_compatibility stamp-backward stamp-ext stamp-pb \
+ stamp-tr1 stamp-tr1-impl stamp-debug stamp-parallel stamp-host
+
+# List of all files that are created by explicit building, editing, or
+# catenation.
+allcreated = \
+ ${host_builddir}/c++config.h \
+ ${thread_host_headers} \
+ ${pch_build}
+
+# Here are the rules for building the headers
+all-local: ${allstamped} ${allcreated}
+
+# Ignore errors from 'mkdir -p' to avoid parallel make failure on
+# systems with broken mkdir. Call mkdir unconditionally because
+# it is just as cheap to avoid going through the shell.
+# Ignore errors from $(LN_S) because the links may already exist.
+stamp-std: ${std_headers}
+ @-mkdir -p ${std_builddir}
+ @-cd ${std_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-std
+
+stamp-bits: ${bits_headers}
+ @-mkdir -p ${bits_builddir}
+ @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-bits
+
+stamp-c_base: ${c_base_headers}
+ @-mkdir -p ${c_base_builddir}
+ @-cd ${c_base_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-c_base
+
+stamp-c_base_extra: ${c_base_headers_extra}
+ @-mkdir -p ${bits_builddir}
+ @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-c_base_extra
+
+stamp-c_compatibility: ${c_compatibility_headers_extra}
+ @-mkdir -p ${c_compatibility_builddir}
+ @-if [ ! -z "${c_compatibility_headers_extra}" ]; then \
+ cd ${c_compatibility_builddir} && $(LN_S) $? . 2>/dev/null ;\
+ fi
+ @$(STAMP) stamp-c_compatibility
+
+stamp-backward: ${backward_headers}
+ @-mkdir -p ${backward_builddir}
+ @-cd ${backward_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-backward
+
+stamp-ext: ${ext_headers}
+ @-mkdir -p ${ext_builddir}
+ @-cd ${ext_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-ext
+
+# Have to deal with nested include directories, gah! Strip off source
+# directory before making the link.
+# XXX check ${pb_headers}
+stamp-pb:
+ @if [ ! -d "${pb_builddir}" ]; then \
+ mkdir -p ${pb_subdirs} ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers1}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers2}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers3}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers4}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers5}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers6}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers7}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ $(STAMP) stamp-pb
+
+stamp-tr1: ${tr1_headers}
+ @-mkdir -p ${tr1_builddir}
+ @-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-tr1
+
+stamp-tr1-impl: ${tr1_impl_headers}
+ @-mkdir -p ${tr1_impl_builddir}
+ @-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-tr1-impl
+
+stamp-debug: ${debug_headers}
+ @-mkdir -p ${debug_builddir}
+ @-cd ${debug_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-debug
+
+stamp-parallel: ${parallel_headers}
+ @-mkdir -p ${parallel_builddir}
+ @-cd ${parallel_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-parallel
+
+stamp-${host_alias}:
+ @-mkdir -p ${host_builddir}
+ @$(STAMP) stamp-${host_alias}
+
+# Host includes static.
+# XXX Missing dependency info for {host_headers_extra}
+stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias}
+ @cd ${host_builddir} && {\
+ $(LN_S) ${host_headers} . || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_H) basic_file.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(ALLOCATOR_H) c++allocator.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CSTDIO_H) c++io.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_H) c++locale.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) . || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(COMPATIBILITY_H) . || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_H) messages_members.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CTIME_H) time_members.h || true;\
+ } 2>/dev/null
+ $(STAMP) stamp-host
+
+# Host includes dynamic.
+if ENABLE_SYMVERS_GNU_NAMESPACE
+stamp-namespace-version:
+ echo 1 > stamp-namespace-version
+else
+stamp-namespace-version:
+ echo 0 > stamp-namespace-version
+endif
+
+if ENABLE_VISIBILITY
+stamp-visibility:
+ echo 1 > stamp-visibility
+else
+stamp-visibility:
+ echo 0 > stamp-visibility
+endif
+
+# NB: The non-empty default ldbl_compat works around an AIX sed
+# oddity, see libstdc++/31957 for details.
+${host_builddir}/c++config.h: ${CONFIG_HEADER} \
+ ${glibcxx_srcdir}/include/bits/c++config \
+ stamp-${host_alias} \
+ ${toplevel_srcdir}/gcc/DATESTAMP \
+ stamp-namespace-version \
+ stamp-visibility
+ @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
+ nsa_version=`cat stamp-namespace-version` ;\
+ visibility=`cat stamp-visibility` ;\
+ ldbl_compat='s,g,g,' ;\
+ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
+ ${CONFIG_HEADER} > /dev/null 2>&1 \
+ && ldbl_compat='s,^#undef _GLIBCXX_LONG_DOUBLE_COMPAT$$,#define _GLIBCXX_LONG_DOUBLE_COMPAT 1,' ;\
+ sed -e "s,define __GLIBCXX__,define __GLIBCXX__ $$date," \
+ -e "s,define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION, define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION $$nsa_version," \
+ -e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \
+ -e "$$ldbl_compat" \
+ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
+ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
+ -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
+ -e 's/VERSION/_GLIBCXX_VERSION/g' \
+ -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
+ -e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \
+ -e '/[ ]_GLIBCXX_LONG_DOUBLE_COMPAT[ ]/d' \
+ < ${CONFIG_HEADER} >> $@ ;\
+ echo "" >> $@ ;\
+ echo "#endif // _GLIBCXX_CXX_CONFIG_H" >> $@
+
+# Host includes for threads
+uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
+
+${host_builddir}/gthr.h: ${toplevel_srcdir}/gcc/gthr.h stamp-${host_alias}
+ sed -e '/^#pragma/b' \
+ -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
+ -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
+ < ${toplevel_srcdir}/gcc/gthr.h > $@
+
+${host_builddir}/gthr-single.h: ${toplevel_srcdir}/gcc/gthr-single.h \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ < ${toplevel_srcdir}/gcc/gthr-single.h > $@
+
+${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/gcc/gthr-posix.h \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
+ < ${toplevel_srcdir}/gcc/gthr-posix.h > $@
+
+${host_builddir}/gthr-tpf.h: ${toplevel_srcdir}/gcc/gthr-tpf.h \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
+ < ${toplevel_srcdir}/gcc/gthr-tpf.h > $@
+
+${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
+ -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
+ < ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
+
+# Build two precompiled C++ includes, stdc++.h.gch/*.gch
+${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ -mkdir -p ${pch1_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O0 -g ${pch1_source} -o $@
+
+${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ -mkdir -p ${pch1_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@
+
+# Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch
+${pch2_output}: ${pch2_source} ${pch1_output}
+ -mkdir -p ${pch2_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@
+
+# Build a precompiled extension include, extc++.h.gch/O2.gch
+${pch3_output}: ${pch3_source} ${pch2_output}
+ -mkdir -p ${pch3_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
+
+# For robustness sake (in light of junk files or in-source
+# configuration), copy from the build or source tree to the install
+# tree using only the human-maintained file lists and directory
+# components. Yes, with minor differences, this is sheer duplication
+# of the staging rules above using $(INSTALL_DATA) instead of LN_S and
+# `$(mkinstalldirs)' instead of `mkdir -p'. In particular,
+# host_headers_extra are taken out of the build tree staging area;
+# the rest are taken from the original source tree.
+
+if GLIBCXX_HOSTED
+install-data-local: install-headers
+else
+install-data-local: install-freestanding-headers
+endif
+
+# This is a subset of the full install-headers rule. We only need <cstddef>,
+# <limits>, <cstdlib>, <cstdarg>, <new>, <typeinfo>, <exception>, and any
+# files which they include (and which we provide). The last three headers
+# are installed by libsupc++, so only the first four and the sub-includes
+# are copied here.
+install-freestanding-headers:
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}
+ $(mkinstalldirs) $(DESTDIR)${host_installdir}
+ for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir}
+ $(INSTALL_DATA) ${std_builddir}/limits $(DESTDIR)${gxx_include_dir}/${std_builddir}
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
+ for file in cstddef cstdlib cstdarg; do \
+ $(INSTALL_DATA) ${c_base_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
+
+# The real deal.
+install-headers:
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${bits_builddir}
+ for file in ${bits_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${bits_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${backward_builddir}
+ for file in ${backward_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${backward_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${ext_builddir}
+ for file in ${ext_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${ext_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${pb_builddir}
+ for dir in ${pb_subdirs}; do \
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/$${dir} ; done
+ for file in ${pb_headers1}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers2}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers3}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers4}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers5}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers6}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers7}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
+ for file in ${tr1_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}
+ for file in ${tr1_impl_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
+ for file in ${c_base_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
+ c_base_headers_extra_install='$(c_base_headers_extra)';\
+ for file in $$c_base_headers_extra_install; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}/${bits_builddir}; done
+ c_compatibility_headers_install='$(c_compatibility_headers_extra)';\
+ for file in $$c_compatibility_headers_install; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir}
+ for file in ${std_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${debug_builddir}
+ for file in ${debug_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${debug_builddir}; done
+ parallel_headers_install='${parallel_headers}';\
+ test -z "$$parallel_headers_install" || \
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${parallel_builddir};\
+ for file in $$parallel_headers_install; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${parallel_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${host_installdir}
+ for file in ${host_headers} ${host_headers_extra} \
+ ${thread_host_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
+
+# By adding these files here, automake will remove them for 'make clean'
+CLEANFILES = ${pch_output} ${pch_output_anchors}
+
+# To remove directories.
+clean-local:
+ rm -rf ${pch_output_dirs}
+
+# Stop implicit '.o' make rules from ever stomping on extensionless
+# headers, in the improbable case where some foolish, crack-addled
+# developer tries to create them via make in the include build
+# directory. (This is more of an example of how this kind of rule can
+# be made.)
+.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr1_impl_headers)
+ $(ext_headers)
+$(std_headers): ; @:
+$(c_base_headers): ; @:
+$(tr1_headers): ; @:
+$(tr1_impl_headers): ; @:
+$(ext_headers): ; @:
diff --git a/gcc-4.4.0/libstdc++-v3/include/Makefile.in b/gcc-4.4.0/libstdc++-v3/include/Makefile.in
new file mode 100644
index 000000000..ff9bb6ff7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/Makefile.in
@@ -0,0 +1,1641 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/fragment.am
+subdir = include
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
+ $(top_srcdir)/../config/futex.m4 \
+ $(top_srcdir)/../config/iconv.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/lib-ld.m4 \
+ $(top_srcdir)/../config/lib-link.m4 \
+ $(top_srcdir)/../config/lib-prefix.m4 \
+ $(top_srcdir)/../config/multi.m4 \
+ $(top_srcdir)/../config/no-executables.m4 \
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/proginstall.m4 \
+ $(top_srcdir)/../config/stdint.m4 \
+ $(top_srcdir)/../config/unwind_ipinfo.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/crossconfig.m4 \
+ $(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/../config/tls.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+depcomp =
+am__depfiles_maybe =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@
+ACLOCAL = @ACLOCAL@
+ALLOCATOR_H = @ALLOCATOR_H@
+ALLOCATOR_NAME = @ALLOCATOR_NAME@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@
+ATOMIC_FLAGS = @ATOMIC_FLAGS@
+ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASIC_FILE_CC = @BASIC_FILE_CC@
+BASIC_FILE_H = @BASIC_FILE_H@
+CC = @CC@
+CCODECVT_CC = @CCODECVT_CC@
+CCOLLATE_CC = @CCOLLATE_CC@
+CCTYPE_CC = @CCTYPE_CC@
+CFLAGS = @CFLAGS@
+CLOCALE_CC = @CLOCALE_CC@
+CLOCALE_H = @CLOCALE_H@
+CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
+CMESSAGES_CC = @CMESSAGES_CC@
+CMESSAGES_H = @CMESSAGES_H@
+CMONEY_CC = @CMONEY_CC@
+CNUMERIC_CC = @CNUMERIC_CC@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@
+CSTDIO_H = @CSTDIO_H@
+CTIME_CC = @CTIME_CC@
+CTIME_H = @CTIME_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+C_INCLUDE_DIR = @C_INCLUDE_DIR@
+DEBUG_FLAGS = @DEBUG_FLAGS@
+DEFS = @DEFS@
+DETERMINISM_CXXFLAGS = @DETERMINISM_CXXFLAGS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_PARALLEL_FALSE = @ENABLE_PARALLEL_FALSE@
+ENABLE_PARALLEL_TRUE = @ENABLE_PARALLEL_TRUE@
+ENABLE_SYMVERS_DARWIN_FALSE = @ENABLE_SYMVERS_DARWIN_FALSE@
+ENABLE_SYMVERS_DARWIN_TRUE = @ENABLE_SYMVERS_DARWIN_TRUE@
+ENABLE_SYMVERS_FALSE = @ENABLE_SYMVERS_FALSE@
+ENABLE_SYMVERS_GNU_FALSE = @ENABLE_SYMVERS_GNU_FALSE@
+ENABLE_SYMVERS_GNU_NAMESPACE_FALSE = @ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@
+ENABLE_SYMVERS_GNU_NAMESPACE_TRUE = @ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@
+ENABLE_SYMVERS_GNU_TRUE = @ENABLE_SYMVERS_GNU_TRUE@
+ENABLE_SYMVERS_TRUE = @ENABLE_SYMVERS_TRUE@
+ENABLE_VISIBILITY_FALSE = @ENABLE_VISIBILITY_FALSE@
+ENABLE_VISIBILITY_TRUE = @ENABLE_VISIBILITY_TRUE@
+ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
+EXEEXT = @EXEEXT@
+EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
+FGREP = @FGREP@
+GLIBCXX_BUILD_DEBUG_FALSE = @GLIBCXX_BUILD_DEBUG_FALSE@
+GLIBCXX_BUILD_DEBUG_TRUE = @GLIBCXX_BUILD_DEBUG_TRUE@
+GLIBCXX_BUILD_PCH_FALSE = @GLIBCXX_BUILD_PCH_FALSE@
+GLIBCXX_BUILD_PCH_TRUE = @GLIBCXX_BUILD_PCH_TRUE@
+GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE = @GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@
+GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE = @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@
+GLIBCXX_C_HEADERS_C_FALSE = @GLIBCXX_C_HEADERS_C_FALSE@
+GLIBCXX_C_HEADERS_C_GLOBAL_FALSE = @GLIBCXX_C_HEADERS_C_GLOBAL_FALSE@
+GLIBCXX_C_HEADERS_C_GLOBAL_TRUE = @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@
+GLIBCXX_C_HEADERS_C_STD_FALSE = @GLIBCXX_C_HEADERS_C_STD_FALSE@
+GLIBCXX_C_HEADERS_C_STD_TRUE = @GLIBCXX_C_HEADERS_C_STD_TRUE@
+GLIBCXX_C_HEADERS_C_TRUE = @GLIBCXX_C_HEADERS_C_TRUE@
+GLIBCXX_C_HEADERS_EXTRA_FALSE = @GLIBCXX_C_HEADERS_EXTRA_FALSE@
+GLIBCXX_C_HEADERS_EXTRA_TRUE = @GLIBCXX_C_HEADERS_EXTRA_TRUE@
+GLIBCXX_HOSTED_FALSE = @GLIBCXX_HOSTED_FALSE@
+GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
+GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
+GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
+GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GLIBCXX_LIBS = @GLIBCXX_LIBS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OS_INC_SRCDIR = @OS_INC_SRCDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SECTION_FLAGS = @SECTION_FLAGS@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYMVER_FILE = @SYMVER_FILE@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_FLAGS = @WARN_FLAGS@
+WERROR = @WERROR@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_LIPO = @ac_ct_LIPO@
+ac_ct_NMEDIT = @ac_ct_NMEDIT@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_OTOOL = @ac_ct_OTOOL@
+ac_ct_OTOOL64 = @ac_ct_OTOOL64@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+baseline_dir = @baseline_dir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+check_msgfmt = @check_msgfmt@
+datadir = @datadir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+glibcxx_MOFILES = @glibcxx_MOFILES@
+glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
+glibcxx_POFILES = @glibcxx_POFILES@
+glibcxx_builddir = @glibcxx_builddir@
+glibcxx_localedir = @glibcxx_localedir@
+glibcxx_prefixdir = @glibcxx_prefixdir@
+glibcxx_srcdir = @glibcxx_srcdir@
+glibcxx_thread_h = @glibcxx_thread_h@
+glibcxx_toolexecdir = @glibcxx_toolexecdir@
+glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@
+gxx_include_dir = @gxx_include_dir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+port_specific_symbol_files = @port_specific_symbol_files@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toplevel_srcdir = @toplevel_srcdir@
+
+# May be used by various substitution variables.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+MAINT_CHARSET = latin1
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+PWD_COMMAND = $${PWDCMD-pwd}
+STAMP = echo timestamp >
+toolexecdir = $(glibcxx_toolexecdir)
+toolexeclibdir = $(glibcxx_toolexeclibdir)
+
+# These bits are all figured out from configure. Look in acinclude.m4
+# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS.
+CONFIG_CXXFLAGS = \
+ $(SECTION_FLAGS) $(EXTRA_CXX_FLAGS)
+
+WARN_CXXFLAGS = \
+ $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
+
+
+# -I/-D flags to pass when compiling.
+AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
+
+# Standard C++ includes.
+std_srcdir = ${glibcxx_srcdir}/include/std
+std_builddir = .
+std_headers = \
+ ${std_srcdir}/algorithm \
+ ${std_srcdir}/array \
+ ${std_srcdir}/bitset \
+ ${std_srcdir}/c++0x_warning.h \
+ ${std_srcdir}/chrono \
+ ${std_srcdir}/complex \
+ ${std_srcdir}/condition_variable \
+ ${std_srcdir}/deque \
+ ${std_srcdir}/forward_list \
+ ${std_srcdir}/fstream \
+ ${std_srcdir}/functional \
+ ${std_srcdir}/iomanip \
+ ${std_srcdir}/ios \
+ ${std_srcdir}/iosfwd \
+ ${std_srcdir}/iostream \
+ ${std_srcdir}/istream \
+ ${std_srcdir}/iterator \
+ ${std_srcdir}/limits \
+ ${std_srcdir}/list \
+ ${std_srcdir}/locale \
+ ${std_srcdir}/map \
+ ${std_srcdir}/memory \
+ ${std_srcdir}/mutex \
+ ${std_srcdir}/numeric \
+ ${std_srcdir}/ostream \
+ ${std_srcdir}/queue \
+ ${std_srcdir}/random \
+ ${std_srcdir}/ratio \
+ ${std_srcdir}/regex \
+ ${std_srcdir}/set \
+ ${std_srcdir}/sstream \
+ ${std_srcdir}/stack \
+ ${std_srcdir}/stdexcept \
+ ${std_srcdir}/streambuf \
+ ${std_srcdir}/string \
+ ${std_srcdir}/system_error \
+ ${std_srcdir}/thread \
+ ${std_srcdir}/tuple \
+ ${std_srcdir}/type_traits \
+ ${std_srcdir}/unordered_map \
+ ${std_srcdir}/unordered_set \
+ ${std_srcdir}/utility \
+ ${std_srcdir}/valarray \
+ ${std_srcdir}/vector
+
+bits_srcdir = ${glibcxx_srcdir}/include/bits
+bits_builddir = ./bits
+bits_headers = \
+ ${bits_srcdir}/algorithmfwd.h \
+ ${bits_srcdir}/allocator.h \
+ ${bits_srcdir}/atomicfwd_c.h \
+ ${bits_srcdir}/atomicfwd_cxx.h \
+ ${bits_srcdir}/atomic_0.h \
+ ${bits_srcdir}/atomic_2.h \
+ ${bits_srcdir}/basic_ios.h \
+ ${bits_srcdir}/basic_ios.tcc \
+ ${bits_srcdir}/basic_string.h \
+ ${bits_srcdir}/basic_string.tcc \
+ ${bits_srcdir}/boost_concept_check.h \
+ ${bits_srcdir}/char_traits.h \
+ ${bits_srcdir}/codecvt.h \
+ ${bits_srcdir}/concept_check.h \
+ ${bits_srcdir}/cpp_type_traits.h \
+ ${bits_srcdir}/deque.tcc \
+ ${bits_srcdir}/forward_list.h \
+ ${bits_srcdir}/forward_list.tcc \
+ ${bits_srcdir}/fstream.tcc \
+ ${bits_srcdir}/functexcept.h \
+ ${bits_srcdir}/functional_hash.h \
+ ${bits_srcdir}/gslice.h \
+ ${bits_srcdir}/gslice_array.h \
+ ${bits_srcdir}/hashtable.h \
+ ${bits_srcdir}/indirect_array.h \
+ ${bits_srcdir}/ios_base.h \
+ ${bits_srcdir}/istream.tcc \
+ ${bits_srcdir}/list.tcc \
+ ${bits_srcdir}/locale_classes.h \
+ ${bits_srcdir}/locale_classes.tcc \
+ ${bits_srcdir}/locale_facets.h \
+ ${bits_srcdir}/locale_facets.tcc \
+ ${bits_srcdir}/locale_facets_nonio.h \
+ ${bits_srcdir}/locale_facets_nonio.tcc \
+ ${bits_srcdir}/localefwd.h \
+ ${bits_srcdir}/mask_array.h \
+ ${bits_srcdir}/move.h \
+ ${bits_srcdir}/ostream.tcc \
+ ${bits_srcdir}/ostream_insert.h \
+ ${bits_srcdir}/postypes.h \
+ ${bits_srcdir}/stream_iterator.h \
+ ${bits_srcdir}/streambuf_iterator.h \
+ ${bits_srcdir}/shared_ptr.h \
+ ${bits_srcdir}/slice_array.h \
+ ${bits_srcdir}/sstream.tcc \
+ ${bits_srcdir}/stl_algo.h \
+ ${bits_srcdir}/stl_algobase.h \
+ ${bits_srcdir}/stl_bvector.h \
+ ${bits_srcdir}/stl_construct.h \
+ ${bits_srcdir}/stl_deque.h \
+ ${bits_srcdir}/stl_function.h \
+ ${bits_srcdir}/stl_heap.h \
+ ${bits_srcdir}/stl_iterator.h \
+ ${bits_srcdir}/stl_iterator_base_funcs.h \
+ ${bits_srcdir}/stl_iterator_base_types.h \
+ ${bits_srcdir}/stl_list.h \
+ ${bits_srcdir}/stl_map.h \
+ ${bits_srcdir}/stl_multimap.h \
+ ${bits_srcdir}/stl_multiset.h \
+ ${bits_srcdir}/stl_numeric.h \
+ ${bits_srcdir}/stl_pair.h \
+ ${bits_srcdir}/stl_queue.h \
+ ${bits_srcdir}/stl_raw_storage_iter.h \
+ ${bits_srcdir}/stl_relops.h \
+ ${bits_srcdir}/stl_set.h \
+ ${bits_srcdir}/stl_stack.h \
+ ${bits_srcdir}/stl_tempbuf.h \
+ ${bits_srcdir}/stl_tree.h \
+ ${bits_srcdir}/stl_uninitialized.h \
+ ${bits_srcdir}/stl_vector.h \
+ ${bits_srcdir}/streambuf.tcc \
+ ${bits_srcdir}/stringfwd.h \
+ ${bits_srcdir}/unique_ptr.h \
+ ${bits_srcdir}/valarray_array.h \
+ ${bits_srcdir}/valarray_array.tcc \
+ ${bits_srcdir}/valarray_before.h \
+ ${bits_srcdir}/valarray_after.h \
+ ${bits_srcdir}/vector.tcc
+
+backward_srcdir = ${glibcxx_srcdir}/include/backward
+backward_builddir = ./backward
+backward_headers = \
+ ${backward_srcdir}/auto_ptr.h \
+ ${backward_srcdir}/backward_warning.h \
+ ${backward_srcdir}/binders.h \
+ ${backward_srcdir}/hash_map \
+ ${backward_srcdir}/hash_set \
+ ${backward_srcdir}/hash_fun.h \
+ ${backward_srcdir}/hashtable.h \
+ ${backward_srcdir}/strstream
+
+pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds
+pb_builddir = ./ext/pb_ds
+pb_subdirs = \
+ ${pb_builddir}/detail \
+ ${pb_builddir}/detail/pairing_heap_ \
+ ${pb_builddir}/detail/splay_tree_ \
+ ${pb_builddir}/detail/list_update_map_ \
+ ${pb_builddir}/detail/basic_tree_policy \
+ ${pb_builddir}/detail/trie_policy \
+ ${pb_builddir}/detail/gp_hash_table_map_ \
+ ${pb_builddir}/detail/tree_policy \
+ ${pb_builddir}/detail/binomial_heap_base_ \
+ ${pb_builddir}/detail/resize_policy \
+ ${pb_builddir}/detail/bin_search_tree_ \
+ ${pb_builddir}/detail/binomial_heap_ \
+ ${pb_builddir}/detail/thin_heap_ \
+ ${pb_builddir}/detail/pat_trie_ \
+ ${pb_builddir}/detail/cc_hash_table_map_ \
+ ${pb_builddir}/detail/rc_binomial_heap_ \
+ ${pb_builddir}/detail/left_child_next_sibling_heap_ \
+ ${pb_builddir}/detail/unordered_iterator \
+ ${pb_builddir}/detail/binary_heap_ \
+ ${pb_builddir}/detail/ov_tree_map_ \
+ ${pb_builddir}/detail/hash_fn \
+ ${pb_builddir}/detail/eq_fn \
+ ${pb_builddir}/detail/rb_tree_map_ \
+ ${pb_builddir}/detail/list_update_policy
+
+
+# The ability for make and the underlying host to deal with this
+# unwieldy list as one entire entity is not a sure thing, and may
+# cause build errors. Thus, split one list into many smaller
+# mini-lists, with the maximum size per mini-list of no more than 42.
+pb_headers1 = \
+ ${pb_srcdir}/assoc_container.hpp \
+ ${pb_srcdir}/exception.hpp \
+ ${pb_srcdir}/hash_policy.hpp \
+ ${pb_srcdir}/list_update_policy.hpp \
+ ${pb_srcdir}/priority_queue.hpp \
+ ${pb_srcdir}/tag_and_trait.hpp \
+ ${pb_srcdir}/tree_policy.hpp \
+ ${pb_srcdir}/trie_policy.hpp \
+ ${pb_srcdir}/detail/basic_tree_policy/basic_tree_policy_base.hpp \
+ ${pb_srcdir}/detail/basic_tree_policy/null_node_metadata.hpp \
+ ${pb_srcdir}/detail/basic_tree_policy/traits.hpp \
+ ${pb_srcdir}/detail/basic_types.hpp \
+ ${pb_srcdir}/detail/binary_heap_/binary_heap_.hpp \
+ ${pb_srcdir}/detail/binary_heap_/const_iterator.hpp \
+ ${pb_srcdir}/detail/binary_heap_/const_point_iterator.hpp \
+ ${pb_srcdir}/detail/binary_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/entry_cmp.hpp \
+ ${pb_srcdir}/detail/binary_heap_/entry_pred.hpp \
+ ${pb_srcdir}/detail/binary_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/resize_policy.hpp \
+ ${pb_srcdir}/detail/binary_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/binary_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/binomial_heap_base_.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_base_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_/binomial_heap_.hpp \
+ ${pb_srcdir}/detail/binomial_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/binomial_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
+
+pb_headers2 = \
+ ${pb_srcdir}/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/node_iterators.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/point_iterators.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/r_erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/rotate_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/bin_search_tree_/traits.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/cc_ht_map_.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/cmp_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/entry_list_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/resize_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/size_fn_imps.hpp \
+ ${pb_srcdir}/detail/cc_hash_table_map_/standard_policies.hpp
+
+pb_headers3 = \
+ ${pb_srcdir}/detail/cc_hash_table_map_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/cond_dealtor.hpp \
+ ${pb_srcdir}/detail/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/container_base_dispatch.hpp \
+ ${pb_srcdir}/detail/eq_fn/eq_by_less.hpp \
+ ${pb_srcdir}/detail/eq_fn/hash_eq_fn.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/gp_ht_map_.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/iterator_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/resize_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/standard_policies.hpp \
+ ${pb_srcdir}/detail/gp_hash_table_map_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/hash_fn/direct_mask_range_hashing_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/direct_mod_range_hashing_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/linear_probe_fn_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/mask_based_range_hashing.hpp \
+ ${pb_srcdir}/detail/hash_fn/mod_based_range_hashing.hpp \
+ ${pb_srcdir}/detail/hash_fn/probe_fn_base.hpp \
+ ${pb_srcdir}/detail/hash_fn/quadratic_probe_fn_imp.hpp \
+ ${pb_srcdir}/detail/hash_fn/ranged_hash_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/ranged_probe_fn.hpp
+
+pb_headers4 = \
+ ${pb_srcdir}/detail/hash_fn/sample_probe_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/sample_ranged_hash_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/sample_ranged_probe_fn.hpp \
+ ${pb_srcdir}/detail/hash_fn/sample_range_hashing.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_iterator.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/const_point_iterator.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/node.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/null_metadata.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/constructor_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/entry_metadata_base.hpp \
+ ${pb_srcdir}/detail/list_update_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_map_/lu_map_.hpp \
+ ${pb_srcdir}/detail/list_update_map_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/list_update_policy/counter_lu_metadata.hpp \
+ ${pb_srcdir}/detail/list_update_policy/counter_lu_policy_imp.hpp \
+ ${pb_srcdir}/detail/list_update_policy/mtf_lu_policy_imp.hpp \
+ ${pb_srcdir}/detail/list_update_policy/sample_update_policy.hpp \
+ ${pb_srcdir}/detail/debug_map_base.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/cond_dtor.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/node_iterators.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/ov_tree_map_.hpp
+
+pb_headers5 = \
+ ${pb_srcdir}/detail/ov_tree_map_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/ov_tree_map_/traits.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/pairing_heap_.hpp \
+ ${pb_srcdir}/detail/pairing_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/child_iterator.hpp \
+ ${pb_srcdir}/detail/pat_trie_/cond_dtor_entry_dealtor.hpp \
+ ${pb_srcdir}/detail/pat_trie_/const_child_iterator.hpp \
+ ${pb_srcdir}/detail/pat_trie_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/head.hpp \
+ ${pb_srcdir}/detail/pat_trie_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/insert_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/internal_node.hpp \
+ ${pb_srcdir}/detail/pat_trie_/iterators_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/leaf.hpp \
+ ${pb_srcdir}/detail/pat_trie_/node_base.hpp \
+ ${pb_srcdir}/detail/pat_trie_/node_iterators.hpp \
+ ${pb_srcdir}/detail/pat_trie_/node_metadata_base.hpp \
+ ${pb_srcdir}/detail/pat_trie_/pat_trie_.hpp \
+ ${pb_srcdir}/detail/pat_trie_/point_iterators.hpp \
+ ${pb_srcdir}/detail/pat_trie_/policy_access_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/r_erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/rotate_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/split_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/split_join_branch_bag.hpp \
+ ${pb_srcdir}/detail/pat_trie_/synth_e_access_traits.hpp \
+ ${pb_srcdir}/detail/pat_trie_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/pat_trie_/traits.hpp \
+ ${pb_srcdir}/detail/pat_trie_/update_fn_imps.hpp \
+ ${pb_srcdir}/detail/priority_queue_base_dispatch.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/debug_fn_imps.hpp
+
+pb_headers6 = \
+ ${pb_srcdir}/detail/rb_tree_map_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/node.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/rb_tree_.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/rb_tree_map_/traits.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/rc_binomial_heap_.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/rc.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/rc_binomial_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_exponential_size_policy_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_prime_size_policy_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/hash_standard_resize_policy_imp.hpp \
+ ${pb_srcdir}/detail/resize_policy/sample_resize_policy.hpp \
+ ${pb_srcdir}/detail/resize_policy/sample_resize_trigger.hpp \
+ ${pb_srcdir}/detail/resize_policy/sample_size_policy.hpp \
+ ${pb_srcdir}/detail/splay_tree_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/erase_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/info_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/node.hpp \
+ ${pb_srcdir}/detail/splay_tree_/splay_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/splay_tree_.hpp \
+ ${pb_srcdir}/detail/splay_tree_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/splay_tree_/traits.hpp \
+ ${pb_srcdir}/detail/standard_policies.hpp \
+ ${pb_srcdir}/detail/thin_heap_/constructors_destructor_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/debug_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/erase_fn_imps.hpp
+
+pb_headers7 = \
+ ${pb_srcdir}/detail/thin_heap_/find_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/insert_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/split_join_fn_imps.hpp \
+ ${pb_srcdir}/detail/thin_heap_/thin_heap_.hpp \
+ ${pb_srcdir}/detail/thin_heap_/trace_fn_imps.hpp \
+ ${pb_srcdir}/detail/tree_policy/node_metadata_selector.hpp \
+ ${pb_srcdir}/detail/tree_policy/null_node_update_imp.hpp \
+ ${pb_srcdir}/detail/tree_policy/order_statistics_imp.hpp \
+ ${pb_srcdir}/detail/tree_policy/sample_tree_node_update.hpp \
+ ${pb_srcdir}/detail/tree_trace_base.hpp \
+ ${pb_srcdir}/detail/trie_policy/node_metadata_selector.hpp \
+ ${pb_srcdir}/detail/trie_policy/null_node_update_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/order_statistics_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/prefix_search_node_update_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/sample_trie_e_access_traits.hpp \
+ ${pb_srcdir}/detail/trie_policy/sample_trie_node_update.hpp \
+ ${pb_srcdir}/detail/trie_policy/string_trie_e_access_traits_imp.hpp \
+ ${pb_srcdir}/detail/trie_policy/trie_policy_base.hpp \
+ ${pb_srcdir}/detail/types_traits.hpp \
+ ${pb_srcdir}/detail/type_utils.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/const_iterator.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/const_point_iterator.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/iterator.hpp \
+ ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp
+
+ext_srcdir = ${glibcxx_srcdir}/include/ext
+ext_builddir = ./ext
+ext_headers = \
+ ${ext_srcdir}/algorithm \
+ ${ext_srcdir}/atomicity.h \
+ ${ext_srcdir}/array_allocator.h \
+ ${ext_srcdir}/bitmap_allocator.h \
+ ${ext_srcdir}/cast.h \
+ ${ext_srcdir}/codecvt_specializations.h \
+ ${ext_srcdir}/concurrence.h \
+ ${ext_srcdir}/debug_allocator.h \
+ ${ext_srcdir}/enc_filebuf.h \
+ ${ext_srcdir}/extptr_allocator.h \
+ ${ext_srcdir}/stdio_filebuf.h \
+ ${ext_srcdir}/stdio_sync_filebuf.h \
+ ${ext_srcdir}/functional \
+ ${ext_srcdir}/iterator \
+ ${ext_srcdir}/malloc_allocator.h \
+ ${ext_srcdir}/memory \
+ ${ext_srcdir}/mt_allocator.h \
+ ${ext_srcdir}/new_allocator.h \
+ ${ext_srcdir}/numeric \
+ ${ext_srcdir}/numeric_traits.h \
+ ${ext_srcdir}/pod_char_traits.h \
+ ${ext_srcdir}/pointer.h \
+ ${ext_srcdir}/pool_allocator.h \
+ ${ext_srcdir}/rb_tree \
+ ${ext_srcdir}/rope \
+ ${ext_srcdir}/ropeimpl.h \
+ ${ext_srcdir}/slist \
+ ${ext_srcdir}/string_conversions.h \
+ ${ext_srcdir}/throw_allocator.h \
+ ${ext_srcdir}/typelist.h \
+ ${ext_srcdir}/type_traits.h \
+ ${ext_srcdir}/rc_string_base.h \
+ ${ext_srcdir}/sso_string_base.h \
+ ${ext_srcdir}/vstring.h \
+ ${ext_srcdir}/vstring.tcc \
+ ${ext_srcdir}/vstring_fwd.h \
+ ${ext_srcdir}/vstring_util.h \
+ ${ext_compat_headers}
+
+ext_compat_headers = \
+ ${backward_srcdir}/hash_set \
+ ${backward_srcdir}/hash_map
+
+tr1_srcdir = ${glibcxx_srcdir}/include/tr1
+tr1_builddir = ./tr1
+tr1_headers = \
+ ${tr1_srcdir}/array \
+ ${tr1_srcdir}/bessel_function.tcc \
+ ${tr1_srcdir}/beta_function.tcc \
+ ${tr1_srcdir}/ccomplex \
+ ${tr1_srcdir}/cctype \
+ ${tr1_srcdir}/cfenv \
+ ${tr1_srcdir}/cfloat \
+ ${tr1_srcdir}/cinttypes \
+ ${tr1_srcdir}/climits \
+ ${tr1_srcdir}/cmath \
+ ${tr1_srcdir}/complex \
+ ${tr1_srcdir}/complex.h \
+ ${tr1_srcdir}/cstdarg \
+ ${tr1_srcdir}/cstdbool \
+ ${tr1_srcdir}/cstdint \
+ ${tr1_srcdir}/cstdio \
+ ${tr1_srcdir}/cstdlib \
+ ${tr1_srcdir}/ctgmath \
+ ${tr1_srcdir}/ctime \
+ ${tr1_srcdir}/ctype.h \
+ ${tr1_srcdir}/cwchar \
+ ${tr1_srcdir}/cwctype \
+ ${tr1_srcdir}/ell_integral.tcc \
+ ${tr1_srcdir}/exp_integral.tcc \
+ ${tr1_srcdir}/fenv.h \
+ ${tr1_srcdir}/float.h \
+ ${tr1_srcdir}/functional \
+ ${tr1_srcdir}/functional_hash.h \
+ ${tr1_srcdir}/gamma.tcc \
+ ${tr1_srcdir}/hypergeometric.tcc \
+ ${tr1_srcdir}/hashtable.h \
+ ${tr1_srcdir}/inttypes.h \
+ ${tr1_srcdir}/limits.h \
+ ${tr1_srcdir}/math.h \
+ ${tr1_srcdir}/memory \
+ ${tr1_srcdir}/modified_bessel_func.tcc \
+ ${tr1_srcdir}/poly_hermite.tcc \
+ ${tr1_srcdir}/poly_laguerre.tcc \
+ ${tr1_srcdir}/legendre_function.tcc \
+ ${tr1_srcdir}/random \
+ ${tr1_srcdir}/regex \
+ ${tr1_srcdir}/riemann_zeta.tcc \
+ ${tr1_srcdir}/shared_ptr.h \
+ ${tr1_srcdir}/special_function_util.h \
+ ${tr1_srcdir}/stdarg.h \
+ ${tr1_srcdir}/stdbool.h \
+ ${tr1_srcdir}/stdint.h \
+ ${tr1_srcdir}/stdio.h \
+ ${tr1_srcdir}/stdlib.h \
+ ${tr1_srcdir}/tgmath.h \
+ ${tr1_srcdir}/tuple \
+ ${tr1_srcdir}/type_traits \
+ ${tr1_srcdir}/unordered_set \
+ ${tr1_srcdir}/unordered_map \
+ ${tr1_srcdir}/utility \
+ ${tr1_srcdir}/wchar.h \
+ ${tr1_srcdir}/wctype.h
+
+tr1_impl_srcdir = ${glibcxx_srcdir}/include/tr1_impl
+tr1_impl_builddir = ./tr1_impl
+tr1_impl_headers = \
+ ${tr1_impl_srcdir}/array \
+ ${tr1_impl_srcdir}/boost_sp_counted_base.h \
+ ${tr1_impl_srcdir}/cctype \
+ ${tr1_impl_srcdir}/cfenv \
+ ${tr1_impl_srcdir}/cinttypes \
+ ${tr1_impl_srcdir}/cmath \
+ ${tr1_impl_srcdir}/complex \
+ ${tr1_impl_srcdir}/cstdint \
+ ${tr1_impl_srcdir}/cstdio \
+ ${tr1_impl_srcdir}/cstdlib \
+ ${tr1_impl_srcdir}/cwchar \
+ ${tr1_impl_srcdir}/cwctype \
+ ${tr1_impl_srcdir}/functional \
+ ${tr1_impl_srcdir}/functional_hash.h \
+ ${tr1_impl_srcdir}/hashtable \
+ ${tr1_impl_srcdir}/hashtable_policy.h \
+ ${tr1_impl_srcdir}/random \
+ ${tr1_impl_srcdir}/random.tcc \
+ ${tr1_impl_srcdir}/regex \
+ ${tr1_impl_srcdir}/type_traits \
+ ${tr1_impl_srcdir}/unordered_map \
+ ${tr1_impl_srcdir}/unordered_set \
+ ${tr1_impl_srcdir}/utility
+
+
+# This is the common subset of C++ files that all three "C" header models use.
+c_base_srcdir = $(C_INCLUDE_DIR)
+c_base_builddir = .
+c_base_headers = \
+ ${c_base_srcdir}/cassert \
+ ${c_base_srcdir}/ccomplex \
+ ${c_base_srcdir}/cctype \
+ ${c_base_srcdir}/cerrno \
+ ${c_base_srcdir}/cfenv \
+ ${c_base_srcdir}/cfloat \
+ ${c_base_srcdir}/cinttypes \
+ ${c_base_srcdir}/ciso646 \
+ ${c_base_srcdir}/climits \
+ ${c_base_srcdir}/clocale \
+ ${c_base_srcdir}/cmath \
+ ${c_base_srcdir}/csetjmp \
+ ${c_base_srcdir}/csignal \
+ ${c_base_srcdir}/cstdarg \
+ ${c_base_srcdir}/cstdatomic \
+ ${c_base_srcdir}/cstdbool \
+ ${c_base_srcdir}/cstddef \
+ ${c_base_srcdir}/cstdint \
+ ${c_base_srcdir}/cstdio \
+ ${c_base_srcdir}/cstdlib \
+ ${c_base_srcdir}/cstring \
+ ${c_base_srcdir}/ctgmath \
+ ${c_base_srcdir}/ctime \
+ ${c_base_srcdir}/cwchar \
+ ${c_base_srcdir}/cwctype
+
+
+# "C" compatibility headers.
+c_compatibility_srcdir = ${glibcxx_srcdir}/include/c_compatibility
+c_compatibility_builddir = .
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers = \
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h
+
+@GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers =
+@GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/assert.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/complex.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/ctype.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/errno.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/fenv.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/float.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/inttypes.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/iso646.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/limits.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/locale.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/math.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/setjmp.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/signal.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/stdarg.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/stdbool.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/stddef.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/stdint.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/stdio.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/stdlib.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/string.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/time.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wchar.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wctype.h
+
+
+# Debug mode headers
+debug_srcdir = ${glibcxx_srcdir}/include/debug
+debug_builddir = ./debug
+debug_headers = \
+ ${debug_srcdir}/bitset \
+ ${debug_srcdir}/debug.h \
+ ${debug_srcdir}/deque \
+ ${debug_srcdir}/formatter.h \
+ ${debug_srcdir}/functions.h \
+ ${debug_srcdir}/list \
+ ${debug_srcdir}/map \
+ ${debug_srcdir}/macros.h \
+ ${debug_srcdir}/map.h \
+ ${debug_srcdir}/multimap.h \
+ ${debug_srcdir}/multiset.h \
+ ${debug_srcdir}/safe_base.h \
+ ${debug_srcdir}/safe_iterator.h \
+ ${debug_srcdir}/safe_iterator.tcc \
+ ${debug_srcdir}/safe_sequence.h \
+ ${debug_srcdir}/set \
+ ${debug_srcdir}/set.h \
+ ${debug_srcdir}/string \
+ ${debug_srcdir}/unordered_map \
+ ${debug_srcdir}/unordered_set \
+ ${debug_srcdir}/vector
+
+
+# Parallel mode headers
+parallel_srcdir = ${glibcxx_srcdir}/include/parallel
+parallel_builddir = ./parallel
+@ENABLE_PARALLEL_FALSE@parallel_headers =
+@ENABLE_PARALLEL_TRUE@parallel_headers = \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algo.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algobase.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithm \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithmfwd.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/balanced_quicksort.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/base.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/basic_iterator.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/checkers.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/compatibility.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/compiletime_settings.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/equally_split.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/features.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/find.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/find_selectors.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/for_each.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/for_each_selectors.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/iterator.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/list_partition.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/losertree.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/merge.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/multiseq_selection.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/multiway_merge.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/multiway_mergesort.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/numeric \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/numericfwd.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/omp_loop.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/omp_loop_static.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/par_loop.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/parallel.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/partial_sum.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/partition.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/queue.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/quicksort.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/random_number.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/random_shuffle.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/search.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/set_operations.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/settings.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/sort.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/tags.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/types.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/unique_copy.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/workstealing.h
+
+@GLIBCXX_C_HEADERS_EXTRA_FALSE@c_base_headers_extra =
+
+# Some of the different "C" header models need extra files.
+# Some "C" header schemes require the "C" compatibility headers.
+# For --enable-cheaders=c_std
+@GLIBCXX_C_HEADERS_EXTRA_TRUE@c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
+@GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
+@GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
+host_srcdir = ${glibcxx_srcdir}/$(OS_INC_SRCDIR)
+host_builddir = ./${host_alias}/bits
+host_installdir = ${gxx_include_dir}/${host_alias}$(MULTISUBDIR)/bits
+host_headers = \
+ ${host_srcdir}/ctype_base.h \
+ ${host_srcdir}/ctype_inline.h \
+ ${host_srcdir}/ctype_noninline.h \
+ ${host_srcdir}/os_defines.h \
+ ${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
+ ${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
+ ${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h \
+ ${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
+ ${glibcxx_srcdir}/include/precompiled/stdc++.h \
+ ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
+ ${glibcxx_srcdir}/include/precompiled/extc++.h
+
+
+# Non-installed host_header files.
+COMPATIBILITY_H = config/abi/compatibility.h
+host_headers_noinst = \
+ ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) \
+ ${glibcxx_srcdir}/$(COMPATIBILITY_H)
+
+
+# These host_headers_extra files are all built with ad hoc naming rules.
+host_headers_extra = \
+ ${host_builddir}/basic_file.h \
+ ${host_builddir}/c++config.h \
+ ${host_builddir}/c++allocator.h \
+ ${host_builddir}/c++io.h \
+ ${host_builddir}/c++locale.h \
+ ${host_builddir}/messages_members.h \
+ ${host_builddir}/time_members.h
+
+thread_host_headers = \
+ ${host_builddir}/gthr.h \
+ ${host_builddir}/gthr-single.h \
+ ${host_builddir}/gthr-posix.h \
+ ${host_builddir}/gthr-tpf.h \
+ ${host_builddir}/gthr-default.h
+
+pch1_source = ${glibcxx_srcdir}/include/precompiled/stdc++.h
+pch1_output_builddir = ${host_builddir}/stdc++.h.gch
+pch1_output_anchor = ${host_builddir}/stdc++.h
+pch1_output_installdir = ${host_installdir}/stdc++.h.gch
+pch1a_output = ${pch1_output_builddir}/O0g.gch
+pch1b_output = ${pch1_output_builddir}/O2g.gch
+pch1_output = ${pch1a_output} ${pch1b_output}
+pch2_source = ${glibcxx_srcdir}/include/precompiled/stdtr1c++.h
+pch2_output_builddir = ${host_builddir}/stdtr1c++.h.gch
+pch2_output_anchor = ${host_builddir}/stdtr1c++.h
+pch2_output_installdir = ${host_installdir}/stdtr1c++.h.gch
+pch2_output = ${pch2_output_builddir}/O2g.gch
+pch3_source = ${glibcxx_srcdir}/include/precompiled/extc++.h
+pch3_output_builddir = ${host_builddir}/extc++.h.gch
+pch3_output_anchor = ${host_builddir}/extc++.h
+pch3_output_installdir = ${host_installdir}/extc++.h.gch
+pch3_output = ${pch3_output_builddir}/O2g.gch
+pch_output = ${pch1_output} ${pch2_output} ${pch3_output}
+pch_output_dirs = \
+ ${pch1_output_builddir} ${pch2_output_builddir} ${pch3_output_builddir}
+
+pch_output_anchors = \
+ ${pch1_output_anchor} ${pch2_output_anchor} ${pch3_output_anchor}
+
+PCHFLAGS = -Winvalid-pch -x c++-header $(CXXFLAGS)
+@GLIBCXX_BUILD_PCH_FALSE@pch_build =
+@GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_output}
+
+# List of all timestamp files. By keeping only one copy of this list, both
+# CLEANFILES and all-local are kept up-to-date.
+allstamped = \
+ stamp-std stamp-bits stamp-c_base stamp-c_base_extra \
+ stamp-c_compatibility stamp-backward stamp-ext stamp-pb \
+ stamp-tr1 stamp-tr1-impl stamp-debug stamp-parallel stamp-host
+
+
+# List of all files that are created by explicit building, editing, or
+# catenation.
+allcreated = \
+ ${host_builddir}/c++config.h \
+ ${thread_host_headers} \
+ ${pch_build}
+
+
+# Host includes for threads
+uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
+
+# By adding these files here, automake will remove them for 'make clean'
+CLEANFILES = ${pch_output} ${pch_output_anchors}
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps include/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign --ignore-deps include/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/..
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am all-local check check-am clean clean-generic \
+ clean-libtool clean-local distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-data-local install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+
+# Here are the rules for building the headers
+all-local: ${allstamped} ${allcreated}
+
+# Ignore errors from 'mkdir -p' to avoid parallel make failure on
+# systems with broken mkdir. Call mkdir unconditionally because
+# it is just as cheap to avoid going through the shell.
+# Ignore errors from $(LN_S) because the links may already exist.
+stamp-std: ${std_headers}
+ @-mkdir -p ${std_builddir}
+ @-cd ${std_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-std
+
+stamp-bits: ${bits_headers}
+ @-mkdir -p ${bits_builddir}
+ @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-bits
+
+stamp-c_base: ${c_base_headers}
+ @-mkdir -p ${c_base_builddir}
+ @-cd ${c_base_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-c_base
+
+stamp-c_base_extra: ${c_base_headers_extra}
+ @-mkdir -p ${bits_builddir}
+ @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-c_base_extra
+
+stamp-c_compatibility: ${c_compatibility_headers_extra}
+ @-mkdir -p ${c_compatibility_builddir}
+ @-if [ ! -z "${c_compatibility_headers_extra}" ]; then \
+ cd ${c_compatibility_builddir} && $(LN_S) $? . 2>/dev/null ;\
+ fi
+ @$(STAMP) stamp-c_compatibility
+
+stamp-backward: ${backward_headers}
+ @-mkdir -p ${backward_builddir}
+ @-cd ${backward_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-backward
+
+stamp-ext: ${ext_headers}
+ @-mkdir -p ${ext_builddir}
+ @-cd ${ext_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-ext
+
+# Have to deal with nested include directories, gah! Strip off source
+# directory before making the link.
+# XXX check ${pb_headers}
+stamp-pb:
+ @if [ ! -d "${pb_builddir}" ]; then \
+ mkdir -p ${pb_subdirs} ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers1}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers2}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers3}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers4}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers5}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers6}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ @if [ ! -f stamp-pb ]; then \
+ cd ${pb_builddir} && for h in ${pb_headers7}; do \
+ build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(LN_S) $$h $${build_name} || true ;\
+ done ;\
+ fi
+ $(STAMP) stamp-pb
+
+stamp-tr1: ${tr1_headers}
+ @-mkdir -p ${tr1_builddir}
+ @-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-tr1
+
+stamp-tr1-impl: ${tr1_impl_headers}
+ @-mkdir -p ${tr1_impl_builddir}
+ @-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-tr1-impl
+
+stamp-debug: ${debug_headers}
+ @-mkdir -p ${debug_builddir}
+ @-cd ${debug_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-debug
+
+stamp-parallel: ${parallel_headers}
+ @-mkdir -p ${parallel_builddir}
+ @-cd ${parallel_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-parallel
+
+stamp-${host_alias}:
+ @-mkdir -p ${host_builddir}
+ @$(STAMP) stamp-${host_alias}
+
+# Host includes static.
+# XXX Missing dependency info for {host_headers_extra}
+stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias}
+ @cd ${host_builddir} && {\
+ $(LN_S) ${host_headers} . || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_H) basic_file.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(ALLOCATOR_H) c++allocator.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CSTDIO_H) c++io.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_H) c++locale.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) . || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(COMPATIBILITY_H) . || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_H) messages_members.h || true ;\
+ $(LN_S) ${glibcxx_srcdir}/$(CTIME_H) time_members.h || true;\
+ } 2>/dev/null
+ $(STAMP) stamp-host
+
+# Host includes dynamic.
+@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@stamp-namespace-version:
+@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@ echo 1 > stamp-namespace-version
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@stamp-namespace-version:
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@ echo 0 > stamp-namespace-version
+
+@ENABLE_VISIBILITY_TRUE@stamp-visibility:
+@ENABLE_VISIBILITY_TRUE@ echo 1 > stamp-visibility
+@ENABLE_VISIBILITY_FALSE@stamp-visibility:
+@ENABLE_VISIBILITY_FALSE@ echo 0 > stamp-visibility
+
+# NB: The non-empty default ldbl_compat works around an AIX sed
+# oddity, see libstdc++/31957 for details.
+${host_builddir}/c++config.h: ${CONFIG_HEADER} \
+ ${glibcxx_srcdir}/include/bits/c++config \
+ stamp-${host_alias} \
+ ${toplevel_srcdir}/gcc/DATESTAMP \
+ stamp-namespace-version \
+ stamp-visibility
+ @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
+ nsa_version=`cat stamp-namespace-version` ;\
+ visibility=`cat stamp-visibility` ;\
+ ldbl_compat='s,g,g,' ;\
+ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \
+ ${CONFIG_HEADER} > /dev/null 2>&1 \
+ && ldbl_compat='s,^#undef _GLIBCXX_LONG_DOUBLE_COMPAT$$,#define _GLIBCXX_LONG_DOUBLE_COMPAT 1,' ;\
+ sed -e "s,define __GLIBCXX__,define __GLIBCXX__ $$date," \
+ -e "s,define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION, define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION $$nsa_version," \
+ -e "s,define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY, define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY $$visibility," \
+ -e "$$ldbl_compat" \
+ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
+ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
+ -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
+ -e 's/VERSION/_GLIBCXX_VERSION/g' \
+ -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
+ -e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \
+ -e '/[ ]_GLIBCXX_LONG_DOUBLE_COMPAT[ ]/d' \
+ < ${CONFIG_HEADER} >> $@ ;\
+ echo "" >> $@ ;\
+ echo "#endif // _GLIBCXX_CXX_CONFIG_H" >> $@
+
+${host_builddir}/gthr.h: ${toplevel_srcdir}/gcc/gthr.h stamp-${host_alias}
+ sed -e '/^#pragma/b' \
+ -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
+ -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
+ < ${toplevel_srcdir}/gcc/gthr.h > $@
+
+${host_builddir}/gthr-single.h: ${toplevel_srcdir}/gcc/gthr-single.h \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ < ${toplevel_srcdir}/gcc/gthr-single.h > $@
+
+${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/gcc/gthr-posix.h \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
+ < ${toplevel_srcdir}/gcc/gthr-posix.h > $@
+
+${host_builddir}/gthr-tpf.h: ${toplevel_srcdir}/gcc/gthr-tpf.h \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
+ < ${toplevel_srcdir}/gcc/gthr-tpf.h > $@
+
+${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \
+ stamp-${host_alias}
+ sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+ -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
+ -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+ -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
+ -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
+ < ${toplevel_srcdir}/gcc/${glibcxx_thread_h} > $@
+
+# Build two precompiled C++ includes, stdc++.h.gch/*.gch
+${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ -mkdir -p ${pch1_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O0 -g ${pch1_source} -o $@
+
+${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
+ -mkdir -p ${pch1_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@
+
+# Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch
+${pch2_output}: ${pch2_source} ${pch1_output}
+ -mkdir -p ${pch2_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@
+
+# Build a precompiled extension include, extc++.h.gch/O2.gch
+${pch3_output}: ${pch3_source} ${pch2_output}
+ -mkdir -p ${pch3_output_builddir}
+ $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
+
+# For robustness sake (in light of junk files or in-source
+# configuration), copy from the build or source tree to the install
+# tree using only the human-maintained file lists and directory
+# components. Yes, with minor differences, this is sheer duplication
+# of the staging rules above using $(INSTALL_DATA) instead of LN_S and
+# `$(mkinstalldirs)' instead of `mkdir -p'. In particular,
+# host_headers_extra are taken out of the build tree staging area;
+# the rest are taken from the original source tree.
+
+@GLIBCXX_HOSTED_TRUE@install-data-local: install-headers
+@GLIBCXX_HOSTED_FALSE@install-data-local: install-freestanding-headers
+
+# This is a subset of the full install-headers rule. We only need <cstddef>,
+# <limits>, <cstdlib>, <cstdarg>, <new>, <typeinfo>, <exception>, and any
+# files which they include (and which we provide). The last three headers
+# are installed by libsupc++, so only the first four and the sub-includes
+# are copied here.
+install-freestanding-headers:
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}
+ $(mkinstalldirs) $(DESTDIR)${host_installdir}
+ for file in ${host_srcdir}/os_defines.h ${host_builddir}/c++config.h; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir}
+ $(INSTALL_DATA) ${std_builddir}/limits $(DESTDIR)${gxx_include_dir}/${std_builddir}
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
+ for file in cstddef cstdlib cstdarg; do \
+ $(INSTALL_DATA) ${c_base_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
+
+# The real deal.
+install-headers:
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${bits_builddir}
+ for file in ${bits_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${bits_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${backward_builddir}
+ for file in ${backward_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${backward_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${ext_builddir}
+ for file in ${ext_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${ext_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${pb_builddir}
+ for dir in ${pb_subdirs}; do \
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/$${dir} ; done
+ for file in ${pb_headers1}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers2}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers3}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers4}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers5}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers6}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ for file in ${pb_headers7}; do \
+ install_base=$(DESTDIR)${gxx_include_dir}/${pb_builddir} ; \
+ relative_name=`echo $$file | sed -e "s|${pb_srcdir}|.|g"` ;\
+ $(INSTALL_DATA) $${file} $${install_base}/$${relative_name} ; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
+ for file in ${tr1_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}
+ for file in ${tr1_impl_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir}
+ for file in ${c_base_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done
+ c_base_headers_extra_install='$(c_base_headers_extra)';\
+ for file in $$c_base_headers_extra_install; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}/${bits_builddir}; done
+ c_compatibility_headers_install='$(c_compatibility_headers_extra)';\
+ for file in $$c_compatibility_headers_install; do \
+ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir}
+ for file in ${std_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${debug_builddir}
+ for file in ${debug_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${debug_builddir}; done
+ parallel_headers_install='${parallel_headers}';\
+ test -z "$$parallel_headers_install" || \
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${parallel_builddir};\
+ for file in $$parallel_headers_install; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${parallel_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${host_installdir}
+ for file in ${host_headers} ${host_headers_extra} \
+ ${thread_host_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${host_installdir}; done
+
+# To remove directories.
+clean-local:
+ rm -rf ${pch_output_dirs}
+
+# Stop implicit '.o' make rules from ever stomping on extensionless
+# headers, in the improbable case where some foolish, crack-addled
+# developer tries to create them via make in the include build
+# directory. (This is more of an example of how this kind of rule can
+# be made.)
+.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr1_impl_headers)
+ $(ext_headers)
+$(std_headers): ; @:
+$(c_base_headers): ; @:
+$(tr1_headers): ; @:
+$(tr1_impl_headers): ; @:
+$(ext_headers): ; @:
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/auto_ptr.h b/gcc-4.4.0/libstdc++-v3/include/backward/auto_ptr.h
new file mode 100644
index 000000000..4554d7a87
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/auto_ptr.h
@@ -0,0 +1,292 @@
+// auto_ptr implementation -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file backward/auto_ptr.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_AUTO_PTR_H
+#define _STL_AUTO_PTR_H 1
+
+#include <bits/c++config.h>
+#include <debug/debug.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * A wrapper class to provide auto_ptr with reference semantics.
+ * For example, an auto_ptr can be assigned (or constructed from)
+ * the result of a function which returns an auto_ptr by value.
+ *
+ * All the auto_ptr_ref stuff should happen behind the scenes.
+ */
+ template<typename _Tp1>
+ struct auto_ptr_ref
+ {
+ _Tp1* _M_ptr;
+
+ explicit
+ auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }
+ } _GLIBCXX_DEPRECATED_ATTR;
+
+
+ /**
+ * @brief A simple smart pointer providing strict ownership semantics.
+ *
+ * The Standard says:
+ * <pre>
+ * An @c auto_ptr owns the object it holds a pointer to. Copying
+ * an @c auto_ptr copies the pointer and transfers ownership to the
+ * destination. If more than one @c auto_ptr owns the same object
+ * at the same time the behavior of the program is undefined.
+ *
+ * The uses of @c auto_ptr include providing temporary
+ * exception-safety for dynamically allocated memory, passing
+ * ownership of dynamically allocated memory to a function, and
+ * returning dynamically allocated memory from a function. @c
+ * auto_ptr does not meet the CopyConstructible and Assignable
+ * requirements for Standard Library <a
+ * href="tables.html#65">container</a> elements and thus
+ * instantiating a Standard Library container with an @c auto_ptr
+ * results in undefined behavior.
+ * </pre>
+ * Quoted from [20.4.5]/3.
+ *
+ * Good examples of what can and cannot be done with auto_ptr can
+ * be found in the libstdc++ testsuite.
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS
+ * 127. auto_ptr<> conversion issues
+ * These resolutions have all been incorporated.
+ */
+ template<typename _Tp>
+ class auto_ptr
+ {
+ private:
+ _Tp* _M_ptr;
+
+ public:
+ /// The pointed-to type.
+ typedef _Tp element_type;
+
+ /**
+ * @brief An %auto_ptr is usually constructed from a raw pointer.
+ * @param p A pointer (defaults to NULL).
+ *
+ * This object now @e owns the object pointed to by @a p.
+ */
+ explicit
+ auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }
+
+ /**
+ * @brief An %auto_ptr can be constructed from another %auto_ptr.
+ * @param a Another %auto_ptr of the same type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownership.
+ */
+ auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }
+
+ /**
+ * @brief An %auto_ptr can be constructed from another %auto_ptr.
+ * @param a Another %auto_ptr of a different but related type.
+ *
+ * A pointer-to-Tp1 must be convertible to a
+ * pointer-to-Tp/element_type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownership.
+ */
+ template<typename _Tp1>
+ auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }
+
+ /**
+ * @brief %auto_ptr assignment operator.
+ * @param a Another %auto_ptr of the same type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownership. The object that this one @e
+ * used to own and track has been deleted.
+ */
+ auto_ptr&
+ operator=(auto_ptr& __a) throw()
+ {
+ reset(__a.release());
+ return *this;
+ }
+
+ /**
+ * @brief %auto_ptr assignment operator.
+ * @param a Another %auto_ptr of a different but related type.
+ *
+ * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.
+ *
+ * This object now @e owns the object previously owned by @a a,
+ * which has given up ownership. The object that this one @e
+ * used to own and track has been deleted.
+ */
+ template<typename _Tp1>
+ auto_ptr&
+ operator=(auto_ptr<_Tp1>& __a) throw()
+ {
+ reset(__a.release());
+ return *this;
+ }
+
+ /**
+ * When the %auto_ptr goes out of scope, the object it owns is
+ * deleted. If it no longer owns anything (i.e., @c get() is
+ * @c NULL), then this has no effect.
+ *
+ * The C++ standard says there is supposed to be an empty throw
+ * specification here, but omitting it is standard conforming. Its
+ * presence can be detected only if _Tp::~_Tp() throws, but this is
+ * prohibited. [17.4.3.6]/2
+ */
+ ~auto_ptr() { delete _M_ptr; }
+
+ /**
+ * @brief Smart pointer dereferencing.
+ *
+ * If this %auto_ptr no longer owns anything, then this
+ * operation will crash. (For a smart pointer, "no longer owns
+ * anything" is the same as being a null pointer, and you know
+ * what happens when you dereference one of those...)
+ */
+ element_type&
+ operator*() const throw()
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return *_M_ptr;
+ }
+
+ /**
+ * @brief Smart pointer dereferencing.
+ *
+ * This returns the pointer itself, which the language then will
+ * automatically cause to be dereferenced.
+ */
+ element_type*
+ operator->() const throw()
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return _M_ptr;
+ }
+
+ /**
+ * @brief Bypassing the smart pointer.
+ * @return The raw pointer being managed.
+ *
+ * You can get a copy of the pointer that this object owns, for
+ * situations such as passing to a function which only accepts
+ * a raw pointer.
+ *
+ * @note This %auto_ptr still owns the memory.
+ */
+ element_type*
+ get() const throw() { return _M_ptr; }
+
+ /**
+ * @brief Bypassing the smart pointer.
+ * @return The raw pointer being managed.
+ *
+ * You can get a copy of the pointer that this object owns, for
+ * situations such as passing to a function which only accepts
+ * a raw pointer.
+ *
+ * @note This %auto_ptr no longer owns the memory. When this object
+ * goes out of scope, nothing will happen.
+ */
+ element_type*
+ release() throw()
+ {
+ element_type* __tmp = _M_ptr;
+ _M_ptr = 0;
+ return __tmp;
+ }
+
+ /**
+ * @brief Forcibly deletes the managed object.
+ * @param p A pointer (defaults to NULL).
+ *
+ * This object now @e owns the object pointed to by @a p. The
+ * previous object has been deleted.
+ */
+ void
+ reset(element_type* __p = 0) throw()
+ {
+ if (__p != _M_ptr)
+ {
+ delete _M_ptr;
+ _M_ptr = __p;
+ }
+ }
+
+ /**
+ * @brief Automatic conversions
+ *
+ * These operations convert an %auto_ptr into and from an auto_ptr_ref
+ * automatically as needed. This allows constructs such as
+ * @code
+ * auto_ptr<Derived> func_returning_auto_ptr(.....);
+ * ...
+ * auto_ptr<Base> ptr = func_returning_auto_ptr(.....);
+ * @endcode
+ */
+ auto_ptr(auto_ptr_ref<element_type> __ref) throw()
+ : _M_ptr(__ref._M_ptr) { }
+
+ auto_ptr&
+ operator=(auto_ptr_ref<element_type> __ref) throw()
+ {
+ if (__ref._M_ptr != this->get())
+ {
+ delete _M_ptr;
+ _M_ptr = __ref._M_ptr;
+ }
+ return *this;
+ }
+
+ template<typename _Tp1>
+ operator auto_ptr_ref<_Tp1>() throw()
+ { return auto_ptr_ref<_Tp1>(this->release()); }
+
+ template<typename _Tp1>
+ operator auto_ptr<_Tp1>() throw()
+ { return auto_ptr<_Tp1>(this->release()); }
+ } _GLIBCXX_DEPRECATED_ATTR;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 541. shared_ptr template assignment and void
+ template<>
+ class auto_ptr<void>
+ {
+ public:
+ typedef void element_type;
+ } _GLIBCXX_DEPRECATED_ATTR;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_AUTO_PTR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/backward_warning.h b/gcc-4.4.0/libstdc++-v3/include/backward/backward_warning.h
new file mode 100644
index 000000000..53df521cb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/backward_warning.h
@@ -0,0 +1,56 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef _BACKWARD_BACKWARD_WARNING_H
+#define _BACKWARD_BACKWARD_WARNING_H 1
+
+#ifdef __DEPRECATED
+#warning \
+ This file includes at least one deprecated or antiquated header which \
+ may be removed without further notice at a future date. Please use a \
+ non-deprecated interface with equivalent functionality instead. For a \
+ listing of replacement headers and interfaces, consult the file \
+ backward_warning.h. To disable this warning use -Wno-deprecated.
+
+/*
+ A list of valid replacements is as follows:
+
+ Use: Instead of:
+ <sstream>, basic_stringbuf <strstream>, strstreambuf
+ <sstream>, basic_istringstream <strstream>, istrstream
+ <sstream>, basic_ostringstream <strstream>, ostrstream
+ <sstream>, basic_stringstream <strstream>, strstream
+ <unordered_set>, unordered_set <ext/hash_set>, hash_set
+ <unordered_set>, unordered_multiset <ext/hash_set>, hash_multiset
+ <unordered_map>, unordered_map <ext/hash_map>, hash_map
+ <unordered_map>, unordered_multimap <ext/hash_map>, hash_multimap
+ <functional>, bind <functional>, binder1st
+ <functional>, bind <functional>, binder2nd
+ <functional>, bind <functional>, bind1st
+ <functional>, bind <functional>, bind2nd
+ <memory>, unique_ptr <memory>, auto_ptr
+*/
+
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/binders.h b/gcc-4.4.0/libstdc++-v3/include/backward/binders.h
new file mode 100644
index 000000000..9b059cef1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/binders.h
@@ -0,0 +1,168 @@
+// Functor implementations -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file backward/binders.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_BINDERS_H
+#define _GLIBCXX_BINDERS_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 20.3.6 binders
+ /** @defgroup binders Binder Classes
+ * @ingroup functors
+ *
+ * Binders turn functions/functors with two arguments into functors with
+ * a single argument, storing an argument to be applied later. For
+ * example, a variable @c B of type @c binder1st is constructed from a
+ * functor @c f and an argument @c x. Later, B's @c operator() is called
+ * with a single argument @c y. The return value is the value of @c f(x,y).
+ * @c B can be "called" with various arguments (y1, y2, ...) and will in
+ * turn call @c f(x,y1), @c f(x,y2), ...
+ *
+ * The function @c bind1st is provided to save some typing. It takes the
+ * function and an argument as parameters, and returns an instance of
+ * @c binder1st.
+ *
+ * The type @c binder2nd and its creator function @c bind2nd do the same
+ * thing, but the stored argument is passed as the second parameter instead
+ * of the first, e.g., @c bind2nd(std::minus<float>,1.3) will create a
+ * functor whose @c operator() accepts a floating-point number, subtracts
+ * 1.3 from it, and returns the result. (If @c bind1st had been used,
+ * the functor would perform "1.3 - x" instead.
+ *
+ * Creator-wrapper functions like @c bind1st are intended to be used in
+ * calling algorithms. Their return values will be temporary objects.
+ * (The goal is to not require you to type names like
+ * @c std::binder1st<std::plus<int>> for declaring a variable to hold the
+ * return value from @c bind1st(std::plus<int>,5).
+ *
+ * These become more useful when combined with the composition functions.
+ *
+ * @{
+ */
+ /// One of the @link binders binder functors@endlink.
+ template<typename _Operation>
+ class binder1st
+ : public unary_function<typename _Operation::second_argument_type,
+ typename _Operation::result_type>
+ {
+ protected:
+ _Operation op;
+ typename _Operation::first_argument_type value;
+
+ public:
+ binder1st(const _Operation& __x,
+ const typename _Operation::first_argument_type& __y)
+ : op(__x), value(__y) { }
+
+ typename _Operation::result_type
+ operator()(const typename _Operation::second_argument_type& __x) const
+ { return op(value, __x); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 109. Missing binders for non-const sequence elements
+ typename _Operation::result_type
+ operator()(typename _Operation::second_argument_type& __x) const
+ { return op(value, __x); }
+ } _GLIBCXX_DEPRECATED_ATTR;
+
+ /// One of the @link binders binder functors@endlink.
+ template<typename _Operation, typename _Tp>
+ inline binder1st<_Operation>
+ bind1st(const _Operation& __fn, const _Tp& __x)
+ {
+ typedef typename _Operation::first_argument_type _Arg1_type;
+ return binder1st<_Operation>(__fn, _Arg1_type(__x));
+ }
+
+ /// One of the @link binders binder functors@endlink.
+ template<typename _Operation>
+ class binder2nd
+ : public unary_function<typename _Operation::first_argument_type,
+ typename _Operation::result_type>
+ {
+ protected:
+ _Operation op;
+ typename _Operation::second_argument_type value;
+
+ public:
+ binder2nd(const _Operation& __x,
+ const typename _Operation::second_argument_type& __y)
+ : op(__x), value(__y) { }
+
+ typename _Operation::result_type
+ operator()(const typename _Operation::first_argument_type& __x) const
+ { return op(__x, value); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 109. Missing binders for non-const sequence elements
+ typename _Operation::result_type
+ operator()(typename _Operation::first_argument_type& __x) const
+ { return op(__x, value); }
+ } _GLIBCXX_DEPRECATED_ATTR;
+
+ /// One of the @link binders binder functors@endlink.
+ template<typename _Operation, typename _Tp>
+ inline binder2nd<_Operation>
+ bind2nd(const _Operation& __fn, const _Tp& __x)
+ {
+ typedef typename _Operation::second_argument_type _Arg2_type;
+ return binder2nd<_Operation>(__fn, _Arg2_type(__x));
+ }
+ /** @} */
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_BINDERS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/hash_fun.h b/gcc-4.4.0/libstdc++-v3/include/backward/hash_fun.h
new file mode 100644
index 000000000..8cc7a4229
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/hash_fun.h
@@ -0,0 +1,167 @@
+// 'struct hash' from SGI -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file backward/hash_fun.h
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _HASH_FUN_H
+#define _HASH_FUN_H 1
+
+#include <cstddef>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+
+ template<class _Key>
+ struct hash { };
+
+ inline size_t
+ __stl_hash_string(const char* __s)
+ {
+ unsigned long __h = 0;
+ for ( ; *__s; ++__s)
+ __h = 5 * __h + *__s;
+ return size_t(__h);
+ }
+
+ template<>
+ struct hash<char*>
+ {
+ size_t
+ operator()(const char* __s) const
+ { return __stl_hash_string(__s); }
+ };
+
+ template<>
+ struct hash<const char*>
+ {
+ size_t
+ operator()(const char* __s) const
+ { return __stl_hash_string(__s); }
+ };
+
+ template<>
+ struct hash<char>
+ {
+ size_t
+ operator()(char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned char>
+ {
+ size_t
+ operator()(unsigned char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<signed char>
+ {
+ size_t
+ operator()(unsigned char __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<short>
+ {
+ size_t
+ operator()(short __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned short>
+ {
+ size_t
+ operator()(unsigned short __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<int>
+ {
+ size_t
+ operator()(int __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned int>
+ {
+ size_t
+ operator()(unsigned int __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<long>
+ {
+ size_t
+ operator()(long __x) const
+ { return __x; }
+ };
+
+ template<>
+ struct hash<unsigned long>
+ {
+ size_t
+ operator()(unsigned long __x) const
+ { return __x; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/hash_map b/gcc-4.4.0/libstdc++-v3/include/backward/hash_map
new file mode 100644
index 000000000..f439f3902
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/hash_map
@@ -0,0 +1,591 @@
+// Hashing map implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file backward/hash_map
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _HASH_MAP
+#define _HASH_MAP 1
+
+// GOOGLE LOCAL: No deprecated warning.
+// #include "backward_warning.h"
+#include <bits/c++config.h>
+#include <backward/hashtable.h>
+#include <bits/concept_check.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::equal_to;
+ using std::allocator;
+ using std::pair;
+ using std::_Select1st;
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<class _Key, class _Tp, class _HashFn = hash<_Key>,
+ class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> >
+ class hash_map
+ {
+ private:
+ typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,
+ _Select1st<pair<const _Key, _Tp> >,
+ _EqualKey, _Alloc> _Ht;
+
+ _Ht _M_ht;
+
+ public:
+ typedef typename _Ht::key_type key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher
+ hash_funct() const
+ { return _M_ht.hash_funct(); }
+
+ key_equal
+ key_eq() const
+ { return _M_ht.key_eq(); }
+
+ allocator_type
+ get_allocator() const
+ { return _M_ht.get_allocator(); }
+
+ hash_map()
+ : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
+
+ explicit
+ hash_map(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+
+ hash_map(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+
+ hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ template<class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+
+ template<class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+
+ template<class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+
+ template<class _InputIterator>
+ hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ size_type
+ size() const
+ { return _M_ht.size(); }
+
+ size_type
+ max_size() const
+ { return _M_ht.max_size(); }
+
+ bool
+ empty() const
+ { return _M_ht.empty(); }
+
+ void
+ swap(hash_map& __hs)
+ { _M_ht.swap(__hs._M_ht); }
+
+ template<class _K1, class _T1, class _HF, class _EqK, class _Al>
+ friend bool
+ operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
+ const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
+
+ iterator
+ begin()
+ { return _M_ht.begin(); }
+
+ iterator
+ end()
+ { return _M_ht.end(); }
+
+ const_iterator
+ begin() const
+ { return _M_ht.begin(); }
+
+ const_iterator
+ end() const
+ { return _M_ht.end(); }
+
+ pair<iterator, bool>
+ insert(const value_type& __obj)
+ { return _M_ht.insert_unique(__obj); }
+
+ template<class _InputIterator>
+ void
+ insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_unique(__f, __l); }
+
+ pair<iterator, bool>
+ insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_unique_noresize(__obj); }
+
+ iterator
+ find(const key_type& __key)
+ { return _M_ht.find(__key); }
+
+ const_iterator
+ find(const key_type& __key) const
+ { return _M_ht.find(__key); }
+
+ _Tp&
+ operator[](const key_type& __key)
+ { return _M_ht.find_or_insert(value_type(__key, _Tp())).second; }
+
+ size_type
+ count(const key_type& __key) const
+ { return _M_ht.count(__key); }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __key)
+ { return _M_ht.equal_range(__key); }
+
+ pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type
+ erase(const key_type& __key)
+ {return _M_ht.erase(__key); }
+
+ void
+ erase(iterator __it)
+ { _M_ht.erase(__it); }
+
+ void
+ erase(iterator __f, iterator __l)
+ { _M_ht.erase(__f, __l); }
+
+ void
+ clear()
+ { _M_ht.clear(); }
+
+ void
+ resize(size_type __hint)
+ { _M_ht.resize(__hint); }
+
+ size_type
+ bucket_count() const
+ { return _M_ht.bucket_count(); }
+
+ size_type
+ max_bucket_count() const
+ { return _M_ht.max_bucket_count(); }
+
+ size_type
+ elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+ };
+
+ template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
+ inline bool
+ operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
+ const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
+ { return __hm1._M_ht == __hm2._M_ht; }
+
+ template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
+ inline bool
+ operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
+ const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
+ { return !(__hm1 == __hm2); }
+
+ template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
+ inline void
+ swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
+ hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
+ { __hm1.swap(__hm2); }
+
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<class _Key, class _Tp,
+ class _HashFn = hash<_Key>,
+ class _EqualKey = equal_to<_Key>,
+ class _Alloc = allocator<_Tp> >
+ class hash_multimap
+ {
+ // concept requirements
+ __glibcxx_class_requires(_Key, _SGIAssignableConcept)
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept)
+ __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)
+
+ private:
+ typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,
+ _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
+ _Ht;
+
+ _Ht _M_ht;
+
+ public:
+ typedef typename _Ht::key_type key_type;
+ typedef _Tp data_type;
+ typedef _Tp mapped_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Ht::pointer pointer;
+ typedef typename _Ht::const_pointer const_pointer;
+ typedef typename _Ht::reference reference;
+ typedef typename _Ht::const_reference const_reference;
+
+ typedef typename _Ht::iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher
+ hash_funct() const
+ { return _M_ht.hash_funct(); }
+
+ key_equal
+ key_eq() const
+ { return _M_ht.key_eq(); }
+
+ allocator_type
+ get_allocator() const
+ { return _M_ht.get_allocator(); }
+
+ hash_multimap()
+ : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
+
+ explicit
+ hash_multimap(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+
+ hash_multimap(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+
+ hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ template<class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template<class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template<class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template<class _InputIterator>
+ hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ size_type
+ size() const
+ { return _M_ht.size(); }
+
+ size_type
+ max_size() const
+ { return _M_ht.max_size(); }
+
+ bool
+ empty() const
+ { return _M_ht.empty(); }
+
+ void
+ swap(hash_multimap& __hs)
+ { _M_ht.swap(__hs._M_ht); }
+
+ template<class _K1, class _T1, class _HF, class _EqK, class _Al>
+ friend bool
+ operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
+ const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
+
+ iterator
+ begin()
+ { return _M_ht.begin(); }
+
+ iterator
+ end()
+ { return _M_ht.end(); }
+
+ const_iterator
+ begin() const
+ { return _M_ht.begin(); }
+
+ const_iterator
+ end() const
+ { return _M_ht.end(); }
+
+ iterator
+ insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+
+ template<class _InputIterator>
+ void
+ insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+
+ iterator
+ insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ iterator
+ find(const key_type& __key)
+ { return _M_ht.find(__key); }
+
+ const_iterator
+ find(const key_type& __key) const
+ { return _M_ht.find(__key); }
+
+ size_type
+ count(const key_type& __key) const
+ { return _M_ht.count(__key); }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __key)
+ { return _M_ht.equal_range(__key); }
+
+ pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type
+ erase(const key_type& __key)
+ { return _M_ht.erase(__key); }
+
+ void
+ erase(iterator __it)
+ { _M_ht.erase(__it); }
+
+ void
+ erase(iterator __f, iterator __l)
+ { _M_ht.erase(__f, __l); }
+
+ void
+ clear()
+ { _M_ht.clear(); }
+
+ void
+ resize(size_type __hint)
+ { _M_ht.resize(__hint); }
+
+ size_type
+ bucket_count() const
+ { return _M_ht.bucket_count(); }
+
+ size_type
+ max_bucket_count() const
+ { return _M_ht.max_bucket_count(); }
+
+ size_type
+ elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+ };
+
+ template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
+ inline bool
+ operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
+ const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
+ { return __hm1._M_ht == __hm2._M_ht; }
+
+ template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
+ inline bool
+ operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
+ const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
+ { return !(__hm1 == __hm2); }
+
+ template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
+ inline void
+ swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
+ hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
+ { __hm1.swap(__hm2); }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Specialization of insert_iterator so that it will work for hash_map
+ // and hash_multimap.
+ template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+ class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn,
+ _EqKey, _Alloc> >
+ {
+ protected:
+ typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>
+ _Container;
+ _Container* container;
+
+ public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x)
+ : container(&__x) {}
+
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value)
+ {
+ container->insert(__value);
+ return *this;
+ }
+
+ insert_iterator<_Container>&
+ operator*()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++() { return *this; }
+
+ insert_iterator<_Container>&
+ operator++(int)
+ { return *this; }
+ };
+
+ template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
+ class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,
+ _EqKey, _Alloc> >
+ {
+ protected:
+ typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
+ _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+
+ public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x)
+ : container(&__x) {}
+
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value)
+ {
+ container->insert(__value);
+ return *this;
+ }
+
+ insert_iterator<_Container>&
+ operator*()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++(int)
+ { return *this; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/hash_set b/gcc-4.4.0/libstdc++-v3/include/backward/hash_set
new file mode 100644
index 000000000..af4aaf4bf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/hash_set
@@ -0,0 +1,559 @@
+// Hashing set implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file backward/hash_set
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _HASH_SET
+#define _HASH_SET 1
+
+// GOOGLE LOCAL: No deprecated warning.
+// #include "backward_warning.h"
+#include <bits/c++config.h>
+#include <backward/hashtable.h>
+#include <bits/concept_check.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::equal_to;
+ using std::allocator;
+ using std::pair;
+ using std::_Identity;
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<class _Value, class _HashFcn = hash<_Value>,
+ class _EqualKey = equal_to<_Value>,
+ class _Alloc = allocator<_Value> >
+ class hash_set
+ {
+ // concept requirements
+ __glibcxx_class_requires(_Value, _SGIAssignableConcept)
+ __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
+ __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
+
+ private:
+ typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
+ _EqualKey, _Alloc> _Ht;
+ _Ht _M_ht;
+
+ public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Alloc::pointer pointer;
+ typedef typename _Alloc::const_pointer const_pointer;
+ typedef typename _Alloc::reference reference;
+ typedef typename _Alloc::const_reference const_reference;
+
+ typedef typename _Ht::const_iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher
+ hash_funct() const
+ { return _M_ht.hash_funct(); }
+
+ key_equal
+ key_eq() const
+ { return _M_ht.key_eq(); }
+
+ allocator_type
+ get_allocator() const
+ { return _M_ht.get_allocator(); }
+
+ hash_set()
+ : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
+
+ explicit
+ hash_set(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+
+ hash_set(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+
+ hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ template<class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+
+ template<class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+
+ template<class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_unique(__f, __l); }
+
+ template<class _InputIterator>
+ hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_unique(__f, __l); }
+
+ size_type
+ size() const
+ { return _M_ht.size(); }
+
+ size_type
+ max_size() const
+ { return _M_ht.max_size(); }
+
+ bool
+ empty() const
+ { return _M_ht.empty(); }
+
+ void
+ swap(hash_set& __hs)
+ { _M_ht.swap(__hs._M_ht); }
+
+ template<class _Val, class _HF, class _EqK, class _Al>
+ friend bool
+ operator==(const hash_set<_Val, _HF, _EqK, _Al>&,
+ const hash_set<_Val, _HF, _EqK, _Al>&);
+
+ iterator
+ begin() const
+ { return _M_ht.begin(); }
+
+ iterator
+ end() const
+ { return _M_ht.end(); }
+
+ pair<iterator, bool>
+ insert(const value_type& __obj)
+ {
+ pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
+ return pair<iterator,bool>(__p.first, __p.second);
+ }
+
+ template<class _InputIterator>
+ void
+ insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_unique(__f, __l); }
+
+ pair<iterator, bool>
+ insert_noresize(const value_type& __obj)
+ {
+ pair<typename _Ht::iterator, bool> __p
+ = _M_ht.insert_unique_noresize(__obj);
+ return pair<iterator, bool>(__p.first, __p.second);
+ }
+
+ iterator
+ find(const key_type& __key) const
+ { return _M_ht.find(__key); }
+
+ size_type
+ count(const key_type& __key) const
+ { return _M_ht.count(__key); }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type
+ erase(const key_type& __key)
+ {return _M_ht.erase(__key); }
+
+ void
+ erase(iterator __it)
+ { _M_ht.erase(__it); }
+
+ void
+ erase(iterator __f, iterator __l)
+ { _M_ht.erase(__f, __l); }
+
+ void
+ clear()
+ { _M_ht.clear(); }
+
+ void
+ resize(size_type __hint)
+ { _M_ht.resize(__hint); }
+
+ size_type
+ bucket_count() const
+ { return _M_ht.bucket_count(); }
+
+ size_type
+ max_bucket_count() const
+ { return _M_ht.max_bucket_count(); }
+
+ size_type
+ elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+ };
+
+ template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+ inline bool
+ operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
+ const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
+ { return __hs1._M_ht == __hs2._M_ht; }
+
+ template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+ inline bool
+ operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
+ const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
+ { return !(__hs1 == __hs2); }
+
+ template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
+ inline void
+ swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
+ hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
+ { __hs1.swap(__hs2); }
+
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<class _Value,
+ class _HashFcn = hash<_Value>,
+ class _EqualKey = equal_to<_Value>,
+ class _Alloc = allocator<_Value> >
+ class hash_multiset
+ {
+ // concept requirements
+ __glibcxx_class_requires(_Value, _SGIAssignableConcept)
+ __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
+ __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
+
+ private:
+ typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
+ _EqualKey, _Alloc> _Ht;
+ _Ht _M_ht;
+
+ public:
+ typedef typename _Ht::key_type key_type;
+ typedef typename _Ht::value_type value_type;
+ typedef typename _Ht::hasher hasher;
+ typedef typename _Ht::key_equal key_equal;
+
+ typedef typename _Ht::size_type size_type;
+ typedef typename _Ht::difference_type difference_type;
+ typedef typename _Alloc::pointer pointer;
+ typedef typename _Alloc::const_pointer const_pointer;
+ typedef typename _Alloc::reference reference;
+ typedef typename _Alloc::const_reference const_reference;
+
+ typedef typename _Ht::const_iterator iterator;
+ typedef typename _Ht::const_iterator const_iterator;
+
+ typedef typename _Ht::allocator_type allocator_type;
+
+ hasher
+ hash_funct() const
+ { return _M_ht.hash_funct(); }
+
+ key_equal
+ key_eq() const
+ { return _M_ht.key_eq(); }
+
+ allocator_type
+ get_allocator() const
+ { return _M_ht.get_allocator(); }
+
+ hash_multiset()
+ : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
+
+ explicit
+ hash_multiset(size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+
+ hash_multiset(size_type __n, const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+
+ hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a) {}
+
+ template<class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l)
+ : _M_ht(100, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template<class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
+ : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template<class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf)
+ : _M_ht(__n, __hf, key_equal(), allocator_type())
+ { _M_ht.insert_equal(__f, __l); }
+
+ template<class _InputIterator>
+ hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_ht(__n, __hf, __eql, __a)
+ { _M_ht.insert_equal(__f, __l); }
+
+ size_type
+ size() const
+ { return _M_ht.size(); }
+
+ size_type
+ max_size() const
+ { return _M_ht.max_size(); }
+
+ bool
+ empty() const
+ { return _M_ht.empty(); }
+
+ void
+ swap(hash_multiset& hs)
+ { _M_ht.swap(hs._M_ht); }
+
+ template<class _Val, class _HF, class _EqK, class _Al>
+ friend bool
+ operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&,
+ const hash_multiset<_Val, _HF, _EqK, _Al>&);
+
+ iterator
+ begin() const
+ { return _M_ht.begin(); }
+
+ iterator
+ end() const
+ { return _M_ht.end(); }
+
+ iterator
+ insert(const value_type& __obj)
+ { return _M_ht.insert_equal(__obj); }
+
+ template<class _InputIterator>
+ void
+ insert(_InputIterator __f, _InputIterator __l)
+ { _M_ht.insert_equal(__f,__l); }
+
+ iterator
+ insert_noresize(const value_type& __obj)
+ { return _M_ht.insert_equal_noresize(__obj); }
+
+ iterator
+ find(const key_type& __key) const
+ { return _M_ht.find(__key); }
+
+ size_type
+ count(const key_type& __key) const
+ { return _M_ht.count(__key); }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __key) const
+ { return _M_ht.equal_range(__key); }
+
+ size_type
+ erase(const key_type& __key)
+ { return _M_ht.erase(__key); }
+
+ void
+ erase(iterator __it)
+ { _M_ht.erase(__it); }
+
+ void
+ erase(iterator __f, iterator __l)
+ { _M_ht.erase(__f, __l); }
+
+ void
+ clear()
+ { _M_ht.clear(); }
+
+ void
+ resize(size_type __hint)
+ { _M_ht.resize(__hint); }
+
+ size_type
+ bucket_count() const
+ { return _M_ht.bucket_count(); }
+
+ size_type
+ max_bucket_count() const
+ { return _M_ht.max_bucket_count(); }
+
+ size_type
+ elems_in_bucket(size_type __n) const
+ { return _M_ht.elems_in_bucket(__n); }
+ };
+
+ template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
+ inline bool
+ operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
+ const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
+ { return __hs1._M_ht == __hs2._M_ht; }
+
+ template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
+ inline bool
+ operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
+ const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
+ { return !(__hs1 == __hs2); }
+
+ template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
+ inline void
+ swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
+ hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
+ { __hs1.swap(__hs2); }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Specialization of insert_iterator so that it will work for hash_set
+ // and hash_multiset.
+ template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+ class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,
+ _EqualKey, _Alloc> >
+ {
+ protected:
+ typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>
+ _Container;
+ _Container* container;
+
+ public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x)
+ : container(&__x) {}
+
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value)
+ {
+ container->insert(__value);
+ return *this;
+ }
+
+ insert_iterator<_Container>&
+ operator*()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++(int)
+ { return *this; }
+ };
+
+ template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
+ class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,
+ _EqualKey, _Alloc> >
+ {
+ protected:
+ typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>
+ _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+
+ public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x)
+ : container(&__x) {}
+
+ insert_iterator(_Container& __x, typename _Container::iterator)
+ : container(&__x) {}
+
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value)
+ {
+ container->insert(__value);
+ return *this;
+ }
+
+ insert_iterator<_Container>&
+ operator*()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++(int) { return *this; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/hashtable.h b/gcc-4.4.0/libstdc++-v3/include/backward/hashtable.h
new file mode 100644
index 000000000..565437c5f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/hashtable.h
@@ -0,0 +1,1148 @@
+// Hashtable implementation used by containers -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file backward/hashtable.h
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _HASHTABLE_H
+#define _HASHTABLE_H 1
+
+// Hashtable class, used to implement the hashed associative containers
+// hash_set, hash_map, hash_multiset, and hash_multimap.
+
+#include <vector>
+#include <iterator>
+#include <algorithm>
+#include <bits/stl_function.h>
+#include <backward/hash_fun.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+ using std::forward_iterator_tag;
+ using std::input_iterator_tag;
+ using std::_Construct;
+ using std::_Destroy;
+ using std::distance;
+ using std::vector;
+ using std::pair;
+ using std::__iterator_category;
+
+ template<class _Val>
+ struct _Hashtable_node
+ {
+ _Hashtable_node* _M_next;
+ _Val _M_val;
+ };
+
+ template<class _Val, class _Key, class _HashFcn, class _ExtractKey,
+ class _EqualKey, class _Alloc = std::allocator<_Val> >
+ class hashtable;
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_iterator;
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_const_iterator;
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_iterator
+ {
+ typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
+ _Hashtable;
+ typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ const_iterator;
+ typedef _Hashtable_node<_Val> _Node;
+ typedef forward_iterator_tag iterator_category;
+ typedef _Val value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef _Val& reference;
+ typedef _Val* pointer;
+
+ _Node* _M_cur;
+ _Hashtable* _M_ht;
+
+ _Hashtable_iterator(_Node* __n, _Hashtable* __tab)
+ : _M_cur(__n), _M_ht(__tab) { }
+
+ _Hashtable_iterator() { }
+
+ reference
+ operator*() const
+ { return _M_cur->_M_val; }
+
+ pointer
+ operator->() const
+ { return &(operator*()); }
+
+ iterator&
+ operator++();
+
+ iterator
+ operator++(int);
+
+ bool
+ operator==(const iterator& __it) const
+ { return _M_cur == __it._M_cur; }
+
+ bool
+ operator!=(const iterator& __it) const
+ { return _M_cur != __it._M_cur; }
+ };
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_const_iterator
+ {
+ typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
+ _Hashtable;
+ typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
+ _ExtractKey,_EqualKey,_Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ const_iterator;
+ typedef _Hashtable_node<_Val> _Node;
+
+ typedef forward_iterator_tag iterator_category;
+ typedef _Val value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef const _Val& reference;
+ typedef const _Val* pointer;
+
+ const _Node* _M_cur;
+ const _Hashtable* _M_ht;
+
+ _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
+ : _M_cur(__n), _M_ht(__tab) { }
+
+ _Hashtable_const_iterator() { }
+
+ _Hashtable_const_iterator(const iterator& __it)
+ : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { }
+
+ reference
+ operator*() const
+ { return _M_cur->_M_val; }
+
+ pointer
+ operator->() const
+ { return &(operator*()); }
+
+ const_iterator&
+ operator++();
+
+ const_iterator
+ operator++(int);
+
+ bool
+ operator==(const const_iterator& __it) const
+ { return _M_cur == __it._M_cur; }
+
+ bool
+ operator!=(const const_iterator& __it) const
+ { return _M_cur != __it._M_cur; }
+ };
+
+ // Note: assumes long is at least 32 bits.
+ enum { _S_num_primes = 29 };
+
+ static const unsigned long __stl_prime_list[_S_num_primes] =
+ {
+ 5ul, // 5ul mini size is a Google addition
+ 53ul, 97ul, 193ul, 389ul, 769ul,
+ 1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
+ 49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
+ 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
+ 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
+ 1610612741ul, 3221225473ul, 4294967291ul
+ };
+
+ inline unsigned long
+ __stl_next_prime(unsigned long __n)
+ {
+ const unsigned long* __first = __stl_prime_list;
+ const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;
+ const unsigned long* pos = std::lower_bound(__first, __last, __n);
+ return pos == __last ? *(__last - 1) : *pos;
+ }
+
+ // Forward declaration of operator==.
+ template<class _Val, class _Key, class _HF, class _Ex,
+ class _Eq, class _All>
+ class hashtable;
+
+ template<class _Val, class _Key, class _HF, class _Ex,
+ class _Eq, class _All>
+ bool
+ operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
+ const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2);
+
+ // Hashtables handle allocators a bit differently than other
+ // containers do. If we're using standard-conforming allocators, then
+ // a hashtable unconditionally has a member variable to hold its
+ // allocator, even if it so happens that all instances of the
+ // allocator type are identical. This is because, for hashtables,
+ // this extra storage is negligible. Additionally, a base class
+ // wouldn't serve any other purposes; it wouldn't, for example,
+ // simplify the exception-handling code.
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ class hashtable
+ {
+ public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef _HashFcn hasher;
+ typedef _EqualKey key_equal;
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ hasher
+ hash_funct() const
+ { return _M_hash; }
+
+ key_equal
+ key_eq() const
+ { return _M_equals; }
+
+ private:
+ typedef _Hashtable_node<_Val> _Node;
+
+ public:
+ typedef typename _Alloc::template rebind<value_type>::other allocator_type;
+ allocator_type
+ get_allocator() const
+ { return _M_node_allocator; }
+
+ private:
+ typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
+ typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
+ typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;
+
+ _Node_Alloc _M_node_allocator;
+
+ _Node*
+ _M_get_node()
+ { return _M_node_allocator.allocate(1); }
+
+ void
+ _M_put_node(_Node* __p)
+ { _M_node_allocator.deallocate(__p, 1); }
+
+ private:
+ hasher _M_hash;
+ key_equal _M_equals;
+ _ExtractKey _M_get_key;
+ _Vector_type _M_buckets;
+ size_type _M_num_elements;
+
+ public:
+ typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>
+ const_iterator;
+
+ friend struct
+ _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
+
+ friend struct
+ _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>;
+
+ public:
+ hashtable(size_type __n, const _HashFcn& __hf,
+ const _EqualKey& __eql, const _ExtractKey& __ext,
+ const allocator_type& __a = allocator_type())
+ : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),
+ _M_get_key(__ext), _M_buckets(__a), _M_num_elements(0)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(size_type __n, const _HashFcn& __hf,
+ const _EqualKey& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),
+ _M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(const hashtable& __ht)
+ : _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash),
+ _M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key),
+ _M_buckets(__ht.get_allocator()), _M_num_elements(0)
+ { _M_copy_from(__ht); }
+
+ hashtable&
+ operator= (const hashtable& __ht)
+ {
+ if (&__ht != this)
+ {
+ clear();
+ _M_hash = __ht._M_hash;
+ _M_equals = __ht._M_equals;
+ _M_get_key = __ht._M_get_key;
+ _M_copy_from(__ht);
+ }
+ return *this;
+ }
+
+ ~hashtable()
+ { clear(); }
+
+ size_type
+ size() const
+ { return _M_num_elements; }
+
+ size_type
+ max_size() const
+ { return size_type(-1); }
+
+ bool
+ empty() const
+ { return size() == 0; }
+
+ void
+ swap(hashtable& __ht)
+ {
+ std::swap(_M_hash, __ht._M_hash);
+ std::swap(_M_equals, __ht._M_equals);
+ std::swap(_M_get_key, __ht._M_get_key);
+ _M_buckets.swap(__ht._M_buckets);
+ std::swap(_M_num_elements, __ht._M_num_elements);
+ }
+
+ iterator
+ begin()
+ {
+ for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
+ if (_M_buckets[__n])
+ return iterator(_M_buckets[__n], this);
+ return end();
+ }
+
+ iterator
+ end()
+ { return iterator(0, this); }
+
+ const_iterator
+ begin() const
+ {
+ for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
+ if (_M_buckets[__n])
+ return const_iterator(_M_buckets[__n], this);
+ return end();
+ }
+
+ const_iterator
+ end() const
+ { return const_iterator(0, this); }
+
+ template<class _Vl, class _Ky, class _HF, class _Ex, class _Eq,
+ class _Al>
+ friend bool
+ operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
+ const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);
+
+ public:
+ size_type
+ bucket_count() const
+ { return _M_buckets.size(); }
+
+ size_type
+ max_bucket_count() const
+ { return __stl_prime_list[(int)_S_num_primes - 1]; }
+
+ size_type
+ elems_in_bucket(size_type __bucket) const
+ {
+ size_type __result = 0;
+ for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next)
+ __result += 1;
+ return __result;
+ }
+
+ pair<iterator, bool>
+ insert_unique(const value_type& __obj)
+ {
+ resize(_M_num_elements + 1);
+ return insert_unique_noresize(__obj);
+ }
+
+ iterator
+ insert_equal(const value_type& __obj)
+ {
+ resize(_M_num_elements + 1);
+ return insert_equal_noresize(__obj);
+ }
+
+ pair<iterator, bool>
+ insert_unique_noresize(const value_type& __obj);
+
+ iterator
+ insert_equal_noresize(const value_type& __obj);
+
+ template<class _InputIterator>
+ void
+ insert_unique(_InputIterator __f, _InputIterator __l)
+ { insert_unique(__f, __l, __iterator_category(__f)); }
+
+ template<class _InputIterator>
+ void
+ insert_equal(_InputIterator __f, _InputIterator __l)
+ { insert_equal(__f, __l, __iterator_category(__f)); }
+
+ template<class _InputIterator>
+ void
+ insert_unique(_InputIterator __f, _InputIterator __l,
+ input_iterator_tag)
+ {
+ for ( ; __f != __l; ++__f)
+ insert_unique(*__f);
+ }
+
+ template<class _InputIterator>
+ void
+ insert_equal(_InputIterator __f, _InputIterator __l,
+ input_iterator_tag)
+ {
+ for ( ; __f != __l; ++__f)
+ insert_equal(*__f);
+ }
+
+ template<class _ForwardIterator>
+ void
+ insert_unique(_ForwardIterator __f, _ForwardIterator __l,
+ forward_iterator_tag)
+ {
+ size_type __n = distance(__f, __l);
+ resize(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ template<class _ForwardIterator>
+ void
+ insert_equal(_ForwardIterator __f, _ForwardIterator __l,
+ forward_iterator_tag)
+ {
+ size_type __n = distance(__f, __l);
+ resize(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+ reference
+ find_or_insert(const value_type& __obj);
+
+ iterator
+ find(const key_type& __key)
+ {
+ size_type __n = _M_bkt_num_key(__key);
+ _Node* __first;
+ for (__first = _M_buckets[__n];
+ __first && !_M_equals(_M_get_key(__first->_M_val), __key);
+ __first = __first->_M_next)
+ { }
+ return iterator(__first, this);
+ }
+
+ const_iterator
+ find(const key_type& __key) const
+ {
+ size_type __n = _M_bkt_num_key(__key);
+ const _Node* __first;
+ for (__first = _M_buckets[__n];
+ __first && !_M_equals(_M_get_key(__first->_M_val), __key);
+ __first = __first->_M_next)
+ { }
+ return const_iterator(__first, this);
+ }
+
+ size_type
+ count(const key_type& __key) const
+ {
+ const size_type __n = _M_bkt_num_key(__key);
+ size_type __result = 0;
+
+ for (const _Node* __cur = _M_buckets[__n]; __cur;
+ __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), __key))
+ ++__result;
+ return __result;
+ }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __key);
+
+ pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const;
+
+ size_type
+ erase(const key_type& __key);
+
+ void
+ erase(const iterator& __it);
+
+ void
+ erase(iterator __first, iterator __last);
+
+ void
+ erase(const const_iterator& __it);
+
+ void
+ erase(const_iterator __first, const_iterator __last);
+
+ void
+ resize(size_type __num_elements_hint);
+
+ void
+ clear();
+
+ private:
+ size_type
+ _M_next_size(size_type __n) const
+ { return __stl_next_prime(__n); }
+
+ void
+ _M_initialize_buckets(size_type __n)
+ {
+ const size_type __n_buckets = _M_next_size(__n);
+ _M_buckets.reserve(__n_buckets);
+ _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
+ _M_num_elements = 0;
+ }
+
+ size_type
+ _M_bkt_num_key(const key_type& __key) const
+ { return _M_bkt_num_key(__key, _M_buckets.size()); }
+
+ size_type
+ _M_bkt_num(const value_type& __obj) const
+ { return _M_bkt_num_key(_M_get_key(__obj)); }
+
+ size_type
+ _M_bkt_num_key(const key_type& __key, size_t __n) const
+ { return _M_hash(__key) % __n; }
+
+ size_type
+ _M_bkt_num(const value_type& __obj, size_t __n) const
+ { return _M_bkt_num_key(_M_get_key(__obj), __n); }
+
+ _Node*
+ _M_new_node(const value_type& __obj)
+ {
+ _Node* __n = _M_get_node();
+ __n->_M_next = 0;
+ __try
+ {
+ this->get_allocator().construct(&__n->_M_val, __obj);
+ return __n;
+ }
+ __catch(...)
+ {
+ _M_put_node(__n);
+ __throw_exception_again;
+ }
+ }
+
+ void
+ _M_delete_node(_Node* __n)
+ {
+ this->get_allocator().destroy(&__n->_M_val);
+ _M_put_node(__n);
+ }
+
+ void
+ _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
+
+ void
+ _M_erase_bucket(const size_type __n, _Node* __last);
+
+ void
+ _M_copy_from(const hashtable& __ht);
+ };
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
+ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++()
+ {
+ const _Node* __old = _M_cur;
+ _M_cur = _M_cur->_M_next;
+ if (!_M_cur)
+ {
+ size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
+ while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
+ _M_cur = _M_ht->_M_buckets[__bucket];
+ }
+ return *this;
+ }
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
+ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++(int)
+ {
+ iterator __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
+ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++()
+ {
+ const _Node* __old = _M_cur;
+ _M_cur = _M_cur->_M_next;
+ if (!_M_cur)
+ {
+ size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
+ while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
+ _M_cur = _M_ht->_M_buckets[__bucket];
+ }
+ return *this;
+ }
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
+ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++(int)
+ {
+ const_iterator __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ bool
+ operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
+ const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
+ {
+ typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node;
+
+ if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
+ return false;
+
+ for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n)
+ {
+ _Node* __cur1 = __ht1._M_buckets[__n];
+ _Node* __cur2 = __ht2._M_buckets[__n];
+ // Check same length of lists
+ for (; __cur1 && __cur2;
+ __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
+ { }
+ if (__cur1 || __cur2)
+ return false;
+ // Now check one's elements are in the other
+ for (__cur1 = __ht1._M_buckets[__n] ; __cur1;
+ __cur1 = __cur1->_M_next)
+ {
+ bool _found__cur1 = false;
+ for (__cur2 = __ht2._M_buckets[__n];
+ __cur2; __cur2 = __cur2->_M_next)
+ {
+ if (__cur1->_M_val == __cur2->_M_val)
+ {
+ _found__cur1 = true;
+ break;
+ }
+ }
+ if (!_found__cur1)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ inline bool
+ operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
+ const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
+ { return !(__ht1 == __ht2); }
+
+ template<class _Val, class _Key, class _HF, class _Extract, class _EqKey,
+ class _All>
+ inline void
+ swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
+ hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2)
+ { __ht1.swap(__ht2); }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool>
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ insert_unique_noresize(const value_type& __obj)
+ {
+ const size_type __n = _M_bkt_num(__obj);
+ _Node* __first = _M_buckets[__n];
+
+ for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
+ return pair<iterator, bool>(iterator(__cur, this), false);
+
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __first;
+ _M_buckets[__n] = __tmp;
+ ++_M_num_elements;
+ return pair<iterator, bool>(iterator(__tmp, this), true);
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ insert_equal_noresize(const value_type& __obj)
+ {
+ const size_type __n = _M_bkt_num(__obj);
+ _Node* __first = _M_buckets[__n];
+
+ for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
+ {
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __cur->_M_next;
+ __cur->_M_next = __tmp;
+ ++_M_num_elements;
+ return iterator(__tmp, this);
+ }
+
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __first;
+ _M_buckets[__n] = __tmp;
+ ++_M_num_elements;
+ return iterator(__tmp, this);
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ find_or_insert(const value_type& __obj)
+ {
+ resize(_M_num_elements + 1);
+
+ size_type __n = _M_bkt_num(__obj);
+ _Node* __first = _M_buckets[__n];
+
+ for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
+ return __cur->_M_val;
+
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __first;
+ _M_buckets[__n] = __tmp;
+ ++_M_num_elements;
+ return __tmp->_M_val;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ equal_range(const key_type& __key)
+ {
+ typedef pair<iterator, iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_Node* __first = _M_buckets[__n]; __first;
+ __first = __first->_M_next)
+ if (_M_equals(_M_get_key(__first->_M_val), __key))
+ {
+ for (_Node* __cur = __first->_M_next; __cur;
+ __cur = __cur->_M_next)
+ if (!_M_equals(_M_get_key(__cur->_M_val), __key))
+ return _Pii(iterator(__first, this), iterator(__cur, this));
+ for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
+ if (_M_buckets[__m])
+ return _Pii(iterator(__first, this),
+ iterator(_M_buckets[__m], this));
+ return _Pii(iterator(__first, this), end());
+ }
+ return _Pii(end(), end());
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ equal_range(const key_type& __key) const
+ {
+ typedef pair<const_iterator, const_iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (const _Node* __first = _M_buckets[__n]; __first;
+ __first = __first->_M_next)
+ {
+ if (_M_equals(_M_get_key(__first->_M_val), __key))
+ {
+ for (const _Node* __cur = __first->_M_next; __cur;
+ __cur = __cur->_M_next)
+ if (!_M_equals(_M_get_key(__cur->_M_val), __key))
+ return _Pii(const_iterator(__first, this),
+ const_iterator(__cur, this));
+ for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
+ if (_M_buckets[__m])
+ return _Pii(const_iterator(__first, this),
+ const_iterator(_M_buckets[__m], this));
+ return _Pii(const_iterator(__first, this), end());
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const key_type& __key)
+ {
+ const size_type __n = _M_bkt_num_key(__key);
+ _Node* __first = _M_buckets[__n];
+ size_type __erased = 0;
+
+ if (__first)
+ {
+ _Node* __cur = __first;
+ _Node* __next = __cur->_M_next;
+ _Node* __saved_slot = 0;
+ while (__next)
+ {
+ if (_M_equals(_M_get_key(__next->_M_val), __key))
+ {
+ if (&_M_get_key(__next->_M_val) != &__key)
+ {
+ __cur->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ __next = __cur->_M_next;
+ ++__erased;
+ --_M_num_elements;
+ }
+ else
+ {
+ __saved_slot = __cur;
+ __cur = __next;
+ __next = __cur->_M_next;
+ }
+ }
+ else
+ {
+ __cur = __next;
+ __next = __cur->_M_next;
+ }
+ }
+ if (_M_equals(_M_get_key(__first->_M_val), __key))
+ {
+ _M_buckets[__n] = __first->_M_next;
+ _M_delete_node(__first);
+ ++__erased;
+ --_M_num_elements;
+ }
+ if (__saved_slot)
+ {
+ __next = __saved_slot->_M_next;
+ __saved_slot->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ ++__erased;
+ --_M_num_elements;
+ }
+ }
+ return __erased;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const iterator& __it)
+ {
+ _Node* __p = __it._M_cur;
+ if (__p)
+ {
+ const size_type __n = _M_bkt_num(__p->_M_val);
+ _Node* __cur = _M_buckets[__n];
+
+ if (__cur == __p)
+ {
+ _M_buckets[__n] = __cur->_M_next;
+ _M_delete_node(__cur);
+ --_M_num_elements;
+ }
+ else
+ {
+ _Node* __next = __cur->_M_next;
+ while (__next)
+ {
+ if (__next == __p)
+ {
+ __cur->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ --_M_num_elements;
+ break;
+ }
+ else
+ {
+ __cur = __next;
+ __next = __cur->_M_next;
+ }
+ }
+ }
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(iterator __first, iterator __last)
+ {
+ size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val)
+ : _M_buckets.size();
+
+ size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val)
+ : _M_buckets.size();
+
+ if (__first._M_cur == __last._M_cur)
+ return;
+ else if (__f_bucket == __l_bucket)
+ _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
+ else
+ {
+ _M_erase_bucket(__f_bucket, __first._M_cur, 0);
+ for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
+ _M_erase_bucket(__n, 0);
+ if (__l_bucket != _M_buckets.size())
+ _M_erase_bucket(__l_bucket, __last._M_cur);
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ inline void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const_iterator __first, const_iterator __last)
+ {
+ erase(iterator(const_cast<_Node*>(__first._M_cur),
+ const_cast<hashtable*>(__first._M_ht)),
+ iterator(const_cast<_Node*>(__last._M_cur),
+ const_cast<hashtable*>(__last._M_ht)));
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ inline void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const const_iterator& __it)
+ { erase(iterator(const_cast<_Node*>(__it._M_cur),
+ const_cast<hashtable*>(__it._M_ht))); }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ resize(size_type __num_elements_hint)
+ {
+ const size_type __old_n = _M_buckets.size();
+ if (__num_elements_hint > __old_n)
+ {
+ const size_type __n = _M_next_size(__num_elements_hint);
+ if (__n > __old_n)
+ {
+ _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator());
+ __try
+ {
+ for (size_type __bucket = 0; __bucket < __old_n; ++__bucket)
+ {
+ _Node* __first = _M_buckets[__bucket];
+ while (__first)
+ {
+ size_type __new_bucket = _M_bkt_num(__first->_M_val,
+ __n);
+ _M_buckets[__bucket] = __first->_M_next;
+ __first->_M_next = __tmp[__new_bucket];
+ __tmp[__new_bucket] = __first;
+ __first = _M_buckets[__bucket];
+ }
+ }
+ _M_buckets.swap(__tmp);
+ }
+ __catch(...)
+ {
+ for (size_type __bucket = 0; __bucket < __tmp.size();
+ ++__bucket)
+ {
+ while (__tmp[__bucket])
+ {
+ _Node* __next = __tmp[__bucket]->_M_next;
+ _M_delete_node(__tmp[__bucket]);
+ __tmp[__bucket] = __next;
+ }
+ }
+ __throw_exception_again;
+ }
+ }
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
+ {
+ _Node* __cur = _M_buckets[__n];
+ if (__cur == __first)
+ _M_erase_bucket(__n, __last);
+ else
+ {
+ _Node* __next;
+ for (__next = __cur->_M_next;
+ __next != __first;
+ __cur = __next, __next = __cur->_M_next)
+ ;
+ while (__next != __last)
+ {
+ __cur->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ __next = __cur->_M_next;
+ --_M_num_elements;
+ }
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ _M_erase_bucket(const size_type __n, _Node* __last)
+ {
+ _Node* __cur = _M_buckets[__n];
+ while (__cur != __last)
+ {
+ _Node* __next = __cur->_M_next;
+ _M_delete_node(__cur);
+ __cur = __next;
+ _M_buckets[__n] = __cur;
+ --_M_num_elements;
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ clear()
+ {
+ // Google addition: do not iterate over buckets when empty
+ if (_M_num_elements == 0)
+ return;
+
+ for (size_type __i = 0; __i < _M_buckets.size(); ++__i)
+ {
+ _Node* __cur = _M_buckets[__i];
+ while (__cur != 0)
+ {
+ _Node* __next = __cur->_M_next;
+ _M_delete_node(__cur);
+ __cur = __next;
+ }
+ _M_buckets[__i] = 0;
+ }
+ _M_num_elements = 0;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ _M_copy_from(const hashtable& __ht)
+ {
+ _M_buckets.clear();
+ _M_buckets.reserve(__ht._M_buckets.size());
+ _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
+ __try
+ {
+ for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
+ const _Node* __cur = __ht._M_buckets[__i];
+ if (__cur)
+ {
+ _Node* __local_copy = _M_new_node(__cur->_M_val);
+ _M_buckets[__i] = __local_copy;
+
+ for (_Node* __next = __cur->_M_next;
+ __next;
+ __cur = __next, __next = __cur->_M_next)
+ {
+ __local_copy->_M_next = _M_new_node(__next->_M_val);
+ __local_copy = __local_copy->_M_next;
+ }
+ }
+ }
+ _M_num_elements = __ht._M_num_elements;
+ }
+ __catch(...)
+ {
+ clear();
+ __throw_exception_again;
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/backward/strstream b/gcc-4.4.0/libstdc++-v3/include/backward/strstream
new file mode 100644
index 000000000..a643e8b81
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/backward/strstream
@@ -0,0 +1,176 @@
+// Backward-compat support -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+// WARNING: The classes defined in this header are DEPRECATED. This
+// header is defined in section D.7.1 of the C++ standard, and it
+// MAY BE REMOVED in a future standard revision. One should use the
+// header <sstream> instead.
+
+#ifndef _GLIBCXX_STRSTREAM
+#define _GLIBCXX_STRSTREAM
+
+#include "backward_warning.h"
+#include <iosfwd>
+#include <ios>
+#include <istream>
+#include <ostream>
+#include <string>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Class strstreambuf, a streambuf class that manages an array of char.
+ // Note that this class is not a template.
+ class strstreambuf : public basic_streambuf<char, char_traits<char> >
+ {
+ public:
+ // Types.
+ typedef char_traits<char> _Traits;
+ typedef basic_streambuf<char, _Traits> _Base;
+
+ public:
+ // Constructor, destructor
+ explicit strstreambuf(streamsize __initial_capacity = 0);
+ strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
+
+ strstreambuf(char* __get, streamsize __n, char* __put = 0);
+ strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
+ strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
+
+ strstreambuf(const char* __get, streamsize __n);
+ strstreambuf(const signed char* __get, streamsize __n);
+ strstreambuf(const unsigned char* __get, streamsize __n);
+
+ virtual ~strstreambuf();
+
+ public:
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+ protected:
+ virtual int_type overflow(int_type __c = _Traits::eof());
+ virtual int_type pbackfail(int_type __c = _Traits::eof());
+ virtual int_type underflow();
+ virtual _Base* setbuf(char* __buf, streamsize __n);
+ virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
+ ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+ virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
+ = ios_base::in | ios_base::out);
+
+ private:
+ strstreambuf&
+ operator=(const strstreambuf&);
+
+ strstreambuf(const strstreambuf&);
+
+ // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
+ char* _M_alloc(size_t);
+ void _M_free(char*);
+
+ // Helper function used in constructors.
+ void _M_setup(char* __get, char* __put, streamsize __n);
+
+ private:
+ // Data members.
+ void* (*_M_alloc_fun)(size_t);
+ void (*_M_free_fun)(void*);
+
+ bool _M_dynamic : 1;
+ bool _M_frozen : 1;
+ bool _M_constant : 1;
+ };
+
+ // Class istrstream, an istream that manages a strstreambuf.
+ class istrstream : public basic_istream<char>
+ {
+ public:
+ explicit istrstream(char*);
+ explicit istrstream(const char*);
+ istrstream(char* , streamsize);
+ istrstream(const char*, streamsize);
+ virtual ~istrstream();
+
+ strstreambuf* rdbuf() const;
+ char* str();
+
+ private:
+ strstreambuf _M_buf;
+ };
+
+ // Class ostrstream
+ class ostrstream : public basic_ostream<char>
+ {
+ public:
+ ostrstream();
+ ostrstream(char*, int, ios_base::openmode = ios_base::out);
+ virtual ~ostrstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ char* str();
+ int pcount() const;
+
+ private:
+ strstreambuf _M_buf;
+ };
+
+ // Class strstream
+ class strstream : public basic_iostream<char>
+ {
+ public:
+ typedef char char_type;
+ typedef char_traits<char>::int_type int_type;
+ typedef char_traits<char>::pos_type pos_type;
+ typedef char_traits<char>::off_type off_type;
+
+ strstream();
+ strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
+ virtual ~strstream();
+
+ strstreambuf* rdbuf() const;
+ void freeze(bool = true);
+ int pcount() const;
+ char* str();
+
+ private:
+ strstreambuf _M_buf;
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/algorithmfwd.h b/gcc-4.4.0/libstdc++-v3/include/bits/algorithmfwd.h
new file mode 100644
index 000000000..e33a14c3b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/algorithmfwd.h
@@ -0,0 +1,805 @@
+// <algorithm> declarations -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/algorithmfwd.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ALGORITHMFWD_H
+#define _GLIBCXX_ALGORITHMFWD_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/stl_pair.h>
+#include <bits/stl_iterator_base_types.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /*
+ adjacent_find
+ all_of (C++0x)
+ any_of (C++0x)
+ binary_search
+ copy
+ copy_backward
+ copy_if (C++0x)
+ copy_n (C++0x)
+ count
+ count_if
+ equal
+ equal_range
+ fill
+ fill_n
+ find
+ find_end
+ find_first_of
+ find_if
+ find_if_not (C++0x)
+ for_each
+ generate
+ generate_n
+ includes
+ inplace_merge
+ is_heap (C++0x)
+ is_heap_until (C++0x)
+ is_partitioned (C++0x)
+ is_sorted (C++0x)
+ is_sorted_until (C++0x)
+ iter_swap
+ lexicographical_compare
+ lower_bound
+ make_heap
+ max
+ max_element
+ merge
+ min
+ min_element
+ minmax (C++0x)
+ minmax_element (C++0x)
+ mismatch
+ next_permutation
+ none_of (C++0x)
+ nth_element
+ partial_sort
+ partial_sort_copy
+ partition
+ partition_copy (C++0x)
+ partition_point (C++0x)
+ pop_heap
+ prev_permutation
+ push_heap
+ random_shuffle
+ remove
+ remove_copy
+ remove_copy_if
+ remove_if
+ replace
+ replace_copy
+ replace_copy_if
+ replace_if
+ reverse
+ reverse_copy
+ rotate
+ rotate_copy
+ search
+ search_n
+ set_difference
+ set_intersection
+ set_symmetric_difference
+ set_union
+ sort
+ sort_heap
+ stable_partition
+ stable_sort
+ swap
+ swap_ranges
+ transform
+ unique
+ unique_copy
+ upper_bound
+ */
+
+ /**
+ * @defgroup algorithms Algorithms
+ *
+ * Components for performing algorithmic operations. Includes
+ * non-modifying sequence, modifying (mutating) sequence, sorting,
+ * searching, merge, partition, heap, set, minima, maxima, and
+ * permutation operations.
+ */
+
+ /**
+ * @defgroup mutating_algorithms Mutating Algorithms
+ * @ingroup algorithms
+ */
+
+ /**
+ * @defgroup non_mutating_algorithms Non-Mutating Algorithms
+ * @ingroup algorithms
+ */
+
+ /**
+ * @defgroup sorting_algorithms Sorting Algorithms
+ * @ingroup algorithms
+ */
+
+ /**
+ * @defgroup set_algorithms Set Operation Algorithms
+ * @ingroup sorting_algorithms
+ *
+ * These algorithms are common set operations performed on sequences
+ * that are already sorted. The number of comparisons will be
+ * linear.
+ */
+
+ /**
+ * @defgroup binary_search_algorithms Binary Search Algorithms
+ * @ingroup sorting_algorithms
+ *
+ * These algorithms are variations of a classic binary search, and
+ * all assume that the sequence being searched is already sorted.
+ *
+ * The number of comparisons will be logarithmic (and as few as
+ * possible). The number of steps through the sequence will be
+ * logarithmic for random-access iterators (e.g., pointers), and
+ * linear otherwise.
+ *
+ * The LWG has passed Defect Report 270, which notes: <em>The
+ * proposed resolution reinterprets binary search. Instead of
+ * thinking about searching for a value in a sorted range, we view
+ * that as an important special case of a more general algorithm:
+ * searching for the partition point in a partitioned range. We
+ * also add a guarantee that the old wording did not: we ensure that
+ * the upper bound is no earlier than the lower bound, that the pair
+ * returned by equal_range is a valid range, and that the first part
+ * of that pair is the lower bound.</em>
+ *
+ * The actual effect of the first sentence is that a comparison
+ * functor passed by the user doesn't necessarily need to induce a
+ * strict weak ordering relation. Rather, it partitions the range.
+ */
+
+ // adjacent_find
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _Predicate>
+ bool
+ all_of(_IIter, _IIter, _Predicate);
+
+ template<typename _IIter, typename _Predicate>
+ bool
+ any_of(_IIter, _IIter, _Predicate);
+#endif
+
+ template<typename _FIter, typename _Tp>
+ bool
+ binary_search(_FIter, _FIter, const _Tp&);
+
+ template<typename _FIter, typename _Tp, typename _Compare>
+ bool
+ binary_search(_FIter, _FIter, const _Tp&, _Compare);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ copy(_IIter, _IIter, _OIter);
+
+ template<typename _BIter1, typename _BIter2>
+ _BIter2
+ copy_backward(_BIter1, _BIter1, _BIter2);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _OIter, typename _Predicate>
+ _OIter
+ copy_if(_IIter, _IIter, _OIter, _Predicate);
+
+ template<typename _IIter, typename _Size, typename _OIter>
+ _OIter
+ copy_n(_IIter, _Size, _OIter);
+#endif
+
+ // count
+ // count_if
+
+ template<typename _FIter, typename _Tp>
+ pair<_FIter, _FIter>
+ equal_range(_FIter, _FIter, const _Tp&);
+
+ template<typename _FIter, typename _Tp, typename _Compare>
+ pair<_FIter, _FIter>
+ equal_range(_FIter, _FIter, const _Tp&, _Compare);
+
+ template<typename _FIter, typename _Tp>
+ void
+ fill(_FIter, _FIter, const _Tp&);
+
+/*
+ XXX NB: return type different from ISO C++.
+ template<typename _OIter, typename _Size, typename _Tp>
+ void
+ fill_n(_OIter, _Size, const _Tp&);
+*/
+
+ template<typename _OIter, typename _Size, typename _Tp>
+ _OIter
+ fill_n(_OIter, _Size, const _Tp&);
+
+ // find
+
+ template<typename _FIter1, typename _FIter2>
+ _FIter1
+ find_end(_FIter1, _FIter1, _FIter2, _FIter2);
+
+ template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _FIter1
+ find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
+
+ // find_first_of
+ // find_if
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _Predicate>
+ _IIter
+ find_if_not(_IIter, _IIter, _Predicate);
+#endif
+
+ // for_each
+ // generate
+ // generate_n
+
+ template<typename _IIter1, typename _IIter2>
+ bool
+ includes(_IIter1, _IIter1, _IIter2, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename _Compare>
+ bool
+ includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
+
+ template<typename _BIter>
+ void
+ inplace_merge(_BIter, _BIter, _BIter);
+
+ template<typename _BIter, typename _Compare>
+ void
+ inplace_merge(_BIter, _BIter, _BIter, _Compare);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _RAIter>
+ bool
+ is_heap(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ bool
+ is_heap(_RAIter, _RAIter, _Compare);
+
+ template<typename _RAIter>
+ _RAIter
+ is_heap_until(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ _RAIter
+ is_heap_until(_RAIter, _RAIter, _Compare);
+
+ template<typename _IIter, typename _Predicate>
+ bool
+ is_partitioned(_IIter, _IIter, _Predicate);
+
+ template<typename _FIter>
+ bool
+ is_sorted(_FIter, _FIter);
+
+ template<typename _FIter, typename _Compare>
+ bool
+ is_sorted(_FIter, _FIter, _Compare);
+
+ template<typename _FIter>
+ _FIter
+ is_sorted_until(_FIter, _FIter);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ is_sorted_until(_FIter, _FIter, _Compare);
+#endif
+
+ template<typename _FIter1, typename _FIter2>
+ void
+ iter_swap(_FIter1, _FIter2);
+
+ template<typename _FIter, typename _Tp>
+ _FIter
+ lower_bound(_FIter, _FIter, const _Tp&);
+
+ template<typename _FIter, typename _Tp, typename _Compare>
+ _FIter
+ lower_bound(_FIter, _FIter, const _Tp&, _Compare);
+
+ template<typename _RAIter>
+ void
+ make_heap(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ make_heap(_RAIter, _RAIter, _Compare);
+
+ template<typename _Tp>
+ const _Tp&
+ max(const _Tp&, const _Tp&);
+
+ template<typename _Tp, typename _Compare>
+ const _Tp&
+ max(const _Tp&, const _Tp&, _Compare);
+
+ // max_element
+ // merge
+
+ template<typename _Tp>
+ const _Tp&
+ min(const _Tp&, const _Tp&);
+
+ template<typename _Tp, typename _Compare>
+ const _Tp&
+ min(const _Tp&, const _Tp&, _Compare);
+
+ // min_element
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ pair<const _Tp&, const _Tp&>
+ minmax(const _Tp&, const _Tp&);
+
+ template<typename _Tp, typename _Compare>
+ pair<const _Tp&, const _Tp&>
+ minmax(const _Tp&, const _Tp&, _Compare);
+
+ template<typename _FIter>
+ pair<_FIter, _FIter>
+ minmax_element(_FIter, _FIter);
+
+ template<typename _FIter, typename _Compare>
+ pair<_FIter, _FIter>
+ minmax_element(_FIter, _FIter, _Compare);
+
+ template<typename _Tp>
+ _Tp
+ min(initializer_list<_Tp>);
+
+ template<typename _Tp, typename _Compare>
+ _Tp
+ min(initializer_list<_Tp>, _Compare);
+
+ template<typename _Tp>
+ _Tp
+ max(initializer_list<_Tp>);
+
+ template<typename _Tp, typename _Compare>
+ _Tp
+ max(initializer_list<_Tp>, _Compare);
+
+ template<typename _Tp>
+ pair<_Tp, _Tp>
+ minmax(initializer_list<_Tp>);
+
+ template<typename _Tp, typename _Compare>
+ pair<_Tp, _Tp>
+ minmax(initializer_list<_Tp>, _Compare);
+#endif
+
+ // mismatch
+
+ template<typename _BIter>
+ bool
+ next_permutation(_BIter, _BIter);
+
+ template<typename _BIter, typename _Compare>
+ bool
+ next_permutation(_BIter, _BIter, _Compare);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _Predicate>
+ bool
+ none_of(_IIter, _IIter, _Predicate);
+#endif
+
+ // nth_element
+ // partial_sort
+
+ template<typename _IIter, typename _RAIter>
+ _RAIter
+ partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter);
+
+ template<typename _IIter, typename _RAIter, typename _Compare>
+ _RAIter
+ partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare);
+
+ // partition
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _IIter, typename _OIter1,
+ typename _OIter2, typename _Predicate>
+ pair<_OIter1, _OIter2>
+ partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate);
+
+ template<typename _FIter, typename _Predicate>
+ _FIter
+ partition_point(_FIter, _FIter, _Predicate);
+#endif
+
+ template<typename _RAIter>
+ void
+ pop_heap(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ pop_heap(_RAIter, _RAIter, _Compare);
+
+ template<typename _BIter>
+ bool
+ prev_permutation(_BIter, _BIter);
+
+ template<typename _BIter, typename _Compare>
+ bool
+ prev_permutation(_BIter, _BIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ push_heap(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ push_heap(_RAIter, _RAIter, _Compare);
+
+ // random_shuffle
+
+ template<typename _FIter, typename _Tp>
+ _FIter
+ remove(_FIter, _FIter, const _Tp&);
+
+ template<typename _FIter, typename _Predicate>
+ _FIter
+ remove_if(_FIter, _FIter, _Predicate);
+
+ template<typename _IIter, typename _OIter, typename _Tp>
+ _OIter
+ remove_copy(_IIter, _IIter, _OIter, const _Tp&);
+
+ template<typename _IIter, typename _OIter, typename _Predicate>
+ _OIter
+ remove_copy_if(_IIter, _IIter, _OIter, _Predicate);
+
+ // replace
+
+ template<typename _IIter, typename _OIter, typename _Tp>
+ _OIter
+ replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);
+
+ template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>
+ _OIter
+ replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);
+
+ // replace_if
+
+ template<typename _BIter>
+ void
+ reverse(_BIter, _BIter);
+
+ template<typename _BIter, typename _OIter>
+ _OIter
+ reverse_copy(_BIter, _BIter, _OIter);
+
+ template<typename _FIter>
+ void
+ rotate(_FIter, _FIter, _FIter);
+
+ template<typename _FIter, typename _OIter>
+ _OIter
+ rotate_copy(_FIter, _FIter, _FIter, _OIter);
+
+ // search
+ // search_n
+ // set_difference
+ // set_intersection
+ // set_symmetric_difference
+ // set_union
+
+ template<typename _RAIter>
+ void
+ sort_heap(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ sort_heap(_RAIter, _RAIter, _Compare);
+
+ template<typename _BIter, typename _Predicate>
+ _BIter
+ stable_partition(_BIter, _BIter, _Predicate);
+
+ template<typename _Tp>
+ void
+ swap(_Tp&, _Tp&);
+
+ template<typename _Tp, size_t _Nm>
+ void
+ swap(_Tp (&)[_Nm], _Tp (&)[_Nm]);
+
+ template<typename _FIter1, typename _FIter2>
+ _FIter2
+ swap_ranges(_FIter1, _FIter1, _FIter2);
+
+ // transform
+
+ template<typename _FIter>
+ _FIter
+ unique(_FIter, _FIter);
+
+ template<typename _FIter, typename _BinaryPredicate>
+ _FIter
+ unique(_FIter, _FIter, _BinaryPredicate);
+
+ // unique_copy
+
+ template<typename _FIter, typename _Tp>
+ _FIter
+ upper_bound(_FIter, _FIter, const _Tp&);
+
+ template<typename _FIter, typename _Tp, typename _Compare>
+ _FIter
+ upper_bound(_FIter, _FIter, const _Tp&, _Compare);
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
+
+ template<typename _FIter>
+ _FIter
+ adjacent_find(_FIter, _FIter);
+
+ template<typename _FIter, typename _BinaryPredicate>
+ _FIter
+ adjacent_find(_FIter, _FIter, _BinaryPredicate);
+
+ template<typename _IIter, typename _Tp>
+ typename iterator_traits<_IIter>::difference_type
+ count(_IIter, _IIter, const _Tp&);
+
+ template<typename _IIter, typename _Predicate>
+ typename iterator_traits<_IIter>::difference_type
+ count_if(_IIter, _IIter, _Predicate);
+
+ template<typename _IIter1, typename _IIter2>
+ bool
+ equal(_IIter1, _IIter1, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ bool
+ equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
+
+ template<typename _IIter, typename _Tp>
+ _IIter
+ find(_IIter, _IIter, const _Tp&);
+
+ template<typename _FIter1, typename _FIter2>
+ _FIter1
+ find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);
+
+ template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _FIter1
+ find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
+
+ template<typename _IIter, typename _Predicate>
+ _IIter
+ find_if(_IIter, _IIter, _Predicate);
+
+ template<typename _IIter, typename _Funct>
+ _Funct
+ for_each(_IIter, _IIter, _Funct);
+
+ template<typename _FIter, typename _Generator>
+ void
+ generate(_FIter, _FIter, _Generator);
+
+/*
+ XXX NB: return type different from ISO C++.
+ template<typename _OIter, typename _Size, typename _Tp>
+ void
+ generate_n(_OIter, _Size, _Generator);
+*/
+
+ template<typename _OIter, typename _Size, typename _Generator>
+ _OIter
+ generate_n(_OIter, _Size, _Generator);
+
+ template<typename _IIter1, typename _IIter2>
+ bool
+ lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename _Compare>
+ bool
+ lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
+
+ template<typename _FIter>
+ _FIter
+ max_element(_FIter, _FIter);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ max_element(_FIter, _FIter, _Compare);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
+
+ template<typename _FIter>
+ _FIter
+ min_element(_FIter, _FIter);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ min_element(_FIter, _FIter, _Compare);
+
+ template<typename _IIter1, typename _IIter2>
+ pair<_IIter1, _IIter2>
+ mismatch(_IIter1, _IIter1, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ pair<_IIter1, _IIter2>
+ mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
+
+ template<typename _RAIter>
+ void
+ nth_element(_RAIter, _RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ nth_element(_RAIter, _RAIter, _RAIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ partial_sort(_RAIter, _RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ partial_sort(_RAIter, _RAIter, _RAIter, _Compare);
+
+ template<typename _BIter, typename _Predicate>
+ _BIter
+ partition(_BIter, _BIter, _Predicate);
+
+ template<typename _RAIter>
+ void
+ random_shuffle(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Generator>
+ void
+ random_shuffle(_RAIter, _RAIter, _Generator&);
+
+ template<typename _FIter, typename _Tp>
+ void
+ replace(_FIter, _FIter, const _Tp&, const _Tp&);
+
+ template<typename _FIter, typename _Predicate, typename _Tp>
+ void
+ replace_if(_FIter, _FIter, _Predicate, const _Tp&);
+
+ template<typename _FIter1, typename _FIter2>
+ _FIter1
+ search(_FIter1, _FIter1, _FIter2, _FIter2);
+
+ template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
+ _FIter1
+ search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
+
+ template<typename _FIter, typename _Size, typename _Tp>
+ _FIter
+ search_n(_FIter, _FIter, _Size, const _Tp&);
+
+ template<typename _FIter, typename _Size, typename _Tp,
+ typename _BinaryPredicate>
+ _FIter
+ search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,
+ _OIter, _Compare);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ sort(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ sort(_RAIter, _RAIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ stable_sort(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ stable_sort(_RAIter, _RAIter, _Compare);
+
+ template<typename _IIter, typename _OIter, typename _UnaryOperation>
+ _OIter
+ transform(_IIter, _IIter, _OIter, _UnaryOperation);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _BinaryOperation>
+ _OIter
+ transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ unique_copy(_IIter, _IIter, _OIter);
+
+ template<typename _IIter, typename _OIter, typename _BinaryPredicate>
+ _OIter
+ unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#ifdef _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
+# include <parallel/algorithmfwd.h>
+#endif
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/allocator.h b/gcc-4.4.0/libstdc++-v3/include/bits/allocator.h
new file mode 100644
index 000000000..334fee5d1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/allocator.h
@@ -0,0 +1,181 @@
+// Allocators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996-1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file allocator.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _ALLOCATOR_H
+#define _ALLOCATOR_H 1
+
+// Define the base class to std::allocator.
+#include <bits/c++allocator.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @defgroup allocators Allocators
+ * @ingroup memory
+ *
+ * Classes encapsulating memory operations.
+ */
+
+ template<typename _Tp>
+ class allocator;
+
+ /// allocator<void> specialization.
+ template<>
+ class allocator<void>
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+
+ template<typename _Tp1>
+ struct rebind
+ { typedef allocator<_Tp1> other; };
+ };
+
+ /**
+ * @brief The "standard" allocator, as per [20.4].
+ * @ingroup allocators
+ *
+ * Further details:
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt04ch11.html
+ */
+ template<typename _Tp>
+ class allocator: public __glibcxx_base_allocator<_Tp>
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template<typename _Tp1>
+ struct rebind
+ { typedef allocator<_Tp1> other; };
+
+ allocator() throw() { }
+
+ allocator(const allocator& __a) throw()
+ : __glibcxx_base_allocator<_Tp>(__a) { }
+
+ template<typename _Tp1>
+ allocator(const allocator<_Tp1>&) throw() { }
+
+ ~allocator() throw() { }
+
+ // Inherit everything else.
+ };
+
+ template<typename _T1, typename _T2>
+ inline bool
+ operator==(const allocator<_T1>&, const allocator<_T2>&)
+ { return true; }
+
+ template<typename _Tp>
+ inline bool
+ operator==(const allocator<_Tp>&, const allocator<_Tp>&)
+ { return true; }
+
+ template<typename _T1, typename _T2>
+ inline bool
+ operator!=(const allocator<_T1>&, const allocator<_T2>&)
+ { return false; }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
+ { return false; }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class allocator<char>;
+ extern template class allocator<wchar_t>;
+#endif
+
+ // Undefine.
+#undef __glibcxx_base_allocator
+
+ // To implement Option 3 of DR 431.
+ template<typename _Alloc, bool = __is_empty(_Alloc)>
+ struct __alloc_swap
+ { static void _S_do_it(_Alloc&, _Alloc&) { } };
+
+ template<typename _Alloc>
+ struct __alloc_swap<_Alloc, false>
+ {
+ static void
+ _S_do_it(_Alloc& __one, _Alloc& __two)
+ {
+ // Precondition: swappable allocators.
+ if (__one != __two)
+ swap(__one, __two);
+ }
+ };
+
+ // Optimize for stateless allocators.
+ template<typename _Alloc, bool = __is_empty(_Alloc)>
+ struct __alloc_neq
+ {
+ static bool
+ _S_do_it(const _Alloc&, const _Alloc&)
+ { return false; }
+ };
+
+ template<typename _Alloc>
+ struct __alloc_neq<_Alloc, false>
+ {
+ static bool
+ _S_do_it(const _Alloc& __one, const _Alloc& __two)
+ { return __one != __two; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/atomic_0.h b/gcc-4.4.0/libstdc++-v3/include/bits/atomic_0.h
new file mode 100644
index 000000000..5d2631d76
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/atomic_0.h
@@ -0,0 +1,463 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/atomic_0.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ATOMIC_0_H
+#define _GLIBCXX_ATOMIC_0_H 1
+
+#pragma GCC system_header
+
+// _GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 0 == __atomic0 == Never lock-free
+namespace __atomic0
+{
+ struct atomic_flag;
+
+ // Implementation specific defines.
+#define _ATOMIC_LOAD_(__a, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
+ atomic_flag_clear_explicit(__g, __x); \
+ __r; })
+
+#define _ATOMIC_STORE_(__a, __m, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __typeof__(__m) __v = (__m); \
+ volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ *__p = __v; \
+ atomic_flag_clear_explicit(__g, __x); \
+ __v; })
+
+#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __typeof__(__m) __v = (__m); \
+ volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
+ *__p __o __v; \
+ atomic_flag_clear_explicit(__g, __x); \
+ __r; })
+
+#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __typeof__(__e) __q = (__e); \
+ __typeof__(__m) __v = (__m); \
+ bool __r; \
+ volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ __typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
+ if (__t__ == *__q) { *__p = __v; __r = true; } \
+ else { *__q = __t__; __r = false; } \
+ atomic_flag_clear_explicit(__g, __x); \
+ __r; })
+
+ /// atomic_flag
+ struct atomic_flag : private __atomic_flag_base
+ {
+ atomic_flag() = default;
+ ~atomic_flag() = default;
+ atomic_flag(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) = delete;
+
+ atomic_flag(bool __i) { _M_i = __i; } // XXX deleted copy ctor != agg
+
+ bool
+ test_and_set(memory_order __m = memory_order_seq_cst) volatile;
+
+ void
+ clear(memory_order __m = memory_order_seq_cst) volatile;
+ };
+
+ /// 29.4.2, address types
+ struct atomic_address
+ {
+ private:
+ void* _M_i;
+
+ public:
+ atomic_address() = default;
+ ~atomic_address() = default;
+ atomic_address(const atomic_address&) = delete;
+ atomic_address& operator=(const atomic_address&) = delete;
+
+ atomic_address(void* __v) { _M_i = __v; }
+
+ bool
+ is_lock_free() const volatile
+ { return false; }
+
+ void
+ store(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m == memory_order_acquire);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+ __glibcxx_assert(__m == memory_order_consume);
+ _ATOMIC_STORE_(this, __v, __m);
+ }
+
+ void*
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m == memory_order_release);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+ return _ATOMIC_LOAD_(this, __m);
+ }
+
+ void*
+ exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, =, __v, __m); }
+
+ bool
+ compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 == memory_order_release);
+ __glibcxx_assert(__m2 == memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
+ compare_exchange_weak(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 == memory_order_release);
+ __glibcxx_assert(__m2 == memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__v1, __v2, __m1);
+ }
+
+ bool
+ compare_exchange_strong(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ void*
+ fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ {
+ void* volatile* __p = &(_M_i);
+ volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+ __atomic_flag_wait_explicit(__g, __m);
+ void* __r = *__p;
+ *__p = (void*)((char*)(*__p) + __d);
+ atomic_flag_clear_explicit(__g, __m);
+ return __r;
+ }
+
+ void*
+ fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ {
+ void* volatile* __p = &(_M_i);
+ volatile __atomic_flag_base* __g = __atomic_flag_for_address(__p);
+ __atomic_flag_wait_explicit(__g, __m);
+ void* __r = *__p;
+ *__p = (void*)((char*)(*__p) - __d);
+ atomic_flag_clear_explicit(__g, __m);
+ return __r;
+ }
+
+ operator void*() const volatile
+ { return load(); }
+
+ void*
+ operator=(void* __v) // XXX volatile
+ {
+ store(__v);
+ return __v;
+ }
+
+ void*
+ operator+=(ptrdiff_t __d) volatile
+ { return fetch_add(__d) + __d; }
+
+ void*
+ operator-=(ptrdiff_t __d) volatile
+ { return fetch_sub(__d) - __d; }
+ };
+
+
+ // 29.3.1 atomic integral types
+ // For each of the integral types, define atomic_[integral type] struct
+ //
+ // atomic_bool bool
+ // atomic_char char
+ // atomic_schar signed char
+ // atomic_uchar unsigned char
+ // atomic_short short
+ // atomic_ushort unsigned short
+ // atomic_int int
+ // atomic_uint unsigned int
+ // atomic_long long
+ // atomic_ulong unsigned long
+ // atomic_llong long long
+ // atomic_ullong unsigned long long
+ // atomic_char16_t char16_t
+ // atomic_char32_t char32_t
+ // atomic_wchar_t wchar_t
+
+ // Base type.
+ // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
+ // since that is what GCC built-in functions for atomic memory access work on.
+ template<typename _ITp>
+ struct __atomic_base
+ {
+ private:
+ typedef _ITp __integral_type;
+
+ __integral_type _M_i;
+
+ public:
+ __atomic_base() = default;
+ ~__atomic_base() = default;
+ __atomic_base(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) = delete;
+
+ // Requires __integral_type convertible to _M_base._M_i.
+ __atomic_base(__integral_type __i) { _M_i = __i; }
+
+ operator __integral_type() const volatile
+ { return load(); }
+
+ __integral_type
+ operator=(__integral_type __i) // XXX volatile
+ {
+ store(__i);
+ return __i;
+ }
+
+ __integral_type
+ operator++(int) volatile
+ { return fetch_add(1); }
+
+ __integral_type
+ operator--(int) volatile
+ { return fetch_sub(1); }
+
+ __integral_type
+ operator++() volatile
+ { return fetch_add(1) + 1; }
+
+ __integral_type
+ operator--() volatile
+ { return fetch_sub(1) - 1; }
+
+ __integral_type
+ operator+=(__integral_type __i) volatile
+ { return fetch_add(__i) + __i; }
+
+ __integral_type
+ operator-=(__integral_type __i) volatile
+ { return fetch_sub(__i) - __i; }
+
+ __integral_type
+ operator&=(__integral_type __i) volatile
+ { return fetch_and(__i) & __i; }
+
+ __integral_type
+ operator|=(__integral_type __i) volatile
+ { return fetch_or(__i) | __i; }
+
+ __integral_type
+ operator^=(__integral_type __i) volatile
+ { return fetch_xor(__i) ^ __i; }
+
+ bool
+ is_lock_free() const volatile
+ { return false; }
+
+ void
+ store(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m == memory_order_acquire);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+ __glibcxx_assert(__m == memory_order_consume);
+ _ATOMIC_STORE_(this, __i, __m);
+ }
+
+ __integral_type
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m == memory_order_release);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+ return _ATOMIC_LOAD_(this, __m);
+ }
+
+ __integral_type
+ exchange(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, =, __i, __m); }
+
+ bool
+ compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 == memory_order_release);
+ __glibcxx_assert(__m2 == memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
+ }
+
+ bool
+ compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 == memory_order_release);
+ __glibcxx_assert(__m2 == memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+ return _ATOMIC_CMPEXCHNG_(this, &__i1, __i2, __m1);
+ }
+
+ bool
+ compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ __integral_type
+ fetch_add(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, +=, __i, __m); }
+
+ __integral_type
+ fetch_sub(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, -=, __i, __m); }
+
+ __integral_type
+ fetch_and(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, &=, __i, __m); }
+
+ __integral_type
+ fetch_or(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, |=, __i, __m); }
+
+ __integral_type
+ fetch_xor(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _ATOMIC_MODIFY_(this, ^=, __i, __m); }
+ };
+
+
+ /// atomic_bool
+ // NB: No operators or fetch-operations for this type.
+ struct atomic_bool
+ {
+ private:
+ __atomic_base<bool> _M_base;
+
+ public:
+ atomic_bool() = default;
+ ~atomic_bool() = default;
+ atomic_bool(const atomic_bool&) = delete;
+ atomic_bool& operator=(const atomic_bool&) = delete;
+
+ atomic_bool(bool __i) : _M_base(__i) { }
+
+ bool
+ operator=(bool __i) // XXX volatile
+ { return _M_base.operator=(__i); }
+
+ operator bool() const volatile
+ { return _M_base.load(); }
+
+ bool
+ is_lock_free() const volatile
+ { return _M_base.is_lock_free(); }
+
+ void
+ store(bool __i, memory_order __m = memory_order_seq_cst) volatile
+ { _M_base.store(__i, __m); }
+
+ bool
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ { return _M_base.load(__m); }
+
+ bool
+ exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.exchange(__i, __m); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2) volatile
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2) volatile
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+ };
+
+#undef _ATOMIC_LOAD_
+#undef _ATOMIC_STORE_
+#undef _ATOMIC_MODIFY_
+#undef _ATOMIC_CMPEXCHNG_
+} // namespace __atomic0
+
+// _GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/atomic_2.h b/gcc-4.4.0/libstdc++-v3/include/bits/atomic_2.h
new file mode 100644
index 000000000..c17276714
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/atomic_2.h
@@ -0,0 +1,449 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/atomic_2.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ATOMIC_2_H
+#define _GLIBCXX_ATOMIC_2_H 1
+
+#pragma GCC system_header
+
+// _GLIBCXX_BEGIN_NAMESPACE(std)
+
+// 2 == __atomic2 == Always lock-free
+// Assumed:
+// _GLIBCXX_ATOMIC_BUILTINS_1
+// _GLIBCXX_ATOMIC_BUILTINS_2
+// _GLIBCXX_ATOMIC_BUILTINS_4
+// _GLIBCXX_ATOMIC_BUILTINS_8
+namespace __atomic2
+{
+ /// atomic_flag
+ struct atomic_flag : private __atomic_flag_base
+ {
+ atomic_flag() = default;
+ ~atomic_flag() = default;
+ atomic_flag(const atomic_flag&) = delete;
+ atomic_flag& operator=(const atomic_flag&) = delete;
+
+ atomic_flag(bool __i) { _M_i = __i; } // XXX deleted copy ctor != agg
+
+ bool
+ test_and_set(memory_order __m = memory_order_seq_cst) volatile
+ {
+ // Redundant synchronize if built-in for lock is a full barrier.
+ if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+ __sync_synchronize();
+ return __sync_lock_test_and_set(&_M_i, 1);
+ }
+
+ void
+ clear(memory_order __m = memory_order_seq_cst) volatile
+ {
+ __sync_lock_release(&_M_i);
+ if (__m != memory_order_acquire && __m != memory_order_acq_rel)
+ __sync_synchronize();
+ }
+ };
+
+
+ /// 29.4.2, address types
+ struct atomic_address
+ {
+ private:
+ void* _M_i;
+
+ public:
+ atomic_address() = default;
+ ~atomic_address() = default;
+ atomic_address(const atomic_address&) = delete;
+ atomic_address& operator=(const atomic_address&) = delete;
+
+ atomic_address(void* __v) { _M_i = __v; }
+
+ bool
+ is_lock_free() const volatile
+ { return true; }
+
+ void
+ store(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m == memory_order_acquire);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+ __glibcxx_assert(__m == memory_order_consume);
+
+ if (__m == memory_order_relaxed)
+ _M_i = __v;
+ else
+ {
+ // write_mem_barrier();
+ _M_i = __v;
+ if (__m = memory_order_seq_cst)
+ __sync_synchronize();
+ }
+ }
+
+ void*
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m == memory_order_release);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+
+ __sync_synchronize();
+ void* __ret = _M_i;
+ __sync_synchronize();
+ return __ret;
+ }
+
+ void*
+ exchange(void* __v, memory_order __m = memory_order_seq_cst) volatile
+ {
+ // XXX built-in assumes memory_order_acquire.
+ return __sync_lock_test_and_set(&_M_i, __v);
+ }
+
+ bool
+ compare_exchange_weak(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ { return compare_exchange_strong(__v1, __v2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(void*& __v1, void* __v2, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 == memory_order_release);
+ __glibcxx_assert(__m2 == memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ void* __v1o = __v1;
+ void* __v1n = __sync_val_compare_and_swap(&_M_i, __v1o, __v2);
+
+ // Assume extra stores (of same value) allowed in true case.
+ __v1 = __v1n;
+ return __v1o == __v1n;
+ }
+
+ bool
+ compare_exchange_strong(void*& __v1, void* __v2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__v1, __v2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ void*
+ fetch_add(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_add(&_M_i, __d); }
+
+ void*
+ fetch_sub(ptrdiff_t __d, memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_sub(&_M_i, __d); }
+
+ operator void*() const volatile
+ { return load(); }
+
+ void*
+ operator=(void* __v) // XXX volatile
+ {
+ store(__v);
+ return __v;
+ }
+
+ void*
+ operator+=(ptrdiff_t __d) volatile
+ { return __sync_add_and_fetch(&_M_i, __d); }
+
+ void*
+ operator-=(ptrdiff_t __d) volatile
+ { return __sync_sub_and_fetch(&_M_i, __d); }
+ };
+
+ // 29.3.1 atomic integral types
+ // For each of the integral types, define atomic_[integral type] struct
+ //
+ // atomic_bool bool
+ // atomic_char char
+ // atomic_schar signed char
+ // atomic_uchar unsigned char
+ // atomic_short short
+ // atomic_ushort unsigned short
+ // atomic_int int
+ // atomic_uint unsigned int
+ // atomic_long long
+ // atomic_ulong unsigned long
+ // atomic_llong long long
+ // atomic_ullong unsigned long long
+ // atomic_char16_t char16_t
+ // atomic_char32_t char32_t
+ // atomic_wchar_t wchar_t
+
+ // Base type.
+ // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or 8 bytes,
+ // since that is what GCC built-in functions for atomic memory access work on.
+ template<typename _ITp>
+ struct __atomic_base
+ {
+ private:
+ typedef _ITp __integral_type;
+
+ __integral_type _M_i;
+
+ public:
+ __atomic_base() = default;
+ ~__atomic_base() = default;
+ __atomic_base(const __atomic_base&) = delete;
+ __atomic_base& operator=(const __atomic_base&) = delete;
+
+ // Requires __integral_type convertible to _M_base._M_i.
+ __atomic_base(__integral_type __i) { _M_i = __i; }
+
+ operator __integral_type() const volatile
+ { return load(); }
+
+ __integral_type
+ operator=(__integral_type __i) // XXX volatile
+ {
+ store(__i);
+ return __i;
+ }
+
+ __integral_type
+ operator++(int) volatile
+ { return fetch_add(1); }
+
+ __integral_type
+ operator--(int) volatile
+ { return fetch_sub(1); }
+
+ __integral_type
+ operator++() volatile
+ { return __sync_add_and_fetch(&_M_i, 1); }
+
+ __integral_type
+ operator--() volatile
+ { return __sync_sub_and_fetch(&_M_i, 1); }
+
+ __integral_type
+ operator+=(__integral_type __i) volatile
+ { return __sync_add_and_fetch(&_M_i, __i); }
+
+ __integral_type
+ operator-=(__integral_type __i) volatile
+ { return __sync_sub_and_fetch(&_M_i, __i); }
+
+ __integral_type
+ operator&=(__integral_type __i) volatile
+ { return __sync_and_and_fetch(&_M_i, __i); }
+
+ __integral_type
+ operator|=(__integral_type __i) volatile
+ { return __sync_or_and_fetch(&_M_i, __i); }
+
+ __integral_type
+ operator^=(__integral_type __i) volatile
+ { return __sync_xor_and_fetch(&_M_i, __i); }
+
+ bool
+ is_lock_free() const volatile
+ { return true; }
+
+ void
+ store(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ __glibcxx_assert(__m == memory_order_acquire);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+ __glibcxx_assert(__m == memory_order_consume);
+
+ if (__m == memory_order_relaxed)
+ _M_i = __i;
+ else
+ {
+ // write_mem_barrier();
+ _M_i = __i;
+ if (__m = memory_order_seq_cst)
+ __sync_synchronize();
+ }
+ }
+
+ __integral_type
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ {
+ __glibcxx_assert(__m == memory_order_release);
+ __glibcxx_assert(__m == memory_order_acq_rel);
+
+ __sync_synchronize();
+ __integral_type __ret = _M_i;
+ __sync_synchronize();
+ return __ret;
+ }
+
+ __integral_type
+ exchange(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ // XXX built-in assumes memory_order_acquire.
+ return __sync_lock_test_and_set(&_M_i, __i);
+ }
+
+ bool
+ compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ { return compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(__integral_type& __i1, __integral_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_weak(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ bool
+ compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ memory_order __m1, memory_order __m2) volatile
+ {
+ __glibcxx_assert(__m2 == memory_order_release);
+ __glibcxx_assert(__m2 == memory_order_acq_rel);
+ __glibcxx_assert(__m2 <= __m1);
+
+ __integral_type __i1o = __i1;
+ __integral_type __i1n = __sync_val_compare_and_swap(&_M_i, __i1o, __i2);
+
+ // Assume extra stores (of same value) allowed in true case.
+ __i1 = __i1n;
+ return __i1o == __i1n;
+ }
+
+ bool
+ compare_exchange_strong(__integral_type& __i1, __integral_type __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ {
+ return compare_exchange_strong(__i1, __i2, __m,
+ __calculate_memory_order(__m));
+ }
+
+ __integral_type
+ fetch_add(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_add(&_M_i, __i); }
+
+ __integral_type
+ fetch_sub(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_sub(&_M_i, __i); }
+
+ __integral_type
+ fetch_and(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_and(&_M_i, __i); }
+
+ __integral_type
+ fetch_or(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_or(&_M_i, __i); }
+
+ __integral_type
+ fetch_xor(__integral_type __i,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return __sync_fetch_and_xor(&_M_i, __i); }
+ };
+
+
+ /// atomic_bool
+ // NB: No operators or fetch-operations for this type.
+ struct atomic_bool
+ {
+ private:
+ __atomic_base<bool> _M_base;
+
+ public:
+ atomic_bool() = default;
+ ~atomic_bool() = default;
+ atomic_bool(const atomic_bool&) = delete;
+ atomic_bool& operator=(const atomic_bool&) = delete;
+
+ atomic_bool(bool __i) : _M_base(__i) { }
+
+ bool
+ operator=(bool __i) // XXX volatile
+ { return _M_base.operator=(__i); }
+
+ operator bool() const volatile
+ { return _M_base.load(); }
+
+ bool
+ is_lock_free() const volatile
+ { return _M_base.is_lock_free(); }
+
+ void
+ store(bool __i, memory_order __m = memory_order_seq_cst) volatile
+ { _M_base.store(__i, __m); }
+
+ bool
+ load(memory_order __m = memory_order_seq_cst) const volatile
+ { return _M_base.load(__m); }
+
+ bool
+ exchange(bool __i, memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.exchange(__i, __m); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2) volatile
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m1, __m2); }
+
+ bool
+ compare_exchange_weak(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.compare_exchange_weak(__i1, __i2, __m); }
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2, memory_order __m1,
+ memory_order __m2) volatile
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m1, __m2); }
+
+
+ bool
+ compare_exchange_strong(bool& __i1, bool __i2,
+ memory_order __m = memory_order_seq_cst) volatile
+ { return _M_base.compare_exchange_strong(__i1, __i2, __m); }
+ };
+} // namespace __atomic2
+
+// _GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_c.h b/gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_c.h
new file mode 100644
index 000000000..084184393
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_c.h
@@ -0,0 +1,174 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/atomicfwd_c.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// "C" only bits.
+
+#define _ATOMIC_MEMBER_ ((__a)->_M_i)
+
+ // POD base classes for atomic intgral types.
+ struct __atomic_bool_base
+ {
+ bool _M_i;
+ };
+
+ struct __atomic_char_base
+ {
+ char _M_i;
+ };
+
+ struct __atomic_schar_base
+ {
+ signed char _M_i;
+ };
+
+ struct __atomic_uchar_base
+ {
+ unsigned char _M_i;
+ };
+
+ struct __atomic_short_base
+ {
+ short _M_i;
+ };
+
+ struct __atomic_ushort_base
+ {
+ unsigned short _M_i;
+ };
+
+ struct __atomic_int_base
+ {
+ int _M_i;
+ };
+
+ struct __atomic_uint_base
+ {
+ unsigned int _M_i;
+ };
+
+ struct __atomic_long_base
+ {
+ long _M_i;
+ };
+
+ struct __atomic_ulong_base
+ {
+ unsigned long _M_i;
+ };
+
+ struct __atomic_llong_base
+ {
+ long long _M_i;
+ };
+
+ struct __atomic_ullong_base
+ {
+ unsigned long long _M_i;
+ };
+
+ struct __atomic_wchar_t_base
+ {
+ wchar_t _M_i;
+ };
+
+ typedef struct __atomic_flag_base atomic_flag;
+ typedef struct __atomic_address_base atomic_address;
+ typedef struct __atomic_bool_base atomic_bool;
+ typedef struct __atomic_char_base atomic_char;
+ typedef struct __atomic_schar_base atomic_schar;
+ typedef struct __atomic_uchar_base atomic_uchar;
+ typedef struct __atomic_short_base atomic_short;
+ typedef struct __atomic_ushort_base atomic_ushort;
+ typedef struct __atomic_int_base atomic_int;
+ typedef struct __atomic_uint_base atomic_uint;
+ typedef struct __atomic_long_base atomic_long;
+ typedef struct __atomic_ulong_base atomic_ulong;
+ typedef struct __atomic_llong_base atomic_llong;
+ typedef struct __atomic_ullong_base atomic_ullong;
+ typedef struct __atomic_wchar_t_base atomic_wchar_t;
+ typedef struct __atomic_short_base atomic_char16_t;
+ typedef struct __atomic_int_base atomic_char32_t;
+
+#define atomic_is_lock_free(__a) \
+ false
+
+#define atomic_load_explicit(__a, __x) \
+ _ATOMIC_LOAD_(__a, __x)
+
+#define atomic_load(__a) \
+ atomic_load_explicit(__a, memory_order_seq_cst)
+
+#define atomic_store_explicit(__a, __m, __x) \
+ _ATOMIC_STORE_(__a, __m, __x)
+
+#define atomic_store(__a, __m) \
+ atomic_store_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_exchange_explicit(__a, __m, __x) \
+ _ATOMIC_MODIFY_(__a, =, __m, __x)
+
+#define atomic_exchange(__a, __m) \
+ atomic_exchange_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_compare_exchange_explicit(__a, __e, __m, __x, __y) \
+ _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x)
+
+#define atomic_compare_exchange(__a, __e, __m) \
+ _ATOMIC_CMPEXCHNG_(__a, __e, __m, memory_order_seq_cst)
+
+#define atomic_fetch_add_explicit(__a, __m, __x) \
+ _ATOMIC_MODIFY_(__a, +=, __m, __x)
+
+#define atomic_fetch_add(__a, __m) \
+ atomic_fetch_add_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_sub_explicit(__a, __m, __x) \
+ _ATOMIC_MODIFY_(__a, -=, __m, __x)
+
+#define atomic_fetch_sub(__a, __m) \
+ atomic_fetch_sub_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_and_explicit(__a, __m, __x) \
+ _ATOMIC_MODIFY_(__a, &=, __m, __x)
+
+#define atomic_fetch_and(__a, __m) \
+ atomic_fetch_and_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_or_explicit(__a, __m, __x) \
+ _ATOMIC_MODIFY_(__a, |=, __m, __x)
+
+#define atomic_fetch_or(__a, __m) \
+ atomic_fetch_or_explicit(__a, __m, memory_order_seq_cst)
+
+#define atomic_fetch_xor_explicit(__a, __m, __x) \
+ _ATOMIC_MODIFY_(__a, ^=, __m, __x)
+
+#define atomic_fetch_xor(__a, __m) \
+ atomic_fetch_xor_explicit(__a, __m, memory_order_seq_cst)
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_cxx.h b/gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_cxx.h
new file mode 100644
index 000000000..8b67635db
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/atomicfwd_cxx.h
@@ -0,0 +1,109 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/atomicfwd_cxx.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// "C++" only bits.
+
+#define _ATOMIC_MEMBER_ _M_i
+
+_GLIBCXX_END_EXTERN_C
+
+ namespace __atomic0
+ {
+ template<typename _IntTp>
+ struct __atomic_base;
+
+ struct atomic_flag;
+ struct atomic_address;
+ struct atomic_bool;
+ }
+
+ namespace __atomic2
+ {
+ template<typename _IntTp>
+ struct __atomic_base;
+
+ struct atomic_flag;
+ struct atomic_address;
+ struct atomic_bool;
+ }
+
+ namespace __atomic1
+ {
+ using __atomic2::atomic_flag;
+ using __atomic2::atomic_bool;
+ using __atomic0::atomic_address;
+ using __atomic0::__atomic_base;
+ }
+
+ /// atomic_char
+ typedef __atomic_base<char> atomic_char;
+
+ /// atomic_schar
+ typedef __atomic_base<signed char> atomic_schar;
+
+ /// atomic_uchar
+ typedef __atomic_base<unsigned char> atomic_uchar;
+
+ /// atomic_short
+ typedef __atomic_base<short> atomic_short;
+
+ /// atomic_ushort
+ typedef __atomic_base<unsigned short> atomic_ushort;
+
+ /// atomic_int
+ typedef __atomic_base<int> atomic_int;
+
+ /// atomic_uint
+ typedef __atomic_base<unsigned int> atomic_uint;
+
+ /// atomic_long
+ typedef __atomic_base<long> atomic_long;
+
+ /// atomic_ulong
+ typedef __atomic_base<unsigned long> atomic_ulong;
+
+ /// atomic_llong
+ typedef __atomic_base<long long> atomic_llong;
+
+ /// atomic_ullong
+ typedef __atomic_base<unsigned long long> atomic_ullong;
+
+ /// atomic_wchar_t
+ typedef __atomic_base<wchar_t> atomic_wchar_t;
+
+ /// atomic_char16_t
+ typedef __atomic_base<char16_t> atomic_char16_t;
+
+ /// atomic_char32_t
+ typedef __atomic_base<char32_t> atomic_char32_t;
+
+ template<typename _Tp>
+ struct atomic;
+_GLIBCXX_BEGIN_EXTERN_C
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.h b/gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.h
new file mode 100644
index 000000000..ee1b64650
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.h
@@ -0,0 +1,474 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file basic_ios.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _BASIC_IOS_H
+#define _BASIC_IOS_H 1
+
+#pragma GCC system_header
+
+#include <bits/localefwd.h>
+#include <bits/locale_classes.h>
+#include <bits/locale_facets.h>
+#include <bits/streambuf_iterator.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Facet>
+ inline const _Facet&
+ __check_facet(const _Facet* __f)
+ {
+ if (!__f)
+ __throw_bad_cast();
+ return *__f;
+ }
+
+ // 27.4.5 Template class basic_ios
+ /**
+ * @brief Virtual base class for all stream classes.
+ * @ingroup io
+ *
+ * Most of the member functions called dispatched on stream objects
+ * (e.g., @c std::cout.foo(bar);) are consolidated in this class.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_ios : public ios_base
+ {
+ public:
+ //@{
+ /**
+ * These are standard types. They permit a standardized way of
+ * referring to names of (or names dependant on) the template
+ * parameters, which are specific to the implementation.
+ */
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+ //@}
+
+ //@{
+ /**
+ * These are non-standard types.
+ */
+ typedef ctype<_CharT> __ctype_type;
+ typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
+ __num_put_type;
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
+ __num_get_type;
+ //@}
+
+ // Data members:
+ protected:
+ basic_ostream<_CharT, _Traits>* _M_tie;
+ mutable char_type _M_fill;
+ mutable bool _M_fill_init;
+ basic_streambuf<_CharT, _Traits>* _M_streambuf;
+
+ // Cached use_facet<ctype>, which is based on the current locale info.
+ const __ctype_type* _M_ctype;
+ // For ostream.
+ const __num_put_type* _M_num_put;
+ // For istream.
+ const __num_get_type* _M_num_get;
+
+ public:
+ //@{
+ /**
+ * @brief The quick-and-easy status check.
+ *
+ * This allows you to write constructs such as
+ * "if (!a_stream) ..." and "while (a_stream) ..."
+ */
+ operator void*() const
+ { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
+
+ bool
+ operator!() const
+ { return this->fail(); }
+ //@}
+
+ /**
+ * @brief Returns the error state of the stream buffer.
+ * @return A bit pattern (well, isn't everything?)
+ *
+ * See std::ios_base::iostate for the possible bit values. Most
+ * users will call one of the interpreting wrappers, e.g., good().
+ */
+ iostate
+ rdstate() const
+ { return _M_streambuf_state; }
+
+ /**
+ * @brief [Re]sets the error state.
+ * @param state The new state flag(s) to set.
+ *
+ * See std::ios_base::iostate for the possible bit values. Most
+ * users will not need to pass an argument.
+ */
+ void
+ clear(iostate __state = goodbit);
+
+ /**
+ * @brief Sets additional flags in the error state.
+ * @param state The additional state flag(s) to set.
+ *
+ * See std::ios_base::iostate for the possible bit values.
+ */
+ void
+ setstate(iostate __state)
+ { this->clear(this->rdstate() | __state); }
+
+ // Flip the internal state on for the proper state bits, then re
+ // throws the propagated exception if bit also set in
+ // exceptions().
+ void
+ _M_setstate(iostate __state)
+ {
+ // 27.6.1.2.1 Common requirements.
+ // Turn this on without causing an ios::failure to be thrown.
+ _M_streambuf_state |= __state;
+ if (this->exceptions() & __state)
+ __throw_exception_again;
+ }
+
+ /**
+ * @brief Fast error checking.
+ * @return True if no error flags are set.
+ *
+ * A wrapper around rdstate.
+ */
+ bool
+ good() const
+ { return this->rdstate() == 0; }
+
+ /**
+ * @brief Fast error checking.
+ * @return True if the eofbit is set.
+ *
+ * Note that other iostate flags may also be set.
+ */
+ bool
+ eof() const
+ { return (this->rdstate() & eofbit) != 0; }
+
+ /**
+ * @brief Fast error checking.
+ * @return True if either the badbit or the failbit is set.
+ *
+ * Checking the badbit in fail() is historical practice.
+ * Note that other iostate flags may also be set.
+ */
+ bool
+ fail() const
+ { return (this->rdstate() & (badbit | failbit)) != 0; }
+
+ /**
+ * @brief Fast error checking.
+ * @return True if the badbit is set.
+ *
+ * Note that other iostate flags may also be set.
+ */
+ bool
+ bad() const
+ { return (this->rdstate() & badbit) != 0; }
+
+ /**
+ * @brief Throwing exceptions on errors.
+ * @return The current exceptions mask.
+ *
+ * This changes nothing in the stream. See the one-argument version
+ * of exceptions(iostate) for the meaning of the return value.
+ */
+ iostate
+ exceptions() const
+ { return _M_exception; }
+
+ /**
+ * @brief Throwing exceptions on errors.
+ * @param except The new exceptions mask.
+ *
+ * By default, error flags are set silently. You can set an
+ * exceptions mask for each stream; if a bit in the mask becomes set
+ * in the error flags, then an exception of type
+ * std::ios_base::failure is thrown.
+ *
+ * If the error flag is already set when the exceptions mask is
+ * added, the exception is immediately thrown. Try running the
+ * following under GCC 3.1 or later:
+ * @code
+ * #include <iostream>
+ * #include <fstream>
+ * #include <exception>
+ *
+ * int main()
+ * {
+ * std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
+ *
+ * std::ifstream f ("/etc/motd");
+ *
+ * std::cerr << "Setting badbit\n";
+ * f.setstate (std::ios_base::badbit);
+ *
+ * std::cerr << "Setting exception mask\n";
+ * f.exceptions (std::ios_base::badbit);
+ * }
+ * @endcode
+ */
+ void
+ exceptions(iostate __except)
+ {
+ _M_exception = __except;
+ this->clear(_M_streambuf_state);
+ }
+
+ // Constructor/destructor:
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * The parameter is passed by derived streams.
+ */
+ explicit
+ basic_ios(basic_streambuf<_CharT, _Traits>* __sb)
+ : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),
+ _M_ctype(0), _M_num_put(0), _M_num_get(0)
+ { this->init(__sb); }
+
+ /**
+ * @brief Empty.
+ *
+ * The destructor does nothing. More specifically, it does not
+ * destroy the streambuf held by rdbuf().
+ */
+ virtual
+ ~basic_ios() { }
+
+ // Members:
+ /**
+ * @brief Fetches the current @e tied stream.
+ * @return A pointer to the tied stream, or NULL if the stream is
+ * not tied.
+ *
+ * A stream may be @e tied (or synchronized) to a second output
+ * stream. When this stream performs any I/O, the tied stream is
+ * first flushed. For example, @c std::cin is tied to @c std::cout.
+ */
+ basic_ostream<_CharT, _Traits>*
+ tie() const
+ { return _M_tie; }
+
+ /**
+ * @brief Ties this stream to an output stream.
+ * @param tiestr The output stream.
+ * @return The previously tied output stream, or NULL if the stream
+ * was not tied.
+ *
+ * This sets up a new tie; see tie() for more.
+ */
+ basic_ostream<_CharT, _Traits>*
+ tie(basic_ostream<_CharT, _Traits>* __tiestr)
+ {
+ basic_ostream<_CharT, _Traits>* __old = _M_tie;
+ _M_tie = __tiestr;
+ return __old;
+ }
+
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current stream buffer.
+ *
+ * This does not change the state of the stream.
+ */
+ basic_streambuf<_CharT, _Traits>*
+ rdbuf() const
+ { return _M_streambuf; }
+
+ /**
+ * @brief Changing the underlying buffer.
+ * @param sb The new stream buffer.
+ * @return The previous stream buffer.
+ *
+ * Associates a new buffer with the current stream, and clears the
+ * error state.
+ *
+ * Due to historical accidents which the LWG refuses to correct, the
+ * I/O library suffers from a design error: this function is hidden
+ * in derived classes by overrides of the zero-argument @c rdbuf(),
+ * which is non-virtual for hysterical raisins. As a result, you
+ * must use explicit qualifications to access this function via any
+ * derived class. For example:
+ *
+ * @code
+ * std::fstream foo; // or some other derived type
+ * std::streambuf* p = .....;
+ *
+ * foo.ios::rdbuf(p); // ios == basic_ios<char>
+ * @endcode
+ */
+ basic_streambuf<_CharT, _Traits>*
+ rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
+
+ /**
+ * @brief Copies fields of __rhs into this.
+ * @param __rhs The source values for the copies.
+ * @return Reference to this object.
+ *
+ * All fields of __rhs are copied into this object except that rdbuf()
+ * and rdstate() remain unchanged. All values in the pword and iword
+ * arrays are copied. Before copying, each callback is invoked with
+ * erase_event. After copying, each (new) callback is invoked with
+ * copyfmt_event. The final step is to copy exceptions().
+ */
+ basic_ios&
+ copyfmt(const basic_ios& __rhs);
+
+ /**
+ * @brief Retrieves the "empty" character.
+ * @return The current fill character.
+ *
+ * It defaults to a space (' ') in the current locale.
+ */
+ char_type
+ fill() const
+ {
+ if (!_M_fill_init)
+ {
+ _M_fill = this->widen(' ');
+ _M_fill_init = true;
+ }
+ return _M_fill;
+ }
+
+ /**
+ * @brief Sets a new "empty" character.
+ * @param ch The new character.
+ * @return The previous fill character.
+ *
+ * The fill character is used to fill out space when P+ characters
+ * have been requested (e.g., via setw), Q characters are actually
+ * used, and Q<P. It defaults to a space (' ') in the current locale.
+ */
+ char_type
+ fill(char_type __ch)
+ {
+ char_type __old = this->fill();
+ _M_fill = __ch;
+ return __old;
+ }
+
+ // Locales:
+ /**
+ * @brief Moves to a new locale.
+ * @param loc The new locale.
+ * @return The previous locale.
+ *
+ * Calls @c ios_base::imbue(loc), and if a stream buffer is associated
+ * with this stream, calls that buffer's @c pubimbue(loc).
+ *
+ * Additional l10n notes are at
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
+ */
+ locale
+ imbue(const locale& __loc);
+
+ /**
+ * @brief Squeezes characters.
+ * @param c The character to narrow.
+ * @param dfault The character to narrow.
+ * @return The narrowed character.
+ *
+ * Maps a character of @c char_type to a character of @c char,
+ * if possible.
+ *
+ * Returns the result of
+ * @code
+ * std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)
+ * @endcode
+ *
+ * Additional l10n notes are at
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
+ */
+ char
+ narrow(char_type __c, char __dfault) const
+ { return __check_facet(_M_ctype).narrow(__c, __dfault); }
+
+ /**
+ * @brief Widens characters.
+ * @param c The character to widen.
+ * @return The widened character.
+ *
+ * Maps a character of @c char to a character of @c char_type.
+ *
+ * Returns the result of
+ * @code
+ * std::use_facet<ctype<char_type> >(getloc()).widen(c)
+ * @endcode
+ *
+ * Additional l10n notes are at
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
+ */
+ char_type
+ widen(char __c) const
+ { return __check_facet(_M_ctype).widen(__c); }
+
+ protected:
+ // 27.4.5.1 basic_ios constructors
+ /**
+ * @brief Empty.
+ *
+ * The default constructor does nothing and is not normally
+ * accessible to users.
+ */
+ basic_ios()
+ : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false),
+ _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
+ { }
+
+ /**
+ * @brief All setup is performed here.
+ *
+ * This is called from the public constructor. It is not virtual and
+ * cannot be redefined.
+ */
+ void
+ init(basic_streambuf<_CharT, _Traits>* __sb);
+
+ void
+ _M_cache_locale(const locale& __loc);
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+#include <bits/basic_ios.tcc>
+#endif
+
+#endif /* _BASIC_IOS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.tcc
new file mode 100644
index 000000000..a0dc67e54
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/basic_ios.tcc
@@ -0,0 +1,187 @@
+// basic_ios member functions -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file basic_ios.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _BASIC_IOS_TCC
+#define _BASIC_IOS_TCC 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_ios<_CharT, _Traits>::clear(iostate __state)
+ {
+ if (this->rdbuf())
+ _M_streambuf_state = __state;
+ else
+ _M_streambuf_state = __state | badbit;
+ if (this->exceptions() & this->rdstate())
+ __throw_ios_failure(__N("basic_ios::clear"));
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_streambuf<_CharT, _Traits>*
+ basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
+ {
+ basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;
+ _M_streambuf = __sb;
+ this->clear();
+ return __old;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ios<_CharT, _Traits>&
+ basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 292. effects of a.copyfmt (a)
+ if (this != &__rhs)
+ {
+ // Per 27.1.1, do not call imbue, yet must trash all caches
+ // associated with imbue()
+
+ // Alloc any new word array first, so if it fails we have "rollback".
+ _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?
+ _M_local_word : new _Words[__rhs._M_word_size];
+
+ // Bump refs before doing callbacks, for safety.
+ _Callback_list* __cb = __rhs._M_callbacks;
+ if (__cb)
+ __cb->_M_add_reference();
+ _M_call_callbacks(erase_event);
+ if (_M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ _M_dispose_callbacks();
+
+ // NB: Don't want any added during above.
+ _M_callbacks = __cb;
+ for (int __i = 0; __i < __rhs._M_word_size; ++__i)
+ __words[__i] = __rhs._M_word[__i];
+ _M_word = __words;
+ _M_word_size = __rhs._M_word_size;
+
+ this->flags(__rhs.flags());
+ this->width(__rhs.width());
+ this->precision(__rhs.precision());
+ this->tie(__rhs.tie());
+ this->fill(__rhs.fill());
+ _M_ios_locale = __rhs.getloc();
+ _M_cache_locale(_M_ios_locale);
+
+ _M_call_callbacks(copyfmt_event);
+
+ // The next is required to be the last assignment.
+ this->exceptions(__rhs.exceptions());
+ }
+ return *this;
+ }
+
+ // Locales:
+ template<typename _CharT, typename _Traits>
+ locale
+ basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
+ {
+ locale __old(this->getloc());
+ ios_base::imbue(__loc);
+ _M_cache_locale(__loc);
+ if (this->rdbuf() != 0)
+ this->rdbuf()->pubimbue(__loc);
+ return __old;
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
+ {
+ // NB: This may be called more than once on the same object.
+ ios_base::_M_init();
+
+ // Cache locale data and specific facets used by iostreams.
+ _M_cache_locale(_M_ios_locale);
+
+ // NB: The 27.4.4.1 Postconditions Table specifies requirements
+ // after basic_ios::init() has been called. As part of this,
+ // fill() must return widen(' ') any time after init() has been
+ // called, which needs an imbued ctype facet of char_type to
+ // return without throwing an exception. Unfortunately,
+ // ctype<char_type> is not necessarily a required facet, so
+ // streams with char_type != [char, wchar_t] will not have it by
+ // default. Because of this, the correct value for _M_fill is
+ // constructed on the first call of fill(). That way,
+ // unformatted input and output with non-required basic_ios
+ // instantiations is possible even without imbuing the expected
+ // ctype<char_type> facet.
+ _M_fill = _CharT();
+ _M_fill_init = false;
+
+ _M_tie = 0;
+ _M_exception = goodbit;
+ _M_streambuf = __sb;
+ _M_streambuf_state = __sb ? goodbit : badbit;
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc)
+ {
+ if (__builtin_expect(has_facet<__ctype_type>(__loc), true))
+ _M_ctype = &use_facet<__ctype_type>(__loc);
+ else
+ _M_ctype = 0;
+
+ if (__builtin_expect(has_facet<__num_put_type>(__loc), true))
+ _M_num_put = &use_facet<__num_put_type>(__loc);
+ else
+ _M_num_put = 0;
+
+ if (__builtin_expect(has_facet<__num_get_type>(__loc), true))
+ _M_num_get = &use_facet<__num_get_type>(__loc);
+ else
+ _M_num_get = 0;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class basic_ios<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_ios<wchar_t>;
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/basic_string.h b/gcc-4.4.0/libstdc++-v3/include/bits/basic_string.h
new file mode 100644
index 000000000..1e8300dab
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/basic_string.h
@@ -0,0 +1,2692 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file basic_string.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _BASIC_STRING_H
+#define _BASIC_STRING_H 1
+
+#pragma GCC system_header
+
+#include <ext/atomicity.h>
+#include <debug/debug.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @class basic_string basic_string.h <string>
+ * @brief Managing sequences of characters and character-like objects.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>. Of the
+ * <a href="tables.html#68">optional sequence requirements</a>, only
+ * @c push_back, @c at, and array access are supported.
+ *
+ * @doctodo
+ *
+ *
+ * Documentation? What's that?
+ * Nathan Myers <ncm@cantrip.org>.
+ *
+ * A string looks like this:
+ *
+ * @code
+ * [_Rep]
+ * _M_length
+ * [basic_string<char_type>] _M_capacity
+ * _M_dataplus _M_refcount
+ * _M_p ----------------> unnamed array of char_type
+ * @endcode
+ *
+ * Where the _M_p points to the first character in the string, and
+ * you cast it to a pointer-to-_Rep and subtract 1 to get a
+ * pointer to the header.
+ *
+ * This approach has the enormous advantage that a string object
+ * requires only one allocation. All the ugliness is confined
+ * within a single pair of inline functions, which each compile to
+ * a single "add" instruction: _Rep::_M_data(), and
+ * string::_M_rep(); and the allocation function which gets a
+ * block of raw bytes and with room enough and constructs a _Rep
+ * object at the front.
+ *
+ * The reason you want _M_data pointing to the character array and
+ * not the _Rep is so that the debugger can see the string
+ * contents. (Probably we should add a non-inline member to get
+ * the _Rep for the debugger to use, so users can check the actual
+ * string length.)
+ *
+ * Note that the _Rep object is a POD so that you can have a
+ * static "empty string" _Rep object already "constructed" before
+ * static constructors have run. The reference-count encoding is
+ * chosen so that a 0 indicates one reference, so you never try to
+ * destroy the empty-string _Rep object.
+ *
+ * All but the last paragraph is considered pretty conventional
+ * for a C++ string implementation.
+ */
+ // 21.3 Template class basic_string
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string
+ {
+ typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
+
+ // Types:
+ public:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef _Alloc allocator_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ typedef typename _CharT_alloc_type::difference_type difference_type;
+ typedef typename _CharT_alloc_type::reference reference;
+ typedef typename _CharT_alloc_type::const_reference const_reference;
+ typedef typename _CharT_alloc_type::pointer pointer;
+ typedef typename _CharT_alloc_type::const_pointer const_pointer;
+ typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
+ typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
+ const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+
+ private:
+ // _Rep: string representation
+ // Invariants:
+ // 1. String really contains _M_length + 1 characters: due to 21.3.4
+ // must be kept null-terminated.
+ // 2. _M_capacity >= _M_length
+ // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT).
+ // 3. _M_refcount has three states:
+ // -1: leaked, one reference, no ref-copies allowed, non-const.
+ // 0: one reference, non-const.
+ // n>0: n + 1 references, operations require a lock, const.
+ // 4. All fields==0 is an empty string, given the extra storage
+ // beyond-the-end for a null terminator; thus, the shared
+ // empty string representation needs no constructor.
+
+ struct _Rep_base
+ {
+ size_type _M_length;
+ size_type _M_capacity;
+ _Atomic_word _M_refcount;
+ };
+
+ struct _Rep : _Rep_base
+ {
+ // Types:
+ typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
+
+ // (Public) Data members:
+
+ // The maximum number of individual char_type elements of an
+ // individual string is determined by _S_max_size. This is the
+ // value that will be returned by max_size(). (Whereas npos
+ // is the maximum number of bytes the allocator can allocate.)
+ // If one was to divvy up the theoretical largest size string,
+ // with a terminating character and m _CharT elements, it'd
+ // look like this:
+ // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)
+ // Solving for m:
+ // m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1
+ // In addition, this implementation quarters this amount.
+ static const size_type _S_max_size;
+ static const _CharT _S_terminal;
+
+ // The following storage is init'd to 0 by the linker, resulting
+ // (carefully) in an empty string with one reference.
+ static size_type _S_empty_rep_storage[];
+
+ static _Rep&
+ _S_empty_rep()
+ {
+ // NB: Mild hack to avoid strict-aliasing warnings. Note that
+ // _S_empty_rep_storage is never modified and the punning should
+ // be reasonably safe in this case.
+ void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
+ return *reinterpret_cast<_Rep*>(__p);
+ }
+
+ bool
+ _M_is_leaked() const
+ { return this->_M_refcount < 0; }
+
+ bool
+ _M_is_shared() const
+ { return this->_M_refcount > 0; }
+
+ void
+ _M_set_leaked()
+ { this->_M_refcount = -1; }
+
+ void
+ _M_set_sharable()
+ { this->_M_refcount = 0; }
+
+ void
+ _M_set_length_and_sharable(size_type __n)
+ {
+ this->_M_set_sharable(); // One reference.
+ this->_M_length = __n;
+ traits_type::assign(this->_M_refdata()[__n], _S_terminal);
+ // grrr. (per 21.3.4)
+ // You cannot leave those LWG people alone for a second.
+ }
+
+ _CharT*
+ _M_refdata() throw()
+ { return reinterpret_cast<_CharT*>(this + 1); }
+
+ _CharT*
+ _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2)
+ {
+ return (!_M_is_leaked() && __alloc1 == __alloc2)
+ ? _M_refcopy() : _M_clone(__alloc1);
+ }
+
+ // Create & Destroy
+ static _Rep*
+ _S_create(size_type, size_type, const _Alloc&);
+
+ void
+ _M_dispose(const _Alloc& __a)
+ {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ if (__builtin_expect(this != &_S_empty_rep(), false))
+#endif
+ if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
+ -1) <= 0)
+ _M_destroy(__a);
+ } // XXX MT
+
+ void
+ _M_destroy(const _Alloc&) throw();
+
+ _CharT*
+ _M_refcopy() throw()
+ {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ if (__builtin_expect(this != &_S_empty_rep(), false))
+#endif
+ __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
+ return _M_refdata();
+ } // XXX MT
+
+ _CharT*
+ _M_clone(const _Alloc&, size_type __res = 0);
+ };
+
+ // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
+ struct _Alloc_hider : _Alloc
+ {
+ _Alloc_hider(_CharT* __dat, const _Alloc& __a)
+ : _Alloc(__a), _M_p(__dat) { }
+
+ _CharT* _M_p; // The actual data.
+ };
+
+ public:
+ // Data Members (public):
+ // NB: This is an unsigned type, and thus represents the maximum
+ // size that the allocator can hold.
+ /// Value returned by various member functions when they fail.
+ static const size_type npos = static_cast<size_type>(-1);
+
+ private:
+ // Data Members (private):
+ mutable _Alloc_hider _M_dataplus;
+
+ _CharT*
+ _M_data() const
+ { return _M_dataplus._M_p; }
+
+ _CharT*
+ _M_data(_CharT* __p)
+ { return (_M_dataplus._M_p = __p); }
+
+ _Rep*
+ _M_rep() const
+ { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
+
+ // For the internal use we have functions similar to `begin'/`end'
+ // but they do not call _M_leak.
+ iterator
+ _M_ibegin() const
+ { return iterator(_M_data()); }
+
+ iterator
+ _M_iend() const
+ { return iterator(_M_data() + this->size()); }
+
+ void
+ _M_leak() // for use in begin() & non-const op[]
+ {
+ if (!_M_rep()->_M_is_leaked())
+ _M_leak_hard();
+ }
+
+ size_type
+ _M_check(size_type __pos, const char* __s) const
+ {
+ if (__pos > this->size())
+ __throw_out_of_range(__N(__s));
+ return __pos;
+ }
+
+ void
+ _M_check_length(size_type __n1, size_type __n2, const char* __s) const
+ {
+ if (this->max_size() - (this->size() - __n1) < __n2)
+ __throw_length_error(__N(__s));
+ }
+
+ // NB: _M_limit doesn't check for a bad __pos value.
+ size_type
+ _M_limit(size_type __pos, size_type __off) const
+ {
+ const bool __testoff = __off < this->size() - __pos;
+ return __testoff ? __off : this->size() - __pos;
+ }
+
+ // True if _Rep and source do not overlap.
+ bool
+ _M_disjunct(const _CharT* __s) const
+ {
+ return (less<const _CharT*>()(__s, _M_data())
+ || less<const _CharT*>()(_M_data() + this->size(), __s));
+ }
+
+ // When __n = 1 way faster than the general multichar
+ // traits_type::copy/move/assign.
+ static void
+ _M_copy(_CharT* __d, const _CharT* __s, size_type __n)
+ {
+ if (__n == 1)
+ traits_type::assign(*__d, *__s);
+ else
+ traits_type::copy(__d, __s, __n);
+ }
+
+ static void
+ _M_move(_CharT* __d, const _CharT* __s, size_type __n)
+ {
+ if (__n == 1)
+ traits_type::assign(*__d, *__s);
+ else
+ traits_type::move(__d, __s, __n);
+ }
+
+ static void
+ _M_assign(_CharT* __d, size_type __n, _CharT __c)
+ {
+ if (__n == 1)
+ traits_type::assign(*__d, __c);
+ else
+ traits_type::assign(__d, __n, __c);
+ }
+
+ // _S_copy_chars is a separate template to permit specialization
+ // to optimize for the common case of pointers as iterators.
+ template<class _Iterator>
+ static void
+ _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
+ {
+ for (; __k1 != __k2; ++__k1, ++__p)
+ traits_type::assign(*__p, *__k1); // These types are off.
+ }
+
+ static void
+ _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2)
+ { _S_copy_chars(__p, __k1.base(), __k2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
+ { _S_copy_chars(__p, __k1.base(), __k2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
+ { _M_copy(__p, __k1, __k2 - __k1); }
+
+ static void
+ _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)
+ { _M_copy(__p, __k1, __k2 - __k1); }
+
+ static int
+ _S_compare(size_type __n1, size_type __n2)
+ {
+ const difference_type __d = difference_type(__n1 - __n2);
+
+ if (__d > __gnu_cxx::__numeric_traits<int>::__max)
+ return __gnu_cxx::__numeric_traits<int>::__max;
+ else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
+ return __gnu_cxx::__numeric_traits<int>::__min;
+ else
+ return int(__d);
+ }
+
+ void
+ _M_mutate(size_type __pos, size_type __len1, size_type __len2);
+
+ void
+ _M_leak_hard();
+
+ static _Rep&
+ _S_empty_rep()
+ { return _Rep::_S_empty_rep(); }
+
+ public:
+ // Construct/copy/destroy:
+ // NB: We overload ctors in some cases instead of using default
+ // arguments, per 17.4.4.4 para. 2 item 2.
+
+ /**
+ * @brief Default constructor creates an empty string.
+ */
+ inline
+ basic_string();
+
+ /**
+ * @brief Construct an empty string using allocator @a a.
+ */
+ explicit
+ basic_string(const _Alloc& __a);
+
+ // NB: per LWG issue 42, semantics different from IS:
+ /**
+ * @brief Construct string with copy of value of @a str.
+ * @param str Source string.
+ */
+ basic_string(const basic_string& __str);
+ /**
+ * @brief Construct string as copy of a substring.
+ * @param str Source string.
+ * @param pos Index of first character to copy from.
+ * @param n Number of characters to copy (default remainder).
+ */
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n = npos);
+ /**
+ * @brief Construct string as copy of a substring.
+ * @param str Source string.
+ * @param pos Index of first character to copy from.
+ * @param n Number of characters to copy.
+ * @param a Allocator to use.
+ */
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n, const _Alloc& __a);
+
+ /**
+ * @brief Construct string initialized by a character array.
+ * @param s Source character array.
+ * @param n Number of characters to copy.
+ * @param a Allocator to use (default is default allocator).
+ *
+ * NB: @a s must have at least @a n characters, '\\0' has no special
+ * meaning.
+ */
+ basic_string(const _CharT* __s, size_type __n,
+ const _Alloc& __a = _Alloc());
+ /**
+ * @brief Construct string as copy of a C string.
+ * @param s Source C string.
+ * @param a Allocator to use (default is default allocator).
+ */
+ basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
+ /**
+ * @brief Construct string as multiple characters.
+ * @param n Number of characters.
+ * @param c Character to use.
+ * @param a Allocator to use (default is default allocator).
+ */
+ basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Construct string from an initializer list.
+ * @param l std::initializer_list of characters.
+ * @param a Allocator to use (default is default allocator).
+ */
+ basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc());
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Construct string as copy of a range.
+ * @param beg Start of range.
+ * @param end End of range.
+ * @param a Allocator to use (default is default allocator).
+ */
+ template<class _InputIterator>
+ basic_string(_InputIterator __beg, _InputIterator __end,
+ const _Alloc& __a = _Alloc());
+
+ /**
+ * @brief Destroy the string instance.
+ */
+ ~basic_string()
+ { _M_rep()->_M_dispose(this->get_allocator()); }
+
+ /**
+ * @brief Assign the value of @a str to this string.
+ * @param str Source string.
+ */
+ basic_string&
+ operator=(const basic_string& __str)
+ { return this->assign(__str); }
+
+ /**
+ * @brief Copy contents of @a s into this string.
+ * @param s Source null-terminated string.
+ */
+ basic_string&
+ operator=(const _CharT* __s)
+ { return this->assign(__s); }
+
+ /**
+ * @brief Set value to string of length 1.
+ * @param c Source character.
+ *
+ * Assigning to a character makes this string length 1 and
+ * (*this)[0] == @a c.
+ */
+ basic_string&
+ operator=(_CharT __c)
+ {
+ this->assign(1, __c);
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Set value to string constructed from initializer list.
+ * @param l std::initializer_list.
+ */
+ basic_string&
+ operator=(initializer_list<_CharT> __l)
+ {
+ this->assign (__l.begin(), __l.end());
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ // Iterators:
+ /**
+ * Returns a read/write iterator that points to the first character in
+ * the %string. Unshares the string.
+ */
+ iterator
+ begin()
+ {
+ _M_leak();
+ return iterator(_M_data());
+ }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * character in the %string.
+ */
+ const_iterator
+ begin() const
+ { return const_iterator(_M_data()); }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * character in the %string. Unshares the string.
+ */
+ iterator
+ end()
+ {
+ _M_leak();
+ return iterator(_M_data() + this->size());
+ }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the
+ * last character in the %string.
+ */
+ const_iterator
+ end() const
+ { return const_iterator(_M_data() + this->size()); }
+
+ /**
+ * Returns a read/write reverse iterator that points to the last
+ * character in the %string. Iteration is done in reverse element
+ * order. Unshares the string.
+ */
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(this->end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last character in the %string. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(this->end()); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one before the
+ * first character in the %string. Iteration is done in reverse
+ * element order. Unshares the string.
+ */
+ reverse_iterator
+ rend()
+ { return reverse_iterator(this->begin()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first character in the %string. Iteration
+ * is done in reverse element order.
+ */
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(this->begin()); }
+
+ public:
+ // Capacity:
+ /// Returns the number of characters in the string, not including any
+ /// null-termination.
+ size_type
+ size() const
+ { return _M_rep()->_M_length; }
+
+ /// Returns the number of characters in the string, not including any
+ /// null-termination.
+ size_type
+ length() const
+ { return _M_rep()->_M_length; }
+
+ /// Returns the size() of the largest possible %string.
+ size_type
+ max_size() const
+ { return _Rep::_S_max_size; }
+
+ /**
+ * @brief Resizes the %string to the specified number of characters.
+ * @param n Number of characters the %string should contain.
+ * @param c Character to fill any new elements.
+ *
+ * This function will %resize the %string to the specified
+ * number of characters. If the number is smaller than the
+ * %string's current size the %string is truncated, otherwise
+ * the %string is extended and new elements are set to @a c.
+ */
+ void
+ resize(size_type __n, _CharT __c);
+
+ /**
+ * @brief Resizes the %string to the specified number of characters.
+ * @param n Number of characters the %string should contain.
+ *
+ * This function will resize the %string to the specified length. If
+ * the new size is smaller than the %string's current size the %string
+ * is truncated, otherwise the %string is extended and new characters
+ * are default-constructed. For basic types such as char, this means
+ * setting them to 0.
+ */
+ void
+ resize(size_type __n)
+ { this->resize(__n, _CharT()); }
+
+ /**
+ * Returns the total number of characters that the %string can hold
+ * before needing to allocate more memory.
+ */
+ size_type
+ capacity() const
+ { return _M_rep()->_M_capacity; }
+
+ /**
+ * @brief Attempt to preallocate enough memory for specified number of
+ * characters.
+ * @param res_arg Number of characters required.
+ * @throw std::length_error If @a res_arg exceeds @c max_size().
+ *
+ * This function attempts to reserve enough memory for the
+ * %string to hold the specified number of characters. If the
+ * number requested is more than max_size(), length_error is
+ * thrown.
+ *
+ * The advantage of this function is that if optimal code is a
+ * necessity and the user can determine the string length that will be
+ * required, the user can reserve the memory in %advance, and thus
+ * prevent a possible reallocation of memory and copying of %string
+ * data.
+ */
+ void
+ reserve(size_type __res_arg = 0);
+
+ /**
+ * Erases the string, making it empty.
+ */
+ void
+ clear()
+ { _M_mutate(0, this->size(), 0); }
+
+ /**
+ * Returns true if the %string is empty. Equivalent to *this == "".
+ */
+ bool
+ empty() const
+ { return this->size() == 0; }
+
+ // Element access:
+ /**
+ * @brief Subscript access to the data contained in the %string.
+ * @param pos The index of the character to access.
+ * @return Read-only (constant) reference to the character.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().)
+ */
+ const_reference
+ operator[] (size_type __pos) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(__pos <= size());
+ return _M_data()[__pos];
+ }
+
+ /**
+ * @brief Subscript access to the data contained in the %string.
+ * @param pos The index of the character to access.
+ * @return Read/write reference to the character.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().) Unshares the string.
+ */
+ reference
+ operator[](size_type __pos)
+ {
+ // allow pos == size() as v3 extension:
+ _GLIBCXX_DEBUG_ASSERT(__pos <= size());
+ // but be strict in pedantic mode:
+ _GLIBCXX_DEBUG_PEDASSERT(__pos < size());
+ _M_leak();
+ return _M_data()[__pos];
+ }
+
+ /**
+ * @brief Provides access to the data contained in the %string.
+ * @param n The index of the character to access.
+ * @return Read-only (const) reference to the character.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter is
+ * first checked that it is in the range of the string. The function
+ * throws out_of_range if the check fails.
+ */
+ const_reference
+ at(size_type __n) const
+ {
+ if (__n >= this->size())
+ __throw_out_of_range(__N("basic_string::at"));
+ return _M_data()[__n];
+ }
+
+ /**
+ * @brief Provides access to the data contained in the %string.
+ * @param n The index of the character to access.
+ * @return Read/write reference to the character.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter is
+ * first checked that it is in the range of the string. The function
+ * throws out_of_range if the check fails. Success results in
+ * unsharing the string.
+ */
+ reference
+ at(size_type __n)
+ {
+ if (__n >= size())
+ __throw_out_of_range(__N("basic_string::at"));
+ _M_leak();
+ return _M_data()[__n];
+ }
+
+ // Modifiers:
+ /**
+ * @brief Append a string to this string.
+ * @param str The string to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ operator+=(const basic_string& __str)
+ { return this->append(__str); }
+
+ /**
+ * @brief Append a C string.
+ * @param s The C string to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ operator+=(const _CharT* __s)
+ { return this->append(__s); }
+
+ /**
+ * @brief Append a character.
+ * @param c The character to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ operator+=(_CharT __c)
+ {
+ this->push_back(__c);
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param l The initializer_list of characters to be appended.
+ * @return Reference to this string.
+ */
+ basic_string&
+ operator+=(initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Append a string to this string.
+ * @param str The string to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ append(const basic_string& __str);
+
+ /**
+ * @brief Append a substring.
+ * @param str The string to append.
+ * @param pos Index of the first character of str to append.
+ * @param n The number of characters to append.
+ * @return Reference to this string.
+ * @throw std::out_of_range if @a pos is not a valid index.
+ *
+ * This function appends @a n characters from @a str starting at @a pos
+ * to this string. If @a n is is larger than the number of available
+ * characters in @a str, the remainder of @a str is appended.
+ */
+ basic_string&
+ append(const basic_string& __str, size_type __pos, size_type __n);
+
+ /**
+ * @brief Append a C substring.
+ * @param s The C string to append.
+ * @param n The number of characters to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ append(const _CharT* __s, size_type __n);
+
+ /**
+ * @brief Append a C string.
+ * @param s The C string to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ append(const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->append(__s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Append multiple characters.
+ * @param n The number of characters to append.
+ * @param c The character to use.
+ * @return Reference to this string.
+ *
+ * Appends n copies of c to this string.
+ */
+ basic_string&
+ append(size_type __n, _CharT __c);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param l The initializer_list of characters to append.
+ * @return Reference to this string.
+ */
+ basic_string&
+ append(initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Append a range of characters.
+ * @param first Iterator referencing the first character to append.
+ * @param last Iterator marking the end of the range.
+ * @return Reference to this string.
+ *
+ * Appends characters in the range [first,last) to this string.
+ */
+ template<class _InputIterator>
+ basic_string&
+ append(_InputIterator __first, _InputIterator __last)
+ { return this->replace(_M_iend(), _M_iend(), __first, __last); }
+
+ /**
+ * @brief Append a single character.
+ * @param c Character to append.
+ */
+ void
+ push_back(_CharT __c)
+ {
+ const size_type __len = 1 + this->size();
+ if (__len > this->capacity() || _M_rep()->_M_is_shared())
+ this->reserve(__len);
+ traits_type::assign(_M_data()[this->size()], __c);
+ _M_rep()->_M_set_length_and_sharable(__len);
+ }
+
+ /**
+ * @brief Set value to contents of another string.
+ * @param str Source string to use.
+ * @return Reference to this string.
+ */
+ basic_string&
+ assign(const basic_string& __str);
+
+ /**
+ * @brief Set value to a substring of a string.
+ * @param str The string to use.
+ * @param pos Index of the first character of str.
+ * @param n Number of characters to use.
+ * @return Reference to this string.
+ * @throw std::out_of_range if @a pos is not a valid index.
+ *
+ * This function sets this string to the substring of @a str consisting
+ * of @a n characters at @a pos. If @a n is is larger than the number
+ * of available characters in @a str, the remainder of @a str is used.
+ */
+ basic_string&
+ assign(const basic_string& __str, size_type __pos, size_type __n)
+ { return this->assign(__str._M_data()
+ + __str._M_check(__pos, "basic_string::assign"),
+ __str._M_limit(__pos, __n)); }
+
+ /**
+ * @brief Set value to a C substring.
+ * @param s The C string to use.
+ * @param n Number of characters to use.
+ * @return Reference to this string.
+ *
+ * This function sets the value of this string to the first @a n
+ * characters of @a s. If @a n is is larger than the number of
+ * available characters in @a s, the remainder of @a s is used.
+ */
+ basic_string&
+ assign(const _CharT* __s, size_type __n);
+
+ /**
+ * @brief Set value to contents of a C string.
+ * @param s The C string to use.
+ * @return Reference to this string.
+ *
+ * This function sets the value of this string to the value of @a s.
+ * The data is copied, so there is no dependence on @a s once the
+ * function returns.
+ */
+ basic_string&
+ assign(const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->assign(__s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Set value to multiple characters.
+ * @param n Length of the resulting string.
+ * @param c The character to use.
+ * @return Reference to this string.
+ *
+ * This function sets the value of this string to @a n copies of
+ * character @a c.
+ */
+ basic_string&
+ assign(size_type __n, _CharT __c)
+ { return _M_replace_aux(size_type(0), this->size(), __n, __c); }
+
+ /**
+ * @brief Set value to a range of characters.
+ * @param first Iterator referencing the first character to append.
+ * @param last Iterator marking the end of the range.
+ * @return Reference to this string.
+ *
+ * Sets value of string to characters in the range [first,last).
+ */
+ template<class _InputIterator>
+ basic_string&
+ assign(_InputIterator __first, _InputIterator __last)
+ { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Set value to an initializer_list of characters.
+ * @param l The initializer_list of characters to assign.
+ * @return Reference to this string.
+ */
+ basic_string&
+ assign(initializer_list<_CharT> __l)
+ { return this->assign(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Insert multiple characters.
+ * @param p Iterator referencing location in string to insert at.
+ * @param n Number of characters to insert
+ * @param c The character to insert.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts @a n copies of character @a c starting at the position
+ * referenced by iterator @a p. If adding characters causes the length
+ * to exceed max_size(), length_error is thrown. The value of the
+ * string doesn't change if an error is thrown.
+ */
+ void
+ insert(iterator __p, size_type __n, _CharT __c)
+ { this->replace(__p, __p, __n, __c); }
+
+ /**
+ * @brief Insert a range of characters.
+ * @param p Iterator referencing location in string to insert at.
+ * @param beg Start of range.
+ * @param end End of range.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts characters in range [beg,end). If adding characters causes
+ * the length to exceed max_size(), length_error is thrown. The value
+ * of the string doesn't change if an error is thrown.
+ */
+ template<class _InputIterator>
+ void
+ insert(iterator __p, _InputIterator __beg, _InputIterator __end)
+ { this->replace(__p, __p, __beg, __end); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Insert an initializer_list of characters.
+ * @param p Iterator referencing location in string to insert at.
+ * @param l The initializer_list of characters to insert.
+ * @throw std::length_error If new length exceeds @c max_size().
+ */
+ void
+ insert(iterator __p, initializer_list<_CharT> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Insert value of a string.
+ * @param pos1 Iterator referencing location in string to insert at.
+ * @param str The string to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts value of @a str starting at @a pos1. If adding characters
+ * causes the length to exceed max_size(), length_error is thrown. The
+ * value of the string doesn't change if an error is thrown.
+ */
+ basic_string&
+ insert(size_type __pos1, const basic_string& __str)
+ { return this->insert(__pos1, __str, size_type(0), __str.size()); }
+
+ /**
+ * @brief Insert a substring.
+ * @param pos1 Iterator referencing location in string to insert at.
+ * @param str The string to insert.
+ * @param pos2 Start of characters in str to insert.
+ * @param n Number of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a pos1 > size() or
+ * @a pos2 > @a str.size().
+ *
+ * Starting at @a pos1, insert @a n character of @a str beginning with
+ * @a pos2. If adding characters causes the length to exceed
+ * max_size(), length_error is thrown. If @a pos1 is beyond the end of
+ * this string or @a pos2 is beyond the end of @a str, out_of_range is
+ * thrown. The value of the string doesn't change if an error is
+ * thrown.
+ */
+ basic_string&
+ insert(size_type __pos1, const basic_string& __str,
+ size_type __pos2, size_type __n)
+ { return this->insert(__pos1, __str._M_data()
+ + __str._M_check(__pos2, "basic_string::insert"),
+ __str._M_limit(__pos2, __n)); }
+
+ /**
+ * @brief Insert a C substring.
+ * @param pos Iterator referencing location in string to insert at.
+ * @param s The C string to insert.
+ * @param n The number of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a pos is beyond the end of this
+ * string.
+ *
+ * Inserts the first @a n characters of @a s starting at @a pos. If
+ * adding characters causes the length to exceed max_size(),
+ * length_error is thrown. If @a pos is beyond end(), out_of_range is
+ * thrown. The value of the string doesn't change if an error is
+ * thrown.
+ */
+ basic_string&
+ insert(size_type __pos, const _CharT* __s, size_type __n);
+
+ /**
+ * @brief Insert a C string.
+ * @param pos Iterator referencing location in string to insert at.
+ * @param s The C string to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a pos is beyond the end of this
+ * string.
+ *
+ * Inserts the first @a n characters of @a s starting at @a pos. If
+ * adding characters causes the length to exceed max_size(),
+ * length_error is thrown. If @a pos is beyond end(), out_of_range is
+ * thrown. The value of the string doesn't change if an error is
+ * thrown.
+ */
+ basic_string&
+ insert(size_type __pos, const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->insert(__pos, __s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Insert multiple characters.
+ * @param pos Index in string to insert at.
+ * @param n Number of characters to insert
+ * @param c The character to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a pos is beyond the end of this
+ * string.
+ *
+ * Inserts @a n copies of character @a c starting at index @a pos. If
+ * adding characters causes the length to exceed max_size(),
+ * length_error is thrown. If @a pos > length(), out_of_range is
+ * thrown. The value of the string doesn't change if an error is
+ * thrown.
+ */
+ basic_string&
+ insert(size_type __pos, size_type __n, _CharT __c)
+ { return _M_replace_aux(_M_check(__pos, "basic_string::insert"),
+ size_type(0), __n, __c); }
+
+ /**
+ * @brief Insert one character.
+ * @param p Iterator referencing position in string to insert at.
+ * @param c The character to insert.
+ * @return Iterator referencing newly inserted char.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts character @a c at position referenced by @a p. If adding
+ * character causes the length to exceed max_size(), length_error is
+ * thrown. If @a p is beyond end of string, out_of_range is thrown.
+ * The value of the string doesn't change if an error is thrown.
+ */
+ iterator
+ insert(iterator __p, _CharT __c)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
+ const size_type __pos = __p - _M_ibegin();
+ _M_replace_aux(__pos, size_type(0), size_type(1), __c);
+ _M_rep()->_M_set_leaked();
+ return iterator(_M_data() + __pos);
+ }
+
+ /**
+ * @brief Remove characters.
+ * @param pos Index of first character to remove (default 0).
+ * @param n Number of characters to remove (default remainder).
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a pos is beyond the end of this
+ * string.
+ *
+ * Removes @a n characters from this string starting at @a pos. The
+ * length of the string is reduced by @a n. If there are < @a n
+ * characters to remove, the remainder of the string is truncated. If
+ * @a p is beyond end of string, out_of_range is thrown. The value of
+ * the string doesn't change if an error is thrown.
+ */
+ basic_string&
+ erase(size_type __pos = 0, size_type __n = npos)
+ {
+ _M_mutate(_M_check(__pos, "basic_string::erase"),
+ _M_limit(__pos, __n), size_type(0));
+ return *this;
+ }
+
+ /**
+ * @brief Remove one character.
+ * @param position Iterator referencing the character to remove.
+ * @return iterator referencing same location after removal.
+ *
+ * Removes the character at @a position from this string. The value
+ * of the string doesn't change if an error is thrown.
+ */
+ iterator
+ erase(iterator __position)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
+ && __position < _M_iend());
+ const size_type __pos = __position - _M_ibegin();
+ _M_mutate(__pos, size_type(1), size_type(0));
+ _M_rep()->_M_set_leaked();
+ return iterator(_M_data() + __pos);
+ }
+
+ /**
+ * @brief Remove a range of characters.
+ * @param first Iterator referencing the first character to remove.
+ * @param last Iterator referencing the end of the range.
+ * @return Iterator referencing location of first after removal.
+ *
+ * Removes the characters in the range [first,last) from this string.
+ * The value of the string doesn't change if an error is thrown.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
+ && __last <= _M_iend());
+ const size_type __pos = __first - _M_ibegin();
+ _M_mutate(__pos, __last - __first, size_type(0));
+ _M_rep()->_M_set_leaked();
+ return iterator(_M_data() + __pos);
+ }
+
+ /**
+ * @brief Replace characters with value from another string.
+ * @param pos Index of first character to replace.
+ * @param n Number of characters to be replaced.
+ * @param str String to insert.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a pos is beyond the end of this
+ * string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos+n) from this string.
+ * In place, the value of @a str is inserted. If @a pos is beyond end
+ * of string, out_of_range is thrown. If the length of the result
+ * exceeds max_size(), length_error is thrown. The value of the string
+ * doesn't change if an error is thrown.
+ */
+ basic_string&
+ replace(size_type __pos, size_type __n, const basic_string& __str)
+ { return this->replace(__pos, __n, __str._M_data(), __str.size()); }
+
+ /**
+ * @brief Replace characters with value from another string.
+ * @param pos1 Index of first character to replace.
+ * @param n1 Number of characters to be replaced.
+ * @param str String to insert.
+ * @param pos2 Index of first character of str to use.
+ * @param n2 Number of characters from str to use.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a pos1 > size() or @a pos2 >
+ * str.size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos1,pos1 + n) from this
+ * string. In place, the value of @a str is inserted. If @a pos is
+ * beyond end of string, out_of_range is thrown. If the length of the
+ * result exceeds max_size(), length_error is thrown. The value of the
+ * string doesn't change if an error is thrown.
+ */
+ basic_string&
+ replace(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2)
+ { return this->replace(__pos1, __n1, __str._M_data()
+ + __str._M_check(__pos2, "basic_string::replace"),
+ __str._M_limit(__pos2, __n2)); }
+
+ /**
+ * @brief Replace characters with value of a C substring.
+ * @param pos Index of first character to replace.
+ * @param n1 Number of characters to be replaced.
+ * @param s C string to insert.
+ * @param n2 Number of characters from @a s to use.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a pos1 > size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos + n1) from this string.
+ * In place, the first @a n2 characters of @a s are inserted, or all
+ * of @a s if @a n2 is too large. If @a pos is beyond end of string,
+ * out_of_range is thrown. If the length of result exceeds max_size(),
+ * length_error is thrown. The value of the string doesn't change if
+ * an error is thrown.
+ */
+ basic_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2);
+
+ /**
+ * @brief Replace characters with value of a C string.
+ * @param pos Index of first character to replace.
+ * @param n1 Number of characters to be replaced.
+ * @param s C string to insert.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a pos > size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos + n1) from this string.
+ * In place, the first @a n characters of @a s are inserted. If @a
+ * pos is beyond end of string, out_of_range is thrown. If the length
+ * of result exceeds max_size(), length_error is thrown. The value of
+ * the string doesn't change if an error is thrown.
+ */
+ basic_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->replace(__pos, __n1, __s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Replace characters with multiple characters.
+ * @param pos Index of first character to replace.
+ * @param n1 Number of characters to be replaced.
+ * @param n2 Number of characters to insert.
+ * @param c Character to insert.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a pos > size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos + n1) from this string.
+ * In place, @a n2 copies of @a c are inserted. If @a pos is beyond
+ * end of string, out_of_range is thrown. If the length of result
+ * exceeds max_size(), length_error is thrown. The value of the string
+ * doesn't change if an error is thrown.
+ */
+ basic_string&
+ replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ { return _M_replace_aux(_M_check(__pos, "basic_string::replace"),
+ _M_limit(__pos, __n1), __n2, __c); }
+
+ /**
+ * @brief Replace range of characters with string.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param str String value to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, the value of
+ * @a str is inserted. If the length of result exceeds max_size(),
+ * length_error is thrown. The value of the string doesn't change if
+ * an error is thrown.
+ */
+ basic_string&
+ replace(iterator __i1, iterator __i2, const basic_string& __str)
+ { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }
+
+ /**
+ * @brief Replace range of characters with C substring.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param s C string value to insert.
+ * @param n Number of characters from s to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, the first @a
+ * n characters of @a s are inserted. If the length of result exceeds
+ * max_size(), length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ basic_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
+ }
+
+ /**
+ * @brief Replace range of characters with C string.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param s C string value to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, the
+ * characters of @a s are inserted. If the length of result exceeds
+ * max_size(), length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ basic_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->replace(__i1, __i2, __s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Replace range of characters with multiple characters
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param n Number of characters to insert.
+ * @param c Character to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, @a n copies
+ * of @a c are inserted. If the length of result exceeds max_size(),
+ * length_error is thrown. The value of the string doesn't change if
+ * an error is thrown.
+ */
+ basic_string&
+ replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
+ }
+
+ /**
+ * @brief Replace range of characters with range.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param k1 Iterator referencing start of range to insert.
+ * @param k2 Iterator referencing end of range to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, characters
+ * in the range [k1,k2) are inserted. If the length of result exceeds
+ * max_size(), length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ template<class _InputIterator>
+ basic_string&
+ replace(iterator __i1, iterator __i2,
+ _InputIterator __k1, _InputIterator __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
+ }
+
+ // Specializations for the common case of pointer and iterator:
+ // useful to avoid the overhead of temporary buffering in _M_replace.
+ basic_string&
+ replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1, __k2 - __k1);
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2,
+ const _CharT* __k1, const _CharT* __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1, __k2 - __k1);
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1.base(), __k2 - __k1);
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2,
+ const_iterator __k1, const_iterator __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1.base(), __k2 - __k1);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Replace range of characters with initializer_list.
+ * @param i1 Iterator referencing start of range to replace.
+ * @param i2 Iterator referencing end of range to replace.
+ * @param l The initializer_list of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, characters
+ * in the range [k1,k2) are inserted. If the length of result exceeds
+ * max_size(), length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ basic_string& replace(iterator __i1, iterator __i2,
+ initializer_list<_CharT> __l)
+ { return this->replace(__i1, __i2, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ private:
+ template<class _Integer>
+ basic_string&
+ _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
+ _Integer __val, __true_type)
+ { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
+
+ template<class _InputIterator>
+ basic_string&
+ _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
+ _InputIterator __k2, __false_type);
+
+ basic_string&
+ _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
+ _CharT __c);
+
+ basic_string&
+ _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,
+ size_type __n2);
+
+ // _S_construct_aux is used to implement the 21.3.1 para 15 which
+ // requires special behaviour if _InIter is an integral type
+ template<class _InIterator>
+ static _CharT*
+ _S_construct_aux(_InIterator __beg, _InIterator __end,
+ const _Alloc& __a, __false_type)
+ {
+ typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
+ return _S_construct(__beg, __end, __a, _Tag());
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<class _Integer>
+ static _CharT*
+ _S_construct_aux(_Integer __beg, _Integer __end,
+ const _Alloc& __a, __true_type)
+ { return _S_construct(static_cast<size_type>(__beg), __end, __a); }
+
+ template<class _InIterator>
+ static _CharT*
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)
+ {
+ typedef typename std::__is_integer<_InIterator>::__type _Integral;
+ return _S_construct_aux(__beg, __end, __a, _Integral());
+ }
+
+ // For Input Iterators, used in istreambuf_iterators, etc.
+ template<class _InIterator>
+ static _CharT*
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
+ input_iterator_tag);
+
+ // For forward_iterators up to random_access_iterators, used for
+ // string::iterator, _CharT*, etc.
+ template<class _FwdIterator>
+ static _CharT*
+ _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a,
+ forward_iterator_tag);
+
+ static _CharT*
+ _S_construct(size_type __req, _CharT __c, const _Alloc& __a);
+
+ public:
+
+ /**
+ * @brief Copy substring into C string.
+ * @param s C string to copy value into.
+ * @param n Number of characters to copy.
+ * @param pos Index of first character to copy.
+ * @return Number of characters actually copied
+ * @throw std::out_of_range If pos > size().
+ *
+ * Copies up to @a n characters starting at @a pos into the C string @a
+ * s. If @a pos is greater than size(), out_of_range is thrown.
+ */
+ size_type
+ copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
+
+ /**
+ * @brief Swap contents with another string.
+ * @param s String to swap with.
+ *
+ * Exchanges the contents of this string with that of @a s in constant
+ * time.
+ */
+ void
+ swap(basic_string& __s);
+
+ // String operations:
+ /**
+ * @brief Return const pointer to null-terminated contents.
+ *
+ * This is a handle to internal data. Do not modify or dire things may
+ * happen.
+ */
+ const _CharT*
+ c_str() const
+ { return _M_data(); }
+
+ /**
+ * @brief Return const pointer to contents.
+ *
+ * This is a handle to internal data. Do not modify or dire things may
+ * happen.
+ */
+ const _CharT*
+ data() const
+ { return _M_data(); }
+
+ /**
+ * @brief Return copy of allocator used to construct this string.
+ */
+ allocator_type
+ get_allocator() const
+ { return _M_dataplus; }
+
+ /**
+ * @brief Find position of a C substring.
+ * @param s C string to locate.
+ * @param pos Index of character to search from.
+ * @param n Number of characters from @a s to search for.
+ * @return Index of start of first occurrence.
+ *
+ * Starting from @a pos, searches forward for the first @a n characters
+ * in @a s within this string. If found, returns the index where it
+ * begins. If not found, returns npos.
+ */
+ size_type
+ find(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find position of a string.
+ * @param str String to locate.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of start of first occurrence.
+ *
+ * Starting from @a pos, searches forward for value of @a str within
+ * this string. If found, returns the index where it begins. If not
+ * found, returns npos.
+ */
+ size_type
+ find(const basic_string& __str, size_type __pos = 0) const
+ { return this->find(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find position of a C string.
+ * @param s C string to locate.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of start of first occurrence.
+ *
+ * Starting from @a pos, searches forward for the value of @a s within
+ * this string. If found, returns the index where it begins. If not
+ * found, returns npos.
+ */
+ size_type
+ find(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find position of a character.
+ * @param c Character to locate.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for @a c within this string.
+ * If found, returns the index where it was found. If not found,
+ * returns npos.
+ */
+ size_type
+ find(_CharT __c, size_type __pos = 0) const;
+
+ /**
+ * @brief Find last position of a string.
+ * @param str String to locate.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of start of last occurrence.
+ *
+ * Starting from @a pos, searches backward for value of @a str within
+ * this string. If found, returns the index where it begins. If not
+ * found, returns npos.
+ */
+ size_type
+ rfind(const basic_string& __str, size_type __pos = npos) const
+ { return this->rfind(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find last position of a C substring.
+ * @param s C string to locate.
+ * @param pos Index of character to search back from.
+ * @param n Number of characters from s to search for.
+ * @return Index of start of last occurrence.
+ *
+ * Starting from @a pos, searches backward for the first @a n
+ * characters in @a s within this string. If found, returns the index
+ * where it begins. If not found, returns npos.
+ */
+ size_type
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find last position of a C string.
+ * @param s C string to locate.
+ * @param pos Index of character to start search at (default end).
+ * @return Index of start of last occurrence.
+ *
+ * Starting from @a pos, searches backward for the value of @a s within
+ * this string. If found, returns the index where it begins. If not
+ * found, returns npos.
+ */
+ size_type
+ rfind(const _CharT* __s, size_type __pos = npos) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->rfind(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find last position of a character.
+ * @param c Character to locate.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for @a c within this string.
+ * If found, returns the index where it was found. If not found,
+ * returns npos.
+ */
+ size_type
+ rfind(_CharT __c, size_type __pos = npos) const;
+
+ /**
+ * @brief Find position of a character of string.
+ * @param str String containing characters to locate.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for one of the characters of
+ * @a str within this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_first_of(const basic_string& __str, size_type __pos = 0) const
+ { return this->find_first_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find position of a character of C substring.
+ * @param s String containing characters to locate.
+ * @param pos Index of character to search from.
+ * @param n Number of characters from s to search for.
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for one of the first @a n
+ * characters of @a s within this string. If found, returns the index
+ * where it was found. If not found, returns npos.
+ */
+ size_type
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find position of a character of C string.
+ * @param s String containing characters to locate.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for one of the characters of
+ * @a s within this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_first_of(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_first_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find position of a character.
+ * @param c Character to locate.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for the character @a c within
+ * this string. If found, returns the index where it was found. If
+ * not found, returns npos.
+ *
+ * Note: equivalent to find(c, pos).
+ */
+ size_type
+ find_first_of(_CharT __c, size_type __pos = 0) const
+ { return this->find(__c, __pos); }
+
+ /**
+ * @brief Find last position of a character of string.
+ * @param str String containing characters to locate.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for one of the characters of
+ * @a str within this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_last_of(const basic_string& __str, size_type __pos = npos) const
+ { return this->find_last_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find last position of a character of C substring.
+ * @param s C string containing characters to locate.
+ * @param pos Index of character to search back from.
+ * @param n Number of characters from s to search for.
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for one of the first @a n
+ * characters of @a s within this string. If found, returns the index
+ * where it was found. If not found, returns npos.
+ */
+ size_type
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find last position of a character of C string.
+ * @param s C string containing characters to locate.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for one of the characters of
+ * @a s within this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_last_of(const _CharT* __s, size_type __pos = npos) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_last_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find last position of a character.
+ * @param c Character to locate.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for @a c within this string.
+ * If found, returns the index where it was found. If not found,
+ * returns npos.
+ *
+ * Note: equivalent to rfind(c, pos).
+ */
+ size_type
+ find_last_of(_CharT __c, size_type __pos = npos) const
+ { return this->rfind(__c, __pos); }
+
+ /**
+ * @brief Find position of a character not in string.
+ * @param str String containing characters to avoid.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for a character not contained
+ * in @a str within this string. If found, returns the index where it
+ * was found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(const basic_string& __str, size_type __pos = 0) const
+ { return this->find_first_not_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find position of a character not in C substring.
+ * @param s C string containing characters to avoid.
+ * @param pos Index of character to search from.
+ * @param n Number of characters from s to consider.
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for a character not contained
+ * in the first @a n characters of @a s within this string. If found,
+ * returns the index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const;
+
+ /**
+ * @brief Find position of a character not in C string.
+ * @param s C string containing characters to avoid.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for a character not contained
+ * in @a s within this string. If found, returns the index where it
+ * was found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_first_not_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find position of a different character.
+ * @param c Character to avoid.
+ * @param pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a pos, searches forward for a character other than @a c
+ * within this string. If found, returns the index where it was found.
+ * If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(_CharT __c, size_type __pos = 0) const;
+
+ /**
+ * @brief Find last position of a character not in string.
+ * @param str String containing characters to avoid.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for a character not
+ * contained in @a str within this string. If found, returns the index
+ * where it was found. If not found, returns npos.
+ */
+ size_type
+ find_last_not_of(const basic_string& __str, size_type __pos = npos) const
+ { return this->find_last_not_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find last position of a character not in C substring.
+ * @param s C string containing characters to avoid.
+ * @param pos Index of character to search back from.
+ * @param n Number of characters from s to consider.
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for a character not
+ * contained in the first @a n characters of @a s within this string.
+ * If found, returns the index where it was found. If not found,
+ * returns npos.
+ */
+ size_type
+ find_last_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const;
+ /**
+ * @brief Find last position of a character not in C string.
+ * @param s C string containing characters to avoid.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for a character not
+ * contained in @a s within this string. If found, returns the index
+ * where it was found. If not found, returns npos.
+ */
+ size_type
+ find_last_not_of(const _CharT* __s, size_type __pos = npos) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_last_not_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find last position of a different character.
+ * @param c Character to avoid.
+ * @param pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a pos, searches backward for a character other than
+ * @a c within this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_last_not_of(_CharT __c, size_type __pos = npos) const;
+
+ /**
+ * @brief Get a substring.
+ * @param pos Index of first character (default 0).
+ * @param n Number of characters in substring (default remainder).
+ * @return The new string.
+ * @throw std::out_of_range If pos > size().
+ *
+ * Construct and return a new string using the @a n characters starting
+ * at @a pos. If the string is too short, use the remainder of the
+ * characters. If @a pos is beyond the end of the string, out_of_range
+ * is thrown.
+ */
+ basic_string
+ substr(size_type __pos = 0, size_type __n = npos) const
+ { return basic_string(*this,
+ _M_check(__pos, "basic_string::substr"), __n); }
+
+ /**
+ * @brief Compare to a string.
+ * @param str String to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Returns an integer < 0 if this string is ordered before @a str, 0 if
+ * their values are equivalent, or > 0 if this string is ordered after
+ * @a str. Determines the effective length rlen of the strings to
+ * compare as the smallest of size() and str.size(). The function
+ * then compares the two strings by calling traits::compare(data(),
+ * str.data(),rlen). If the result of the comparison is nonzero returns
+ * it, otherwise the shorter one is ordered first.
+ */
+ int
+ compare(const basic_string& __str) const
+ {
+ const size_type __size = this->size();
+ const size_type __osize = __str.size();
+ const size_type __len = std::min(__size, __osize);
+
+ int __r = traits_type::compare(_M_data(), __str.data(), __len);
+ if (!__r)
+ __r = _S_compare(__size, __osize);
+ return __r;
+ }
+
+ /**
+ * @brief Compare substring to a string.
+ * @param pos Index of first character of substring.
+ * @param n Number of characters in substring.
+ * @param str String to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a n characters starting
+ * at @a pos. Returns an integer < 0 if the substring is ordered
+ * before @a str, 0 if their values are equivalent, or > 0 if the
+ * substring is ordered after @a str. Determines the effective length
+ * rlen of the strings to compare as the smallest of the length of the
+ * substring and @a str.size(). The function then compares the two
+ * strings by calling traits::compare(substring.data(),str.data(),rlen).
+ * If the result of the comparison is nonzero returns it, otherwise the
+ * shorter one is ordered first.
+ */
+ int
+ compare(size_type __pos, size_type __n, const basic_string& __str) const;
+
+ /**
+ * @brief Compare substring to a substring.
+ * @param pos1 Index of first character of substring.
+ * @param n1 Number of characters in substring.
+ * @param str String to compare against.
+ * @param pos2 Index of first character of substring of str.
+ * @param n2 Number of characters in substring of str.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a n1 characters starting
+ * at @a pos1. Form the substring of @a str from the @a n2 characters
+ * starting at @a pos2. Returns an integer < 0 if this substring is
+ * ordered before the substring of @a str, 0 if their values are
+ * equivalent, or > 0 if this substring is ordered after the substring
+ * of @a str. Determines the effective length rlen of the strings
+ * to compare as the smallest of the lengths of the substrings. The
+ * function then compares the two strings by calling
+ * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).
+ * If the result of the comparison is nonzero returns it, otherwise the
+ * shorter one is ordered first.
+ */
+ int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2) const;
+
+ /**
+ * @brief Compare to a C string.
+ * @param s C string to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Returns an integer < 0 if this string is ordered before @a s, 0 if
+ * their values are equivalent, or > 0 if this string is ordered after
+ * @a s. Determines the effective length rlen of the strings to
+ * compare as the smallest of size() and the length of a string
+ * constructed from @a s. The function then compares the two strings
+ * by calling traits::compare(data(),s,rlen). If the result of the
+ * comparison is nonzero returns it, otherwise the shorter one is
+ * ordered first.
+ */
+ int
+ compare(const _CharT* __s) const;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 5 String::compare specification questionable
+ /**
+ * @brief Compare substring to a C string.
+ * @param pos Index of first character of substring.
+ * @param n1 Number of characters in substring.
+ * @param s C string to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a n1 characters starting
+ * at @a pos. Returns an integer < 0 if the substring is ordered
+ * before @a s, 0 if their values are equivalent, or > 0 if the
+ * substring is ordered after @a s. Determines the effective length
+ * rlen of the strings to compare as the smallest of the length of the
+ * substring and the length of a string constructed from @a s. The
+ * function then compares the two string by calling
+ * traits::compare(substring.data(),s,rlen). If the result of the
+ * comparison is nonzero returns it, otherwise the shorter one is
+ * ordered first.
+ */
+ int
+ compare(size_type __pos, size_type __n1, const _CharT* __s) const;
+
+ /**
+ * @brief Compare substring against a character array.
+ * @param pos1 Index of first character of substring.
+ * @param n1 Number of characters in substring.
+ * @param s character array to compare against.
+ * @param n2 Number of characters of s.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a n1 characters starting
+ * at @a pos1. Form a string from the first @a n2 characters of @a s.
+ * Returns an integer < 0 if this substring is ordered before the string
+ * from @a s, 0 if their values are equivalent, or > 0 if this substring
+ * is ordered after the string from @a s. Determines the effective
+ * length rlen of the strings to compare as the smallest of the length
+ * of the substring and @a n2. The function then compares the two
+ * strings by calling traits::compare(substring.data(),s,rlen). If the
+ * result of the comparison is nonzero returns it, otherwise the shorter
+ * one is ordered first.
+ *
+ * NB: s must have at least n2 characters, '\\0' has no special
+ * meaning.
+ */
+ int
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2) const;
+ };
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_string<_CharT, _Traits, _Alloc>::
+ basic_string()
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
+#else
+ : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()) { }
+#endif
+
+ // operator+
+ /**
+ * @brief Concatenate two strings.
+ * @param lhs First string.
+ * @param rhs Last string.
+ * @return New string with value of @a lhs followed by @a rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ {
+ basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ /**
+ * @brief Concatenate C string and string.
+ * @param lhs First string.
+ * @param rhs Last string.
+ * @return New string with value of @a lhs followed by @a rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>
+ operator+(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Alloc>& __rhs);
+
+ /**
+ * @brief Concatenate character and string.
+ * @param lhs First string.
+ * @param rhs Last string.
+ * @return New string with @a lhs followed by @a rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT,_Traits,_Alloc>
+ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs);
+
+ /**
+ * @brief Concatenate string and C string.
+ * @param lhs First string.
+ * @param rhs Last string.
+ * @return New string with @a lhs followed by @a rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_string<_CharT, _Traits, _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ {
+ basic_string<_CharT, _Traits, _Alloc> __str(__lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ /**
+ * @brief Concatenate string and character.
+ * @param lhs First string.
+ * @param rhs Last string.
+ * @return New string with @a lhs followed by @a rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_string<_CharT, _Traits, _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
+ {
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __string_type::size_type __size_type;
+ __string_type __str(__lhs);
+ __str.append(__size_type(1), __rhs);
+ return __str;
+ }
+
+ // operator ==
+ /**
+ * @brief Test equivalence of two strings.
+ * @param lhs First string.
+ * @param rhs Second string.
+ * @return True if @a lhs.compare(@a rhs) == 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ template<typename _CharT>
+ inline
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type
+ operator==(const basic_string<_CharT>& __lhs,
+ const basic_string<_CharT>& __rhs)
+ { return (__lhs.size() == __rhs.size()
+ && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(),
+ __lhs.size())); }
+
+ /**
+ * @brief Test equivalence of C string and string.
+ * @param lhs C string.
+ * @param rhs String.
+ * @return True if @a rhs.compare(@a lhs) == 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator==(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) == 0; }
+
+ /**
+ * @brief Test equivalence of string and C string.
+ * @param lhs String.
+ * @param rhs C string.
+ * @return True if @a lhs.compare(@a rhs) == 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ // operator !=
+ /**
+ * @brief Test difference of two strings.
+ * @param lhs First string.
+ * @param rhs Second string.
+ * @return True if @a lhs.compare(@a rhs) != 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * @brief Test difference of C string and string.
+ * @param lhs C string.
+ * @param rhs String.
+ * @return True if @a rhs.compare(@a lhs) != 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator!=(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * @brief Test difference of string and C string.
+ * @param lhs String.
+ * @param rhs C string.
+ * @return True if @a lhs.compare(@a rhs) != 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return !(__lhs == __rhs); }
+
+ // operator <
+ /**
+ * @brief Test if string precedes string.
+ * @param lhs First string.
+ * @param rhs Second string.
+ * @return True if @a lhs precedes @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Test if string precedes C string.
+ * @param lhs String.
+ * @param rhs C string.
+ * @return True if @a lhs precedes @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Test if C string precedes string.
+ * @param lhs C string.
+ * @param rhs String.
+ * @return True if @a lhs precedes @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) > 0; }
+
+ // operator >
+ /**
+ * @brief Test if string follows string.
+ * @param lhs First string.
+ * @param rhs Second string.
+ * @return True if @a lhs follows @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Test if string follows C string.
+ * @param lhs String.
+ * @param rhs C string.
+ * @return True if @a lhs follows @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Test if C string follows string.
+ * @param lhs C string.
+ * @param rhs String.
+ * @return True if @a lhs follows @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) < 0; }
+
+ // operator <=
+ /**
+ * @brief Test if string doesn't follow string.
+ * @param lhs First string.
+ * @param rhs Second string.
+ * @return True if @a lhs doesn't follow @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Test if string doesn't follow C string.
+ * @param lhs String.
+ * @param rhs C string.
+ * @return True if @a lhs doesn't follow @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Test if C string doesn't follow string.
+ * @param lhs C string.
+ * @param rhs String.
+ * @return True if @a lhs doesn't follow @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator<=(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) >= 0; }
+
+ // operator >=
+ /**
+ * @brief Test if string doesn't precede string.
+ * @param lhs First string.
+ * @param rhs Second string.
+ * @return True if @a lhs doesn't precede @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Test if string doesn't precede C string.
+ * @param lhs String.
+ * @param rhs C string.
+ * @return True if @a lhs doesn't precede @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Test if C string doesn't precede string.
+ * @param lhs C string.
+ * @param rhs String.
+ * @return True if @a lhs doesn't precede @a rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline bool
+ operator>=(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { return __rhs.compare(__lhs) <= 0; }
+
+ /**
+ * @brief Swap contents of two strings.
+ * @param lhs First string.
+ * @param rhs Second string.
+ *
+ * Exchanges the contents of @a lhs and @a rhs in constant time.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline void
+ swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ /**
+ * @brief Read stream into a string.
+ * @param is Input stream.
+ * @param str Buffer to store into.
+ * @return Reference to the input stream.
+ *
+ * Stores characters from @a is into @a str until whitespace is found, the
+ * end of the stream is encountered, or str.max_size() is reached. If
+ * is.width() is non-zero, that is the limit on the number of characters
+ * stored into @a str. Any previous contents of @a str are erased.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str);
+
+ template<>
+ basic_istream<char>&
+ operator>>(basic_istream<char>& __is, basic_string<char>& __str);
+
+ /**
+ * @brief Write string to a stream.
+ * @param os Output stream.
+ * @param str String to write out.
+ * @return Reference to the output stream.
+ *
+ * Output characters of @a str into os following the same rules as for
+ * writing a C string.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT, _Traits, _Alloc>& __str)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 586. string inserter not a formatted function
+ return __ostream_insert(__os, __str.data(), __str.size());
+ }
+
+ /**
+ * @brief Read a line from stream into a string.
+ * @param is Input stream.
+ * @param str Buffer to store into.
+ * @param delim Character marking end of line.
+ * @return Reference to the input stream.
+ *
+ * Stores characters from @a is into @a str until @a delim is found, the
+ * end of the stream is encountered, or str.max_size() is reached. If
+ * is.width() is non-zero, that is the limit on the number of characters
+ * stored into @a str. Any previous contents of @a str are erased. If @a
+ * delim was encountered, it is extracted but not stored into @a str.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
+
+ /**
+ * @brief Read a line from stream into a string.
+ * @param is Input stream.
+ * @param str Buffer to store into.
+ * @return Reference to the input stream.
+ *
+ * Stores characters from is into @a str until '\n' is found, the end of
+ * the stream is encountered, or str.max_size() is reached. If is.width()
+ * is non-zero, that is the limit on the number of characters stored into
+ * @a str. Any previous contents of @a str are erased. If end of line was
+ * encountered, it is extracted but not stored into @a str.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ inline basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __is,
+ basic_string<_CharT, _Traits, _Alloc>& __str)
+ { return getline(__is, __str, __is.widen('\n')); }
+
+ template<>
+ basic_istream<char>&
+ getline(basic_istream<char>& __in, basic_string<char>& __str,
+ char __delim);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
+ wchar_t __delim);
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99) \
+ && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
+
+#include <ext/string_conversions.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 21.4 Numeric Conversions [string.conversions].
+ inline int
+ stoi(const string& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(),
+ __idx, __base); }
+
+ inline long
+ stol(const string& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long
+ stoul(const string& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(),
+ __idx, __base); }
+
+ inline long long
+ stoll(const string& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long long
+ stoull(const string& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(),
+ __idx, __base); }
+
+ // NB: strtof vs strtod.
+ inline float
+ stof(const string& __str, size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); }
+
+ inline double
+ stod(const string& __str, size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); }
+
+ inline long double
+ stold(const string& __str, size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); }
+
+ // NB: (v)snprintf vs sprintf.
+ inline string
+ to_string(long long __val)
+ { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
+ 4 * sizeof(long long),
+ "%lld", __val); }
+
+ inline string
+ to_string(unsigned long long __val)
+ { return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
+ 4 * sizeof(unsigned long long),
+ "%llu", __val); }
+
+ inline string
+ to_string(long double __val)
+ {
+ const int __n =
+ __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
+ "%Lf", __val);
+ }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ inline int
+ stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa<long, int>(&std::wcstol, "stoi", __str.c_str(),
+ __idx, __base); }
+
+ inline long
+ stol(const wstring& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long
+ stoul(const wstring& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(),
+ __idx, __base); }
+
+ inline long long
+ stoll(const wstring& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long long
+ stoull(const wstring& __str, size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(),
+ __idx, __base); }
+
+ // NB: wcstof vs wcstod.
+ inline float
+ stof(const wstring& __str, size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); }
+
+ inline double
+ stod(const wstring& __str, size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); }
+
+ inline long double
+ stold(const wstring& __str, size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); }
+
+ inline wstring
+ to_wstring(long long __val)
+ { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
+ 4 * sizeof(long long),
+ L"%lld", __val); }
+
+ inline wstring
+ to_wstring(unsigned long long __val)
+ { return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
+ 4 * sizeof(unsigned long long),
+ L"%llu", __val); }
+
+ inline wstring
+ to_wstring(long double __val)
+ {
+ const int __n =
+ __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
+ L"%Lf", __val);
+ }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#endif /* _BASIC_STRING_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/basic_string.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/basic_string.tcc
new file mode 100644
index 000000000..a5553c61a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/basic_string.tcc
@@ -0,0 +1,1144 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file basic_string.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+// Written by Jason Merrill based upon the specification by Takanori Adachi
+// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882.
+
+#ifndef _BASIC_STRING_TCC
+#define _BASIC_STRING_TCC 1
+
+#pragma GCC system_header
+
+#include <cxxabi-forced.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ const typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4;
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ const _CharT
+ basic_string<_CharT, _Traits, _Alloc>::
+ _Rep::_S_terminal = _CharT();
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ const typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::npos;
+
+ // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string)
+ // at static init time (before static ctors are run).
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[
+ (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) /
+ sizeof(size_type)];
+
+ // NB: This is the special case for Input Iterators, used in
+ // istreambuf_iterators, etc.
+ // Input Iterators have a cost structure very different from
+ // pointers, calling for a different coding style.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InIterator>
+ _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
+ input_iterator_tag)
+ {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ if (__beg == __end && __a == _Alloc())
+ return _S_empty_rep()._M_refdata();
+#endif
+ // Avoid reallocation for common case.
+ _CharT __buf[128];
+ size_type __len = 0;
+ while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))
+ {
+ __buf[__len++] = *__beg;
+ ++__beg;
+ }
+ _Rep* __r = _Rep::_S_create(__len, size_type(0), __a);
+ _M_copy(__r->_M_refdata(), __buf, __len);
+ __try
+ {
+ while (__beg != __end)
+ {
+ if (__len == __r->_M_capacity)
+ {
+ // Allocate more space.
+ _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);
+ _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len);
+ __r->_M_destroy(__a);
+ __r = __another;
+ }
+ __r->_M_refdata()[__len++] = *__beg;
+ ++__beg;
+ }
+ }
+ __catch(...)
+ {
+ __r->_M_destroy(__a);
+ __throw_exception_again;
+ }
+ __r->_M_set_length_and_sharable(__len);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template <typename _InIterator>
+ _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
+ forward_iterator_tag)
+ {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ if (__beg == __end && __a == _Alloc())
+ return _S_empty_rep()._M_refdata();
+#endif
+ // NB: Not required, but considered best practice.
+ if (__builtin_expect(__gnu_cxx::__is_null_pointer(__beg)
+ && __beg != __end, 0))
+ __throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
+
+ const size_type __dnew = static_cast<size_type>(std::distance(__beg,
+ __end));
+ // Check for out_of_range and length_error exceptions.
+ _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
+ __try
+ { _S_copy_chars(__r->_M_refdata(), __beg, __end); }
+ __catch(...)
+ {
+ __r->_M_destroy(__a);
+ __throw_exception_again;
+ }
+ __r->_M_set_length_and_sharable(__dnew);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::
+ _S_construct(size_type __n, _CharT __c, const _Alloc& __a)
+ {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ if (__n == 0 && __a == _Alloc())
+ return _S_empty_rep()._M_refdata();
+#endif
+ // Check for out_of_range and length_error exceptions.
+ _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
+ if (__n)
+ _M_assign(__r->_M_refdata(), __n, __c);
+
+ __r->_M_set_length_and_sharable(__n);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const basic_string& __str)
+ : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()),
+ __str.get_allocator()),
+ __str.get_allocator())
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const _Alloc& __a)
+ : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const basic_string& __str, size_type __pos, size_type __n)
+ : _M_dataplus(_S_construct(__str._M_data()
+ + __str._M_check(__pos,
+ "basic_string::basic_string"),
+ __str._M_data() + __str._M_limit(__pos, __n)
+ + __pos, _Alloc()), _Alloc())
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__str._M_data()
+ + __str._M_check(__pos,
+ "basic_string::basic_string"),
+ __str._M_data() + __str._M_limit(__pos, __n)
+ + __pos, __a), __a)
+ { }
+
+ // TBD: DPG annotate
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const _CharT* __s, size_type __n, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__s, __s + __n, __a), __a)
+ { }
+
+ // TBD: DPG annotate
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(const _CharT* __s, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) :
+ __s + npos, __a), __a)
+ { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(size_type __n, _CharT __c, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__n, __c, __a), __a)
+ { }
+
+ // TBD: DPG annotate
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InputIterator>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__beg, __end, __a), __a)
+ { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>::
+ basic_string(initializer_list<_CharT> __l, const _Alloc& __a)
+ : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a)
+ { }
+#endif
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ assign(const basic_string& __str)
+ {
+ if (_M_rep() != __str._M_rep())
+ {
+ // XXX MT
+ const allocator_type __a = this->get_allocator();
+ _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator());
+ _M_rep()->_M_dispose(__a);
+ _M_data(__tmp);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ assign(const _CharT* __s, size_type __n)
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ _M_check_length(this->size(), __n, "basic_string::assign");
+ if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
+ return _M_replace_safe(size_type(0), this->size(), __s, __n);
+ else
+ {
+ // Work in-place.
+ const size_type __pos = __s - _M_data();
+ if (__pos >= __n)
+ _M_copy(_M_data(), __s, __n);
+ else if (__pos)
+ _M_move(_M_data(), __s, __n);
+ _M_rep()->_M_set_length_and_sharable(__n);
+ return *this;
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ append(size_type __n, _CharT __c)
+ {
+ if (__n)
+ {
+ _M_check_length(size_type(0), __n, "basic_string::append");
+ const size_type __len = __n + this->size();
+ if (__len > this->capacity() || _M_rep()->_M_is_shared())
+ this->reserve(__len);
+ _M_assign(_M_data() + this->size(), __n, __c);
+ _M_rep()->_M_set_length_and_sharable(__len);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ append(const _CharT* __s, size_type __n)
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ if (__n)
+ {
+ _M_check_length(size_type(0), __n, "basic_string::append");
+ const size_type __len = __n + this->size();
+ if (__len > this->capacity() || _M_rep()->_M_is_shared())
+ {
+ if (_M_disjunct(__s))
+ this->reserve(__len);
+ else
+ {
+ const size_type __off = __s - _M_data();
+ this->reserve(__len);
+ __s = _M_data() + __off;
+ }
+ }
+ _M_copy(_M_data() + this->size(), __s, __n);
+ _M_rep()->_M_set_length_and_sharable(__len);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ append(const basic_string& __str)
+ {
+ const size_type __size = __str.size();
+ if (__size)
+ {
+ const size_type __len = __size + this->size();
+ if (__len > this->capacity() || _M_rep()->_M_is_shared())
+ this->reserve(__len);
+ _M_copy(_M_data() + this->size(), __str._M_data(), __size);
+ _M_rep()->_M_set_length_and_sharable(__len);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ append(const basic_string& __str, size_type __pos, size_type __n)
+ {
+ __str._M_check(__pos, "basic_string::append");
+ __n = __str._M_limit(__pos, __n);
+ if (__n)
+ {
+ const size_type __len = __n + this->size();
+ if (__len > this->capacity() || _M_rep()->_M_is_shared())
+ this->reserve(__len);
+ _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n);
+ _M_rep()->_M_set_length_and_sharable(__len);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ insert(size_type __pos, const _CharT* __s, size_type __n)
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ _M_check(__pos, "basic_string::insert");
+ _M_check_length(size_type(0), __n, "basic_string::insert");
+ if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
+ return _M_replace_safe(__pos, size_type(0), __s, __n);
+ else
+ {
+ // Work in-place.
+ const size_type __off = __s - _M_data();
+ _M_mutate(__pos, 0, __n);
+ __s = _M_data() + __off;
+ _CharT* __p = _M_data() + __pos;
+ if (__s + __n <= __p)
+ _M_copy(__p, __s, __n);
+ else if (__s >= __p)
+ _M_copy(__p, __s + __n, __n);
+ else
+ {
+ const size_type __nleft = __p - __s;
+ _M_copy(__p, __s, __nleft);
+ _M_copy(__p + __nleft, __p + __n, __n - __nleft);
+ }
+ return *this;
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ replace(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2)
+ {
+ __glibcxx_requires_string_len(__s, __n2);
+ _M_check(__pos, "basic_string::replace");
+ __n1 = _M_limit(__pos, __n1);
+ _M_check_length(__n1, __n2, "basic_string::replace");
+ bool __left;
+ if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
+ return _M_replace_safe(__pos, __n1, __s, __n2);
+ else if ((__left = __s + __n2 <= _M_data() + __pos)
+ || _M_data() + __pos + __n1 <= __s)
+ {
+ // Work in-place: non-overlapping case.
+ size_type __off = __s - _M_data();
+ __left ? __off : (__off += __n2 - __n1);
+ _M_mutate(__pos, __n1, __n2);
+ _M_copy(_M_data() + __pos, _M_data() + __off, __n2);
+ return *this;
+ }
+ else
+ {
+ // Todo: overlapping case.
+ const basic_string __tmp(__s, __n2);
+ return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2);
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _M_destroy(const _Alloc& __a) throw ()
+ {
+ const size_type __size = sizeof(_Rep_base) +
+ (this->_M_capacity + 1) * sizeof(_CharT);
+ _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_leak_hard()
+ {
+#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
+ if (_M_rep() == &_S_empty_rep())
+ return;
+#endif
+ if (_M_rep()->_M_is_shared())
+ _M_mutate(0, 0, 0);
+ _M_rep()->_M_set_leaked();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_mutate(size_type __pos, size_type __len1, size_type __len2)
+ {
+ const size_type __old_size = this->size();
+ const size_type __new_size = __old_size + __len2 - __len1;
+ const size_type __how_much = __old_size - __pos - __len1;
+
+ if (__new_size > this->capacity() || _M_rep()->_M_is_shared())
+ {
+ // Must reallocate.
+ const allocator_type __a = get_allocator();
+ _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a);
+
+ if (__pos)
+ _M_copy(__r->_M_refdata(), _M_data(), __pos);
+ if (__how_much)
+ _M_copy(__r->_M_refdata() + __pos + __len2,
+ _M_data() + __pos + __len1, __how_much);
+
+ _M_rep()->_M_dispose(__a);
+ _M_data(__r->_M_refdata());
+ }
+ else if (__how_much && __len1 != __len2)
+ {
+ // Work in-place.
+ _M_move(_M_data() + __pos + __len2,
+ _M_data() + __pos + __len1, __how_much);
+ }
+ _M_rep()->_M_set_length_and_sharable(__new_size);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::
+ reserve(size_type __res)
+ {
+ if (__res != this->capacity() || _M_rep()->_M_is_shared())
+ {
+ // Make sure we don't shrink below the current size
+ if (__res < this->size())
+ __res = this->size();
+ const allocator_type __a = get_allocator();
+ _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());
+ _M_rep()->_M_dispose(__a);
+ _M_data(__tmp);
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::
+ swap(basic_string& __s)
+ {
+ if (_M_rep()->_M_is_leaked())
+ _M_rep()->_M_set_sharable();
+ if (__s._M_rep()->_M_is_leaked())
+ __s._M_rep()->_M_set_sharable();
+ if (this->get_allocator() == __s.get_allocator())
+ {
+ _CharT* __tmp = _M_data();
+ _M_data(__s._M_data());
+ __s._M_data(__tmp);
+ }
+ // The code below can usually be optimized away.
+ else
+ {
+ const basic_string __tmp1(_M_ibegin(), _M_iend(),
+ __s.get_allocator());
+ const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(),
+ this->get_allocator());
+ *this = __tmp2;
+ __s = __tmp1;
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::_Rep*
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _S_create(size_type __capacity, size_type __old_capacity,
+ const _Alloc& __alloc)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 83. String::npos vs. string::max_size()
+ if (__capacity > _S_max_size)
+ __throw_length_error(__N("basic_string::_S_create"));
+
+ // The standard places no restriction on allocating more memory
+ // than is strictly needed within this layer at the moment or as
+ // requested by an explicit application call to reserve().
+
+ // Many malloc implementations perform quite poorly when an
+ // application attempts to allocate memory in a stepwise fashion
+ // growing each allocation size by only 1 char. Additionally,
+ // it makes little sense to allocate less linear memory than the
+ // natural blocking size of the malloc implementation.
+ // Unfortunately, we would need a somewhat low-level calculation
+ // with tuned parameters to get this perfect for any particular
+ // malloc implementation. Fortunately, generalizations about
+ // common features seen among implementations seems to suffice.
+
+ // __pagesize need not match the actual VM page size for good
+ // results in practice, thus we pick a common value on the low
+ // side. __malloc_header_size is an estimate of the amount of
+ // overhead per memory allocation (in practice seen N * sizeof
+ // (void*) where N is 0, 2 or 4). According to folklore,
+ // picking this value on the high side is better than
+ // low-balling it (especially when this algorithm is used with
+ // malloc implementations that allocate memory blocks rounded up
+ // to a size which is a power of 2).
+ const size_type __pagesize = 4096;
+ const size_type __malloc_header_size = 4 * sizeof(void*);
+
+ // The below implements an exponential growth policy, necessary to
+ // meet amortized linear time requirements of the library: see
+ // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
+ // It's active for allocations requiring an amount of memory above
+ // system pagesize. This is consistent with the requirements of the
+ // standard: http://gcc.gnu.org/ml/libstdc++/2001-07/msg00130.html
+ if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
+ __capacity = 2 * __old_capacity;
+
+ // NB: Need an array of char_type[__capacity], plus a terminating
+ // null char_type() element, plus enough for the _Rep data structure.
+ // Whew. Seemingly so needy, yet so elemental.
+ size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
+
+ const size_type __adj_size = __size + __malloc_header_size;
+ if (__adj_size > __pagesize && __capacity > __old_capacity)
+ {
+ const size_type __extra = __pagesize - __adj_size % __pagesize;
+ __capacity += __extra / sizeof(_CharT);
+ // Never allocate a string bigger than _S_max_size.
+ if (__capacity > _S_max_size)
+ __capacity = _S_max_size;
+ __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);
+ }
+
+ // NB: Might throw, but no worries about a leak, mate: _Rep()
+ // does not throw.
+ void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);
+ _Rep *__p = new (__place) _Rep;
+ __p->_M_capacity = __capacity;
+ // ABI compatibility - 3.4.x set in _S_create both
+ // _M_refcount and _M_length. All callers of _S_create
+ // in basic_string.tcc then set just _M_length.
+ // In 4.0.x and later both _M_refcount and _M_length
+ // are initialized in the callers, unfortunately we can
+ // have 3.4.x compiled code with _S_create callers inlined
+ // calling 4.0.x+ _S_create.
+ __p->_M_set_sharable();
+ return __p;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ basic_string<_CharT, _Traits, _Alloc>::_Rep::
+ _M_clone(const _Alloc& __alloc, size_type __res)
+ {
+ // Requested capacity of the clone.
+ const size_type __requested_cap = this->_M_length + __res;
+ _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity,
+ __alloc);
+ if (this->_M_length)
+ _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length);
+
+ __r->_M_set_length_and_sharable(this->_M_length);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ basic_string<_CharT, _Traits, _Alloc>::
+ resize(size_type __n, _CharT __c)
+ {
+ const size_type __size = this->size();
+ _M_check_length(__size, __n, "basic_string::resize");
+ if (__size < __n)
+ this->append(__n - __size, __c);
+ else if (__n < __size)
+ this->erase(__n);
+ // else nothing (in particular, avoid calling _M_mutate() unnecessarily.)
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InputIterator>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
+ _InputIterator __k2, __false_type)
+ {
+ const basic_string __s(__k1, __k2);
+ const size_type __n1 = __i2 - __i1;
+ _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch");
+ return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(),
+ __s.size());
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
+ _CharT __c)
+ {
+ _M_check_length(__n1, __n2, "basic_string::_M_replace_aux");
+ _M_mutate(__pos1, __n1, __n2);
+ if (__n2)
+ _M_assign(_M_data() + __pos1, __n2, __c);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>&
+ basic_string<_CharT, _Traits, _Alloc>::
+ _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,
+ size_type __n2)
+ {
+ _M_mutate(__pos1, __n1, __n2);
+ if (__n2)
+ _M_copy(_M_data() + __pos1, __s, __n2);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>
+ operator+(const _CharT* __lhs,
+ const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ {
+ __glibcxx_requires_string(__lhs);
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __string_type::size_type __size_type;
+ const __size_type __len = _Traits::length(__lhs);
+ __string_type __str;
+ __str.reserve(__len + __rhs.size());
+ __str.append(__lhs, __len);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_string<_CharT, _Traits, _Alloc>
+ operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ {
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __string_type::size_type __size_type;
+ __string_type __str;
+ const __size_type __len = __rhs.size();
+ __str.reserve(__len + 1);
+ __str.append(__size_type(1), __lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ copy(_CharT* __s, size_type __n, size_type __pos) const
+ {
+ _M_check(__pos, "basic_string::copy");
+ __n = _M_limit(__pos, __n);
+ __glibcxx_requires_string_len(__s, __n);
+ if (__n)
+ _M_copy(__s, _M_data() + __pos, __n);
+ // 21.3.5.7 par 3: do not append null. (good.)
+ return __n;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ const size_type __size = this->size();
+ const _CharT* __data = _M_data();
+
+ if (__n == 0)
+ return __pos <= __size ? __pos : npos;
+
+ if (__n <= __size)
+ {
+ for (; __pos <= __size - __n; ++__pos)
+ if (traits_type::eq(__data[__pos], __s[0])
+ && traits_type::compare(__data + __pos + 1,
+ __s + 1, __n - 1) == 0)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find(_CharT __c, size_type __pos) const
+ {
+ size_type __ret = npos;
+ const size_type __size = this->size();
+ if (__pos < __size)
+ {
+ const _CharT* __data = _M_data();
+ const size_type __n = __size - __pos;
+ const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
+ if (__p)
+ __ret = __p - __data;
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ const size_type __size = this->size();
+ if (__n <= __size)
+ {
+ __pos = std::min(size_type(__size - __n), __pos);
+ const _CharT* __data = _M_data();
+ do
+ {
+ if (traits_type::compare(__data + __pos, __s, __n) == 0)
+ return __pos;
+ }
+ while (__pos-- > 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ rfind(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ for (++__size; __size-- > 0; )
+ if (traits_type::eq(_M_data()[__size], __c))
+ return __size;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ for (; __n && __pos < this->size(); ++__pos)
+ {
+ const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);
+ if (__p)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ size_type __size = this->size();
+ if (__size && __n)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (traits_type::find(__s, __n, _M_data()[__size]))
+ return __size;
+ }
+ while (__size-- != 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ for (; __pos < this->size(); ++__pos)
+ if (!traits_type::find(__s, __n, _M_data()[__pos]))
+ return __pos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_first_not_of(_CharT __c, size_type __pos) const
+ {
+ for (; __pos < this->size(); ++__pos)
+ if (!traits_type::eq(_M_data()[__pos], __c))
+ return __pos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::find(__s, __n, _M_data()[__size]))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename basic_string<_CharT, _Traits, _Alloc>::size_type
+ basic_string<_CharT, _Traits, _Alloc>::
+ find_last_not_of(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::eq(_M_data()[__size], __c))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string<_CharT, _Traits, _Alloc>::
+ compare(size_type __pos, size_type __n, const basic_string& __str) const
+ {
+ _M_check(__pos, "basic_string::compare");
+ __n = _M_limit(__pos, __n);
+ const size_type __osize = __str.size();
+ const size_type __len = std::min(__n, __osize);
+ int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);
+ if (!__r)
+ __r = _S_compare(__n, __osize);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string<_CharT, _Traits, _Alloc>::
+ compare(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2) const
+ {
+ _M_check(__pos1, "basic_string::compare");
+ __str._M_check(__pos2, "basic_string::compare");
+ __n1 = _M_limit(__pos1, __n1);
+ __n2 = __str._M_limit(__pos2, __n2);
+ const size_type __len = std::min(__n1, __n2);
+ int __r = traits_type::compare(_M_data() + __pos1,
+ __str.data() + __pos2, __len);
+ if (!__r)
+ __r = _S_compare(__n1, __n2);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string<_CharT, _Traits, _Alloc>::
+ compare(const _CharT* __s) const
+ {
+ __glibcxx_requires_string(__s);
+ const size_type __size = this->size();
+ const size_type __osize = traits_type::length(__s);
+ const size_type __len = std::min(__size, __osize);
+ int __r = traits_type::compare(_M_data(), __s, __len);
+ if (!__r)
+ __r = _S_compare(__size, __osize);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string <_CharT, _Traits, _Alloc>::
+ compare(size_type __pos, size_type __n1, const _CharT* __s) const
+ {
+ __glibcxx_requires_string(__s);
+ _M_check(__pos, "basic_string::compare");
+ __n1 = _M_limit(__pos, __n1);
+ const size_type __osize = traits_type::length(__s);
+ const size_type __len = std::min(__n1, __osize);
+ int __r = traits_type::compare(_M_data() + __pos, __s, __len);
+ if (!__r)
+ __r = _S_compare(__n1, __osize);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ int
+ basic_string <_CharT, _Traits, _Alloc>::
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2) const
+ {
+ __glibcxx_requires_string_len(__s, __n2);
+ _M_check(__pos, "basic_string::compare");
+ __n1 = _M_limit(__pos, __n1);
+ const size_type __len = std::min(__n1, __n2);
+ int __r = traits_type::compare(_M_data() + __pos, __s, __len);
+ if (!__r)
+ __r = _S_compare(__n1, __n2);
+ return __r;
+ }
+
+ // 21.3.7.9 basic_string::getline and operators
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in,
+ basic_string<_CharT, _Traits, _Alloc>& __str)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __istream_type::ios_base __ios_base;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __string_type::size_type __size_type;
+ typedef ctype<_CharT> __ctype_type;
+ typedef typename __ctype_type::ctype_base __ctype_base;
+
+ __size_type __extracted = 0;
+ typename __ios_base::iostate __err = __ios_base::goodbit;
+ typename __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ __try
+ {
+ // Avoid reallocation for common case.
+ __str.erase();
+ _CharT __buf[128];
+ __size_type __len = 0;
+ const streamsize __w = __in.width();
+ const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)
+ : __str.max_size();
+ const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
+ const __int_type __eof = _Traits::eof();
+ __int_type __c = __in.rdbuf()->sgetc();
+
+ while (__extracted < __n
+ && !_Traits::eq_int_type(__c, __eof)
+ && !__ct.is(__ctype_base::space,
+ _Traits::to_char_type(__c)))
+ {
+ if (__len == sizeof(__buf) / sizeof(_CharT))
+ {
+ __str.append(__buf, sizeof(__buf) / sizeof(_CharT));
+ __len = 0;
+ }
+ __buf[__len++] = _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __in.rdbuf()->snextc();
+ }
+ __str.append(__buf, __len);
+
+ if (_Traits::eq_int_type(__c, __eof))
+ __err |= __ios_base::eofbit;
+ __in.width(0);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(__ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 91. Description of operator>> and getline() for string<>
+ // might cause endless loop
+ __in._M_setstate(__ios_base::badbit);
+ }
+ }
+ // 211. operator>>(istream&, string&) doesn't set failbit
+ if (!__extracted)
+ __err |= __ios_base::failbit;
+ if (__err)
+ __in.setstate(__err);
+ return __in;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __in,
+ basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef typename __istream_type::ios_base __ios_base;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __string_type::size_type __size_type;
+
+ __size_type __extracted = 0;
+ const __size_type __n = __str.max_size();
+ typename __ios_base::iostate __err = __ios_base::goodbit;
+ typename __istream_type::sentry __cerb(__in, true);
+ if (__cerb)
+ {
+ __try
+ {
+ __str.erase();
+ const __int_type __idelim = _Traits::to_int_type(__delim);
+ const __int_type __eof = _Traits::eof();
+ __int_type __c = __in.rdbuf()->sgetc();
+
+ while (__extracted < __n
+ && !_Traits::eq_int_type(__c, __eof)
+ && !_Traits::eq_int_type(__c, __idelim))
+ {
+ __str += _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __in.rdbuf()->snextc();
+ }
+
+ if (_Traits::eq_int_type(__c, __eof))
+ __err |= __ios_base::eofbit;
+ else if (_Traits::eq_int_type(__c, __idelim))
+ {
+ ++__extracted;
+ __in.rdbuf()->sbumpc();
+ }
+ else
+ __err |= __ios_base::failbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(__ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 91. Description of operator>> and getline() for string<>
+ // might cause endless loop
+ __in._M_setstate(__ios_base::badbit);
+ }
+ }
+ if (!__extracted)
+ __err |= __ios_base::failbit;
+ if (__err)
+ __in.setstate(__err);
+ return __in;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE > 0
+ extern template class basic_string<char>;
+ extern template
+ basic_istream<char>&
+ operator>>(basic_istream<char>&, string&);
+ extern template
+ basic_ostream<char>&
+ operator<<(basic_ostream<char>&, const string&);
+ extern template
+ basic_istream<char>&
+ getline(basic_istream<char>&, string&, char);
+ extern template
+ basic_istream<char>&
+ getline(basic_istream<char>&, string&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_string<wchar_t>;
+ extern template
+ basic_istream<wchar_t>&
+ operator>>(basic_istream<wchar_t>&, wstring&);
+ extern template
+ basic_ostream<wchar_t>&
+ operator<<(basic_ostream<wchar_t>&, const wstring&);
+ extern template
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>&, wstring&, wchar_t);
+ extern template
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>&, wstring&);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/boost_concept_check.h b/gcc-4.4.0/libstdc++-v3/include/bits/boost_concept_check.h
new file mode 100644
index 000000000..054fcf27e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/boost_concept_check.h
@@ -0,0 +1,787 @@
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
+// sell and distribute this software is granted provided this
+// copyright notice appears in all copies. This software is provided
+// "as is" without express or implied warranty, and with no claim as
+// to its suitability for any purpose.
+//
+
+/** @file boost_concept_check.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// GCC Note: based on version 1.12.0 of the Boost library.
+
+#ifndef _BOOST_CONCEPT_CHECK_H
+#define _BOOST_CONCEPT_CHECK_H 1
+
+#pragma GCC system_header
+
+#include <cstddef> // for ptrdiff_t, used next
+#include <bits/stl_iterator_base_types.h> // for traits and tags
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#define _IsUnused __attribute__ ((__unused__))
+
+// When the C-C code is in use, we would like this function to do as little
+// as possible at runtime, use as few resources as possible, and hopefully
+// be elided out of existence... hmmm.
+template <class _Concept>
+inline void __function_requires()
+{
+ void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;
+}
+
+// No definition: if this is referenced, there's a problem with
+// the instantiating type not being one of the required integer types.
+// Unfortunately, this results in a link-time error, not a compile-time error.
+void __error_type_must_be_an_integer_type();
+void __error_type_must_be_an_unsigned_integer_type();
+void __error_type_must_be_a_signed_integer_type();
+
+// ??? Should the "concept_checking*" structs begin with more than _ ?
+#define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \
+ typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \
+ template <_func##_type_var##_concept _Tp1> \
+ struct _concept_checking##_type_var##_concept { }; \
+ typedef _concept_checking##_type_var##_concept< \
+ &_ns::_concept <_type_var>::__constraints> \
+ _concept_checking_typedef##_type_var##_concept
+
+#define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \
+ typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \
+ template <_func##_type_var1##_type_var2##_concept _Tp1> \
+ struct _concept_checking##_type_var1##_type_var2##_concept { }; \
+ typedef _concept_checking##_type_var1##_type_var2##_concept< \
+ &_ns::_concept <_type_var1,_type_var2>::__constraints> \
+ _concept_checking_typedef##_type_var1##_type_var2##_concept
+
+#define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \
+ typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \
+ template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \
+ struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \
+ typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \
+ &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \
+ _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept
+
+#define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \
+ typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \
+ template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \
+ struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \
+ typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \
+ &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \
+ _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept
+
+
+template <class _Tp1, class _Tp2>
+struct _Aux_require_same { };
+
+template <class _Tp>
+struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
+
+ template <class _Tp1, class _Tp2>
+ struct _SameTypeConcept
+ {
+ void __constraints() {
+ typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required;
+ }
+ };
+
+ template <class _Tp>
+ struct _IntegerConcept {
+ void __constraints() {
+ __error_type_must_be_an_integer_type();
+ }
+ };
+ template <> struct _IntegerConcept<short> { void __constraints() {} };
+ template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };
+ template <> struct _IntegerConcept<int> { void __constraints() {} };
+ template <> struct _IntegerConcept<unsigned int> { void __constraints() {} };
+ template <> struct _IntegerConcept<long> { void __constraints() {} };
+ template <> struct _IntegerConcept<unsigned long> { void __constraints() {} };
+ template <> struct _IntegerConcept<long long> { void __constraints() {} };
+ template <> struct _IntegerConcept<unsigned long long>
+ { void __constraints() {} };
+
+ template <class _Tp>
+ struct _SignedIntegerConcept {
+ void __constraints() {
+ __error_type_must_be_a_signed_integer_type();
+ }
+ };
+ template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
+ template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
+ template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
+ template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
+
+ template <class _Tp>
+ struct _UnsignedIntegerConcept {
+ void __constraints() {
+ __error_type_must_be_an_unsigned_integer_type();
+ }
+ };
+ template <> struct _UnsignedIntegerConcept<unsigned short>
+ { void __constraints() {} };
+ template <> struct _UnsignedIntegerConcept<unsigned int>
+ { void __constraints() {} };
+ template <> struct _UnsignedIntegerConcept<unsigned long>
+ { void __constraints() {} };
+ template <> struct _UnsignedIntegerConcept<unsigned long long>
+ { void __constraints() {} };
+
+ //===========================================================================
+ // Basic Concepts
+
+ template <class _Tp>
+ struct _DefaultConstructibleConcept
+ {
+ void __constraints() {
+ _Tp __a _IsUnused; // require default constructor
+ }
+ };
+
+ template <class _Tp>
+ struct _AssignableConcept
+ {
+ void __constraints() {
+ __a = __a; // require assignment operator
+ __const_constraints(__a);
+ }
+ void __const_constraints(const _Tp& __b) {
+ __a = __b; // const required for argument to assignment
+ }
+ _Tp __a;
+ // possibly should be "Tp* a;" and then dereference "a" in constraint
+ // functions? present way would require a default ctor, i think...
+ };
+
+ template <class _Tp>
+ struct _CopyConstructibleConcept
+ {
+ void __constraints() {
+ _Tp __a(__b); // require copy constructor
+ _Tp* __ptr _IsUnused = &__a; // require address of operator
+ __const_constraints(__a);
+ }
+ void __const_constraints(const _Tp& __a) {
+ _Tp __c _IsUnused(__a); // require const copy constructor
+ const _Tp* __ptr _IsUnused = &__a; // require const address of operator
+ }
+ _Tp __b;
+ };
+
+ // The SGI STL version of Assignable requires copy constructor and operator=
+ template <class _Tp>
+ struct _SGIAssignableConcept
+ {
+ void __constraints() {
+ _Tp __b _IsUnused(__a);
+ __a = __a; // require assignment operator
+ __const_constraints(__a);
+ }
+ void __const_constraints(const _Tp& __b) {
+ _Tp __c _IsUnused(__b);
+ __a = __b; // const required for argument to assignment
+ }
+ _Tp __a;
+ };
+
+ template <class _From, class _To>
+ struct _ConvertibleConcept
+ {
+ void __constraints() {
+ _To __y _IsUnused = __x;
+ }
+ _From __x;
+ };
+
+ // The C++ standard requirements for many concepts talk about return
+ // types that must be "convertible to bool". The problem with this
+ // requirement is that it leaves the door open for evil proxies that
+ // define things like operator|| with strange return types. Two
+ // possible solutions are:
+ // 1) require the return type to be exactly bool
+ // 2) stay with convertible to bool, and also
+ // specify stuff about all the logical operators.
+ // For now we just test for convertible to bool.
+ template <class _Tp>
+ void __aux_require_boolean_expr(const _Tp& __t) {
+ bool __x _IsUnused = __t;
+ }
+
+// FIXME
+ template <class _Tp>
+ struct _EqualityComparableConcept
+ {
+ void __constraints() {
+ __aux_require_boolean_expr(__a == __b);
+ }
+ _Tp __a, __b;
+ };
+
+ template <class _Tp>
+ struct _LessThanComparableConcept
+ {
+ void __constraints() {
+ __aux_require_boolean_expr(__a < __b);
+ }
+ _Tp __a, __b;
+ };
+
+ // This is equivalent to SGI STL's LessThanComparable.
+ template <class _Tp>
+ struct _ComparableConcept
+ {
+ void __constraints() {
+ __aux_require_boolean_expr(__a < __b);
+ __aux_require_boolean_expr(__a > __b);
+ __aux_require_boolean_expr(__a <= __b);
+ __aux_require_boolean_expr(__a >= __b);
+ }
+ _Tp __a, __b;
+ };
+
+#define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \
+ template <class _First, class _Second> \
+ struct _NAME { \
+ void __constraints() { (void)__constraints_(); } \
+ bool __constraints_() { \
+ return __a _OP __b; \
+ } \
+ _First __a; \
+ _Second __b; \
+ }
+
+#define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \
+ template <class _Ret, class _First, class _Second> \
+ struct _NAME { \
+ void __constraints() { (void)__constraints_(); } \
+ _Ret __constraints_() { \
+ return __a _OP __b; \
+ } \
+ _First __a; \
+ _Second __b; \
+ }
+
+ _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept);
+ _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept);
+ _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept);
+ _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept);
+ _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept);
+ _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept);
+
+ _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept);
+ _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept);
+ _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept);
+ _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept);
+ _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept);
+
+#undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
+#undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT
+
+ //===========================================================================
+ // Function Object Concepts
+
+ template <class _Func, class _Return>
+ struct _GeneratorConcept
+ {
+ void __constraints() {
+ const _Return& __r _IsUnused = __f();// require operator() member function
+ }
+ _Func __f;
+ };
+
+
+ template <class _Func>
+ struct _GeneratorConcept<_Func,void>
+ {
+ void __constraints() {
+ __f(); // require operator() member function
+ }
+ _Func __f;
+ };
+
+ template <class _Func, class _Return, class _Arg>
+ struct _UnaryFunctionConcept
+ {
+ void __constraints() {
+ __r = __f(__arg); // require operator()
+ }
+ _Func __f;
+ _Arg __arg;
+ _Return __r;
+ };
+
+ template <class _Func, class _Arg>
+ struct _UnaryFunctionConcept<_Func, void, _Arg> {
+ void __constraints() {
+ __f(__arg); // require operator()
+ }
+ _Func __f;
+ _Arg __arg;
+ };
+
+ template <class _Func, class _Return, class _First, class _Second>
+ struct _BinaryFunctionConcept
+ {
+ void __constraints() {
+ __r = __f(__first, __second); // require operator()
+ }
+ _Func __f;
+ _First __first;
+ _Second __second;
+ _Return __r;
+ };
+
+ template <class _Func, class _First, class _Second>
+ struct _BinaryFunctionConcept<_Func, void, _First, _Second>
+ {
+ void __constraints() {
+ __f(__first, __second); // require operator()
+ }
+ _Func __f;
+ _First __first;
+ _Second __second;
+ };
+
+ template <class _Func, class _Arg>
+ struct _UnaryPredicateConcept
+ {
+ void __constraints() {
+ __aux_require_boolean_expr(__f(__arg)); // require op() returning bool
+ }
+ _Func __f;
+ _Arg __arg;
+ };
+
+ template <class _Func, class _First, class _Second>
+ struct _BinaryPredicateConcept
+ {
+ void __constraints() {
+ __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool
+ }
+ _Func __f;
+ _First __a;
+ _Second __b;
+ };
+
+ // use this when functor is used inside a container class like std::set
+ template <class _Func, class _First, class _Second>
+ struct _Const_BinaryPredicateConcept {
+ void __constraints() {
+ __const_constraints(__f);
+ }
+ void __const_constraints(const _Func& __fun) {
+ __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >();
+ // operator() must be a const member function
+ __aux_require_boolean_expr(__fun(__a, __b));
+ }
+ _Func __f;
+ _First __a;
+ _Second __b;
+ };
+
+ //===========================================================================
+ // Iterator Concepts
+
+ template <class _Tp>
+ struct _TrivialIteratorConcept
+ {
+ void __constraints() {
+// __function_requires< _DefaultConstructibleConcept<_Tp> >();
+ __function_requires< _AssignableConcept<_Tp> >();
+ __function_requires< _EqualityComparableConcept<_Tp> >();
+// typedef typename std::iterator_traits<_Tp>::value_type _V;
+ (void)*__i; // require dereference operator
+ }
+ _Tp __i;
+ };
+
+ template <class _Tp>
+ struct _Mutable_TrivialIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _TrivialIteratorConcept<_Tp> >();
+ *__i = *__j; // require dereference and assignment
+ }
+ _Tp __i, __j;
+ };
+
+ template <class _Tp>
+ struct _InputIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _TrivialIteratorConcept<_Tp> >();
+ // require iterator_traits typedef's
+ typedef typename std::iterator_traits<_Tp>::difference_type _Diff;
+// __function_requires< _SignedIntegerConcept<_Diff> >();
+ typedef typename std::iterator_traits<_Tp>::reference _Ref;
+ typedef typename std::iterator_traits<_Tp>::pointer _Pt;
+ typedef typename std::iterator_traits<_Tp>::iterator_category _Cat;
+ __function_requires< _ConvertibleConcept<
+ typename std::iterator_traits<_Tp>::iterator_category,
+ std::input_iterator_tag> >();
+ ++__i; // require preincrement operator
+ __i++; // require postincrement operator
+ }
+ _Tp __i;
+ };
+
+ template <class _Tp, class _ValueT>
+ struct _OutputIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _AssignableConcept<_Tp> >();
+ ++__i; // require preincrement operator
+ __i++; // require postincrement operator
+ *__i++ = __t; // require postincrement and assignment
+ }
+ _Tp __i;
+ _ValueT __t;
+ };
+
+ template <class _Tp>
+ struct _ForwardIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _InputIteratorConcept<_Tp> >();
+ __function_requires< _DefaultConstructibleConcept<_Tp> >();
+ __function_requires< _ConvertibleConcept<
+ typename std::iterator_traits<_Tp>::iterator_category,
+ std::forward_iterator_tag> >();
+ typedef typename std::iterator_traits<_Tp>::reference _Ref;
+ _Ref __r _IsUnused = *__i;
+ }
+ _Tp __i;
+ };
+
+ template <class _Tp>
+ struct _Mutable_ForwardIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _ForwardIteratorConcept<_Tp> >();
+ *__i++ = *__i; // require postincrement and assignment
+ }
+ _Tp __i;
+ };
+
+ template <class _Tp>
+ struct _BidirectionalIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _ForwardIteratorConcept<_Tp> >();
+ __function_requires< _ConvertibleConcept<
+ typename std::iterator_traits<_Tp>::iterator_category,
+ std::bidirectional_iterator_tag> >();
+ --__i; // require predecrement operator
+ __i--; // require postdecrement operator
+ }
+ _Tp __i;
+ };
+
+ template <class _Tp>
+ struct _Mutable_BidirectionalIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _BidirectionalIteratorConcept<_Tp> >();
+ __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >();
+ *__i-- = *__i; // require postdecrement and assignment
+ }
+ _Tp __i;
+ };
+
+
+ template <class _Tp>
+ struct _RandomAccessIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _BidirectionalIteratorConcept<_Tp> >();
+ __function_requires< _ComparableConcept<_Tp> >();
+ __function_requires< _ConvertibleConcept<
+ typename std::iterator_traits<_Tp>::iterator_category,
+ std::random_access_iterator_tag> >();
+ // ??? We don't use _Ref, are we just checking for "referenceability"?
+ typedef typename std::iterator_traits<_Tp>::reference _Ref;
+
+ __i += __n; // require assignment addition operator
+ __i = __i + __n; __i = __n + __i; // require addition with difference type
+ __i -= __n; // require assignment subtraction op
+ __i = __i - __n; // require subtraction with
+ // difference type
+ __n = __i - __j; // require difference operator
+ (void)__i[__n]; // require element access operator
+ }
+ _Tp __a, __b;
+ _Tp __i, __j;
+ typename std::iterator_traits<_Tp>::difference_type __n;
+ };
+
+ template <class _Tp>
+ struct _Mutable_RandomAccessIteratorConcept
+ {
+ void __constraints() {
+ __function_requires< _RandomAccessIteratorConcept<_Tp> >();
+ __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >();
+ __i[__n] = *__i; // require element access and assignment
+ }
+ _Tp __i;
+ typename std::iterator_traits<_Tp>::difference_type __n;
+ };
+
+ //===========================================================================
+ // Container Concepts
+
+ template <class _Container>
+ struct _ContainerConcept
+ {
+ typedef typename _Container::value_type _Value_type;
+ typedef typename _Container::difference_type _Difference_type;
+ typedef typename _Container::size_type _Size_type;
+ typedef typename _Container::const_reference _Const_reference;
+ typedef typename _Container::const_pointer _Const_pointer;
+ typedef typename _Container::const_iterator _Const_iterator;
+
+ void __constraints() {
+ __function_requires< _InputIteratorConcept<_Const_iterator> >();
+ __function_requires< _AssignableConcept<_Container> >();
+ const _Container __c;
+ __i = __c.begin();
+ __i = __c.end();
+ __n = __c.size();
+ __n = __c.max_size();
+ __b = __c.empty();
+ }
+ bool __b;
+ _Const_iterator __i;
+ _Size_type __n;
+ };
+
+ template <class _Container>
+ struct _Mutable_ContainerConcept
+ {
+ typedef typename _Container::value_type _Value_type;
+ typedef typename _Container::reference _Reference;
+ typedef typename _Container::iterator _Iterator;
+ typedef typename _Container::pointer _Pointer;
+
+ void __constraints() {
+ __function_requires< _ContainerConcept<_Container> >();
+ __function_requires< _AssignableConcept<_Value_type> >();
+ __function_requires< _InputIteratorConcept<_Iterator> >();
+
+ __i = __c.begin();
+ __i = __c.end();
+ __c.swap(__c2);
+ }
+ _Iterator __i;
+ _Container __c, __c2;
+ };
+
+ template <class _ForwardContainer>
+ struct _ForwardContainerConcept
+ {
+ void __constraints() {
+ __function_requires< _ContainerConcept<_ForwardContainer> >();
+ typedef typename _ForwardContainer::const_iterator _Const_iterator;
+ __function_requires< _ForwardIteratorConcept<_Const_iterator> >();
+ }
+ };
+
+ template <class _ForwardContainer>
+ struct _Mutable_ForwardContainerConcept
+ {
+ void __constraints() {
+ __function_requires< _ForwardContainerConcept<_ForwardContainer> >();
+ __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >();
+ typedef typename _ForwardContainer::iterator _Iterator;
+ __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >();
+ }
+ };
+
+ template <class _ReversibleContainer>
+ struct _ReversibleContainerConcept
+ {
+ typedef typename _ReversibleContainer::const_iterator _Const_iterator;
+ typedef typename _ReversibleContainer::const_reverse_iterator
+ _Const_reverse_iterator;
+
+ void __constraints() {
+ __function_requires< _ForwardContainerConcept<_ReversibleContainer> >();
+ __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >();
+ __function_requires<
+ _BidirectionalIteratorConcept<_Const_reverse_iterator> >();
+
+ const _ReversibleContainer __c;
+ _Const_reverse_iterator __i = __c.rbegin();
+ __i = __c.rend();
+ }
+ };
+
+ template <class _ReversibleContainer>
+ struct _Mutable_ReversibleContainerConcept
+ {
+ typedef typename _ReversibleContainer::iterator _Iterator;
+ typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator;
+
+ void __constraints() {
+ __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >();
+ __function_requires<
+ _Mutable_ForwardContainerConcept<_ReversibleContainer> >();
+ __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >();
+ __function_requires<
+ _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >();
+
+ _Reverse_iterator __i = __c.rbegin();
+ __i = __c.rend();
+ }
+ _ReversibleContainer __c;
+ };
+
+ template <class _RandomAccessContainer>
+ struct _RandomAccessContainerConcept
+ {
+ typedef typename _RandomAccessContainer::size_type _Size_type;
+ typedef typename _RandomAccessContainer::const_reference _Const_reference;
+ typedef typename _RandomAccessContainer::const_iterator _Const_iterator;
+ typedef typename _RandomAccessContainer::const_reverse_iterator
+ _Const_reverse_iterator;
+
+ void __constraints() {
+ __function_requires<
+ _ReversibleContainerConcept<_RandomAccessContainer> >();
+ __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >();
+ __function_requires<
+ _RandomAccessIteratorConcept<_Const_reverse_iterator> >();
+
+ const _RandomAccessContainer __c;
+ _Const_reference __r _IsUnused = __c[__n];
+ }
+ _Size_type __n;
+ };
+
+ template <class _RandomAccessContainer>
+ struct _Mutable_RandomAccessContainerConcept
+ {
+ typedef typename _RandomAccessContainer::size_type _Size_type;
+ typedef typename _RandomAccessContainer::reference _Reference;
+ typedef typename _RandomAccessContainer::iterator _Iterator;
+ typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator;
+
+ void __constraints() {
+ __function_requires<
+ _RandomAccessContainerConcept<_RandomAccessContainer> >();
+ __function_requires<
+ _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >();
+ __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >();
+ __function_requires<
+ _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >();
+
+ _Reference __r _IsUnused = __c[__i];
+ }
+ _Size_type __i;
+ _RandomAccessContainer __c;
+ };
+
+ // A Sequence is inherently mutable
+ template <class _Sequence>
+ struct _SequenceConcept
+ {
+ typedef typename _Sequence::reference _Reference;
+ typedef typename _Sequence::const_reference _Const_reference;
+
+ void __constraints() {
+ // Matt Austern's book puts DefaultConstructible here, the C++
+ // standard places it in Container
+ // function_requires< DefaultConstructible<Sequence> >();
+ __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();
+ __function_requires< _DefaultConstructibleConcept<_Sequence> >();
+
+ _Sequence
+ __c _IsUnused(__n, __t),
+ __c2 _IsUnused(__first, __last);
+
+ __c.insert(__p, __t);
+ __c.insert(__p, __n, __t);
+ __c.insert(__p, __first, __last);
+
+ __c.erase(__p);
+ __c.erase(__p, __q);
+
+ _Reference __r _IsUnused = __c.front();
+
+ __const_constraints(__c);
+ }
+ void __const_constraints(const _Sequence& __c) {
+ _Const_reference __r _IsUnused = __c.front();
+ }
+ typename _Sequence::value_type __t;
+ typename _Sequence::size_type __n;
+ typename _Sequence::value_type *__first, *__last;
+ typename _Sequence::iterator __p, __q;
+ };
+
+ template <class _FrontInsertionSequence>
+ struct _FrontInsertionSequenceConcept
+ {
+ void __constraints() {
+ __function_requires< _SequenceConcept<_FrontInsertionSequence> >();
+
+ __c.push_front(__t);
+ __c.pop_front();
+ }
+ _FrontInsertionSequence __c;
+ typename _FrontInsertionSequence::value_type __t;
+ };
+
+ template <class _BackInsertionSequence>
+ struct _BackInsertionSequenceConcept
+ {
+ typedef typename _BackInsertionSequence::reference _Reference;
+ typedef typename _BackInsertionSequence::const_reference _Const_reference;
+
+ void __constraints() {
+ __function_requires< _SequenceConcept<_BackInsertionSequence> >();
+
+ __c.push_back(__t);
+ __c.pop_back();
+ _Reference __r _IsUnused = __c.back();
+ }
+ void __const_constraints(const _BackInsertionSequence& __c) {
+ _Const_reference __r _IsUnused = __c.back();
+ };
+ _BackInsertionSequence __c;
+ typename _BackInsertionSequence::value_type __t;
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#undef _IsUnused
+
+#endif // _GLIBCXX_BOOST_CONCEPT_CHECK
+
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/c++config b/gcc-4.4.0/libstdc++-v3/include/bits/c++config
new file mode 100644
index 000000000..dfbe48c8f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/c++config
@@ -0,0 +1,317 @@
+// Predefined symbols and macros -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file c++config.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_CXX_CONFIG_H
+#define _GLIBCXX_CXX_CONFIG_H 1
+
+// The current version of the C++ library in compressed ISO date format.
+#define __GLIBCXX__
+
+// Macros for visibility.
+// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+// _GLIBCXX_VISIBILITY_ATTR
+#define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+
+#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
+# define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V)))
+#else
+# define _GLIBCXX_VISIBILITY_ATTR(V)
+#endif
+
+// Macros for deprecated.
+// _GLIBCXX_DEPRECATED
+// _GLIBCXX_DEPRECATED_ATTR
+#ifndef _GLIBCXX_DEPRECATED
+# define _GLIBCXX_DEPRECATED 1
+#endif
+
+#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define _GLIBCXX_DEPRECATED_ATTR __attribute__ ((__deprecated__))
+#else
+# define _GLIBCXX_DEPRECATED_ATTR
+#endif
+
+// Macros for activating various namespace association modes.
+// _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+// _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
+// _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
+
+// Guide to libstdc++ namespaces.
+/*
+ namespace std
+ {
+ namespace __debug { }
+ namespace __parallel { }
+ namespace __norm { } // __normative, __shadow, __replaced
+ namespace __cxx1998 { }
+
+ namespace tr1 { }
+ }
+*/
+#if __cplusplus
+
+#ifdef _GLIBCXX_DEBUG
+# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
+#endif
+
+#ifdef _GLIBCXX_PARALLEL
+# define _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 1
+#endif
+
+#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
+
+// Defined if any namespace association modes are active.
+#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG \
+ || _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL \
+ || _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
+# define _GLIBCXX_USE_NAMESPACE_ASSOCIATION 1
+#endif
+
+// Macros for namespace scope. Either namespace std:: or the name
+// of some nested namespace within it.
+// _GLIBCXX_STD
+// _GLIBCXX_STD_D
+// _GLIBCXX_STD_P
+//
+// Macros for enclosing namespaces and possibly nested namespaces.
+// _GLIBCXX_BEGIN_NAMESPACE
+// _GLIBCXX_END_NAMESPACE
+// _GLIBCXX_BEGIN_NESTED_NAMESPACE
+// _GLIBCXX_END_NESTED_NAMESPACE
+#ifndef _GLIBCXX_USE_NAMESPACE_ASSOCIATION
+# define _GLIBCXX_STD_D _GLIBCXX_STD
+# define _GLIBCXX_STD_P _GLIBCXX_STD
+# define _GLIBCXX_STD std
+# define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) _GLIBCXX_BEGIN_NAMESPACE(X)
+# define _GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NAMESPACE
+# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NAMESPACE }
+#else
+
+# if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION // && not anything else
+# define _GLIBCXX_STD_D _GLIBCXX_STD
+# define _GLIBCXX_STD_P _GLIBCXX_STD
+# define _GLIBCXX_STD _6
+# define _GLIBCXX_BEGIN_NAMESPACE(X) _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, _6)
+# define _GLIBCXX_END_NAMESPACE _GLIBCXX_END_NESTED_NAMESPACE
+# endif
+
+// debug
+# if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
+# define _GLIBCXX_STD_D __norm
+# define _GLIBCXX_STD_P _GLIBCXX_STD
+# define _GLIBCXX_STD __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NAMESPACE }
+# define _GLIBCXX_EXTERN_TEMPLATE -1
+# endif
+
+// parallel
+# if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && !_GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+# define _GLIBCXX_STD_D _GLIBCXX_STD
+# define _GLIBCXX_STD_P __norm
+# define _GLIBCXX_STD __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NAMESPACE }
+# define _GLIBCXX_EXTERN_TEMPLATE -1
+# endif
+
+// debug + parallel
+# if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+# define _GLIBCXX_STD_D __norm
+# define _GLIBCXX_STD_P __norm
+# define _GLIBCXX_STD __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NAMESPACE }
+# define _GLIBCXX_EXTERN_TEMPLATE -1
+# endif
+
+# if __NO_INLINE__ && !__GXX_WEAK__
+# warning currently using namespace associated mode which may fail \
+ without inlining due to lack of weak symbols
+# endif
+
+# define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NESTED_NAMESPACE } }
+#endif
+
+// Namespace associations for debug mode.
+#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+namespace std
+{
+ namespace __norm { }
+ inline namespace __debug { }
+ inline namespace __cxx1998 { }
+}
+#endif
+
+// Namespace associations for parallel mode.
+#if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
+namespace std
+{
+ namespace __norm { }
+ inline namespace __parallel { }
+ inline namespace __cxx1998 { }
+}
+#endif
+
+// Namespace associations for versioning mode.
+#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
+namespace std
+{
+ inline namespace _6 { }
+}
+
+namespace __gnu_cxx
+{
+ inline namespace _6 { }
+}
+
+namespace std
+{
+ namespace tr1
+ {
+ inline namespace _6 { }
+ }
+}
+#endif
+
+// XXX GLIBCXX_ABI Deprecated
+// Define if compatibility should be provided for -mlong-double-64
+#undef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+// Namespace associations for long double 128 mode.
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+namespace std
+{
+ inline namespace __gnu_cxx_ldbl128 { }
+}
+# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
+# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
+# define _GLIBCXX_END_LDBL_NAMESPACE }
+#else
+# define _GLIBCXX_LDBL_NAMESPACE
+# define _GLIBCXX_BEGIN_LDBL_NAMESPACE
+# define _GLIBCXX_END_LDBL_NAMESPACE
+#endif
+
+
+// Defines for C compatibility. In particular, define extern "C"
+// linkage only when using C++.
+# define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
+# define _GLIBCXX_END_EXTERN_C }
+
+#else // !__cplusplus
+# undef _GLIBCXX_BEGIN_NAMESPACE
+# undef _GLIBCXX_END_NAMESPACE
+# define _GLIBCXX_BEGIN_NAMESPACE(X)
+# define _GLIBCXX_END_NAMESPACE
+# define _GLIBCXX_BEGIN_EXTERN_C
+# define _GLIBCXX_END_EXTERN_C
+#endif
+
+// First includes.
+
+// Pick up any OS-specific definitions.
+#include <bits/os_defines.h>
+
+// Pick up any CPU-specific definitions.
+#include <bits/cpu_defines.h>
+
+// Allow use of "export template." This is currently not a feature
+// that g++ supports.
+// #define _GLIBCXX_EXPORT_TEMPLATE 1
+
+// Allow use of the GNU syntax extension, "extern template." This
+// extension is fully documented in the g++ manual, but in a nutshell,
+// it inhibits all implicit instantiations and is used throughout the
+// library to avoid multiple weak definitions for required types that
+// are already explicitly instantiated in the library binary. This
+// substantially reduces the binary size of resulting executables.
+#ifndef _GLIBCXX_EXTERN_TEMPLATE
+# define _GLIBCXX_EXTERN_TEMPLATE 1
+#endif
+
+// Certain function definitions that are meant to be overridable from
+// user code are decorated with this macro. For some targets, this
+// macro causes these definitions to be weak.
+#ifndef _GLIBCXX_WEAK_DEFINITION
+# define _GLIBCXX_WEAK_DEFINITION
+#endif
+
+// Assert.
+// Avoid the use of assert, because we're trying to keep the <cassert>
+// include out of the mix.
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
+#define __glibcxx_assert(_Condition)
+#else
+_GLIBCXX_BEGIN_NAMESPACE(std)
+ // Avoid the use of assert, because we're trying to keep the <cassert>
+ // include out of the mix.
+ inline void
+ __replacement_assert(const char* __file, int __line,
+ const char* __function, const char* __condition)
+ {
+ __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
+ __function, __condition);
+ __builtin_abort();
+ }
+_GLIBCXX_END_NAMESPACE
+
+#define __glibcxx_assert(_Condition) \
+ do \
+ { \
+ if (! (_Condition)) \
+ std::__replacement_assert(__FILE__, __LINE__, \
+ __PRETTY_FUNCTION__, #_Condition); \
+ } while (false)
+#endif
+
+// The remainder of the prewritten config is automatic; all the
+// user hooks are listed above.
+
+// Create a boolean flag to be used to determine if --fast-math is set.
+#ifdef __FAST_MATH__
+# define _GLIBCXX_FAST_MATH 1
+#else
+# define _GLIBCXX_FAST_MATH 0
+#endif
+
+// This marks string literals in header files to be extracted for eventual
+// translation. It is primarily used for messages in thrown exceptions; see
+// src/functexcept.cc. We use __N because the more traditional _N is used
+// for something else under certain OSes (see BADNAMES).
+#define __N(msgid) (msgid)
+
+// For example, <windows.h> is known to #define min and max as macros...
+#undef min
+#undef max
+
+// End of prewritten config; the discovered settings follow.
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/char_traits.h b/gcc-4.4.0/libstdc++-v3/include/bits/char_traits.h
new file mode 100644
index 000000000..5e52c7537
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/char_traits.h
@@ -0,0 +1,575 @@
+// Character Traits for use by standard string and iostream -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file char_traits.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _CHAR_TRAITS_H
+#define _CHAR_TRAITS_H 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h> // std::copy, std::fill_n
+#include <bits/postypes.h> // For streampos
+#include <cwchar> // For WEOF, wmemmove, wmemset, etc.
+
+#ifndef _GLIBCXX_STDIO_MACROS
+# include <cstdio> // For EOF
+# define _CHAR_TRAITS_EOF EOF
+#else
+# define _CHAR_TRAITS_EOF (-1)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /**
+ * @brief Mapping from character type to associated types.
+ *
+ * @note This is an implementation class for the generic version
+ * of char_traits. It defines int_type, off_type, pos_type, and
+ * state_type. By default these are unsigned long, streamoff,
+ * streampos, and mbstate_t. Users who need a different set of
+ * types, but who don't need to change the definitions of any function
+ * defined in char_traits, can specialize __gnu_cxx::_Char_types
+ * while leaving __gnu_cxx::char_traits alone. */
+ template<typename _CharT>
+ struct _Char_types
+ {
+ typedef unsigned long int_type;
+ typedef std::streampos pos_type;
+ typedef std::streamoff off_type;
+ typedef std::mbstate_t state_type;
+ };
+
+
+ /**
+ * @brief Base class used to implement std::char_traits.
+ *
+ * @note For any given actual character type, this definition is
+ * probably wrong. (Most of the member functions are likely to be
+ * right, but the int_type and state_type typedefs, and the eof()
+ * member function, are likely to be wrong.) The reason this class
+ * exists is so users can specialize it. Classes in namespace std
+ * may not be specialized for fundamental types, but classes in
+ * namespace __gnu_cxx may be.
+ *
+ * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html
+ * for advice on how to make use of this class for "unusual" character
+ * types. Also, check out include/ext/pod_char_traits.h.
+ */
+ template<typename _CharT>
+ struct char_traits
+ {
+ typedef _CharT char_type;
+ typedef typename _Char_types<_CharT>::int_type int_type;
+ typedef typename _Char_types<_CharT>::pos_type pos_type;
+ typedef typename _Char_types<_CharT>::off_type off_type;
+ typedef typename _Char_types<_CharT>::state_type state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
+
+ static std::size_t
+ length(const char_type* __s);
+
+ static const char_type*
+ find(const char_type* __s, std::size_t __n, const char_type& __a);
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, std::size_t __n);
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, std::size_t __n);
+
+ static char_type*
+ assign(char_type* __s, std::size_t __n, char_type __a);
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return static_cast<char_type>(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c)
+ { return static_cast<int_type>(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof()
+ { return static_cast<int_type>(_CHAR_TRAITS_EOF); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
+ };
+
+ template<typename _CharT>
+ int
+ char_traits<_CharT>::
+ compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
+ {
+ for (std::size_t __i = 0; __i < __n; ++__i)
+ if (lt(__s1[__i], __s2[__i]))
+ return -1;
+ else if (lt(__s2[__i], __s1[__i]))
+ return 1;
+ return 0;
+ }
+
+ template<typename _CharT>
+ std::size_t
+ char_traits<_CharT>::
+ length(const char_type* __p)
+ {
+ std::size_t __i = 0;
+ while (!eq(__p[__i], char_type()))
+ ++__i;
+ return __i;
+ }
+
+ template<typename _CharT>
+ const typename char_traits<_CharT>::char_type*
+ char_traits<_CharT>::
+ find(const char_type* __s, std::size_t __n, const char_type& __a)
+ {
+ for (std::size_t __i = 0; __i < __n; ++__i)
+ if (eq(__s[__i], __a))
+ return __s + __i;
+ return 0;
+ }
+
+ template<typename _CharT>
+ typename char_traits<_CharT>::char_type*
+ char_traits<_CharT>::
+ move(char_type* __s1, const char_type* __s2, std::size_t __n)
+ {
+ return static_cast<_CharT*>(__builtin_memmove(__s1, __s2,
+ __n * sizeof(char_type)));
+ }
+
+ template<typename _CharT>
+ typename char_traits<_CharT>::char_type*
+ char_traits<_CharT>::
+ copy(char_type* __s1, const char_type* __s2, std::size_t __n)
+ {
+ // NB: Inline std::copy so no recursive dependencies.
+ std::copy(__s2, __s2 + __n, __s1);
+ return __s1;
+ }
+
+ template<typename _CharT>
+ typename char_traits<_CharT>::char_type*
+ char_traits<_CharT>::
+ assign(char_type* __s, std::size_t __n, char_type __a)
+ {
+ // NB: Inline std::fill_n so no recursive dependencies.
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 21.1
+ /**
+ * @brief Basis for explicit traits specializations.
+ *
+ * @note For any given actual character type, this definition is
+ * probably wrong. Since this is just a thin wrapper around
+ * __gnu_cxx::char_traits, it is possible to achieve a more
+ * appropriate definition by specializing __gnu_cxx::char_traits.
+ *
+ * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt05ch13s03.html
+ * for advice on how to make use of this class for "unusual" character
+ * types. Also, check out include/ext/pod_char_traits.h.
+ */
+ template<class _CharT>
+ struct char_traits : public __gnu_cxx::char_traits<_CharT>
+ { };
+
+
+ /// 21.1.3.1 char_traits specializations
+ template<>
+ struct char_traits<char>
+ {
+ typedef char char_type;
+ typedef int int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ { return __builtin_memcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s)
+ { return __builtin_strlen(__s); }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ { return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n)); }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ { return static_cast<char_type*>(__builtin_memmove(__s1, __s2, __n)); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ { return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return static_cast<char_type>(__c); }
+
+ // To keep both the byte 0xff and the eof symbol 0xffffffff
+ // from ending up as 0xffffffff.
+ static int_type
+ to_int_type(const char_type& __c)
+ { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof()
+ { return static_cast<int_type>(_CHAR_TRAITS_EOF); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return (__c == eof()) ? 0 : __c; }
+ };
+
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /// 21.1.3.2 char_traits specializations
+ template<>
+ struct char_traits<wchar_t>
+ {
+ typedef wchar_t char_type;
+ typedef wint_t int_type;
+ typedef streamoff off_type;
+ typedef wstreampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ { return wmemcmp(__s1, __s2, __n); }
+
+ static size_t
+ length(const char_type* __s)
+ { return wcslen(__s); }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ { return wmemchr(__s, __a, __n); }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ { return wmemmove(__s1, __s2, __n); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return wmemcpy(__s1, __s2, __n); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ { return wmemset(__s, __a, __n); }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return char_type(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c)
+ { return int_type(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof()
+ { return static_cast<int_type>(WEOF); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? 0 : __c; }
+ };
+#endif //_GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_END_NAMESPACE
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+#include <cstdint>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<>
+ struct char_traits<char16_t>
+ {
+ typedef char16_t char_type;
+ typedef uint_least16_t int_type;
+ typedef streamoff off_type;
+ typedef u16streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (lt(__s1[__i], __s2[__i]))
+ return -1;
+ else if (lt(__s2[__i], __s1[__i]))
+ return 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ size_t __i = 0;
+ while (!eq(__s[__i], char_type()))
+ ++__i;
+ return __i;
+ }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (eq(__s[__i], __a))
+ return __s + __i;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ return (static_cast<char_type*>
+ (__builtin_memmove(__s1, __s2, __n * sizeof(char_type))));
+ }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ return (static_cast<char_type*>
+ (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type))));
+ }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ assign(__s[__i], __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return char_type(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c)
+ { return int_type(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof()
+ { return static_cast<int_type>(-1); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? 0 : __c; }
+ };
+
+ template<>
+ struct char_traits<char32_t>
+ {
+ typedef char32_t char_type;
+ typedef uint_least32_t int_type;
+ typedef streamoff off_type;
+ typedef u32streampos pos_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (lt(__s1[__i], __s2[__i]))
+ return -1;
+ else if (lt(__s2[__i], __s1[__i]))
+ return 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ size_t __i = 0;
+ while (!eq(__s[__i], char_type()))
+ ++__i;
+ return __i;
+ }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (eq(__s[__i], __a))
+ return __s + __i;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ return (static_cast<char_type*>
+ (__builtin_memmove(__s1, __s2, __n * sizeof(char_type))));
+ }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ return (static_cast<char_type*>
+ (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type))));
+ }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ assign(__s[__i], __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type& __c)
+ { return char_type(__c); }
+
+ static int_type
+ to_int_type(const char_type& __c)
+ { return int_type(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof()
+ { return static_cast<int_type>(-1); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? 0 : __c; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#undef _CHAR_TRAITS_EOF
+
+#endif // _CHAR_TRAITS_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/codecvt.h b/gcc-4.4.0/libstdc++-v3/include/bits/codecvt.h
new file mode 100644
index 000000000..2dbb49863
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/codecvt.h
@@ -0,0 +1,497 @@
+// Locale support (codecvt) -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/codecvt.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 22.2.1.5 Template class codecvt
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#ifndef _CODECVT_H
+#define _CODECVT_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /// Empty base class for codecvt facet [22.2.1.5].
+ class codecvt_base
+ {
+ public:
+ enum result
+ {
+ ok,
+ partial,
+ error,
+ noconv
+ };
+ };
+
+ /**
+ * @brief Common base for codecvt functions.
+ *
+ * This template class provides implementations of the public functions
+ * that forward to the protected virtual functions.
+ *
+ * This template also provides abstract stubs for the protected virtual
+ * functions.
+ */
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class __codecvt_abstract_base
+ : public locale::facet, public codecvt_base
+ {
+ public:
+ // Types:
+ typedef codecvt_base::result result;
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+ // 22.2.1.5.1 codecvt members
+ /**
+ * @brief Convert from internal to external character set.
+ *
+ * Converts input string of intern_type to output string of
+ * extern_type. This is analogous to wcsrtombs. It does this by
+ * calling codecvt::do_out.
+ *
+ * The source and destination character sets are determined by the
+ * facet's locale, internal and external types.
+ *
+ * The characters in [from,from_end) are converted and written to
+ * [to,to_end). from_next and to_next are set to point to the
+ * character following the last successfully converted character,
+ * respectively. If the result needed no conversion, from_next and
+ * to_next are not affected.
+ *
+ * The @a state argument should be initialized if the input is at the
+ * beginning and carried from a previous call if continuing
+ * conversion. There are no guarantees about how @a state is used.
+ *
+ * The result returned is a member of codecvt_base::result. If
+ * all the input is converted, returns codecvt_base::ok. If no
+ * conversion is necessary, returns codecvt_base::noconv. If
+ * the input ends early or there is insufficient space in the
+ * output, returns codecvt_base::partial. Otherwise the
+ * conversion failed and codecvt_base::error is returned.
+ *
+ * @param state Persistent conversion state data.
+ * @param from Start of input.
+ * @param from_end End of input.
+ * @param from_next Returns start of unconverted data.
+ * @param to Start of output buffer.
+ * @param to_end End of output buffer.
+ * @param to_next Returns start of unused output area.
+ * @return codecvt_base::result.
+ */
+ result
+ out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const
+ {
+ return this->do_out(__state, __from, __from_end, __from_next,
+ __to, __to_end, __to_next);
+ }
+
+ /**
+ * @brief Reset conversion state.
+ *
+ * Writes characters to output that would restore @a state to initial
+ * conditions. The idea is that if a partial conversion occurs, then
+ * the converting the characters written by this function would leave
+ * the state in initial conditions, rather than partial conversion
+ * state. It does this by calling codecvt::do_unshift().
+ *
+ * For example, if 4 external characters always converted to 1 internal
+ * character, and input to in() had 6 external characters with state
+ * saved, this function would write two characters to the output and
+ * set the state to initialized conditions.
+ *
+ * The source and destination character sets are determined by the
+ * facet's locale, internal and external types.
+ *
+ * The result returned is a member of codecvt_base::result. If the
+ * state could be reset and data written, returns codecvt_base::ok. If
+ * no conversion is necessary, returns codecvt_base::noconv. If the
+ * output has insufficient space, returns codecvt_base::partial.
+ * Otherwise the reset failed and codecvt_base::error is returned.
+ *
+ * @param state Persistent conversion state data.
+ * @param to Start of output buffer.
+ * @param to_end End of output buffer.
+ * @param to_next Returns start of unused output area.
+ * @return codecvt_base::result.
+ */
+ result
+ unshift(state_type& __state, extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const
+ { return this->do_unshift(__state, __to,__to_end,__to_next); }
+
+ /**
+ * @brief Convert from external to internal character set.
+ *
+ * Converts input string of extern_type to output string of
+ * intern_type. This is analogous to mbsrtowcs. It does this by
+ * calling codecvt::do_in.
+ *
+ * The source and destination character sets are determined by the
+ * facet's locale, internal and external types.
+ *
+ * The characters in [from,from_end) are converted and written to
+ * [to,to_end). from_next and to_next are set to point to the
+ * character following the last successfully converted character,
+ * respectively. If the result needed no conversion, from_next and
+ * to_next are not affected.
+ *
+ * The @a state argument should be initialized if the input is at the
+ * beginning and carried from a previous call if continuing
+ * conversion. There are no guarantees about how @a state is used.
+ *
+ * The result returned is a member of codecvt_base::result. If
+ * all the input is converted, returns codecvt_base::ok. If no
+ * conversion is necessary, returns codecvt_base::noconv. If
+ * the input ends early or there is insufficient space in the
+ * output, returns codecvt_base::partial. Otherwise the
+ * conversion failed and codecvt_base::error is returned.
+ *
+ * @param state Persistent conversion state data.
+ * @param from Start of input.
+ * @param from_end End of input.
+ * @param from_next Returns start of unconverted data.
+ * @param to Start of output buffer.
+ * @param to_end End of output buffer.
+ * @param to_next Returns start of unused output area.
+ * @return codecvt_base::result.
+ */
+ result
+ in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const
+ {
+ return this->do_in(__state, __from, __from_end, __from_next,
+ __to, __to_end, __to_next);
+ }
+
+ int
+ encoding() const throw()
+ { return this->do_encoding(); }
+
+ bool
+ always_noconv() const throw()
+ { return this->do_always_noconv(); }
+
+ int
+ length(state_type& __state, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return this->do_length(__state, __from, __end, __max); }
+
+ int
+ max_length() const throw()
+ { return this->do_max_length(); }
+
+ protected:
+ explicit
+ __codecvt_abstract_base(size_t __refs = 0) : locale::facet(__refs) { }
+
+ virtual
+ ~__codecvt_abstract_base() { }
+
+ /**
+ * @brief Convert from internal to external character set.
+ *
+ * Converts input string of intern_type to output string of
+ * extern_type. This function is a hook for derived classes to change
+ * the value returned. @see out for more information.
+ */
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const = 0;
+
+ virtual result
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const = 0;
+
+ virtual result
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const = 0;
+
+ virtual int
+ do_encoding() const throw() = 0;
+
+ virtual bool
+ do_always_noconv() const throw() = 0;
+
+ virtual int
+ do_length(state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const = 0;
+
+ virtual int
+ do_max_length() const throw() = 0;
+ };
+
+ /// @brief class codecvt [22.2.1.5].
+ /// NB: Generic, mostly useless implementation.
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt
+ : public __codecvt_abstract_base<_InternT, _ExternT, _StateT>
+ {
+ public:
+ // Types:
+ typedef codecvt_base::result result;
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef _StateT state_type;
+
+ protected:
+ __c_locale _M_c_locale_codecvt;
+
+ public:
+ static locale::id id;
+
+ explicit
+ codecvt(size_t __refs = 0)
+ : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs) { }
+
+ explicit
+ codecvt(__c_locale __cloc, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~codecvt() { }
+
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const;
+
+ virtual int
+ do_encoding() const throw();
+
+ virtual bool
+ do_always_noconv() const throw();
+
+ virtual int
+ do_length(state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+
+ virtual int
+ do_max_length() const throw();
+ };
+
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ locale::id codecvt<_InternT, _ExternT, _StateT>::id;
+
+ /// class codecvt<char, char, mbstate_t> specialization.
+ template<>
+ class codecvt<char, char, mbstate_t>
+ : public __codecvt_abstract_base<char, char, mbstate_t>
+ {
+ public:
+ // Types:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ protected:
+ __c_locale _M_c_locale_codecvt;
+
+ public:
+ static locale::id id;
+
+ explicit
+ codecvt(size_t __refs = 0);
+
+ explicit
+ codecvt(__c_locale __cloc, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~codecvt();
+
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const;
+
+ virtual int
+ do_encoding() const throw();
+
+ virtual bool
+ do_always_noconv() const throw();
+
+ virtual int
+ do_length(state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+
+ virtual int
+ do_max_length() const throw();
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /// class codecvt<wchar_t, char, mbstate_t> specialization.
+ template<>
+ class codecvt<wchar_t, char, mbstate_t>
+ : public __codecvt_abstract_base<wchar_t, char, mbstate_t>
+ {
+ public:
+ // Types:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef mbstate_t state_type;
+
+ protected:
+ __c_locale _M_c_locale_codecvt;
+
+ public:
+ static locale::id id;
+
+ explicit
+ codecvt(size_t __refs = 0);
+
+ explicit
+ codecvt(__c_locale __cloc, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~codecvt();
+
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state,
+ const extern_type* __from, const extern_type* __from_end,
+ const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const;
+
+ virtual
+ int do_encoding() const throw();
+
+ virtual
+ bool do_always_noconv() const throw();
+
+ virtual
+ int do_length(state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+
+ virtual int
+ do_max_length() const throw();
+ };
+#endif //_GLIBCXX_USE_WCHAR_T
+
+ /// class codecvt_byname [22.2.1.6].
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT>
+ {
+ public:
+ explicit
+ codecvt_byname(const char* __s, size_t __refs = 0)
+ : codecvt<_InternT, _ExternT, _StateT>(__refs)
+ {
+ if (__builtin_strcmp(__s, "C") != 0
+ && __builtin_strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_codecvt);
+ this->_S_create_c_locale(this->_M_c_locale_codecvt, __s);
+ }
+ }
+
+ protected:
+ virtual
+ ~codecvt_byname() { }
+ };
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class codecvt_byname<char, char, mbstate_t>;
+
+ extern template
+ const codecvt<char, char, mbstate_t>&
+ use_facet<codecvt<char, char, mbstate_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<codecvt<char, char, mbstate_t> >(const locale&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class codecvt_byname<wchar_t, char, mbstate_t>;
+
+ extern template
+ const codecvt<wchar_t, char, mbstate_t>&
+ use_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _CODECVT_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/concept_check.h b/gcc-4.4.0/libstdc++-v3/include/bits/concept_check.h
new file mode 100644
index 000000000..6d45e268b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/concept_check.h
@@ -0,0 +1,80 @@
+// Concept-checking control -*- C++ -*-
+
+// Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file concept_check.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _CONCEPT_CHECK_H
+#define _CONCEPT_CHECK_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+// All places in libstdc++-v3 where these are used, or /might/ be used, or
+// don't need to be used, or perhaps /should/ be used, are commented with
+// "concept requirements" (and maybe some more text). So grep like crazy
+// if you're looking for additional places to use these.
+
+// Concept-checking code is off by default unless users turn it on via
+// configure options or editing c++config.h.
+
+#ifndef _GLIBCXX_CONCEPT_CHECKS
+
+#define __glibcxx_function_requires(...)
+#define __glibcxx_class_requires(_a,_b)
+#define __glibcxx_class_requires2(_a,_b,_c)
+#define __glibcxx_class_requires3(_a,_b,_c,_d)
+#define __glibcxx_class_requires4(_a,_b,_c,_d,_e)
+
+#else // the checks are on
+
+#include <bits/boost_concept_check.h>
+
+// Note that the obvious and elegant approach of
+//
+//#define glibcxx_function_requires(C) boost::function_requires< boost::C >()
+//
+// won't work due to concept templates with more than one parameter, e.g.,
+// BinaryPredicateConcept. The preprocessor tries to split things up on
+// the commas in the template argument list. We can't use an inner pair of
+// parenthesis to hide the commas, because "boost::(Temp<Foo,Bar>)" isn't
+// a valid instantiation pattern. Thus, we steal a feature from C99.
+
+#define __glibcxx_function_requires(...) \
+ __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >();
+#define __glibcxx_class_requires(_a,_C) \
+ _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C);
+#define __glibcxx_class_requires2(_a,_b,_C) \
+ _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C);
+#define __glibcxx_class_requires3(_a,_b,_c,_C) \
+ _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C);
+#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \
+ _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C);
+
+#endif // enable/disable
+
+#endif // _GLIBCXX_CONCEPT_CHECK
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/cpp_type_traits.h b/gcc-4.4.0/libstdc++-v3/include/bits/cpp_type_traits.h
new file mode 100644
index 000000000..afb0049b5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -0,0 +1,419 @@
+// The -*- C++ -*- type traits classes for internal use in libstdc++
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cpp_type_traits.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+#ifndef _CPP_TYPE_TRAITS_H
+#define _CPP_TYPE_TRAITS_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+//
+// This file provides some compile-time information about various types.
+// These representations were designed, on purpose, to be constant-expressions
+// and not types as found in <bits/type_traits.h>. In particular, they
+// can be used in control structures and the optimizer hopefully will do
+// the obvious thing.
+//
+// Why integral expressions, and not functions nor types?
+// Firstly, these compile-time entities are used as template-arguments
+// so function return values won't work: We need compile-time entities.
+// We're left with types and constant integral expressions.
+// Secondly, from the point of view of ease of use, type-based compile-time
+// information is -not- *that* convenient. On has to write lots of
+// overloaded functions and to hope that the compiler will select the right
+// one. As a net effect, the overall structure isn't very clear at first
+// glance.
+// Thirdly, partial ordering and overload resolution (of function templates)
+// is highly costly in terms of compiler-resource. It is a Good Thing to
+// keep these resource consumption as least as possible.
+//
+// See valarray_array.h for a case use.
+//
+// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
+//
+// Update 2005: types are also provided and <bits/type_traits.h> has been
+// removed.
+//
+
+// Forward declaration hack, should really include this from somewhere.
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ template<typename _Iterator, typename _Container>
+ class __normal_iterator;
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ struct __true_type { };
+ struct __false_type { };
+
+ template<bool>
+ struct __truth_type
+ { typedef __false_type __type; };
+
+ template<>
+ struct __truth_type<true>
+ { typedef __true_type __type; };
+
+ // N.B. The conversions to bool are needed due to the issue
+ // explained in c++/19404.
+ template<class _Sp, class _Tp>
+ struct __traitor
+ {
+ enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
+ typedef typename __truth_type<__value>::__type __type;
+ };
+
+ // Compare for equality of types.
+ template<typename, typename>
+ struct __are_same
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ template<typename _Tp>
+ struct __are_same<_Tp, _Tp>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ // Holds if the template-argument is a void type.
+ template<typename _Tp>
+ struct __is_void
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ template<>
+ struct __is_void<void>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ //
+ // Integer types
+ //
+ template<typename _Tp>
+ struct __is_integer
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ // Thirteen specializations (yes there are eleven standard integer
+ // types; 'long long' and 'unsigned long long' are supported as
+ // extensions)
+ template<>
+ struct __is_integer<bool>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<signed char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<unsigned char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+# ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ struct __is_integer<wchar_t>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+# endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<>
+ struct __is_integer<char16_t>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<char32_t>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+ template<>
+ struct __is_integer<short>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<unsigned short>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<int>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<unsigned int>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<long>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<unsigned long>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<long long>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_integer<unsigned long long>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ //
+ // Floating point types
+ //
+ template<typename _Tp>
+ struct __is_floating
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ // three specializations (float, double and 'long double')
+ template<>
+ struct __is_floating<float>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_floating<double>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_floating<long double>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ //
+ // Pointer types
+ //
+ template<typename _Tp>
+ struct __is_pointer
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ template<typename _Tp>
+ struct __is_pointer<_Tp*>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ //
+ // Normal iterator type
+ //
+ template<typename _Tp>
+ struct __is_normal_iterator
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ template<typename _Iterator, typename _Container>
+ struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
+ _Container> >
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ //
+ // An arithmetic type is an integer type or a floating point type
+ //
+ template<typename _Tp>
+ struct __is_arithmetic
+ : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
+ { };
+
+ //
+ // A fundamental type is `void' or and arithmetic type
+ //
+ template<typename _Tp>
+ struct __is_fundamental
+ : public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> >
+ { };
+
+ //
+ // A scalar type is an arithmetic type or a pointer type
+ //
+ template<typename _Tp>
+ struct __is_scalar
+ : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
+ { };
+
+ //
+ // For use in std::copy and std::find overloads for streambuf iterators.
+ //
+ template<typename _Tp>
+ struct __is_char
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ template<>
+ struct __is_char<char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ struct __is_char<wchar_t>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+ template<typename _Tp>
+ struct __is_byte
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+ template<>
+ struct __is_byte<char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_byte<signed char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ template<>
+ struct __is_byte<unsigned char>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+
+ //
+ // Move iterator type
+ //
+ template<typename _Tp>
+ struct __is_move_iterator
+ {
+ enum { __value = 0 };
+ typedef __false_type __type;
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Iterator>
+ class move_iterator;
+
+ template<typename _Iterator>
+ struct __is_move_iterator< move_iterator<_Iterator> >
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif //_CPP_TYPE_TRAITS_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/deque.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/deque.tcc
new file mode 100644
index 000000000..aac0d590b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/deque.tcc
@@ -0,0 +1,863 @@
+// Deque implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file deque.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _DEQUE_TCC
+#define _DEQUE_TCC 1
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ template <typename _Tp, typename _Alloc>
+ deque<_Tp, _Alloc>&
+ deque<_Tp, _Alloc>::
+ operator=(const deque& __x)
+ {
+ const size_type __len = size();
+ if (&__x != this)
+ {
+ if (__len >= __x.size())
+ _M_erase_at_end(std::copy(__x.begin(), __x.end(),
+ this->_M_impl._M_start));
+ else
+ {
+ const_iterator __mid = __x.begin() + difference_type(__len);
+ std::copy(__x.begin(), __mid, this->_M_impl._M_start);
+ insert(this->_M_impl._M_finish, __mid, __x.end());
+ }
+ }
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ deque<_Tp, _Alloc>::
+ emplace_front(_Args&&... __args)
+ {
+ if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
+ {
+ this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1,
+ std::forward<_Args>(__args)...);
+ --this->_M_impl._M_start._M_cur;
+ }
+ else
+ _M_push_front_aux(std::forward<_Args>(__args)...);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ deque<_Tp, _Alloc>::
+ emplace_back(_Args&&... __args)
+ {
+ if (this->_M_impl._M_finish._M_cur
+ != this->_M_impl._M_finish._M_last - 1)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
+ std::forward<_Args>(__args)...);
+ ++this->_M_impl._M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux(std::forward<_Args>(__args)...);
+ }
+#endif
+
+ template <typename _Tp, typename _Alloc>
+ typename deque<_Tp, _Alloc>::iterator
+ deque<_Tp, _Alloc>::
+ insert(iterator __position, const value_type& __x)
+ {
+ if (__position._M_cur == this->_M_impl._M_start._M_cur)
+ {
+ push_front(__x);
+ return this->_M_impl._M_start;
+ }
+ else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
+ {
+ push_back(__x);
+ iterator __tmp = this->_M_impl._M_finish;
+ --__tmp;
+ return __tmp;
+ }
+ else
+ return _M_insert_aux(__position, __x);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ typename deque<_Tp, _Alloc>::iterator
+ deque<_Tp, _Alloc>::
+ emplace(iterator __position, _Args&&... __args)
+ {
+ if (__position._M_cur == this->_M_impl._M_start._M_cur)
+ {
+ push_front(std::forward<_Args>(__args)...);
+ return this->_M_impl._M_start;
+ }
+ else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
+ {
+ push_back(std::forward<_Args>(__args)...);
+ iterator __tmp = this->_M_impl._M_finish;
+ --__tmp;
+ return __tmp;
+ }
+ else
+ return _M_insert_aux(__position, std::forward<_Args>(__args)...);
+ }
+#endif
+
+ template <typename _Tp, typename _Alloc>
+ typename deque<_Tp, _Alloc>::iterator
+ deque<_Tp, _Alloc>::
+ erase(iterator __position)
+ {
+ iterator __next = __position;
+ ++__next;
+ const difference_type __index = __position - begin();
+ if (static_cast<size_type>(__index) < (size() >> 1))
+ {
+ if (__position != begin())
+ _GLIBCXX_MOVE_BACKWARD3(begin(), __position, __next);
+ pop_front();
+ }
+ else
+ {
+ if (__next != end())
+ _GLIBCXX_MOVE3(__next, end(), __position);
+ pop_back();
+ }
+ return begin() + __index;
+ }
+
+ template <typename _Tp, typename _Alloc>
+ typename deque<_Tp, _Alloc>::iterator
+ deque<_Tp, _Alloc>::
+ erase(iterator __first, iterator __last)
+ {
+ if (__first == begin() && __last == end())
+ {
+ clear();
+ return end();
+ }
+ else
+ {
+ const difference_type __n = __last - __first;
+ const difference_type __elems_before = __first - begin();
+ if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2)
+ {
+ if (__first != begin())
+ _GLIBCXX_MOVE_BACKWARD3(begin(), __first, __last);
+ _M_erase_at_begin(begin() + __n);
+ }
+ else
+ {
+ if (__last != end())
+ _GLIBCXX_MOVE3(__last, end(), __first);
+ _M_erase_at_end(end() - __n);
+ }
+ return begin() + __elems_before;
+ }
+ }
+
+ template <typename _Tp, class _Alloc>
+ template <typename _InputIterator>
+ void
+ deque<_Tp, _Alloc>::
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
+ {
+ iterator __cur = begin();
+ for (; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ _M_erase_at_end(__cur);
+ else
+ insert(end(), __first, __last);
+ }
+
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_fill_insert(iterator __pos, size_type __n, const value_type& __x)
+ {
+ if (__pos._M_cur == this->_M_impl._M_start._M_cur)
+ {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __try
+ {
+ std::__uninitialized_fill_a(__new_start, this->_M_impl._M_start,
+ __x, _M_get_Tp_allocator());
+ this->_M_impl._M_start = __new_start;
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
+ __throw_exception_again;
+ }
+ }
+ else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
+ {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ __try
+ {
+ std::__uninitialized_fill_a(this->_M_impl._M_finish,
+ __new_finish, __x,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
+ __new_finish._M_node + 1);
+ __throw_exception_again;
+ }
+ }
+ else
+ _M_insert_aux(__pos, __n, __x);
+ }
+
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_fill_initialize(const value_type& __value)
+ {
+ _Map_pointer __cur;
+ __try
+ {
+ for (__cur = this->_M_impl._M_start._M_node;
+ __cur < this->_M_impl._M_finish._M_node;
+ ++__cur)
+ std::__uninitialized_fill_a(*__cur, *__cur + _S_buffer_size(),
+ __value, _M_get_Tp_allocator());
+ std::__uninitialized_fill_a(this->_M_impl._M_finish._M_first,
+ this->_M_impl._M_finish._M_cur,
+ __value, _M_get_Tp_allocator());
+ }
+ __catch(...)
+ {
+ std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),
+ _M_get_Tp_allocator());
+ __throw_exception_again;
+ }
+ }
+
+ template <typename _Tp, typename _Alloc>
+ template <typename _InputIterator>
+ void
+ deque<_Tp, _Alloc>::
+ _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
+ {
+ this->_M_initialize_map(0);
+ __try
+ {
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
+ __catch(...)
+ {
+ clear();
+ __throw_exception_again;
+ }
+ }
+
+ template <typename _Tp, typename _Alloc>
+ template <typename _ForwardIterator>
+ void
+ deque<_Tp, _Alloc>::
+ _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ const size_type __n = std::distance(__first, __last);
+ this->_M_initialize_map(__n);
+
+ _Map_pointer __cur_node;
+ __try
+ {
+ for (__cur_node = this->_M_impl._M_start._M_node;
+ __cur_node < this->_M_impl._M_finish._M_node;
+ ++__cur_node)
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, _S_buffer_size());
+ std::__uninitialized_copy_a(__first, __mid, *__cur_node,
+ _M_get_Tp_allocator());
+ __first = __mid;
+ }
+ std::__uninitialized_copy_a(__first, __last,
+ this->_M_impl._M_finish._M_first,
+ _M_get_Tp_allocator());
+ }
+ __catch(...)
+ {
+ std::_Destroy(this->_M_impl._M_start,
+ iterator(*__cur_node, __cur_node),
+ _M_get_Tp_allocator());
+ __throw_exception_again;
+ }
+ }
+
+ // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_last - 1.
+ template<typename _Tp, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ deque<_Tp, _Alloc>::
+ _M_push_back_aux(_Args&&... __args)
+#else
+ void
+ deque<_Tp, _Alloc>::
+ _M_push_back_aux(const value_type& __t)
+#endif
+ {
+ _M_reserve_map_at_back();
+ *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();
+ __try
+ {
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
+ std::forward<_Args>(__args)...);
+#else
+ this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t);
+#endif
+ this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
+ + 1);
+ this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
+ }
+ __catch(...)
+ {
+ _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));
+ __throw_exception_again;
+ }
+ }
+
+ // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_first.
+ template<typename _Tp, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ deque<_Tp, _Alloc>::
+ _M_push_front_aux(_Args&&... __args)
+#else
+ void
+ deque<_Tp, _Alloc>::
+ _M_push_front_aux(const value_type& __t)
+#endif
+ {
+ _M_reserve_map_at_front();
+ *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
+ __try
+ {
+ this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
+ - 1);
+ this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ this->_M_impl.construct(this->_M_impl._M_start._M_cur,
+ std::forward<_Args>(__args)...);
+#else
+ this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t);
+#endif
+ }
+ __catch(...)
+ {
+ ++this->_M_impl._M_start;
+ _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));
+ __throw_exception_again;
+ }
+ }
+
+ // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_first.
+ template <typename _Tp, typename _Alloc>
+ void deque<_Tp, _Alloc>::
+ _M_pop_back_aux()
+ {
+ _M_deallocate_node(this->_M_impl._M_finish._M_first);
+ this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1);
+ this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1;
+ this->_M_impl.destroy(this->_M_impl._M_finish._M_cur);
+ }
+
+ // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1.
+ // Note that if the deque has at least one element (a precondition for this
+ // member function), and if
+ // _M_impl._M_start._M_cur == _M_impl._M_start._M_last,
+ // then the deque must have at least two nodes.
+ template <typename _Tp, typename _Alloc>
+ void deque<_Tp, _Alloc>::
+ _M_pop_front_aux()
+ {
+ this->_M_impl.destroy(this->_M_impl._M_start._M_cur);
+ _M_deallocate_node(this->_M_impl._M_start._M_first);
+ this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1);
+ this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first;
+ }
+
+ template <typename _Tp, typename _Alloc>
+ template <typename _InputIterator>
+ void
+ deque<_Tp, _Alloc>::
+ _M_range_insert_aux(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
+ { std::copy(__first, __last, std::inserter(*this, __pos)); }
+
+ template <typename _Tp, typename _Alloc>
+ template <typename _ForwardIterator>
+ void
+ deque<_Tp, _Alloc>::
+ _M_range_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ const size_type __n = std::distance(__first, __last);
+ if (__pos._M_cur == this->_M_impl._M_start._M_cur)
+ {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ __try
+ {
+ std::__uninitialized_copy_a(__first, __last, __new_start,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_start = __new_start;
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
+ __throw_exception_again;
+ }
+ }
+ else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)
+ {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ __try
+ {
+ std::__uninitialized_copy_a(__first, __last,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
+ __new_finish._M_node + 1);
+ __throw_exception_again;
+ }
+ }
+ else
+ _M_insert_aux(__pos, __first, __last, __n);
+ }
+
+ template<typename _Tp, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ typename deque<_Tp, _Alloc>::iterator
+ deque<_Tp, _Alloc>::
+ _M_insert_aux(iterator __pos, _Args&&... __args)
+ {
+ value_type __x_copy(std::forward<_Args>(__args)...); // XXX copy
+#else
+ typename deque<_Tp, _Alloc>::iterator
+ deque<_Tp, _Alloc>::
+ _M_insert_aux(iterator __pos, const value_type& __x)
+ {
+ value_type __x_copy = __x; // XXX copy
+#endif
+ difference_type __index = __pos - this->_M_impl._M_start;
+ if (static_cast<size_type>(__index) < size() / 2)
+ {
+ push_front(_GLIBCXX_MOVE(front()));
+ iterator __front1 = this->_M_impl._M_start;
+ ++__front1;
+ iterator __front2 = __front1;
+ ++__front2;
+ __pos = this->_M_impl._M_start + __index;
+ iterator __pos1 = __pos;
+ ++__pos1;
+ _GLIBCXX_MOVE3(__front2, __pos1, __front1);
+ }
+ else
+ {
+ push_back(_GLIBCXX_MOVE(back()));
+ iterator __back1 = this->_M_impl._M_finish;
+ --__back1;
+ iterator __back2 = __back1;
+ --__back2;
+ __pos = this->_M_impl._M_start + __index;
+ _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1);
+ }
+ *__pos = _GLIBCXX_MOVE(__x_copy);
+ return __pos;
+ }
+
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_insert_aux(iterator __pos, size_type __n, const value_type& __x)
+ {
+ const difference_type __elems_before = __pos - this->_M_impl._M_start;
+ const size_type __length = this->size();
+ value_type __x_copy = __x;
+ if (__elems_before < difference_type(__length / 2))
+ {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_impl._M_start;
+ __pos = this->_M_impl._M_start + __elems_before;
+ __try
+ {
+ if (__elems_before >= difference_type(__n))
+ {
+ iterator __start_n = (this->_M_impl._M_start
+ + difference_type(__n));
+ std::__uninitialized_move_a(this->_M_impl._M_start,
+ __start_n, __new_start,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_start = __new_start;
+ _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
+ std::fill(__pos - difference_type(__n), __pos, __x_copy);
+ }
+ else
+ {
+ std::__uninitialized_move_fill(this->_M_impl._M_start,
+ __pos, __new_start,
+ this->_M_impl._M_start,
+ __x_copy,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_start = __new_start;
+ std::fill(__old_start, __pos, __x_copy);
+ }
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
+ __throw_exception_again;
+ }
+ }
+ else
+ {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_impl._M_finish;
+ const difference_type __elems_after =
+ difference_type(__length) - __elems_before;
+ __pos = this->_M_impl._M_finish - __elems_after;
+ __try
+ {
+ if (__elems_after > difference_type(__n))
+ {
+ iterator __finish_n = (this->_M_impl._M_finish
+ - difference_type(__n));
+ std::__uninitialized_move_a(__finish_n,
+ this->_M_impl._M_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
+ std::fill(__pos, __pos + difference_type(__n), __x_copy);
+ }
+ else
+ {
+ std::__uninitialized_fill_move(this->_M_impl._M_finish,
+ __pos + difference_type(__n),
+ __x_copy, __pos,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ std::fill(__pos, __old_finish, __x_copy);
+ }
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
+ __new_finish._M_node + 1);
+ __throw_exception_again;
+ }
+ }
+ }
+
+ template <typename _Tp, typename _Alloc>
+ template <typename _ForwardIterator>
+ void
+ deque<_Tp, _Alloc>::
+ _M_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n)
+ {
+ const difference_type __elemsbefore = __pos - this->_M_impl._M_start;
+ const size_type __length = size();
+ if (static_cast<size_type>(__elemsbefore) < __length / 2)
+ {
+ iterator __new_start = _M_reserve_elements_at_front(__n);
+ iterator __old_start = this->_M_impl._M_start;
+ __pos = this->_M_impl._M_start + __elemsbefore;
+ __try
+ {
+ if (__elemsbefore >= difference_type(__n))
+ {
+ iterator __start_n = (this->_M_impl._M_start
+ + difference_type(__n));
+ std::__uninitialized_move_a(this->_M_impl._M_start,
+ __start_n, __new_start,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_start = __new_start;
+ _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
+ std::copy(__first, __last, __pos - difference_type(__n));
+ }
+ else
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, difference_type(__n) - __elemsbefore);
+ std::__uninitialized_move_copy(this->_M_impl._M_start,
+ __pos, __first, __mid,
+ __new_start,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_start = __new_start;
+ std::copy(__mid, __last, __old_start);
+ }
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(__new_start._M_node,
+ this->_M_impl._M_start._M_node);
+ __throw_exception_again;
+ }
+ }
+ else
+ {
+ iterator __new_finish = _M_reserve_elements_at_back(__n);
+ iterator __old_finish = this->_M_impl._M_finish;
+ const difference_type __elemsafter =
+ difference_type(__length) - __elemsbefore;
+ __pos = this->_M_impl._M_finish - __elemsafter;
+ __try
+ {
+ if (__elemsafter > difference_type(__n))
+ {
+ iterator __finish_n = (this->_M_impl._M_finish
+ - difference_type(__n));
+ std::__uninitialized_move_a(__finish_n,
+ this->_M_impl._M_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
+ std::copy(__first, __last, __pos);
+ }
+ else
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, __elemsafter);
+ std::__uninitialized_copy_move(__mid, __last, __pos,
+ this->_M_impl._M_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __new_finish;
+ std::copy(__first, __mid, __pos);
+ }
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,
+ __new_finish._M_node + 1);
+ __throw_exception_again;
+ }
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_destroy_data_aux(iterator __first, iterator __last)
+ {
+ for (_Map_pointer __node = __first._M_node + 1;
+ __node < __last._M_node; ++__node)
+ std::_Destroy(*__node, *__node + _S_buffer_size(),
+ _M_get_Tp_allocator());
+
+ if (__first._M_node != __last._M_node)
+ {
+ std::_Destroy(__first._M_cur, __first._M_last,
+ _M_get_Tp_allocator());
+ std::_Destroy(__last._M_first, __last._M_cur,
+ _M_get_Tp_allocator());
+ }
+ else
+ std::_Destroy(__first._M_cur, __last._M_cur,
+ _M_get_Tp_allocator());
+ }
+
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_new_elements_at_front(size_type __new_elems)
+ {
+ if (this->max_size() - this->size() < __new_elems)
+ __throw_length_error(__N("deque::_M_new_elements_at_front"));
+
+ const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
+ / _S_buffer_size());
+ _M_reserve_map_at_front(__new_nodes);
+ size_type __i;
+ __try
+ {
+ for (__i = 1; __i <= __new_nodes; ++__i)
+ *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node();
+ }
+ __catch(...)
+ {
+ for (size_type __j = 1; __j < __i; ++__j)
+ _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j));
+ __throw_exception_again;
+ }
+ }
+
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_new_elements_at_back(size_type __new_elems)
+ {
+ if (this->max_size() - this->size() < __new_elems)
+ __throw_length_error(__N("deque::_M_new_elements_at_back"));
+
+ const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
+ / _S_buffer_size());
+ _M_reserve_map_at_back(__new_nodes);
+ size_type __i;
+ __try
+ {
+ for (__i = 1; __i <= __new_nodes; ++__i)
+ *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node();
+ }
+ __catch(...)
+ {
+ for (size_type __j = 1; __j < __i; ++__j)
+ _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j));
+ __throw_exception_again;
+ }
+ }
+
+ template <typename _Tp, typename _Alloc>
+ void
+ deque<_Tp, _Alloc>::
+ _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front)
+ {
+ const size_type __old_num_nodes
+ = this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1;
+ const size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
+
+ _Map_pointer __new_nstart;
+ if (this->_M_impl._M_map_size > 2 * __new_num_nodes)
+ {
+ __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size
+ - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ if (__new_nstart < this->_M_impl._M_start._M_node)
+ std::copy(this->_M_impl._M_start._M_node,
+ this->_M_impl._M_finish._M_node + 1,
+ __new_nstart);
+ else
+ std::copy_backward(this->_M_impl._M_start._M_node,
+ this->_M_impl._M_finish._M_node + 1,
+ __new_nstart + __old_num_nodes);
+ }
+ else
+ {
+ size_type __new_map_size = this->_M_impl._M_map_size
+ + std::max(this->_M_impl._M_map_size,
+ __nodes_to_add) + 2;
+
+ _Map_pointer __new_map = this->_M_allocate_map(__new_map_size);
+ __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
+ + (__add_at_front ? __nodes_to_add : 0);
+ std::copy(this->_M_impl._M_start._M_node,
+ this->_M_impl._M_finish._M_node + 1,
+ __new_nstart);
+ _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);
+
+ this->_M_impl._M_map = __new_map;
+ this->_M_impl._M_map_size = __new_map_size;
+ }
+
+ this->_M_impl._M_start._M_set_node(__new_nstart);
+ this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
+ }
+
+ // Overload for deque::iterators, exploiting the "segmented-iterator
+ // optimization". NB: leave const_iterators alone!
+ template<typename _Tp>
+ void
+ fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first,
+ const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value)
+ {
+ typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;
+
+ for (typename _Self::_Map_pointer __node = __first._M_node + 1;
+ __node < __last._M_node; ++__node)
+ std::fill(*__node, *__node + _Self::_S_buffer_size(), __value);
+
+ if (__first._M_node != __last._M_node)
+ {
+ std::fill(__first._M_cur, __first._M_last, __value);
+ std::fill(__last._M_first, __last._M_cur, __value);
+ }
+ else
+ std::fill(__first._M_cur, __last._M_cur, __value);
+ }
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/forward_list.h b/gcc-4.4.0/libstdc++-v3/include/bits/forward_list.h
new file mode 100644
index 000000000..d49eb4a06
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/forward_list.h
@@ -0,0 +1,1306 @@
+// <forward_list.h> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file forward_list.h
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _FORWARD_LIST_H
+#define _FORWARD_LIST_H 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <memory>
+#include <initializer_list>
+#include <ext/cast.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using __gnu_cxx::__static_pointer_cast;
+ using __gnu_cxx::__const_pointer_cast;
+
+ /**
+ * @brief A helper basic node class for %forward_list.
+ * This is just a linked list with nothing inside it.
+ * There are purely list shuffling utility methods here.
+ */
+ template<typename _Alloc>
+ struct _Fwd_list_node_base
+ {
+ // The type allocated by _Alloc cannot be this type, so we rebind
+ typedef typename _Alloc::template rebind<_Fwd_list_node_base<_Alloc> >
+ ::other::pointer _Pointer;
+ typedef typename _Alloc::template rebind<_Fwd_list_node_base<_Alloc> >
+ ::other::const_pointer _Const_pointer;
+
+ _Pointer _M_next;
+
+ _Fwd_list_node_base() : _M_next(0) { }
+
+ static void
+ swap(_Fwd_list_node_base& __x, _Fwd_list_node_base& __y)
+ { std::swap(__x._M_next, __y._M_next); }
+
+ void
+ _M_transfer_after(_Pointer __bbegin);
+
+ void
+ _M_transfer_after(_Pointer __bbegin, _Pointer __bend);
+
+ void
+ _M_reverse_after();
+ };
+
+ /**
+ * @brief A helper node class for %forward_list.
+ * This is just a linked list with a data value in each node.
+ * There is a sorting utility method.
+ */
+ template<typename _Tp, typename _Alloc>
+ struct _Fwd_list_node : public _Fwd_list_node_base<_Alloc>
+ {
+ typedef typename _Alloc::template rebind<_Fwd_list_node<_Tp, _Alloc> >
+ ::other::pointer _Pointer;
+
+ template<typename... _Args>
+ _Fwd_list_node(_Args&&... __args)
+ : _Fwd_list_node_base<_Alloc>(),
+ _M_value(std::forward<_Args>(__args)...) { }
+
+ template<typename _Comp>
+ void
+ _M_sort_after(_Comp __comp);
+
+ _Tp _M_value;
+ };
+
+ /**
+ * @brief A forward_list::iterator.
+ *
+ * All the functions are op overloads.
+ */
+ template<typename _Tp, typename _Alloc>
+ struct _Fwd_list_iterator
+ {
+ typedef _Fwd_list_iterator<_Tp, _Alloc> _Self;
+ typedef _Fwd_list_node<_Tp, _Alloc> _Node;
+ typedef _Fwd_list_node_base<_Alloc> _Node_base;
+
+ typedef _Tp value_type;
+ typedef typename _Alloc::pointer pointer;
+ typedef typename _Alloc::reference reference;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Fwd_list_iterator() : _M_node() { }
+
+ explicit
+ _Fwd_list_iterator(typename _Node_base::_Pointer __n)
+ : _M_node(__n) { }
+
+ reference
+ operator*() const
+ { return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
+
+ pointer
+ operator->() const
+ { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
+
+ _Self&
+ operator++()
+ {
+ _M_node = _M_node->_M_next;
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp(*this);
+ _M_node = _M_node->_M_next;
+ return __tmp;
+ }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ _Self
+ _M_next() const
+ {
+ if (_M_node)
+ return _Fwd_list_iterator(_M_node->_M_next);
+ else
+ return _Fwd_list_iterator(0);
+ }
+
+ typename _Node_base::_Pointer _M_node;
+ };
+
+ /**
+ * @brief A forward_list::const_iterator.
+ *
+ * All the functions are op overloads.
+ */
+ template<typename _Tp, typename _Alloc>
+ struct _Fwd_list_const_iterator
+ {
+ typedef _Fwd_list_const_iterator<_Tp, _Alloc> _Self;
+ typedef const _Fwd_list_node<_Tp, _Alloc> _Node;
+ typedef const _Fwd_list_node_base<_Alloc> _Node_base;
+ typedef _Fwd_list_iterator<_Tp, _Alloc> iterator;
+
+ typedef _Tp value_type;
+ typedef typename _Alloc::const_pointer pointer;
+ typedef typename _Alloc::const_reference reference;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Fwd_list_const_iterator() : _M_node() { }
+
+ explicit
+ _Fwd_list_const_iterator(typename _Node_base::_Const_pointer __n)
+ : _M_node(__n) { }
+
+ _Fwd_list_const_iterator(const iterator& __iter)
+ : _M_node(__iter._M_node) { }
+
+ reference
+ operator*() const
+ { return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
+
+ pointer
+ operator->() const
+ { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
+
+ _Self&
+ operator++()
+ {
+ _M_node = _M_node->_M_next;
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp(*this);
+ _M_node = _M_node->_M_next;
+ return __tmp;
+ }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ _Self
+ _M_next() const
+ {
+ if (this->_M_node)
+ return _Fwd_list_const_iterator(_M_node->_M_next);
+ else
+ return _Fwd_list_const_iterator(0);
+ }
+
+ typename _Node_base::_Const_pointer _M_node;
+ };
+
+ /**
+ * @brief Forward list iterator equality comparison.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const _Fwd_list_iterator<_Tp, _Alloc>& __x,
+ const _Fwd_list_const_iterator<_Tp, _Alloc>& __y)
+ { return __x._M_node == __y._M_node; }
+
+ /**
+ * @brief Forward list iterator inequality comparison.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const _Fwd_list_iterator<_Tp, _Alloc>& __x,
+ const _Fwd_list_const_iterator<_Tp, _Alloc>& __y)
+ { return __x._M_node != __y._M_node; }
+
+ /**
+ * @brief Base class for %forward_list.
+ */
+ template<typename _Tp, typename _Alloc>
+ struct _Fwd_list_base
+ {
+ protected:
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+
+ typedef typename _Alloc::template
+ rebind<_Fwd_list_node<_Tp, _Tp_alloc_type>>::other _Node_alloc_type;
+
+ struct _Fwd_list_impl
+ : public _Node_alloc_type
+ {
+ _Fwd_list_node_base<_Tp_alloc_type> _M_head;
+
+ _Fwd_list_impl()
+ : _Node_alloc_type(), _M_head()
+ { }
+
+ _Fwd_list_impl(const _Node_alloc_type& __a)
+ : _Node_alloc_type(__a), _M_head()
+ { }
+ };
+
+ _Fwd_list_impl _M_impl;
+
+ public:
+ typedef _Fwd_list_iterator<_Tp, _Tp_alloc_type> iterator;
+ typedef _Fwd_list_const_iterator<_Tp, _Tp_alloc_type> const_iterator;
+
+ typedef _Fwd_list_node<_Tp, _Tp_alloc_type> _Node;
+ typedef _Fwd_list_node_base<_Tp_alloc_type> _Node_base;
+
+ _Node_alloc_type&
+ _M_get_Node_allocator()
+ { return *static_cast<_Node_alloc_type*>(&this->_M_impl); }
+
+ const _Node_alloc_type&
+ _M_get_Node_allocator() const
+ { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); }
+
+ _Fwd_list_base()
+ : _M_impl()
+ { this->_M_impl._M_head._M_next = 0; }
+
+ _Fwd_list_base(const _Alloc& __a)
+ : _M_impl(__a)
+ { this->_M_impl._M_head._M_next = 0; }
+
+ _Fwd_list_base(const _Fwd_list_base& __lst, const _Alloc& __a);
+
+ _Fwd_list_base(_Fwd_list_base&& __lst, const _Alloc& __a)
+ : _M_impl(__a)
+ { _Node_base::swap(this->_M_impl._M_head,
+ __lst._M_impl._M_head); }
+
+ _Fwd_list_base(_Fwd_list_base&& __lst)
+ : _M_impl(__lst._M_get_Node_allocator())
+ { _Node_base::swap(this->_M_impl._M_head,
+ __lst._M_impl._M_head); }
+
+ ~_Fwd_list_base()
+ { _M_erase_after(&_M_impl._M_head, 0); }
+
+ protected:
+
+ typename _Node::_Pointer
+ _M_get_node()
+ { return _M_get_Node_allocator().allocate(1); }
+
+ template<typename... _Args>
+ typename _Node::_Pointer
+ _M_create_node(_Args&&... __args)
+ {
+ typename _Node::_Pointer __node = this->_M_get_node();
+ __try
+ {
+ _M_get_Node_allocator().construct(__node,
+ std::forward<_Args>(__args)...);
+ __node->_M_next = 0;
+ }
+ __catch(...)
+ {
+ this->_M_put_node(__node);
+ __throw_exception_again;
+ }
+ return __node;
+ }
+
+ template<typename... _Args>
+ typename _Node_base::_Pointer
+ _M_insert_after(const_iterator __pos, _Args&&... __args);
+
+ void
+ _M_put_node(typename _Node::_Pointer __p)
+ { _M_get_Node_allocator().deallocate(__p, 1); }
+
+ typename _Node_base::_Pointer
+ _M_erase_after(typename _Node_base::_Pointer __pos);
+
+ typename _Node_base::_Pointer
+ _M_erase_after(typename _Node_base::_Pointer __pos,
+ typename _Node_base::_Pointer __last);
+ };
+
+ /**
+ * @brief A standard container with linear time access to elements,
+ * and fixed time insertion/deletion at any point in the sequence.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#67">sequence</a>, including the
+ * <a href="tables.html#68">optional sequence requirements</a> with the
+ * %exception of @c at and @c operator[].
+ *
+ * This is a @e singly @e linked %list. Traversal up the
+ * %list requires linear time, but adding and removing elements (or
+ * @e nodes) is done in constant time, regardless of where the
+ * change takes place. Unlike std::vector and std::deque,
+ * random-access iterators are not provided, so subscripting ( @c
+ * [] ) access is not allowed. For algorithms which only need
+ * sequential access, this lack makes no difference.
+ *
+ * Also unlike the other standard containers, std::forward_list provides
+ * specialized algorithms %unique to linked lists, such as
+ * splicing, sorting, and in-place reversal.
+ *
+ * A couple points on memory allocation for forward_list<Tp>:
+ *
+ * First, we never actually allocate a Tp, we allocate
+ * Fwd_list_node<Tp>'s and trust [20.1.5]/4 to DTRT. This is to ensure
+ * that after elements from %forward_list<X,Alloc1> are spliced into
+ * %forward_list<X,Alloc2>, destroying the memory of the second %list is a
+ * valid operation, i.e., Alloc1 giveth and Alloc2 taketh away.
+ */
+ template<typename _Tp, typename _Alloc = allocator<_Tp> >
+ class forward_list : private _Fwd_list_base<_Tp, _Alloc>
+ {
+ private:
+ typedef _Fwd_list_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Node _Node;
+ typedef typename _Base::_Node_base _Node_base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+
+ public:
+ // types:
+ typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef typename _Tp_alloc_type::const_pointer const_pointer;
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+
+ // 23.2.3.1 construct/copy/destroy:
+
+ /**
+ * @brief Creates a %forward_list with no elements.
+ * @param al An allocator object.
+ */
+ explicit
+ forward_list(const _Alloc& __al = _Alloc())
+ : _Base(__al)
+ { }
+
+ /**
+ * @brief Copy constructor with allocator argument.
+ * @param list Input list to copy.
+ * @param al An allocator object.
+ */
+ forward_list(const forward_list& __list, const _Alloc& __al)
+ : _Base(__list, __al)
+ { }
+
+ /**
+ * @brief Move constructor with allocator argument.
+ * @param list Input list to move.
+ * @param al An allocator object.
+ */
+ forward_list(forward_list&& __list, const _Alloc& __al)
+ : _Base(std::forward<_Base>(__list), __al)
+ { }
+
+ /**
+ * @brief Creates a %forward_list with copies of the default element
+ * type.
+ * @param n The number of elements to initially create.
+ *
+ * This constructor fills the %forward_list with @a n copies of
+ * the default value.
+ */
+ explicit
+ forward_list(size_type __n)
+ : _Base()
+ { _M_fill_initialize(__n, value_type()); }
+
+ /**
+ * @brief Creates a %forward_list with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param al An allocator object.
+ *
+ * This constructor fills the %forward_list with @a n copies of @a
+ * value.
+ */
+ forward_list(size_type __n, const _Tp& __value,
+ const _Alloc& __al = _Alloc())
+ : _Base(__al)
+ { _M_fill_initialize(__n, __value); }
+
+ /**
+ * @brief Builds a %forward_list from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param al An allocator object.
+ *
+ * Create a %forward_list consisting of copies of the elements from
+ * [@a first,@a last). This is linear in N (where N is
+ * distance(@a first,@a last)).
+ */
+ template<typename _InputIterator>
+ forward_list(_InputIterator __first, _InputIterator __last,
+ const _Alloc& __al = _Alloc())
+ : _Base(__al)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+ /**
+ * @brief The %forward_list copy constructor.
+ * @param list A %forward_list of identical element and allocator
+ * types.
+ *
+ * The newly-created %forward_list uses a copy of the allocation
+ * object used by @a list.
+ */
+ forward_list(const forward_list& __list)
+ : _Base(__list.get_allocator())
+ { _M_initialize_dispatch(__list.begin(), __list.end(), __false_type()); }
+
+ /**
+ * @brief The %forward_list move constructor.
+ * @param list A %forward_list of identical element and allocator
+ * types.
+ *
+ * The newly-created %forward_list contains the exact contents of @a
+ * forward_list. The contents of @a list are a valid, but unspecified
+ * %forward_list.
+ */
+ forward_list(forward_list&& __list)
+ : _Base(std::forward<_Base>(__list)) { }
+
+ /**
+ * @brief Builds a %forward_list from an initializer_list
+ * @param il An initializer_list of value_type.
+ * @param al An allocator object.
+ *
+ * Create a %forward_list consisting of copies of the elements
+ * in the initializer_list @a il. This is linear in il.size().
+ */
+ forward_list(std::initializer_list<_Tp> __il,
+ const _Alloc& __al = _Alloc())
+ : _Base(__al)
+ { _M_initialize_dispatch(__il.begin(), __il.end(), __false_type()); }
+
+ /**
+ * @brief The forward_list dtor.
+ */
+ ~forward_list()
+ { _M_erase_after(&this->_M_impl._M_head, 0); }
+
+ /**
+ * @brief The %forward_list assignment operator.
+ * @param list A %forward_list of identical element and allocator
+ * types.
+ *
+ * All the elements of @a list are copied, but unlike the copy
+ * constructor, the allocator object is not copied.
+ */
+ forward_list&
+ operator=(const forward_list& __list);
+
+ /**
+ * @brief The %forward_list move assignment operator.
+ * @param list A %forward_list of identical element and allocator
+ * types.
+ *
+ * The contents of @a list are moved into this %forward_list
+ * (without copying). @a list is a valid, but unspecified
+ * %forward_list
+ */
+ forward_list&
+ operator=(forward_list&& __list)
+ {
+ if (&__list != this)
+ {
+ this->clear();
+ this->swap(__list);
+ }
+ return *this;
+ }
+
+ /**
+ * @brief The %forward_list initializer list assignment operator.
+ * @param il An initializer_list of value_type.
+ *
+ * Replace the contents of the %forward_list with copies of the
+ * elements in the initializer_list @a il. This is linear in
+ * il.size().
+ */
+ forward_list&
+ operator=(std::initializer_list<_Tp> __il)
+ {
+ assign(__il);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a range to a %forward_list.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function fills a %forward_list with copies of the elements
+ * in the range [@a first,@a last).
+ *
+ * Note that the assignment completely changes the %forward_list and
+ * that the resulting %forward_list's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ template<typename _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ clear();
+ insert_after(cbefore_begin(), __first, __last);
+ }
+
+ /**
+ * @brief Assigns a given value to a %forward_list.
+ * @param n Number of elements to be assigned.
+ * @param val Value to be assigned.
+ *
+ * This function fills a %forward_list with @a n copies of the given
+ * value. Note that the assignment completely changes the
+ * %forward_list and that the resulting %forward_list's size is the
+ * same as the number of elements assigned. Old data may be lost.
+ */
+ void
+ assign(size_type __n, const _Tp& __val)
+ {
+ clear();
+ insert_after(cbefore_begin(), __n, __val);
+ }
+
+ /**
+ * @brief Assigns an initializer_list to a %forward_list.
+ * @param il An initializer_list of value_type.
+ *
+ * Replace the contents of the %forward_list with copies of the
+ * elements in the initializer_list @a il. This is linear in
+ * il.size().
+ */
+ void
+ assign(std::initializer_list<_Tp> __il)
+ {
+ clear();
+ insert_after(cbefore_begin(), __il);
+ }
+
+ /// Get a copy of the memory allocation object.
+ allocator_type
+ get_allocator() const
+ { return this->_M_get_Node_allocator(); }
+
+ // 23.2.3.2 iterators:
+
+ /**
+ * Returns a read/write iterator that points before the first element
+ * in the %forward_list. Iteration is done in ordinary element order.
+ */
+ iterator
+ before_begin()
+ { return iterator(&this->_M_impl._M_head); }
+
+ /**
+ * Returns a read-only (constant) iterator that points before the
+ * first element in the %forward_list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ before_begin() const
+ { return const_iterator(&this->_M_impl._M_head); }
+
+ /**
+ * Returns a read/write iterator that points to the first element
+ * in the %forward_list. Iteration is done in ordinary element order.
+ */
+ iterator
+ begin()
+ { return iterator(this->_M_impl._M_head._M_next); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %forward_list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ begin() const
+ { return const_iterator(this->_M_impl._M_head._M_next); }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * element in the %forward_list. Iteration is done in ordinary
+ * element order.
+ */
+ iterator
+ end()
+ { return iterator(0); }
+
+ /**
+ * Returns a read-only iterator that points one past the last
+ * element in the %forward_list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ end() const
+ { return const_iterator(0); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the
+ * first element in the %forward_list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ cbegin() const
+ { return const_iterator(this->_M_impl._M_head._M_next); }
+
+ /**
+ * Returns a read-only (constant) iterator that points before the
+ * first element in the %forward_list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ cbefore_begin() const
+ { return const_iterator(&this->_M_impl._M_head); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %forward_list. Iteration is done in
+ * ordinary element order.
+ */
+ const_iterator
+ cend() const
+ { return const_iterator(0); }
+
+ /**
+ * Returns true if the %forward_list is empty. (Thus begin() would
+ * equal end().)
+ */
+ bool
+ empty() const
+ { return this->_M_impl._M_head._M_next == 0; }
+
+ /**
+ * Returns the largest possible size of %forward_list.
+ */
+ size_type
+ max_size() const
+ { return this->_M_get_Node_allocator().max_size(); }
+
+ // 23.2.3.3 element access:
+
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %forward_list.
+ */
+ reference
+ front()
+ {
+ _Node* __front =
+ __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next);
+ return __front->_M_value;
+ }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %forward_list.
+ */
+ const_reference
+ front() const
+ {
+ _Node* __front =
+ __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next);
+ return __front->_M_value;
+ }
+
+ // 23.2.3.4 modifiers:
+
+ /**
+ * @brief Constructs object in %forward_list at the front of the
+ * list.
+ * @param args Arguments.
+ *
+ * This function will insert an object of type Tp constructed
+ * with Tp(std::forward<Args>(args)...) at the front of the list
+ * Due to the nature of a %forward_list this operation can
+ * be done in constant time, and does not invalidate iterators
+ * and references.
+ */
+ template<typename... _Args>
+ void
+ emplace_front(_Args&&... __args)
+ { this->_M_insert_after(cbefore_begin(),
+ std::forward<_Args>(__args)...); }
+
+ /**
+ * @brief Add data to the front of the %forward_list.
+ * @param val Data to be added.
+ *
+ * This is a typical stack operation. The function creates an
+ * element at the front of the %forward_list and assigns the given
+ * data to it. Due to the nature of a %forward_list this operation
+ * can be done in constant time, and does not invalidate iterators
+ * and references.
+ */
+ void
+ push_front(const _Tp& __val)
+ { this->_M_insert_after(cbefore_begin(), __val); }
+
+ /**
+ *
+ */
+ void
+ push_front(_Tp&& __val)
+ { this->_M_insert_after(cbefore_begin(), std::move(__val)); }
+
+ /**
+ * @brief Removes first element.
+ *
+ * This is a typical stack operation. It shrinks the %forward_list
+ * by one. Due to the nature of a %forward_list this operation can
+ * be done in constant time, and only invalidates iterators/references
+ * to the element being removed.
+ *
+ * Note that no data is returned, and if the first element's data
+ * is needed, it should be retrieved before pop_front() is
+ * called.
+ */
+ void
+ pop_front()
+ { this->_M_erase_after(&this->_M_impl._M_head); }
+
+ /**
+ * @brief Constructs object in %forward_list after the specified
+ * iterator.
+ * @param pos A const_iterator into the %forward_list.
+ * @param args Arguments.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert an object of type T constructed
+ * with T(std::forward<Args>(args)...) after the specified
+ * location. Due to the nature of a %forward_list this operation can
+ * be done in constant time, and does not invalidate iterators
+ * and references.
+ */
+ template<typename... _Args>
+ iterator
+ emplace_after(const_iterator __pos, _Args&&... __args)
+ { return iterator(this->_M_insert_after(__pos,
+ std::forward<_Args>(__args)...)); }
+
+ /**
+ * @brief Inserts given value into %forward_list after specified
+ * iterator.
+ * @param pos An iterator into the %forward_list.
+ * @param val Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given value after
+ * the specified location. Due to the nature of a %forward_list this
+ * operation can be done in constant time, and does not
+ * invalidate iterators and references.
+ */
+ iterator
+ insert_after(const_iterator __pos, const _Tp& __val)
+ { return iterator(this->_M_insert_after(__pos, __val)); }
+
+ /**
+ *
+ */
+ iterator
+ insert_after(const_iterator __pos, _Tp&& __val)
+ { return iterator(this->_M_insert_after(__pos, std::move(__val))); }
+
+ /**
+ * @brief Inserts a number of copies of given data into the
+ * %forward_list.
+ * @param pos An iterator into the %forward_list.
+ * @param n Number of elements to be inserted.
+ * @param val Data to be inserted.
+ *
+ * This function will insert a specified number of copies of the
+ * given data after the location specified by @a pos.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ void
+ insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
+ {
+ forward_list __tmp(__n, __val, this->get_allocator());
+ this->splice_after(__pos, std::move(__tmp));
+ }
+
+ /**
+ * @brief Inserts a range into the %forward_list.
+ * @param position An iterator into the %forward_list.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function will insert copies of the data in the range [@a
+ * first,@a last) into the %forward_list after the location specified
+ * by @a pos.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ template<typename _InputIterator>
+ void
+ insert_after(const_iterator __pos,
+ _InputIterator __first, _InputIterator __last)
+ {
+ forward_list __tmp(__first, __last, this->get_allocator());
+ this->splice_after(__pos, std::move(__tmp));
+ }
+
+ /**
+ * @brief Inserts the contents of an initializer_list into
+ * %forward_list after the specified iterator.
+ * @param pos An iterator into the %forward_list.
+ * @param il An initializer_list of value_type.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a il into the %forward_list before the location
+ * specified by @a pos.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ void
+ insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
+ {
+ forward_list __tmp(__il, this->get_allocator());
+ this->splice_after(__pos, std::move(__tmp));
+ }
+
+ /**
+ * @brief Removes the element pointed to by the iterator following
+ * @c pos.
+ * @param pos Iterator pointing to element to be erased.
+ * @return An iterator pointing to the next element (or end()).
+ *
+ * This function will erase the element at the given position and
+ * thus shorten the %forward_list by one.
+ *
+ * Due to the nature of a %forward_list this operation can be done
+ * in constant time, and only invalidates iterators/references to
+ * the element being removed. The user is also cautioned that
+ * this function only erases the element, and that if the element
+ * is itself a pointer, the pointed-to memory is not touched in
+ * any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase_after(const_iterator __pos)
+ {
+ _Node_base* __tmp = __const_pointer_cast<_Node_base*>(__pos._M_node);
+ if (__tmp)
+ return iterator(this->_M_erase_after(__tmp));
+ else
+ return end();
+ }
+
+ /**
+ * @brief Remove a range of elements.
+ * @param pos Iterator pointing before the first element to be
+ * erased.
+ * @param last Iterator pointing to one past the last element to be
+ * erased.
+ * @return An iterator pointing to the element pointed to by @a last
+ * prior to erasing (or end()).
+ *
+ * This function will erase the elements in the range @a
+ * (pos,last) and shorten the %forward_list accordingly.
+ *
+ * This operation is linear time in the size of the range and only
+ * invalidates iterators/references to the element being removed.
+ * The user is also cautioned that this function only erases the
+ * elements, and that if the elements themselves are pointers, the
+ * pointed-to memory is not touched in any way. Managing the pointer
+ * is the user's responsibility.
+ */
+ iterator
+ erase_after(const_iterator __pos, iterator __last)
+ {
+ _Node_base* __tmp = __const_pointer_cast<_Node_base*>(__pos._M_node);
+ return iterator(this->_M_erase_after(__tmp, &*__last._M_node));
+ }
+
+ /**
+ * @brief Swaps data with another %forward_list.
+ * @param list A %forward_list of the same element and allocator
+ * types.
+ *
+ * This exchanges the elements between two lists in constant
+ * time. Note that the global std::swap() function is
+ * specialized such that std::swap(l1,l2) will feed to this
+ * function.
+ */
+ void
+ swap(forward_list&& __list)
+ { _Node_base::swap(this->_M_impl._M_head, __list._M_impl._M_head); }
+
+ /**
+ * @brief Resizes the %forward_list to the specified number of
+ * elements.
+ * @param sz Number of elements the %forward_list should contain.
+ *
+ * This function will %resize the %forward_list to the specified
+ * number of elements. If the number is smaller than the
+ * %forward_list's current size the %forward_list is truncated,
+ * otherwise the %forward_list is extended and new elements are
+ * populated with given data.
+ */
+ void
+ resize(size_type __sz)
+ { resize(__sz, _Tp()); }
+
+ /**
+ * @brief Resizes the %forward_list to the specified number of
+ * elements.
+ * @param sz Number of elements the %forward_list should contain.
+ * @param val Data with which new elements should be populated.
+ *
+ * This function will %resize the %forward_list to the specified
+ * number of elements. If the number is smaller than the
+ * %forward_list's current size the %forward_list is truncated,
+ * otherwise the %forward_list is extended and new elements are
+ * populated with given data.
+ */
+ void
+ resize(size_type __sz, value_type __val);
+
+ /**
+ * @brief Erases all the elements.
+ *
+ * Note that this function only erases
+ * the elements, and that if the elements themselves are
+ * pointers, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ void
+ clear()
+ { this->_M_erase_after(&this->_M_impl._M_head, 0); }
+
+ // 23.2.3.5 forward_list operations:
+
+ /**
+ * @brief Insert contents of another %forward_list.
+ * @param pos Iterator referencing the element to insert after.
+ * @param list Source list.
+ *
+ * The elements of @a list are inserted in constant time after
+ * the element referenced by @a pos. @a list becomes an empty
+ * list.
+ *
+ * Requires this != @a x.
+ */
+ void
+ splice_after(const_iterator __pos, forward_list&& __list);
+
+ /**
+ * @brief Insert element from another %forward_list.
+ * @param pos Iterator referencing the element to insert after.
+ * @param list Source list.
+ * @param it Iterator referencing the element before the element
+ * to move.
+ *
+ * Removes the element in list @a list referenced by @a i and
+ * inserts it into the current list after @a pos.
+ */
+ void
+ splice_after(const_iterator __pos, forward_list&& __list,
+ const_iterator __it)
+ { this->splice_after(__pos, __list, __it, __it._M_next()); }
+
+ /**
+ * @brief Insert range from another %forward_list.
+ * @param pos Iterator referencing the element to insert after.
+ * @param list Source list.
+ * @param before Iterator referencing before the start of range
+ * in list.
+ * @param last Iterator referencing the end of range in list.
+ *
+ * Removes elements in the range (before,last) and inserts them
+ * after @a pos in constant time.
+ *
+ * Undefined if @a pos is in (before,last).
+ */
+ void
+ splice_after(const_iterator __pos, forward_list&& __list,
+ const_iterator __before, const_iterator __last);
+
+ /**
+ * @brief Remove all elements equal to value.
+ * @param val The value to remove.
+ *
+ * Removes every element in the list equal to @a value.
+ * Remaining elements stay in list order. Note that this
+ * function only erases the elements, and that if the elements
+ * themselves are pointers, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ void
+ remove(const _Tp& __val);
+
+ /**
+ * @brief Remove all elements satisfying a predicate.
+ * @param pred Unary predicate function or object.
+ *
+ * Removes every element in the list for which the predicate
+ * returns true. Remaining elements stay in list order. Note
+ * that this function only erases the elements, and that if the
+ * elements themselves are pointers, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ template<typename _Pred>
+ void
+ remove_if(_Pred __pred);
+
+ /**
+ * @brief Remove consecutive duplicate elements.
+ *
+ * For each consecutive set of elements with the same value,
+ * remove all but the first one. Remaining elements stay in
+ * list order. Note that this function only erases the
+ * elements, and that if the elements themselves are pointers,
+ * the pointed-to memory is not touched in any way. Managing
+ * the pointer is the user's responsibility.
+ */
+ void
+ unique()
+ { this->unique(std::equal_to<_Tp>()); }
+
+ /**
+ * @brief Remove consecutive elements satisfying a predicate.
+ * @param binary_pred Binary predicate function or object.
+ *
+ * For each consecutive set of elements [first,last) that
+ * satisfy predicate(first,i) where i is an iterator in
+ * [first,last), remove all but the first one. Remaining
+ * elements stay in list order. Note that this function only
+ * erases the elements, and that if the elements themselves are
+ * pointers, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ template<typename _BinPred>
+ void
+ unique(_BinPred __binary_pred);
+
+ /**
+ * @brief Merge sorted lists.
+ * @param list Sorted list to merge.
+ *
+ * Assumes that both @a list and this list are sorted according to
+ * operator<(). Merges elements of @a list into this list in
+ * sorted order, leaving @a list empty when complete. Elements in
+ * this list precede elements in @a list that are equal.
+ */
+ void
+ merge(forward_list&& __list)
+ { this->merge(__list, std::less<_Tp>()); }
+
+ /**
+ * @brief Merge sorted lists according to comparison function.
+ * @param list Sorted list to merge.
+ * @param comp Comparison function defining sort order.
+ *
+ * Assumes that both @a list and this list are sorted according to
+ * comp. Merges elements of @a list into this list
+ * in sorted order, leaving @a list empty when complete. Elements
+ * in this list precede elements in @a list that are equivalent
+ * according to comp().
+ */
+ template<typename _Comp>
+ void
+ merge(forward_list&& __list, _Comp __comp);
+
+ /**
+ * @brief Sort the elements of the list.
+ *
+ * Sorts the elements of this list in NlogN time. Equivalent
+ * elements remain in list order.
+ */
+ void
+ sort()
+ {
+ _Node* __tmp = __static_pointer_cast<_Node*>(&this->_M_impl._M_head);
+ __tmp->_M_sort_after(std::less<_Tp>());
+ }
+
+ /**
+ * @brief Sort the forward_list using a comparison function.
+ *
+ * Sorts the elements of this list in NlogN time. Equivalent
+ * elements remain in list order.
+ */
+ template<typename _Comp>
+ void
+ sort(_Comp __comp)
+ {
+ _Node* __tmp = __static_pointer_cast<_Node*>(&this->_M_impl._M_head);
+ __tmp->_M_sort_after(__comp);
+ }
+
+ /**
+ * @brief Reverse the elements in list.
+ *
+ * Reverse the order of elements in the list in linear time.
+ */
+ void
+ reverse()
+ { this->_M_impl._M_head._M_reverse_after(); }
+
+ private:
+ template<typename _Integer>
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
+ { _M_fill_initialize(static_cast<size_type>(__n), __x); }
+
+ // Called by the range constructor to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type);
+
+ // Called by forward_list(n,v,a), and the range constructor when it
+ // turns out to be the same thing.
+ void
+ _M_fill_initialize(size_type __n, const value_type& __value);
+ };
+
+ /**
+ * @brief Forward list equality comparison.
+ * @param lx A %forward_list
+ * @param ly A %forward_list of the same type as @a lx.
+ * @return True iff the size and elements of the forward lists are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the
+ * forward lists. Deques are considered equivalent if corresponding
+ * elements compare equal.
+ */
+ template<typename _Tp, typename _Alloc>
+ bool
+ operator==(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly);
+
+ /**
+ * @brief Forward list ordering relation.
+ * @param lx A %forward_list.
+ * @param ly A %forward_list of the same type as @a lx.
+ * @return True iff @a lx is lexicographically less than @a ly.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * forward lists. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly)
+ { return std::lexicographical_compare(__lx.cbegin(), __lx.cend(),
+ __ly.cbegin(), __ly.cend()); }
+
+ /// Based on operator==
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly)
+ { return !(__lx == __ly); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly)
+ { return (__ly < __lx); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly)
+ { return !(__lx < __ly); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly)
+ { return !(__ly < __lx); }
+
+ /// See std::forward_list::swap().
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(forward_list<_Tp, _Alloc>& __lx,
+ forward_list<_Tp, _Alloc>& __ly)
+ { __lx.swap(__ly); }
+
+ /// See std::forward_list::swap().
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(forward_list<_Tp, _Alloc>&& __lx,
+ forward_list<_Tp, _Alloc>& __ly)
+ { __lx.swap(__ly); }
+
+ /// See std::forward_list::swap().
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(forward_list<_Tp, _Alloc>& __lx,
+ forward_list<_Tp, _Alloc>&& __ly)
+ { __lx.swap(__ly); }
+
+_GLIBCXX_END_NAMESPACE // namespace std
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _FORWARD_LIST_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/forward_list.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/forward_list.tcc
new file mode 100644
index 000000000..8458e7e5f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/forward_list.tcc
@@ -0,0 +1,478 @@
+// <forward_list.tcc> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file forward_list.tcc
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _FORWARD_LIST_TCC
+#define _FORWARD_LIST_TCC 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Alloc>
+ void
+ _Fwd_list_node_base<_Alloc>::
+ _M_transfer_after(_Pointer __bbegin)
+ {
+ _Pointer __bend = __bbegin;
+ while (__bend && __bend->_M_next)
+ __bend = __bend->_M_next;
+ _M_transfer_after(__bbegin, __bend);
+ }
+
+ template<typename _Alloc>
+ void
+ _Fwd_list_node_base<_Alloc>::
+ _M_transfer_after(_Pointer __bbegin, _Pointer __bend)
+ {
+ _Pointer __keep = __bbegin->_M_next;
+ if (__bend)
+ {
+ __bbegin->_M_next = __bend->_M_next;
+ __bend->_M_next = _M_next;
+ }
+ else
+ __bbegin->_M_next = 0;
+ _M_next = __keep;
+ }
+
+ template<typename _Alloc>
+ void
+ _Fwd_list_node_base<_Alloc>::
+ _M_reverse_after()
+ {
+ _Pointer __tail = _M_next;
+ if (!__tail)
+ return;
+ while (_Pointer __temp = __tail->_M_next)
+ {
+ _Pointer __keep = _M_next;
+ _M_next = __temp;
+ __tail->_M_next = __temp->_M_next;
+ _M_next->_M_next = __keep;
+ }
+ }
+
+ /**
+ * @brief Sort the singly linked list starting after this node.
+ * This node is assumed to be an empty head node (of type
+ * _Fwd_list_node_base).
+ */
+ template<typename _Tp, class _Alloc>
+ template<typename _Comp>
+ void
+ _Fwd_list_node<_Tp, _Alloc>::
+ _M_sort_after(_Comp __comp)
+ {
+ // If `next' is 0, return immediately.
+ _Pointer __list = __static_pointer_cast<_Pointer>(this->_M_next);
+ if (!__list)
+ return;
+
+ unsigned long __insize = 1;
+
+ while (1)
+ {
+ _Pointer __p = __list;
+ __list = 0;
+ _Pointer __tail = 0;
+
+ // Count number of merges we do in this pass.
+ unsigned long __nmerges = 0;
+
+ while (__p)
+ {
+ ++__nmerges;
+ // There exists a merge to be done.
+ // Step `insize' places along from p.
+ _Pointer __q = __p;
+ unsigned long __psize = 0;
+ for (unsigned long __i = 0; __i < __insize; ++__i)
+ {
+ ++__psize;
+ __q = __static_pointer_cast<_Pointer>(__q->_M_next);
+ if (!__q)
+ break;
+ }
+
+ // If q hasn't fallen off end, we have two lists to merge.
+ unsigned long __qsize = __insize;
+
+ // Now we have two lists; merge them.
+ while (__psize > 0 || (__qsize > 0 && __q))
+ {
+ // Decide whether next node of merge comes from p or q.
+ _Pointer __e;
+ if (__psize == 0)
+ {
+ // p is empty; e must come from q.
+ __e = __q;
+ __q = __static_pointer_cast<_Pointer>(__q->_M_next);
+ --__qsize;
+ }
+ else if (__qsize == 0 || !__q)
+ {
+ // q is empty; e must come from p.
+ __e = __p;
+ __p = __static_pointer_cast<_Pointer>(__p->_M_next);
+ --__psize;
+ }
+ else if (__comp(__p->_M_value, __q->_M_value))
+ {
+ // First node of p is lower; e must come from p.
+ __e = __p;
+ __p = __static_pointer_cast<_Pointer>(__p->_M_next);
+ --__psize;
+ }
+ else
+ {
+ // First node of q is lower; e must come from q.
+ __e = __q;
+ __q = __static_pointer_cast<_Pointer>(__q->_M_next);
+ --__qsize;
+ }
+
+ // Add the next node to the merged list.
+ if (__tail)
+ __tail->_M_next = __e;
+ else
+ __list = __e;
+ __tail = __e;
+ }
+
+ // Now p has stepped `insize' places along, and q has too.
+ __p = __q;
+ }
+ __tail->_M_next = 0;
+
+ // If we have done only one merge, we're finished.
+ // Allow for nmerges == 0, the empty list case.
+ if (__nmerges <= 1)
+ {
+ this->_M_next = __list;
+ return;
+ }
+
+ // Otherwise repeat, merging lists twice the size.
+ __insize *= 2;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ _Fwd_list_base<_Tp, _Alloc>::
+ _Fwd_list_base(const _Fwd_list_base& __lst, const _Alloc& __a)
+ : _M_impl(__a)
+ {
+ this->_M_impl._M_head._M_next = 0;
+ typename _Node_base::_Pointer __to = &this->_M_impl._M_head;
+ typename _Node::_Pointer __curr
+ = __static_pointer_cast<typename _Node::_Pointer>
+ (__lst._M_impl._M_head._M_next);
+ while (__curr)
+ {
+ __to->_M_next = _M_create_node(__curr->_M_value);
+ __to = __to->_M_next;
+ __curr = __static_pointer_cast<typename _Node::_Pointer>
+ (__curr->_M_next);
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ typename _Fwd_list_base<_Tp, _Alloc>::_Node_base::_Pointer
+ _Fwd_list_base<_Tp, _Alloc>::
+ _M_insert_after(const_iterator __pos, _Args&&... __args)
+ {
+ typename _Node_base::_Pointer __to
+ = __const_pointer_cast<typename _Node_base::_Pointer>
+ (__pos._M_node);
+ typename _Node::_Pointer __thing
+ = __static_pointer_cast<typename _Node::_Pointer>(
+ _M_create_node(std::forward<_Args>(__args)...) );
+ __thing->_M_next = __to->_M_next;
+ __to->_M_next = __thing;
+ return __static_pointer_cast<typename _Node_base::_Pointer>
+ (__to->_M_next);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ typename _Fwd_list_base<_Tp, _Alloc>::_Node_base::_Pointer
+ _Fwd_list_base<_Tp, _Alloc>::
+ _M_erase_after(typename _Node_base::_Pointer __pos)
+ {
+ typename _Node::_Pointer __curr
+ = __static_pointer_cast<typename _Node::_Pointer>(__pos->_M_next);
+ if (__curr)
+ {
+ typename _Node_base::_Pointer __next = __curr->_M_next;
+ __pos->_M_next = __next;
+ _M_get_Node_allocator().destroy(__curr);
+ _M_put_node(__curr);
+ }
+ return __pos;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ typename _Fwd_list_base<_Tp, _Alloc>::_Node_base::_Pointer
+ _Fwd_list_base<_Tp, _Alloc>::
+ _M_erase_after(typename _Node_base::_Pointer __pos,
+ typename _Node_base::_Pointer __last)
+ {
+ typename _Node::_Pointer __curr
+ = __static_pointer_cast<typename _Node::_Pointer>(__pos->_M_next);
+ while (__curr)
+ {
+ typename _Node::_Pointer __temp = __curr;
+ __curr = __static_pointer_cast<typename _Node::_Pointer>
+ (__curr->_M_next);
+ _M_get_Node_allocator().destroy(__temp);
+ _M_put_node(__temp);
+ __pos->_M_next = __curr;
+ if (__temp == __last)
+ break;
+ }
+ return __pos;
+ }
+
+ // Called by the range constructor to implement [23.1.1]/9
+ template<typename _Tp, typename _Alloc>
+ template<typename _InputIterator>
+ void
+ forward_list<_Tp, _Alloc>::
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ typename _Node_base::_Pointer __to = &this->_M_impl._M_head;
+ for (; __first != __last; ++__first)
+ {
+ __to->_M_next = this->_M_create_node(*__first);
+ __to = __to->_M_next;
+ }
+ }
+
+ // Called by forward_list(n,v,a), and the range constructor
+ // when it turns out to be the same thing.
+ template<typename _Tp, typename _Alloc>
+ void
+ forward_list<_Tp, _Alloc>::
+ _M_fill_initialize(size_type __n, const value_type& __value)
+ {
+ typename _Node_base::_Pointer __to = &this->_M_impl._M_head;
+ for (; __n > 0; --__n)
+ {
+ __to->_M_next = this->_M_create_node(__value);
+ __to = __to->_M_next;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ forward_list<_Tp, _Alloc>&
+ forward_list<_Tp, _Alloc>::
+ operator=(const forward_list& __list)
+ {
+ if (&__list != this)
+ {
+ iterator __prev1 = before_begin();
+ iterator __curr1 = begin();
+ iterator __last1 = end();
+ const_iterator __first2 = __list.cbegin();
+ const_iterator __last2 = __list.cend();
+ while (__curr1 != __last1 && __first2 != __last2)
+ {
+ *__curr1 = *__first2;
+ ++__prev1;
+ ++__curr1;
+ ++__first2;
+ }
+ if (__first2 == __last2)
+ erase_after(__prev1, __last1);
+ else
+ insert_after(__prev1, __first2, __last2);
+ }
+ return *this;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ forward_list<_Tp, _Alloc>::
+ resize(size_type __sz, value_type __val)
+ {
+ iterator __k = before_begin();
+
+ size_type __len = 0;
+ while (__k._M_next() != end() && __len < __sz)
+ {
+ ++__k;
+ ++__len;
+ }
+ if (__len == __sz)
+ erase_after(__k, end());
+ else
+ insert_after(__k, __sz - __len, __val);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ forward_list<_Tp, _Alloc>::
+ splice_after(const_iterator __pos, forward_list&& __list)
+ {
+ if (!__list.empty() && &__list != this)
+ {
+ typename _Node_base::_Pointer __tmp
+ = __const_pointer_cast<typename _Node_base::_Pointer>
+ (__pos._M_node);
+ const_iterator __before = __list.cbefore_begin();
+ __tmp->_M_transfer_after(__const_pointer_cast
+ <typename _Node_base::_Pointer>
+ (__before._M_node));
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ forward_list<_Tp, _Alloc>::
+ splice_after(const_iterator __pos, forward_list&& __list,
+ const_iterator __before, const_iterator __last)
+ {
+ typename _Node_base::_Pointer __tmp
+ = __const_pointer_cast<typename _Node_base::_Pointer>(__pos._M_node);
+ __tmp->_M_transfer_after(__const_pointer_cast
+ <typename _Node_base::_Pointer>
+ (__before._M_node),
+ __const_pointer_cast
+ <typename _Node_base::_Pointer>
+ (__last._M_node));
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ forward_list<_Tp, _Alloc>::
+ remove(const _Tp& __val)
+ {
+ typename _Node::_Pointer __curr
+ = __static_pointer_cast<typename _Node::_Pointer>
+ (&this->_M_impl._M_head);
+ while (typename _Node::_Pointer __temp =
+ __static_pointer_cast<typename _Node::_Pointer>(__curr->_M_next))
+ {
+ if (__temp->_M_value == __val)
+ this->_M_erase_after(__curr);
+ else
+ __curr = __static_pointer_cast<typename _Node::_Pointer>
+ (__curr->_M_next);
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _Pred>
+ void
+ forward_list<_Tp, _Alloc>::
+ remove_if(_Pred __pred)
+ {
+ typename _Node::_Pointer __curr
+ = __static_pointer_cast<typename _Node::_Pointer>
+ (&this->_M_impl._M_head);
+ while (typename _Node::_Pointer __temp =
+ __static_pointer_cast<typename _Node::_Pointer>(__curr->_M_next))
+ {
+ if (__pred(__temp->_M_value))
+ this->_M_erase_after(__curr);
+ else
+ __curr = __static_pointer_cast<typename _Node::_Pointer>
+ (__curr->_M_next);
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _BinPred>
+ void
+ forward_list<_Tp, _Alloc>::
+ unique(_BinPred __binary_pred)
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ if (__first == __last)
+ return;
+ iterator __next = __first;
+ while (++__next != __last)
+ {
+ if (__binary_pred(*__first, *__next))
+ erase_after(__first);
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _Comp>
+ void
+ forward_list<_Tp, _Alloc>::
+ merge(forward_list&& __list, _Comp __comp)
+ {
+ typename _Node_base::_Pointer __node = &this->_M_impl._M_head;
+ while (__node->_M_next && __list._M_impl._M_head._M_next)
+ {
+ if (__comp(__static_pointer_cast<typename _Node::_Pointer>
+ (__list._M_impl._M_head._M_next)->_M_value,
+ __static_pointer_cast<typename _Node::_Pointer>
+ (__node->_M_next)->_M_value))
+ __node->_M_transfer_after(&__list._M_impl._M_head,
+ __list._M_impl._M_head._M_next);
+ __node = __node->_M_next;
+ }
+ if (__list._M_impl._M_head._M_next)
+ {
+ __node->_M_next = __list._M_impl._M_head._M_next;
+ __list._M_impl._M_head._M_next = 0;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ bool
+ operator==(const forward_list<_Tp, _Alloc>& __lx,
+ const forward_list<_Tp, _Alloc>& __ly)
+ {
+ // We don't have size() so we need to walk through both lists
+ // making sure both iterators are valid.
+ auto __ix = __lx.cbegin();
+ auto __iy = __ly.cbegin();
+ while (__ix != __lx.cend() && __iy != __ly.cend())
+ {
+ if (*__ix != *__iy)
+ return false;
+ ++__ix;
+ ++__iy;
+ }
+ if (__ix == __lx.cend() && __iy == __ly.cend())
+ return true;
+ else
+ return false;
+ }
+
+_GLIBCXX_END_NAMESPACE // namespace std
+
+#endif /* _FORWARD_LIST_TCC */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/fstream.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/fstream.tcc
new file mode 100644
index 000000000..c5f7f8c52
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/fstream.tcc
@@ -0,0 +1,926 @@
+// File based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+// 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file fstream.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#ifndef _FSTREAM_TCC
+#define _FSTREAM_TCC 1
+
+#pragma GCC system_header
+
+#include <cxxabi-forced.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ _M_allocate_internal_buffer()
+ {
+ // Allocate internal buffer only if one doesn't already exist
+ // (either allocated or provided by the user via setbuf).
+ if (!_M_buf_allocated && !_M_buf)
+ {
+ _M_buf = new char_type[_M_buf_size];
+ _M_buf_allocated = true;
+ }
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ _M_destroy_internal_buffer() throw()
+ {
+ if (_M_buf_allocated)
+ {
+ delete [] _M_buf;
+ _M_buf = NULL;
+ _M_buf_allocated = false;
+ }
+ delete [] _M_ext_buf;
+ _M_ext_buf = NULL;
+ _M_ext_buf_size = 0;
+ _M_ext_next = NULL;
+ _M_ext_end = NULL;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::
+ basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),
+ _M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(),
+ _M_state_last(), _M_buf(NULL), _M_buf_size(BUFSIZ),
+ _M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(),
+ _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false),
+ _M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0),
+ _M_ext_end(0)
+ {
+ if (has_facet<__codecvt_type>(this->_M_buf_locale))
+ _M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale);
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
+ basic_filebuf<_CharT, _Traits>::
+ open(const char* __s, ios_base::openmode __mode)
+ {
+ __filebuf_type *__ret = NULL;
+ if (!this->is_open())
+ {
+ _M_file.open(__s, __mode);
+ if (this->is_open())
+ {
+ _M_allocate_internal_buffer();
+ _M_mode = __mode;
+
+ // Setup initial buffer to 'uncommitted' mode.
+ _M_reading = false;
+ _M_writing = false;
+ _M_set_buffer(-1);
+
+ // Reset to initial state.
+ _M_state_last = _M_state_cur = _M_state_beg;
+
+ // 27.8.1.3,4
+ if ((__mode & ios_base::ate)
+ && this->seekoff(0, ios_base::end, __mode)
+ == pos_type(off_type(-1)))
+ this->close();
+ else
+ __ret = this;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
+ basic_filebuf<_CharT, _Traits>::
+ close()
+ {
+ if (!this->is_open())
+ return NULL;
+
+ bool __testfail = false;
+ {
+ // NB: Do this here so that re-opened filebufs will be cool...
+ struct __close_sentry
+ {
+ basic_filebuf *__fb;
+ __close_sentry (basic_filebuf *__fbi): __fb(__fbi) { }
+ ~__close_sentry ()
+ {
+ __fb->_M_mode = ios_base::openmode(0);
+ __fb->_M_pback_init = false;
+ __fb->_M_destroy_internal_buffer();
+ __fb->_M_reading = false;
+ __fb->_M_writing = false;
+ __fb->_M_set_buffer(-1);
+ __fb->_M_state_last = __fb->_M_state_cur = __fb->_M_state_beg;
+ }
+ } __cs (this);
+
+ __try
+ {
+ if (!_M_terminate_output())
+ __testfail = true;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ _M_file.close();
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __testfail = true; }
+ }
+
+ if (!_M_file.close())
+ __testfail = true;
+
+ if (__testfail)
+ return NULL;
+ else
+ return this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_filebuf<_CharT, _Traits>::
+ showmanyc()
+ {
+ streamsize __ret = -1;
+ const bool __testin = _M_mode & ios_base::in;
+ if (__testin && this->is_open())
+ {
+ // For a stateful encoding (-1) the pending sequence might be just
+ // shift and unshift prefixes with no actual character.
+ __ret = this->egptr() - this->gptr();
+
+#if _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM
+ // About this workaround, see libstdc++/20806.
+ const bool __testbinary = _M_mode & ios_base::binary;
+ if (__check_facet(_M_codecvt).encoding() >= 0
+ && __testbinary)
+#else
+ if (__check_facet(_M_codecvt).encoding() >= 0)
+#endif
+ __ret += _M_file.showmanyc() / _M_codecvt->max_length();
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ underflow()
+ {
+ int_type __ret = traits_type::eof();
+ const bool __testin = _M_mode & ios_base::in;
+ if (__testin && !_M_writing)
+ {
+ // Check for pback madness, and if so switch back to the
+ // normal buffers and jet outta here before expensive
+ // fileops happen...
+ _M_destroy_pback();
+
+ if (this->gptr() < this->egptr())
+ return traits_type::to_int_type(*this->gptr());
+
+ // Get and convert input sequence.
+ const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;
+
+ // Will be set to true if ::read() returns 0 indicating EOF.
+ bool __got_eof = false;
+ // Number of internal characters produced.
+ streamsize __ilen = 0;
+ codecvt_base::result __r = codecvt_base::ok;
+ if (__check_facet(_M_codecvt).always_noconv())
+ {
+ __ilen = _M_file.xsgetn(reinterpret_cast<char*>(this->eback()),
+ __buflen);
+ if (__ilen == 0)
+ __got_eof = true;
+ }
+ else
+ {
+ // Worst-case number of external bytes.
+ // XXX Not done encoding() == -1.
+ const int __enc = _M_codecvt->encoding();
+ streamsize __blen; // Minimum buffer size.
+ streamsize __rlen; // Number of chars to read.
+ if (__enc > 0)
+ __blen = __rlen = __buflen * __enc;
+ else
+ {
+ __blen = __buflen + _M_codecvt->max_length() - 1;
+ __rlen = __buflen;
+ }
+ const streamsize __remainder = _M_ext_end - _M_ext_next;
+ __rlen = __rlen > __remainder ? __rlen - __remainder : 0;
+
+ // An imbue in 'read' mode implies first converting the external
+ // chars already present.
+ if (_M_reading && this->egptr() == this->eback() && __remainder)
+ __rlen = 0;
+
+ // Allocate buffer if necessary and move unconverted
+ // bytes to front.
+ if (_M_ext_buf_size < __blen)
+ {
+ char* __buf = new char[__blen];
+ if (__remainder)
+ __builtin_memcpy(__buf, _M_ext_next, __remainder);
+
+ delete [] _M_ext_buf;
+ _M_ext_buf = __buf;
+ _M_ext_buf_size = __blen;
+ }
+ else if (__remainder)
+ __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder);
+
+ _M_ext_next = _M_ext_buf;
+ _M_ext_end = _M_ext_buf + __remainder;
+ _M_state_last = _M_state_cur;
+
+ do
+ {
+ if (__rlen > 0)
+ {
+ // Sanity check!
+ // This may fail if the return value of
+ // codecvt::max_length() is bogus.
+ if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size)
+ {
+ __throw_ios_failure(__N("basic_filebuf::underflow "
+ "codecvt::max_length() "
+ "is not valid"));
+ }
+ streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen);
+ if (__elen == 0)
+ __got_eof = true;
+ else if (__elen == -1)
+ break;
+ _M_ext_end += __elen;
+ }
+
+ char_type* __iend = this->eback();
+ if (_M_ext_next < _M_ext_end)
+ __r = _M_codecvt->in(_M_state_cur, _M_ext_next,
+ _M_ext_end, _M_ext_next,
+ this->eback(),
+ this->eback() + __buflen, __iend);
+ if (__r == codecvt_base::noconv)
+ {
+ size_t __avail = _M_ext_end - _M_ext_buf;
+ __ilen = std::min(__avail, __buflen);
+ traits_type::copy(this->eback(),
+ reinterpret_cast<char_type*>
+ (_M_ext_buf), __ilen);
+ _M_ext_next = _M_ext_buf + __ilen;
+ }
+ else
+ __ilen = __iend - this->eback();
+
+ // _M_codecvt->in may return error while __ilen > 0: this is
+ // ok, and actually occurs in case of mixed encodings (e.g.,
+ // XML files).
+ if (__r == codecvt_base::error)
+ break;
+
+ __rlen = 1;
+ }
+ while (__ilen == 0 && !__got_eof);
+ }
+
+ if (__ilen > 0)
+ {
+ _M_set_buffer(__ilen);
+ _M_reading = true;
+ __ret = traits_type::to_int_type(*this->gptr());
+ }
+ else if (__got_eof)
+ {
+ // If the actual end of file is reached, set 'uncommitted'
+ // mode, thus allowing an immediate write without an
+ // intervening seek.
+ _M_set_buffer(-1);
+ _M_reading = false;
+ // However, reaching it while looping on partial means that
+ // the file has got an incomplete character.
+ if (__r == codecvt_base::partial)
+ __throw_ios_failure(__N("basic_filebuf::underflow "
+ "incomplete character in file"));
+ }
+ else if (__r == codecvt_base::error)
+ __throw_ios_failure(__N("basic_filebuf::underflow "
+ "invalid byte sequence in file"));
+ else
+ __throw_ios_failure(__N("basic_filebuf::underflow "
+ "error reading the file"));
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ pbackfail(int_type __i)
+ {
+ int_type __ret = traits_type::eof();
+ const bool __testin = _M_mode & ios_base::in;
+ if (__testin && !_M_writing)
+ {
+ // Remember whether the pback buffer is active, otherwise below
+ // we may try to store in it a second char (libstdc++/9761).
+ const bool __testpb = _M_pback_init;
+ const bool __testeof = traits_type::eq_int_type(__i, __ret);
+ int_type __tmp;
+ if (this->eback() < this->gptr())
+ {
+ this->gbump(-1);
+ __tmp = traits_type::to_int_type(*this->gptr());
+ }
+ else if (this->seekoff(-1, ios_base::cur) != pos_type(off_type(-1)))
+ {
+ __tmp = this->underflow();
+ if (traits_type::eq_int_type(__tmp, __ret))
+ return __ret;
+ }
+ else
+ {
+ // At the beginning of the buffer, need to make a
+ // putback position available. But the seek may fail
+ // (f.i., at the beginning of a file, see
+ // libstdc++/9439) and in that case we return
+ // traits_type::eof().
+ return __ret;
+ }
+
+ // Try to put back __i into input sequence in one of three ways.
+ // Order these tests done in is unspecified by the standard.
+ if (!__testeof && traits_type::eq_int_type(__i, __tmp))
+ __ret = __i;
+ else if (__testeof)
+ __ret = traits_type::not_eof(__i);
+ else if (!__testpb)
+ {
+ _M_create_pback();
+ _M_reading = true;
+ *this->gptr() = traits_type::to_char_type(__i);
+ __ret = __i;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::int_type
+ basic_filebuf<_CharT, _Traits>::
+ overflow(int_type __c)
+ {
+ int_type __ret = traits_type::eof();
+ const bool __testeof = traits_type::eq_int_type(__c, __ret);
+ const bool __testout = _M_mode & ios_base::out;
+ if (__testout && !_M_reading)
+ {
+ if (this->pbase() < this->pptr())
+ {
+ // If appropriate, append the overflow char.
+ if (!__testeof)
+ {
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ }
+
+ // Convert pending sequence to external representation,
+ // and output.
+ if (_M_convert_to_external(this->pbase(),
+ this->pptr() - this->pbase()))
+ {
+ _M_set_buffer(0);
+ __ret = traits_type::not_eof(__c);
+ }
+ }
+ else if (_M_buf_size > 1)
+ {
+ // Overflow in 'uncommitted' mode: set _M_writing, set
+ // the buffer to the initial 'write' mode, and put __c
+ // into the buffer.
+ _M_set_buffer(0);
+ _M_writing = true;
+ if (!__testeof)
+ {
+ *this->pptr() = traits_type::to_char_type(__c);
+ this->pbump(1);
+ }
+ __ret = traits_type::not_eof(__c);
+ }
+ else
+ {
+ // Unbuffered.
+ char_type __conv = traits_type::to_char_type(__c);
+ if (__testeof || _M_convert_to_external(&__conv, 1))
+ {
+ _M_writing = true;
+ __ret = traits_type::not_eof(__c);
+ }
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ bool
+ basic_filebuf<_CharT, _Traits>::
+ _M_convert_to_external(_CharT* __ibuf, streamsize __ilen)
+ {
+ // Sizes of external and pending output.
+ streamsize __elen;
+ streamsize __plen;
+ if (__check_facet(_M_codecvt).always_noconv())
+ {
+ __elen = _M_file.xsputn(reinterpret_cast<char*>(__ibuf), __ilen);
+ __plen = __ilen;
+ }
+ else
+ {
+ // Worst-case number of external bytes needed.
+ // XXX Not done encoding() == -1.
+ streamsize __blen = __ilen * _M_codecvt->max_length();
+ char* __buf = static_cast<char*>(__builtin_alloca(__blen));
+
+ char* __bend;
+ const char_type* __iend;
+ codecvt_base::result __r;
+ __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen,
+ __iend, __buf, __buf + __blen, __bend);
+
+ if (__r == codecvt_base::ok || __r == codecvt_base::partial)
+ __blen = __bend - __buf;
+ else if (__r == codecvt_base::noconv)
+ {
+ // Same as the always_noconv case above.
+ __buf = reinterpret_cast<char*>(__ibuf);
+ __blen = __ilen;
+ }
+ else
+ __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external "
+ "conversion error"));
+
+ __elen = _M_file.xsputn(__buf, __blen);
+ __plen = __blen;
+
+ // Try once more for partial conversions.
+ if (__r == codecvt_base::partial && __elen == __plen)
+ {
+ const char_type* __iresume = __iend;
+ streamsize __rlen = this->pptr() - __iend;
+ __r = _M_codecvt->out(_M_state_cur, __iresume,
+ __iresume + __rlen, __iend, __buf,
+ __buf + __blen, __bend);
+ if (__r != codecvt_base::error)
+ {
+ __rlen = __bend - __buf;
+ __elen = _M_file.xsputn(__buf, __rlen);
+ __plen = __rlen;
+ }
+ else
+ __throw_ios_failure(__N("basic_filebuf::_M_convert_to_external "
+ "conversion error"));
+ }
+ }
+ return __elen == __plen;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_filebuf<_CharT, _Traits>::
+ xsgetn(_CharT* __s, streamsize __n)
+ {
+ // Clear out pback buffer before going on to the real deal...
+ streamsize __ret = 0;
+ if (_M_pback_init)
+ {
+ if (__n > 0 && this->gptr() == this->eback())
+ {
+ *__s++ = *this->gptr();
+ this->gbump(1);
+ __ret = 1;
+ --__n;
+ }
+ _M_destroy_pback();
+ }
+
+ // Optimization in the always_noconv() case, to be generalized in the
+ // future: when __n > __buflen we read directly instead of using the
+ // buffer repeatedly.
+ const bool __testin = _M_mode & ios_base::in;
+ const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;
+
+ if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()
+ && __testin && !_M_writing)
+ {
+ // First, copy the chars already present in the buffer.
+ const streamsize __avail = this->egptr() - this->gptr();
+ if (__avail != 0)
+ {
+ if (__avail == 1)
+ *__s = *this->gptr();
+ else
+ traits_type::copy(__s, this->gptr(), __avail);
+ __s += __avail;
+ this->gbump(__avail);
+ __ret += __avail;
+ __n -= __avail;
+ }
+
+ // Need to loop in case of short reads (relatively common
+ // with pipes).
+ streamsize __len;
+ for (;;)
+ {
+ __len = _M_file.xsgetn(reinterpret_cast<char*>(__s),
+ __n);
+ if (__len == -1)
+ __throw_ios_failure(__N("basic_filebuf::xsgetn "
+ "error reading the file"));
+ if (__len == 0)
+ break;
+
+ __n -= __len;
+ __ret += __len;
+ if (__n == 0)
+ break;
+
+ __s += __len;
+ }
+
+ if (__n == 0)
+ {
+ _M_set_buffer(0);
+ _M_reading = true;
+ }
+ else if (__len == 0)
+ {
+ // If end of file is reached, set 'uncommitted'
+ // mode, thus allowing an immediate write without
+ // an intervening seek.
+ _M_set_buffer(-1);
+ _M_reading = false;
+ }
+ }
+ else
+ __ret += __streambuf_type::xsgetn(__s, __n);
+
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_filebuf<_CharT, _Traits>::
+ xsputn(const _CharT* __s, streamsize __n)
+ {
+ // Optimization in the always_noconv() case, to be generalized in the
+ // future: when __n is sufficiently large we write directly instead of
+ // using the buffer.
+ streamsize __ret = 0;
+ const bool __testout = _M_mode & ios_base::out;
+ if (__check_facet(_M_codecvt).always_noconv()
+ && __testout && !_M_reading)
+ {
+ // Measurement would reveal the best choice.
+ const streamsize __chunk = 1ul << 10;
+ streamsize __bufavail = this->epptr() - this->pptr();
+
+ // Don't mistake 'uncommitted' mode buffered with unbuffered.
+ if (!_M_writing && _M_buf_size > 1)
+ __bufavail = _M_buf_size - 1;
+
+ const streamsize __limit = std::min(__chunk, __bufavail);
+ if (__n >= __limit)
+ {
+ const streamsize __buffill = this->pptr() - this->pbase();
+ const char* __buf = reinterpret_cast<const char*>(this->pbase());
+ __ret = _M_file.xsputn_2(__buf, __buffill,
+ reinterpret_cast<const char*>(__s),
+ __n);
+ if (__ret == __buffill + __n)
+ {
+ _M_set_buffer(0);
+ _M_writing = true;
+ }
+ if (__ret > __buffill)
+ __ret -= __buffill;
+ else
+ __ret = 0;
+ }
+ else
+ __ret = __streambuf_type::xsputn(__s, __n);
+ }
+ else
+ __ret = __streambuf_type::xsputn(__s, __n);
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::__streambuf_type*
+ basic_filebuf<_CharT, _Traits>::
+ setbuf(char_type* __s, streamsize __n)
+ {
+ if (!this->is_open())
+ {
+ if (__s == 0 && __n == 0)
+ _M_buf_size = 1;
+ else if (__s && __n > 0)
+ {
+ // This is implementation-defined behavior, and assumes that
+ // an external char_type array of length __n exists and has
+ // been pre-allocated. If this is not the case, things will
+ // quickly blow up. When __n > 1, __n - 1 positions will be
+ // used for the get area, __n - 1 for the put area and 1
+ // position to host the overflow char of a full put area.
+ // When __n == 1, 1 position will be used for the get area
+ // and 0 for the put area, as in the unbuffered case above.
+ _M_buf = __s;
+ _M_buf_size = __n;
+ }
+ }
+ return this;
+ }
+
+
+ // According to 27.8.1.4 p11 - 13, seekoff should ignore the last
+ // argument (of type openmode).
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::pos_type
+ basic_filebuf<_CharT, _Traits>::
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode)
+ {
+ int __width = 0;
+ if (_M_codecvt)
+ __width = _M_codecvt->encoding();
+ if (__width < 0)
+ __width = 0;
+
+ pos_type __ret = pos_type(off_type(-1));
+ const bool __testfail = __off != 0 && __width <= 0;
+ if (this->is_open() && !__testfail)
+ {
+ // Ditch any pback buffers to avoid confusion.
+ _M_destroy_pback();
+
+ // Correct state at destination. Note that this is the correct
+ // state for the current position during output, because
+ // codecvt::unshift() returns the state to the initial state.
+ // This is also the correct state at the end of the file because
+ // an unshift sequence should have been written at the end.
+ __state_type __state = _M_state_beg;
+ off_type __computed_off = __off * __width;
+ if (_M_reading && __way == ios_base::cur)
+ {
+ if (_M_codecvt->always_noconv())
+ __computed_off += this->gptr() - this->egptr();
+ else
+ {
+ // Calculate offset from _M_ext_buf that corresponds
+ // to gptr(). Note: uses _M_state_last, which
+ // corresponds to eback().
+ const int __gptr_off =
+ _M_codecvt->length(_M_state_last, _M_ext_buf, _M_ext_next,
+ this->gptr() - this->eback());
+ __computed_off += _M_ext_buf + __gptr_off - _M_ext_end;
+
+ // _M_state_last is modified by codecvt::length() so
+ // it now corresponds to gptr().
+ __state = _M_state_last;
+ }
+ }
+ __ret = _M_seek(__computed_off, __way, __state);
+ }
+ return __ret;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 171. Strange seekpos() semantics due to joint position
+ // According to the resolution of DR 171, seekpos should ignore the last
+ // argument (of type openmode).
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::pos_type
+ basic_filebuf<_CharT, _Traits>::
+ seekpos(pos_type __pos, ios_base::openmode)
+ {
+ pos_type __ret = pos_type(off_type(-1));
+ if (this->is_open())
+ {
+ // Ditch any pback buffers to avoid confusion.
+ _M_destroy_pback();
+ __ret = _M_seek(off_type(__pos), ios_base::beg, __pos.state());
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_filebuf<_CharT, _Traits>::pos_type
+ basic_filebuf<_CharT, _Traits>::
+ _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state)
+ {
+ pos_type __ret = pos_type(off_type(-1));
+ if (_M_terminate_output())
+ {
+ // Returns pos_type(off_type(-1)) in case of failure.
+ __ret = pos_type(_M_file.seekoff(__off, __way));
+ if (__ret != pos_type(off_type(-1)))
+ {
+ _M_reading = false;
+ _M_writing = false;
+ _M_ext_next = _M_ext_end = _M_ext_buf;
+ _M_set_buffer(-1);
+ _M_state_cur = __state;
+ __ret.state(_M_state_cur);
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ bool
+ basic_filebuf<_CharT, _Traits>::
+ _M_terminate_output()
+ {
+ // Part one: update the output sequence.
+ bool __testvalid = true;
+ if (this->pbase() < this->pptr())
+ {
+ const int_type __tmp = this->overflow();
+ if (traits_type::eq_int_type(__tmp, traits_type::eof()))
+ __testvalid = false;
+ }
+
+ // Part two: output unshift sequence.
+ if (_M_writing && !__check_facet(_M_codecvt).always_noconv()
+ && __testvalid)
+ {
+ // Note: this value is arbitrary, since there is no way to
+ // get the length of the unshift sequence from codecvt,
+ // without calling unshift.
+ const size_t __blen = 128;
+ char __buf[__blen];
+ codecvt_base::result __r;
+ streamsize __ilen = 0;
+
+ do
+ {
+ char* __next;
+ __r = _M_codecvt->unshift(_M_state_cur, __buf,
+ __buf + __blen, __next);
+ if (__r == codecvt_base::error)
+ __testvalid = false;
+ else if (__r == codecvt_base::ok ||
+ __r == codecvt_base::partial)
+ {
+ __ilen = __next - __buf;
+ if (__ilen > 0)
+ {
+ const streamsize __elen = _M_file.xsputn(__buf, __ilen);
+ if (__elen != __ilen)
+ __testvalid = false;
+ }
+ }
+ }
+ while (__r == codecvt_base::partial && __ilen > 0 && __testvalid);
+
+ if (__testvalid)
+ {
+ // This second call to overflow() is required by the standard,
+ // but it's not clear why it's needed, since the output buffer
+ // should be empty by this point (it should have been emptied
+ // in the first call to overflow()).
+ const int_type __tmp = this->overflow();
+ if (traits_type::eq_int_type(__tmp, traits_type::eof()))
+ __testvalid = false;
+ }
+ }
+ return __testvalid;
+ }
+
+ template<typename _CharT, typename _Traits>
+ int
+ basic_filebuf<_CharT, _Traits>::
+ sync()
+ {
+ // Make sure that the internal buffer resyncs its idea of
+ // the file position with the external file.
+ int __ret = 0;
+ if (this->pbase() < this->pptr())
+ {
+ const int_type __tmp = this->overflow();
+ if (traits_type::eq_int_type(__tmp, traits_type::eof()))
+ __ret = -1;
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ imbue(const locale& __loc)
+ {
+ bool __testvalid = true;
+
+ const __codecvt_type* _M_codecvt_tmp = 0;
+ if (__builtin_expect(has_facet<__codecvt_type>(__loc), true))
+ _M_codecvt_tmp = &use_facet<__codecvt_type>(__loc);
+
+ if (this->is_open())
+ {
+ // encoding() == -1 is ok only at the beginning.
+ if ((_M_reading || _M_writing)
+ && __check_facet(_M_codecvt).encoding() == -1)
+ __testvalid = false;
+ else
+ {
+ if (_M_reading)
+ {
+ if (__check_facet(_M_codecvt).always_noconv())
+ {
+ if (_M_codecvt_tmp
+ && !__check_facet(_M_codecvt_tmp).always_noconv())
+ __testvalid = this->seekoff(0, ios_base::cur, _M_mode)
+ != pos_type(off_type(-1));
+ }
+ else
+ {
+ // External position corresponding to gptr().
+ _M_ext_next = _M_ext_buf
+ + _M_codecvt->length(_M_state_last, _M_ext_buf, _M_ext_next,
+ this->gptr() - this->eback());
+ const streamsize __remainder = _M_ext_end - _M_ext_next;
+ if (__remainder)
+ __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder);
+
+ _M_ext_next = _M_ext_buf;
+ _M_ext_end = _M_ext_buf + __remainder;
+ _M_set_buffer(-1);
+ _M_state_last = _M_state_cur = _M_state_beg;
+ }
+ }
+ else if (_M_writing && (__testvalid = _M_terminate_output()))
+ _M_set_buffer(-1);
+ }
+ }
+
+ if (__testvalid)
+ _M_codecvt = _M_codecvt_tmp;
+ else
+ _M_codecvt = 0;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class basic_filebuf<char>;
+ extern template class basic_ifstream<char>;
+ extern template class basic_ofstream<char>;
+ extern template class basic_fstream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_filebuf<wchar_t>;
+ extern template class basic_ifstream<wchar_t>;
+ extern template class basic_ofstream<wchar_t>;
+ extern template class basic_fstream<wchar_t>;
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/functexcept.h b/gcc-4.4.0/libstdc++-v3/include/bits/functexcept.h
new file mode 100644
index 000000000..9315d3409
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/functexcept.h
@@ -0,0 +1,93 @@
+// Function-Based Exception Support -*- C++ -*-
+
+// Copyright (C) 2001, 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file functexcept.h
+ * This header provides support for -fno-exceptions.
+ */
+
+//
+// ISO C++ 14882: 19.1 Exception classes
+//
+
+#ifndef _FUNCTEXCEPT_H
+#define _FUNCTEXCEPT_H 1
+
+#include <bits/c++config.h>
+#include <exception_defines.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Helper for exception objects in <except>
+ void
+ __throw_bad_exception(void) __attribute__((__noreturn__));
+
+ // Helper for exception objects in <new>
+ void
+ __throw_bad_alloc(void) __attribute__((__noreturn__));
+
+ // Helper for exception objects in <typeinfo>
+ void
+ __throw_bad_cast(void) __attribute__((__noreturn__));
+
+ void
+ __throw_bad_typeid(void) __attribute__((__noreturn__));
+
+ // Helpers for exception objects in <stdexcept>
+ void
+ __throw_logic_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_domain_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_invalid_argument(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_length_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_out_of_range(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_runtime_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_range_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_overflow_error(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_underflow_error(const char*) __attribute__((__noreturn__));
+
+ // Helpers for exception objects in <ios>
+ void
+ __throw_ios_failure(const char*) __attribute__((__noreturn__));
+
+ void
+ __throw_system_error(int) __attribute__((__noreturn__));
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/functional_hash.h b/gcc-4.4.0/libstdc++-v3/include/bits/functional_hash.h
new file mode 100644
index 000000000..892fcfa69
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/functional_hash.h
@@ -0,0 +1,68 @@
+// functional_hash.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/functional_hash.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _FUNCTIONAL_HASH_H
+#define _FUNCTIONAL_HASH_H 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/functional_hash.h>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/functional_hash.h>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+
+namespace std
+{
+ struct error_code;
+
+ template<>
+ size_t
+ hash<error_code>::operator()(error_code) const;
+}
+
+#endif // _FUNCTIONAL_HASH_H
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/gslice.h b/gcc-4.4.0/libstdc++-v3/include/bits/gslice.h
new file mode 100644
index 000000000..29ba46ac9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/gslice.h
@@ -0,0 +1,182 @@
+// The template and inlines for the -*- C++ -*- gslice class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2005, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file gslice.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _GSLICE_H
+#define _GSLICE_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup numeric_arrays
+ * @{
+ */
+
+ /**
+ * @brief Class defining multi-dimensional subset of an array.
+ *
+ * The slice class represents a multi-dimensional subset of an array,
+ * specified by three parameter sets: start offset, size array, and stride
+ * array. The start offset is the index of the first element of the array
+ * that is part of the subset. The size and stride array describe each
+ * dimension of the slice. Size is the number of elements in that
+ * dimension, and stride is the distance in the array between successive
+ * elements in that dimension. Each dimension's size and stride is taken
+ * to begin at an array element described by the previous dimension. The
+ * size array and stride array must be the same size.
+ *
+ * For example, if you have offset==3, stride[0]==11, size[1]==3,
+ * stride[1]==3, then slice[0,0]==array[3], slice[0,1]==array[6],
+ * slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17],
+ * slice[1,2]==array[20].
+ */
+ class gslice
+ {
+ public:
+ /// Construct an empty slice.
+ gslice();
+
+ /**
+ * @brief Construct a slice.
+ *
+ * Constructs a slice with as many dimensions as the length of the @a l
+ * and @a s arrays.
+ *
+ * @param o Offset in array of first element.
+ * @param l Array of dimension lengths.
+ * @param s Array of dimension strides between array elements.
+ */
+ gslice(size_t, const valarray<size_t>&, const valarray<size_t>&);
+
+ // XXX: the IS says the copy-ctor and copy-assignment operators are
+ // synthesized by the compiler but they are just unsuitable
+ // for a ref-counted semantic
+ /// Copy constructor.
+ gslice(const gslice&);
+
+ /// Destructor.
+ ~gslice();
+
+ // XXX: See the note above.
+ /// Assignment operator.
+ gslice& operator=(const gslice&);
+
+ /// Return array offset of first slice element.
+ size_t start() const;
+
+ /// Return array of sizes of slice dimensions.
+ valarray<size_t> size() const;
+
+ /// Return array of array strides for each dimension.
+ valarray<size_t> stride() const;
+
+ private:
+ struct _Indexer
+ {
+ size_t _M_count;
+ size_t _M_start;
+ valarray<size_t> _M_size;
+ valarray<size_t> _M_stride;
+ valarray<size_t> _M_index; // Linear array of referenced indices
+
+ _Indexer()
+ : _M_count(1), _M_start(0), _M_size(), _M_stride(), _M_index() {}
+
+ _Indexer(size_t, const valarray<size_t>&,
+ const valarray<size_t>&);
+
+ void
+ _M_increment_use()
+ { ++_M_count; }
+
+ size_t
+ _M_decrement_use()
+ { return --_M_count; }
+ };
+
+ _Indexer* _M_index;
+
+ template<typename _Tp> friend class valarray;
+ };
+
+ inline size_t
+ gslice::start() const
+ { return _M_index ? _M_index->_M_start : 0; }
+
+ inline valarray<size_t>
+ gslice::size() const
+ { return _M_index ? _M_index->_M_size : valarray<size_t>(); }
+
+ inline valarray<size_t>
+ gslice::stride() const
+ { return _M_index ? _M_index->_M_stride : valarray<size_t>(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 543. valarray slice default constructor
+ inline
+ gslice::gslice()
+ : _M_index(new gslice::_Indexer()) {}
+
+ inline
+ gslice::gslice(size_t __o, const valarray<size_t>& __l,
+ const valarray<size_t>& __s)
+ : _M_index(new gslice::_Indexer(__o, __l, __s)) {}
+
+ inline
+ gslice::gslice(const gslice& __g)
+ : _M_index(__g._M_index)
+ { if (_M_index) _M_index->_M_increment_use(); }
+
+ inline
+ gslice::~gslice()
+ {
+ if (_M_index && _M_index->_M_decrement_use() == 0)
+ delete _M_index;
+ }
+
+ inline gslice&
+ gslice::operator=(const gslice& __g)
+ {
+ if (__g._M_index)
+ __g._M_index->_M_increment_use();
+ if (_M_index && _M_index->_M_decrement_use() == 0)
+ delete _M_index;
+ _M_index = __g._M_index;
+ return *this;
+ }
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GSLICE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/gslice_array.h b/gcc-4.4.0/libstdc++-v3/include/bits/gslice_array.h
new file mode 100644
index 000000000..745a5a83d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/gslice_array.h
@@ -0,0 +1,216 @@
+// The template and inlines for the -*- C++ -*- gslice_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2005, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file gslice_array.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _GSLICE_ARRAY_H
+#define _GSLICE_ARRAY_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup numeric_arrays
+ * @{
+ */
+
+ /**
+ * @brief Reference to multi-dimensional subset of an array.
+ *
+ * A gslice_array is a reference to the actual elements of an array
+ * specified by a gslice. The way to get a gslice_array is to call
+ * operator[](gslice) on a valarray. The returned gslice_array then
+ * permits carrying operations out on the referenced subset of elements in
+ * the original valarray. For example, operator+=(valarray) will add
+ * values to the subset of elements in the underlying valarray this
+ * gslice_array refers to.
+ *
+ * @param Tp Element type.
+ */
+ template<typename _Tp>
+ class gslice_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 253. valarray helper functions are almost entirely useless
+
+ /// Copy constructor. Both slices refer to the same underlying array.
+ gslice_array(const gslice_array&);
+
+ /// Assignment operator. Assigns slice elements to corresponding
+ /// elements of @a a.
+ gslice_array& operator=(const gslice_array&);
+
+ /// Assign slice elements to corresponding elements of @a v.
+ void operator=(const valarray<_Tp>&) const;
+ /// Multiply slice elements by corresponding elements of @a v.
+ void operator*=(const valarray<_Tp>&) const;
+ /// Divide slice elements by corresponding elements of @a v.
+ void operator/=(const valarray<_Tp>&) const;
+ /// Modulo slice elements by corresponding elements of @a v.
+ void operator%=(const valarray<_Tp>&) const;
+ /// Add corresponding elements of @a v to slice elements.
+ void operator+=(const valarray<_Tp>&) const;
+ /// Subtract corresponding elements of @a v from slice elements.
+ void operator-=(const valarray<_Tp>&) const;
+ /// Logical xor slice elements with corresponding elements of @a v.
+ void operator^=(const valarray<_Tp>&) const;
+ /// Logical and slice elements with corresponding elements of @a v.
+ void operator&=(const valarray<_Tp>&) const;
+ /// Logical or slice elements with corresponding elements of @a v.
+ void operator|=(const valarray<_Tp>&) const;
+ /// Left shift slice elements by corresponding elements of @a v.
+ void operator<<=(const valarray<_Tp>&) const;
+ /// Right shift slice elements by corresponding elements of @a v.
+ void operator>>=(const valarray<_Tp>&) const;
+ /// Assign all slice elements to @a t.
+ void operator=(const _Tp&) const;
+
+ template<class _Dom>
+ void operator=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator*=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator/=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator%=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator+=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator-=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator^=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator&=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator|=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator<<=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator>>=(const _Expr<_Dom, _Tp>&) const;
+
+ private:
+ _Array<_Tp> _M_array;
+ const valarray<size_t>& _M_index;
+
+ friend class valarray<_Tp>;
+
+ gslice_array(_Array<_Tp>, const valarray<size_t>&);
+
+ // not implemented
+ gslice_array();
+ };
+
+ template<typename _Tp>
+ inline
+ gslice_array<_Tp>::gslice_array(_Array<_Tp> __a,
+ const valarray<size_t>& __i)
+ : _M_array(__a), _M_index(__i) {}
+
+ template<typename _Tp>
+ inline
+ gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a)
+ : _M_array(__a._M_array), _M_index(__a._M_index) {}
+
+ template<typename _Tp>
+ inline gslice_array<_Tp>&
+ gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a)
+ {
+ std::__valarray_copy(_Array<_Tp>(__a._M_array),
+ _Array<size_t>(__a._M_index), _M_index.size(),
+ _M_array, _Array<size_t>(_M_index));
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline void
+ gslice_array<_Tp>::operator=(const _Tp& __t) const
+ {
+ std::__valarray_fill(_M_array, _Array<size_t>(_M_index),
+ _M_index.size(), __t);
+ }
+
+ template<typename _Tp>
+ inline void
+ gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const
+ {
+ std::__valarray_copy(_Array<_Tp>(__v), __v.size(),
+ _M_array, _Array<size_t>(_M_index));
+ }
+
+ template<typename _Tp>
+ template<class _Dom>
+ inline void
+ gslice_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const
+ {
+ std::__valarray_copy (__e, _M_index.size(), _M_array,
+ _Array<size_t>(_M_index));
+ }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \
+ template<typename _Tp> \
+ inline void \
+ gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \
+ { \
+ _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), \
+ _Array<_Tp>(__v), __v.size()); \
+ } \
+ \
+ template<typename _Tp> \
+ template<class _Dom> \
+ inline void \
+ gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\
+ { \
+ _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), __e,\
+ _M_index.size()); \
+ }
+
+_DEFINE_VALARRAY_OPERATOR(*, __multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, __divides)
+_DEFINE_VALARRAY_OPERATOR(%, __modulus)
+_DEFINE_VALARRAY_OPERATOR(+, __plus)
+_DEFINE_VALARRAY_OPERATOR(-, __minus)
+_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
+_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
+_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
+_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GSLICE_ARRAY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/hashtable.h b/gcc-4.4.0/libstdc++-v3/include/bits/hashtable.h
new file mode 100644
index 000000000..cdfa8af3e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/hashtable.h
@@ -0,0 +1,58 @@
+// hashtable.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/hashtable.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _HASHTABLE_H
+#define _HASHTABLE_H 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/hashtable>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/hashtable>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // _HASHTABLE_H
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/indirect_array.h b/gcc-4.4.0/libstdc++-v3/include/bits/indirect_array.h
new file mode 100644
index 000000000..4920394bf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/indirect_array.h
@@ -0,0 +1,210 @@
+// The template and inlines for the -*- C++ -*- indirect_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file indirect_array.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _INDIRECT_ARRAY_H
+#define _INDIRECT_ARRAY_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup numeric_arrays
+ * @{
+ */
+
+ /**
+ * @brief Reference to arbitrary subset of an array.
+ *
+ * An indirect_array is a reference to the actual elements of an array
+ * specified by an ordered array of indices. The way to get an
+ * indirect_array is to call operator[](valarray<size_t>) on a valarray.
+ * The returned indirect_array then permits carrying operations out on the
+ * referenced subset of elements in the original valarray.
+ *
+ * For example, if an indirect_array is obtained using the array (4,2,0) as
+ * an argument, and then assigned to an array containing (1,2,3), then the
+ * underlying array will have array[0]==3, array[2]==2, and array[4]==1.
+ *
+ * @param Tp Element type.
+ */
+ template <class _Tp>
+ class indirect_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 253. valarray helper functions are almost entirely useless
+
+ /// Copy constructor. Both slices refer to the same underlying array.
+ indirect_array(const indirect_array&);
+
+ /// Assignment operator. Assigns elements to corresponding elements
+ /// of @a a.
+ indirect_array& operator=(const indirect_array&);
+
+ /// Assign slice elements to corresponding elements of @a v.
+ void operator=(const valarray<_Tp>&) const;
+ /// Multiply slice elements by corresponding elements of @a v.
+ void operator*=(const valarray<_Tp>&) const;
+ /// Divide slice elements by corresponding elements of @a v.
+ void operator/=(const valarray<_Tp>&) const;
+ /// Modulo slice elements by corresponding elements of @a v.
+ void operator%=(const valarray<_Tp>&) const;
+ /// Add corresponding elements of @a v to slice elements.
+ void operator+=(const valarray<_Tp>&) const;
+ /// Subtract corresponding elements of @a v from slice elements.
+ void operator-=(const valarray<_Tp>&) const;
+ /// Logical xor slice elements with corresponding elements of @a v.
+ void operator^=(const valarray<_Tp>&) const;
+ /// Logical and slice elements with corresponding elements of @a v.
+ void operator&=(const valarray<_Tp>&) const;
+ /// Logical or slice elements with corresponding elements of @a v.
+ void operator|=(const valarray<_Tp>&) const;
+ /// Left shift slice elements by corresponding elements of @a v.
+ void operator<<=(const valarray<_Tp>&) const;
+ /// Right shift slice elements by corresponding elements of @a v.
+ void operator>>=(const valarray<_Tp>&) const;
+ /// Assign all slice elements to @a t.
+ void operator= (const _Tp&) const;
+ // ~indirect_array();
+
+ template<class _Dom>
+ void operator=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator*=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator/=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator%=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator+=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator-=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator^=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator&=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator|=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator<<=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator>>=(const _Expr<_Dom, _Tp>&) const;
+
+ private:
+ /// Copy constructor. Both slices refer to the same underlying array.
+ indirect_array(_Array<_Tp>, size_t, _Array<size_t>);
+
+ friend class valarray<_Tp>;
+ friend class gslice_array<_Tp>;
+
+ const size_t _M_sz;
+ const _Array<size_t> _M_index;
+ const _Array<_Tp> _M_array;
+
+ // not implemented
+ indirect_array();
+ };
+
+ template<typename _Tp>
+ inline
+ indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
+ : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {}
+
+ template<typename _Tp>
+ inline
+ indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s,
+ _Array<size_t> __i)
+ : _M_sz(__s), _M_index(__i), _M_array(__a) {}
+
+ template<typename _Tp>
+ inline indirect_array<_Tp>&
+ indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a)
+ {
+ std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array,
+ _M_index);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline void
+ indirect_array<_Tp>::operator=(const _Tp& __t) const
+ { std::__valarray_fill(_M_array, _M_index, _M_sz, __t); }
+
+ template<typename _Tp>
+ inline void
+ indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const
+ { std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); }
+
+ template<typename _Tp>
+ template<class _Dom>
+ inline void
+ indirect_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const
+ { std::__valarray_copy(__e, _M_sz, _M_array, _M_index); }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \
+ template<typename _Tp> \
+ inline void \
+ indirect_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\
+ { \
+ _Array_augmented_##_Name(_M_array, _M_index, _Array<_Tp>(__v), _M_sz); \
+ } \
+ \
+ template<typename _Tp> \
+ template<class _Dom> \
+ inline void \
+ indirect_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\
+ { \
+ _Array_augmented_##_Name(_M_array, _M_index, __e, _M_sz); \
+ }
+
+_DEFINE_VALARRAY_OPERATOR(*, __multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, __divides)
+_DEFINE_VALARRAY_OPERATOR(%, __modulus)
+_DEFINE_VALARRAY_OPERATOR(+, __plus)
+_DEFINE_VALARRAY_OPERATOR(-, __minus)
+_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
+_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
+_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
+_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _INDIRECT_ARRAY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/ios_base.h b/gcc-4.4.0/libstdc++-v3/include/bits/ios_base.h
new file mode 100644
index 000000000..8dde10035
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/ios_base.h
@@ -0,0 +1,982 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ios_base.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#ifndef _IOS_BASE_H
+#define _IOS_BASE_H 1
+
+#pragma GCC system_header
+
+#include <ext/atomicity.h>
+#include <bits/localefwd.h>
+#include <bits/locale_classes.h>
+
+#ifndef _GLIBCXX_STDIO_MACROS
+# include <cstdio> // For SEEK_CUR, SEEK_END
+# define _IOS_BASE_SEEK_CUR SEEK_CUR
+# define _IOS_BASE_SEEK_END SEEK_END
+#else
+# define _IOS_BASE_SEEK_CUR 1
+# define _IOS_BASE_SEEK_END 2
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // The following definitions of bitmask types are enums, not ints,
+ // as permitted (but not required) in the standard, in order to provide
+ // better type safety in iostream calls. A side effect is that
+ // expressions involving them are no longer compile-time constants.
+ enum _Ios_Fmtflags
+ {
+ _S_boolalpha = 1L << 0,
+ _S_dec = 1L << 1,
+ _S_fixed = 1L << 2,
+ _S_hex = 1L << 3,
+ _S_internal = 1L << 4,
+ _S_left = 1L << 5,
+ _S_oct = 1L << 6,
+ _S_right = 1L << 7,
+ _S_scientific = 1L << 8,
+ _S_showbase = 1L << 9,
+ _S_showpoint = 1L << 10,
+ _S_showpos = 1L << 11,
+ _S_skipws = 1L << 12,
+ _S_unitbuf = 1L << 13,
+ _S_uppercase = 1L << 14,
+ _S_adjustfield = _S_left | _S_right | _S_internal,
+ _S_basefield = _S_dec | _S_oct | _S_hex,
+ _S_floatfield = _S_scientific | _S_fixed,
+ _S_ios_fmtflags_end = 1L << 16
+ };
+
+ inline _Ios_Fmtflags
+ operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+ inline _Ios_Fmtflags
+ operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+ inline _Ios_Fmtflags
+ operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
+ { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+ inline _Ios_Fmtflags&
+ operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ { return __a = __a | __b; }
+
+ inline _Ios_Fmtflags&
+ operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ { return __a = __a & __b; }
+
+ inline _Ios_Fmtflags&
+ operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
+ { return __a = __a ^ __b; }
+
+ inline _Ios_Fmtflags
+ operator~(_Ios_Fmtflags __a)
+ { return _Ios_Fmtflags(~static_cast<int>(__a)); }
+
+
+ enum _Ios_Openmode
+ {
+ _S_app = 1L << 0,
+ _S_ate = 1L << 1,
+ _S_bin = 1L << 2,
+ _S_in = 1L << 3,
+ _S_out = 1L << 4,
+ _S_trunc = 1L << 5,
+ _S_ios_openmode_end = 1L << 16
+ };
+
+ inline _Ios_Openmode
+ operator&(_Ios_Openmode __a, _Ios_Openmode __b)
+ { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+ inline _Ios_Openmode
+ operator|(_Ios_Openmode __a, _Ios_Openmode __b)
+ { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+ inline _Ios_Openmode
+ operator^(_Ios_Openmode __a, _Ios_Openmode __b)
+ { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+ inline _Ios_Openmode&
+ operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ { return __a = __a | __b; }
+
+ inline _Ios_Openmode&
+ operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ { return __a = __a & __b; }
+
+ inline _Ios_Openmode&
+ operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
+ { return __a = __a ^ __b; }
+
+ inline _Ios_Openmode
+ operator~(_Ios_Openmode __a)
+ { return _Ios_Openmode(~static_cast<int>(__a)); }
+
+
+ enum _Ios_Iostate
+ {
+ _S_goodbit = 0,
+ _S_badbit = 1L << 0,
+ _S_eofbit = 1L << 1,
+ _S_failbit = 1L << 2,
+ _S_ios_iostate_end = 1L << 16
+ };
+
+ inline _Ios_Iostate
+ operator&(_Ios_Iostate __a, _Ios_Iostate __b)
+ { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
+
+ inline _Ios_Iostate
+ operator|(_Ios_Iostate __a, _Ios_Iostate __b)
+ { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
+
+ inline _Ios_Iostate
+ operator^(_Ios_Iostate __a, _Ios_Iostate __b)
+ { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
+
+ inline _Ios_Iostate&
+ operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ { return __a = __a | __b; }
+
+ inline _Ios_Iostate&
+ operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ { return __a = __a & __b; }
+
+ inline _Ios_Iostate&
+ operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
+ { return __a = __a ^ __b; }
+
+ inline _Ios_Iostate
+ operator~(_Ios_Iostate __a)
+ { return _Ios_Iostate(~static_cast<int>(__a)); }
+
+ enum _Ios_Seekdir
+ {
+ _S_beg = 0,
+ _S_cur = _IOS_BASE_SEEK_CUR,
+ _S_end = _IOS_BASE_SEEK_END,
+ _S_ios_seekdir_end = 1L << 16
+ };
+
+ // 27.4.2 Class ios_base
+ /**
+ * @brief The base of the I/O class hierarchy.
+ * @ingroup io
+ *
+ * This class defines everything that can be defined about I/O that does
+ * not depend on the type of characters being input or output. Most
+ * people will only see @c ios_base when they need to specify the full
+ * name of the various I/O flags (e.g., the openmodes).
+ */
+ class ios_base
+ {
+ public:
+
+ /**
+ * @brief These are thrown to indicate problems with io.
+ * @ingroup exceptions
+ *
+ * 27.4.2.1.1 Class ios_base::failure
+ */
+ class failure : public exception
+ {
+ public:
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 48. Use of non-existent exception constructor
+ explicit
+ failure(const string& __str) throw();
+
+ // This declaration is not useless:
+ // http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Vague-Linkage.html
+ virtual
+ ~failure() throw();
+
+ virtual const char*
+ what() const throw();
+
+ private:
+ string _M_msg;
+ };
+
+ // 27.4.2.1.2 Type ios_base::fmtflags
+ /**
+ * @brief This is a bitmask type.
+ *
+ * @c "_Ios_Fmtflags" is implementation-defined, but it is valid to
+ * perform bitwise operations on these values and expect the Right
+ * Thing to happen. Defined objects of type fmtflags are:
+ * - boolalpha
+ * - dec
+ * - fixed
+ * - hex
+ * - internal
+ * - left
+ * - oct
+ * - right
+ * - scientific
+ * - showbase
+ * - showpoint
+ * - showpos
+ * - skipws
+ * - unitbuf
+ * - uppercase
+ * - adjustfield
+ * - basefield
+ * - floatfield
+ */
+ typedef _Ios_Fmtflags fmtflags;
+
+ /// Insert/extract @c bool in alphabetic rather than numeric format.
+ static const fmtflags boolalpha = _S_boolalpha;
+
+ /// Converts integer input or generates integer output in decimal base.
+ static const fmtflags dec = _S_dec;
+
+ /// Generate floating-point output in fixed-point notation.
+ static const fmtflags fixed = _S_fixed;
+
+ /// Converts integer input or generates integer output in hexadecimal base.
+ static const fmtflags hex = _S_hex;
+
+ /// Adds fill characters at a designated internal point in certain
+ /// generated output, or identical to @c right if no such point is
+ /// designated.
+ static const fmtflags internal = _S_internal;
+
+ /// Adds fill characters on the right (final positions) of certain
+ /// generated output. (I.e., the thing you print is flush left.)
+ static const fmtflags left = _S_left;
+
+ /// Converts integer input or generates integer output in octal base.
+ static const fmtflags oct = _S_oct;
+
+ /// Adds fill characters on the left (initial positions) of certain
+ /// generated output. (I.e., the thing you print is flush right.)
+ static const fmtflags right = _S_right;
+
+ /// Generates floating-point output in scientific notation.
+ static const fmtflags scientific = _S_scientific;
+
+ /// Generates a prefix indicating the numeric base of generated integer
+ /// output.
+ static const fmtflags showbase = _S_showbase;
+
+ /// Generates a decimal-point character unconditionally in generated
+ /// floating-point output.
+ static const fmtflags showpoint = _S_showpoint;
+
+ /// Generates a + sign in non-negative generated numeric output.
+ static const fmtflags showpos = _S_showpos;
+
+ /// Skips leading white space before certain input operations.
+ static const fmtflags skipws = _S_skipws;
+
+ /// Flushes output after each output operation.
+ static const fmtflags unitbuf = _S_unitbuf;
+
+ /// Replaces certain lowercase letters with their uppercase equivalents
+ /// in generated output.
+ static const fmtflags uppercase = _S_uppercase;
+
+ /// A mask of left|right|internal. Useful for the 2-arg form of @c setf.
+ static const fmtflags adjustfield = _S_adjustfield;
+
+ /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf.
+ static const fmtflags basefield = _S_basefield;
+
+ /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf.
+ static const fmtflags floatfield = _S_floatfield;
+
+ // 27.4.2.1.3 Type ios_base::iostate
+ /**
+ * @brief This is a bitmask type.
+ *
+ * @c "_Ios_Iostate" is implementation-defined, but it is valid to
+ * perform bitwise operations on these values and expect the Right
+ * Thing to happen. Defined objects of type iostate are:
+ * - badbit
+ * - eofbit
+ * - failbit
+ * - goodbit
+ */
+ typedef _Ios_Iostate iostate;
+
+ /// Indicates a loss of integrity in an input or output sequence (such
+ /// as an irrecoverable read error from a file).
+ static const iostate badbit = _S_badbit;
+
+ /// Indicates that an input operation reached the end of an input sequence.
+ static const iostate eofbit = _S_eofbit;
+
+ /// Indicates that an input operation failed to read the expected
+ /// characters, or that an output operation failed to generate the
+ /// desired characters.
+ static const iostate failbit = _S_failbit;
+
+ /// Indicates all is well.
+ static const iostate goodbit = _S_goodbit;
+
+ // 27.4.2.1.4 Type ios_base::openmode
+ /**
+ * @brief This is a bitmask type.
+ *
+ * @c "_Ios_Openmode" is implementation-defined, but it is valid to
+ * perform bitwise operations on these values and expect the Right
+ * Thing to happen. Defined objects of type openmode are:
+ * - app
+ * - ate
+ * - binary
+ * - in
+ * - out
+ * - trunc
+ */
+ typedef _Ios_Openmode openmode;
+
+ /// Seek to end before each write.
+ static const openmode app = _S_app;
+
+ /// Open and seek to end immediately after opening.
+ static const openmode ate = _S_ate;
+
+ /// Perform input and output in binary mode (as opposed to text mode).
+ /// This is probably not what you think it is; see
+ /// http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch27s02.html
+ static const openmode binary = _S_bin;
+
+ /// Open for input. Default for @c ifstream and fstream.
+ static const openmode in = _S_in;
+
+ /// Open for output. Default for @c ofstream and fstream.
+ static const openmode out = _S_out;
+
+ /// Open for input. Default for @c ofstream.
+ static const openmode trunc = _S_trunc;
+
+ // 27.4.2.1.5 Type ios_base::seekdir
+ /**
+ * @brief This is an enumerated type.
+ *
+ * @c "_Ios_Seekdir" is implementation-defined. Defined values
+ * of type seekdir are:
+ * - beg
+ * - cur, equivalent to @c SEEK_CUR in the C standard library.
+ * - end, equivalent to @c SEEK_END in the C standard library.
+ */
+ typedef _Ios_Seekdir seekdir;
+
+ /// Request a seek relative to the beginning of the stream.
+ static const seekdir beg = _S_beg;
+
+ /// Request a seek relative to the current position within the sequence.
+ static const seekdir cur = _S_cur;
+
+ /// Request a seek relative to the current end of the sequence.
+ static const seekdir end = _S_end;
+
+ // Annex D.6
+ typedef int io_state;
+ typedef int open_mode;
+ typedef int seek_dir;
+
+ typedef std::streampos streampos;
+ typedef std::streamoff streamoff;
+
+ // Callbacks;
+ /**
+ * @brief The set of events that may be passed to an event callback.
+ *
+ * erase_event is used during ~ios() and copyfmt(). imbue_event is used
+ * during imbue(). copyfmt_event is used during copyfmt().
+ */
+ enum event
+ {
+ erase_event,
+ imbue_event,
+ copyfmt_event
+ };
+
+ /**
+ * @brief The type of an event callback function.
+ * @param event One of the members of the event enum.
+ * @param ios_base Reference to the ios_base object.
+ * @param int The integer provided when the callback was registered.
+ *
+ * Event callbacks are user defined functions that get called during
+ * several ios_base and basic_ios functions, specifically imbue(),
+ * copyfmt(), and ~ios().
+ */
+ typedef void (*event_callback) (event, ios_base&, int);
+
+ /**
+ * @brief Add the callback __fn with parameter __index.
+ * @param __fn The function to add.
+ * @param __index The integer to pass to the function when invoked.
+ *
+ * Registers a function as an event callback with an integer parameter to
+ * be passed to the function when invoked. Multiple copies of the
+ * function are allowed. If there are multiple callbacks, they are
+ * invoked in the order they were registered.
+ */
+ void
+ register_callback(event_callback __fn, int __index);
+
+ protected:
+ //@{
+ /**
+ * ios_base data members (doc me)
+ */
+ streamsize _M_precision;
+ streamsize _M_width;
+ fmtflags _M_flags;
+ iostate _M_exception;
+ iostate _M_streambuf_state;
+ //@}
+
+ // 27.4.2.6 Members for callbacks
+ // 27.4.2.6 ios_base callbacks
+ struct _Callback_list
+ {
+ // Data Members
+ _Callback_list* _M_next;
+ ios_base::event_callback _M_fn;
+ int _M_index;
+ _Atomic_word _M_refcount; // 0 means one reference.
+
+ _Callback_list(ios_base::event_callback __fn, int __index,
+ _Callback_list* __cb)
+ : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
+
+ void
+ _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
+
+ // 0 => OK to delete.
+ int
+ _M_remove_reference()
+ { return __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); }
+ };
+
+ _Callback_list* _M_callbacks;
+
+ void
+ _M_call_callbacks(event __ev) throw();
+
+ void
+ _M_dispose_callbacks(void);
+
+ // 27.4.2.5 Members for iword/pword storage
+ struct _Words
+ {
+ void* _M_pword;
+ long _M_iword;
+ _Words() : _M_pword(0), _M_iword(0) { }
+ };
+
+ // Only for failed iword/pword calls.
+ _Words _M_word_zero;
+
+ // Guaranteed storage.
+ // The first 5 iword and pword slots are reserved for internal use.
+ enum { _S_local_word_size = 8 };
+ _Words _M_local_word[_S_local_word_size];
+
+ // Allocated storage.
+ int _M_word_size;
+ _Words* _M_word;
+
+ _Words&
+ _M_grow_words(int __index, bool __iword);
+
+ // Members for locale and locale caching.
+ locale _M_ios_locale;
+
+ void
+ _M_init();
+
+ public:
+
+ // 27.4.2.1.6 Class ios_base::Init
+ // Used to initialize standard streams. In theory, g++ could use
+ // -finit-priority to order this stuff correctly without going
+ // through these machinations.
+ class Init
+ {
+ friend class ios_base;
+ public:
+ Init();
+ ~Init();
+
+ private:
+ static _Atomic_word _S_refcount;
+ static bool _S_synced_with_stdio;
+ };
+
+ // [27.4.2.2] fmtflags state functions
+ /**
+ * @brief Access to format flags.
+ * @return The format control flags for both input and output.
+ */
+ fmtflags
+ flags() const
+ { return _M_flags; }
+
+ /**
+ * @brief Setting new format flags all at once.
+ * @param fmtfl The new flags to set.
+ * @return The previous format control flags.
+ *
+ * This function overwrites all the format flags with @a fmtfl.
+ */
+ fmtflags
+ flags(fmtflags __fmtfl)
+ {
+ fmtflags __old = _M_flags;
+ _M_flags = __fmtfl;
+ return __old;
+ }
+
+ /**
+ * @brief Setting new format flags.
+ * @param fmtfl Additional flags to set.
+ * @return The previous format control flags.
+ *
+ * This function sets additional flags in format control. Flags that
+ * were previously set remain set.
+ */
+ fmtflags
+ setf(fmtflags __fmtfl)
+ {
+ fmtflags __old = _M_flags;
+ _M_flags |= __fmtfl;
+ return __old;
+ }
+
+ /**
+ * @brief Setting new format flags.
+ * @param fmtfl Additional flags to set.
+ * @param mask The flags mask for @a fmtfl.
+ * @return The previous format control flags.
+ *
+ * This function clears @a mask in the format flags, then sets
+ * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield.
+ */
+ fmtflags
+ setf(fmtflags __fmtfl, fmtflags __mask)
+ {
+ fmtflags __old = _M_flags;
+ _M_flags &= ~__mask;
+ _M_flags |= (__fmtfl & __mask);
+ return __old;
+ }
+
+ /**
+ * @brief Clearing format flags.
+ * @param mask The flags to unset.
+ *
+ * This function clears @a mask in the format flags.
+ */
+ void
+ unsetf(fmtflags __mask)
+ { _M_flags &= ~__mask; }
+
+ /**
+ * @brief Flags access.
+ * @return The precision to generate on certain output operations.
+ *
+ * Be careful if you try to give a definition of "precision" here; see
+ * DR 189.
+ */
+ streamsize
+ precision() const
+ { return _M_precision; }
+
+ /**
+ * @brief Changing flags.
+ * @param prec The new precision value.
+ * @return The previous value of precision().
+ */
+ streamsize
+ precision(streamsize __prec)
+ {
+ streamsize __old = _M_precision;
+ _M_precision = __prec;
+ return __old;
+ }
+
+ /**
+ * @brief Flags access.
+ * @return The minimum field width to generate on output operations.
+ *
+ * "Minimum field width" refers to the number of characters.
+ */
+ streamsize
+ width() const
+ { return _M_width; }
+
+ /**
+ * @brief Changing flags.
+ * @param wide The new width value.
+ * @return The previous value of width().
+ */
+ streamsize
+ width(streamsize __wide)
+ {
+ streamsize __old = _M_width;
+ _M_width = __wide;
+ return __old;
+ }
+
+ // [27.4.2.4] ios_base static members
+ /**
+ * @brief Interaction with the standard C I/O objects.
+ * @param sync Whether to synchronize or not.
+ * @return True if the standard streams were previously synchronized.
+ *
+ * The synchronization referred to is @e only that between the standard
+ * C facilities (e.g., stdout) and the standard C++ objects (e.g.,
+ * cout). User-declared streams are unaffected. See
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch28s02.html
+ */
+ static bool
+ sync_with_stdio(bool __sync = true);
+
+ // [27.4.2.3] ios_base locale functions
+ /**
+ * @brief Setting a new locale.
+ * @param loc The new locale.
+ * @return The previous locale.
+ *
+ * Sets the new locale for this stream, and then invokes each callback
+ * with imbue_event.
+ */
+ locale
+ imbue(const locale& __loc);
+
+ /**
+ * @brief Locale access
+ * @return A copy of the current locale.
+ *
+ * If @c imbue(loc) has previously been called, then this function
+ * returns @c loc. Otherwise, it returns a copy of @c std::locale(),
+ * the global C++ locale.
+ */
+ locale
+ getloc() const
+ { return _M_ios_locale; }
+
+ /**
+ * @brief Locale access
+ * @return A reference to the current locale.
+ *
+ * Like getloc above, but returns a reference instead of
+ * generating a copy.
+ */
+ const locale&
+ _M_getloc() const
+ { return _M_ios_locale; }
+
+ // [27.4.2.5] ios_base storage functions
+ /**
+ * @brief Access to unique indices.
+ * @return An integer different from all previous calls.
+ *
+ * This function returns a unique integer every time it is called. It
+ * can be used for any purpose, but is primarily intended to be a unique
+ * index for the iword and pword functions. The expectation is that an
+ * application calls xalloc in order to obtain an index in the iword and
+ * pword arrays that can be used without fear of conflict.
+ *
+ * The implementation maintains a static variable that is incremented and
+ * returned on each invocation. xalloc is guaranteed to return an index
+ * that is safe to use in the iword and pword arrays.
+ */
+ static int
+ xalloc() throw();
+
+ /**
+ * @brief Access to integer array.
+ * @param __ix Index into the array.
+ * @return A reference to an integer associated with the index.
+ *
+ * The iword function provides access to an array of integers that can be
+ * used for any purpose. The array grows as required to hold the
+ * supplied index. All integers in the array are initialized to 0.
+ *
+ * The implementation reserves several indices. You should use xalloc to
+ * obtain an index that is safe to use. Also note that since the array
+ * can grow dynamically, it is not safe to hold onto the reference.
+ */
+ long&
+ iword(int __ix)
+ {
+ _Words& __word = (__ix < _M_word_size)
+ ? _M_word[__ix] : _M_grow_words(__ix, true);
+ return __word._M_iword;
+ }
+
+ /**
+ * @brief Access to void pointer array.
+ * @param __ix Index into the array.
+ * @return A reference to a void* associated with the index.
+ *
+ * The pword function provides access to an array of pointers that can be
+ * used for any purpose. The array grows as required to hold the
+ * supplied index. All pointers in the array are initialized to 0.
+ *
+ * The implementation reserves several indices. You should use xalloc to
+ * obtain an index that is safe to use. Also note that since the array
+ * can grow dynamically, it is not safe to hold onto the reference.
+ */
+ void*&
+ pword(int __ix)
+ {
+ _Words& __word = (__ix < _M_word_size)
+ ? _M_word[__ix] : _M_grow_words(__ix, false);
+ return __word._M_pword;
+ }
+
+ // Destructor
+ /**
+ * Invokes each callback with erase_event. Destroys local storage.
+ *
+ * Note that the ios_base object for the standard streams never gets
+ * destroyed. As a result, any callbacks registered with the standard
+ * streams will not get invoked with erase_event (unless copyfmt is
+ * used).
+ */
+ virtual ~ios_base();
+
+ protected:
+ ios_base();
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 50. Copy constructor and assignment operator of ios_base
+ private:
+ ios_base(const ios_base&);
+
+ ios_base&
+ operator=(const ios_base&);
+ };
+
+ // [27.4.5.1] fmtflags manipulators
+ /// Calls base.setf(ios_base::boolalpha).
+ inline ios_base&
+ boolalpha(ios_base& __base)
+ {
+ __base.setf(ios_base::boolalpha);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::boolalpha).
+ inline ios_base&
+ noboolalpha(ios_base& __base)
+ {
+ __base.unsetf(ios_base::boolalpha);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::showbase).
+ inline ios_base&
+ showbase(ios_base& __base)
+ {
+ __base.setf(ios_base::showbase);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::showbase).
+ inline ios_base&
+ noshowbase(ios_base& __base)
+ {
+ __base.unsetf(ios_base::showbase);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::showpoint).
+ inline ios_base&
+ showpoint(ios_base& __base)
+ {
+ __base.setf(ios_base::showpoint);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::showpoint).
+ inline ios_base&
+ noshowpoint(ios_base& __base)
+ {
+ __base.unsetf(ios_base::showpoint);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::showpos).
+ inline ios_base&
+ showpos(ios_base& __base)
+ {
+ __base.setf(ios_base::showpos);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::showpos).
+ inline ios_base&
+ noshowpos(ios_base& __base)
+ {
+ __base.unsetf(ios_base::showpos);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::skipws).
+ inline ios_base&
+ skipws(ios_base& __base)
+ {
+ __base.setf(ios_base::skipws);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::skipws).
+ inline ios_base&
+ noskipws(ios_base& __base)
+ {
+ __base.unsetf(ios_base::skipws);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::uppercase).
+ inline ios_base&
+ uppercase(ios_base& __base)
+ {
+ __base.setf(ios_base::uppercase);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::uppercase).
+ inline ios_base&
+ nouppercase(ios_base& __base)
+ {
+ __base.unsetf(ios_base::uppercase);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::unitbuf).
+ inline ios_base&
+ unitbuf(ios_base& __base)
+ {
+ __base.setf(ios_base::unitbuf);
+ return __base;
+ }
+
+ /// Calls base.unsetf(ios_base::unitbuf).
+ inline ios_base&
+ nounitbuf(ios_base& __base)
+ {
+ __base.unsetf(ios_base::unitbuf);
+ return __base;
+ }
+
+ // [27.4.5.2] adjustfield manipulators
+ /// Calls base.setf(ios_base::internal, ios_base::adjustfield).
+ inline ios_base&
+ internal(ios_base& __base)
+ {
+ __base.setf(ios_base::internal, ios_base::adjustfield);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::left, ios_base::adjustfield).
+ inline ios_base&
+ left(ios_base& __base)
+ {
+ __base.setf(ios_base::left, ios_base::adjustfield);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::right, ios_base::adjustfield).
+ inline ios_base&
+ right(ios_base& __base)
+ {
+ __base.setf(ios_base::right, ios_base::adjustfield);
+ return __base;
+ }
+
+ // [27.4.5.3] basefield manipulators
+ /// Calls base.setf(ios_base::dec, ios_base::basefield).
+ inline ios_base&
+ dec(ios_base& __base)
+ {
+ __base.setf(ios_base::dec, ios_base::basefield);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::hex, ios_base::basefield).
+ inline ios_base&
+ hex(ios_base& __base)
+ {
+ __base.setf(ios_base::hex, ios_base::basefield);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::oct, ios_base::basefield).
+ inline ios_base&
+ oct(ios_base& __base)
+ {
+ __base.setf(ios_base::oct, ios_base::basefield);
+ return __base;
+ }
+
+ // [27.4.5.4] floatfield manipulators
+ /// Calls base.setf(ios_base::fixed, ios_base::floatfield).
+ inline ios_base&
+ fixed(ios_base& __base)
+ {
+ __base.setf(ios_base::fixed, ios_base::floatfield);
+ return __base;
+ }
+
+ /// Calls base.setf(ios_base::scientific, ios_base::floatfield).
+ inline ios_base&
+ scientific(ios_base& __base)
+ {
+ __base.setf(ios_base::scientific, ios_base::floatfield);
+ return __base;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#undef _IOS_BASE_SEEK_CUR
+#undef _IOS_BASE_SEEK_END
+
+#endif /* _IOS_BASE_H */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/istream.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/istream.tcc
new file mode 100644
index 000000000..5d60791ec
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/istream.tcc
@@ -0,0 +1,1022 @@
+// istream classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file istream.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.6.1 Input streams
+//
+
+#ifndef _ISTREAM_TCC
+#define _ISTREAM_TCC 1
+
+#pragma GCC system_header
+
+#include <cxxabi-forced.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>::sentry::
+ sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ if (__in.good())
+ {
+ if (__in.tie())
+ __in.tie()->flush();
+ if (!__noskip && bool(__in.flags() & ios_base::skipws))
+ {
+ const __int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = __in.rdbuf();
+ __int_type __c = __sb->sgetc();
+
+ const __ctype_type& __ct = __check_facet(__in._M_ctype);
+ while (!traits_type::eq_int_type(__c, __eof)
+ && __ct.is(ctype_base::space,
+ traits_type::to_char_type(__c)))
+ __c = __sb->snextc();
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 195. Should basic_istream::sentry's constructor ever
+ // set eofbit?
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ }
+
+ if (__in.good() && __err == ios_base::goodbit)
+ _M_ok = true;
+ else
+ {
+ __err |= ios_base::failbit;
+ __in.setstate(__err);
+ }
+ }
+
+ template<typename _CharT, typename _Traits>
+ template<typename _ValueT>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ _M_extract(_ValueT& __v)
+ {
+ sentry __cerb(*this, false);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const __num_get_type& __ng = __check_facet(this->_M_num_get);
+ __ng.get(*this, 0, *this, __err, __v);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(short& __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 118. basic_istream uses nonexistent num_get member functions.
+ long __l;
+ _M_extract(__l);
+ if (!this->fail())
+ {
+ if (__gnu_cxx::__numeric_traits<short>::__min <= __l
+ && __l <= __gnu_cxx::__numeric_traits<short>::__max)
+ __n = short(__l);
+ else
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(int& __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 118. basic_istream uses nonexistent num_get member functions.
+ long __l;
+ _M_extract(__l);
+ if (!this->fail())
+ {
+ if (__gnu_cxx::__numeric_traits<int>::__min <= __l
+ && __l <= __gnu_cxx::__numeric_traits<int>::__max)
+ __n = int(__l);
+ else
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ operator>>(__streambuf_type* __sbout)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this, false);
+ if (__cerb && __sbout)
+ {
+ __try
+ {
+ bool __ineof;
+ if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof))
+ __err |= ios_base::failbit;
+ if (__ineof)
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::failbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::failbit); }
+ }
+ else if (!__sbout)
+ __err |= ios_base::failbit;
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_istream<_CharT, _Traits>::int_type
+ basic_istream<_CharT, _Traits>::
+ get(void)
+ {
+ const int_type __eof = traits_type::eof();
+ int_type __c = __eof;
+ _M_gcount = 0;
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ __try
+ {
+ __c = this->rdbuf()->sbumpc();
+ // 27.6.1.1 paragraph 3
+ if (!traits_type::eq_int_type(__c, __eof))
+ _M_gcount = 1;
+ else
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ }
+ if (!_M_gcount)
+ __err |= ios_base::failbit;
+ if (__err)
+ this->setstate(__err);
+ return __c;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ get(char_type& __c)
+ {
+ _M_gcount = 0;
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ __try
+ {
+ const int_type __cb = this->rdbuf()->sbumpc();
+ // 27.6.1.1 paragraph 3
+ if (!traits_type::eq_int_type(__cb, traits_type::eof()))
+ {
+ _M_gcount = 1;
+ __c = traits_type::to_char_type(__cb);
+ }
+ else
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ }
+ if (!_M_gcount)
+ __err |= ios_base::failbit;
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ get(char_type* __s, streamsize __n, char_type __delim)
+ {
+ _M_gcount = 0;
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ __try
+ {
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sgetc();
+
+ while (_M_gcount + 1 < __n
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __idelim))
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 243. get and getline when sentry reports failure.
+ if (__n > 0)
+ *__s = char_type();
+ if (!_M_gcount)
+ __err |= ios_base::failbit;
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ get(__streambuf_type& __sb, char_type __delim)
+ {
+ _M_gcount = 0;
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ __try
+ {
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __this_sb = this->rdbuf();
+ int_type __c = __this_sb->sgetc();
+ char_type __c2 = traits_type::to_char_type(__c);
+
+ while (!traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __idelim)
+ && !traits_type::eq_int_type(__sb.sputc(__c2), __eof))
+ {
+ ++_M_gcount;
+ __c = __this_sb->snextc();
+ __c2 = traits_type::to_char_type(__c);
+ }
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ }
+ if (!_M_gcount)
+ __err |= ios_base::failbit;
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ getline(char_type* __s, streamsize __n, char_type __delim)
+ {
+ _M_gcount = 0;
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ __try
+ {
+ const int_type __idelim = traits_type::to_int_type(__delim);
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sgetc();
+
+ while (_M_gcount + 1 < __n
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __idelim))
+ {
+ *__s++ = traits_type::to_char_type(__c);
+ __c = __sb->snextc();
+ ++_M_gcount;
+ }
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ else
+ {
+ if (traits_type::eq_int_type(__c, __idelim))
+ {
+ __sb->sbumpc();
+ ++_M_gcount;
+ }
+ else
+ __err |= ios_base::failbit;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 243. get and getline when sentry reports failure.
+ if (__n > 0)
+ *__s = char_type();
+ if (!_M_gcount)
+ __err |= ios_base::failbit;
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ // We provide three overloads, since the first two are much simpler
+ // than the general case. Also, the latter two can thus adopt the
+ // same "batchy" strategy used by getline above.
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ ignore(void)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+
+ if (traits_type::eq_int_type(__sb->sbumpc(), __eof))
+ __err |= ios_base::eofbit;
+ else
+ _M_gcount = 1;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ ignore(streamsize __n)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb && __n > 0)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sgetc();
+
+ // N.B. On LFS-enabled platforms streamsize is still 32 bits
+ // wide: if we want to implement the standard mandated behavior
+ // for n == max() (see 27.6.1.3/24) we are at risk of signed
+ // integer overflow: thus these contortions. Also note that,
+ // by definition, when more than 2G chars are actually ignored,
+ // _M_gcount (the return value of gcount, that is) cannot be
+ // really correct, being unavoidably too small.
+ bool __large_ignore = false;
+ while (true)
+ {
+ while (_M_gcount < __n
+ && !traits_type::eq_int_type(__c, __eof))
+ {
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
+ && !traits_type::eq_int_type(__c, __eof))
+ {
+ _M_gcount =
+ __gnu_cxx::__numeric_traits<streamsize>::__min;
+ __large_ignore = true;
+ }
+ else
+ break;
+ }
+
+ if (__large_ignore)
+ _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
+
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ ignore(streamsize __n, int_type __delim)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb && __n > 0)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ int_type __c = __sb->sgetc();
+
+ // See comment above.
+ bool __large_ignore = false;
+ while (true)
+ {
+ while (_M_gcount < __n
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __delim))
+ {
+ ++_M_gcount;
+ __c = __sb->snextc();
+ }
+ if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
+ && !traits_type::eq_int_type(__c, __eof)
+ && !traits_type::eq_int_type(__c, __delim))
+ {
+ _M_gcount =
+ __gnu_cxx::__numeric_traits<streamsize>::__min;
+ __large_ignore = true;
+ }
+ else
+ break;
+ }
+
+ if (__large_ignore)
+ _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
+
+ if (traits_type::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+ else if (traits_type::eq_int_type(__c, __delim))
+ {
+ if (_M_gcount
+ < __gnu_cxx::__numeric_traits<streamsize>::__max)
+ ++_M_gcount;
+ __sb->sbumpc();
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_istream<_CharT, _Traits>::int_type
+ basic_istream<_CharT, _Traits>::
+ peek(void)
+ {
+ int_type __c = traits_type::eof();
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ __c = this->rdbuf()->sgetc();
+ if (traits_type::eq_int_type(__c, traits_type::eof()))
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return __c;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ read(char_type* __s, streamsize __n)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ _M_gcount = this->rdbuf()->sgetn(__s, __n);
+ if (_M_gcount != __n)
+ __err |= (ios_base::eofbit | ios_base::failbit);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_istream<_CharT, _Traits>::
+ readsome(char_type* __s, streamsize __n)
+ {
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ // Cannot compare int_type with streamsize generically.
+ const streamsize __num = this->rdbuf()->in_avail();
+ if (__num > 0)
+ _M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n));
+ else if (__num == -1)
+ __err |= ios_base::eofbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return _M_gcount;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ putback(char_type __c)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 60. What is a formatted input function?
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb
+ || traits_type::eq_int_type(__sb->sputbackc(__c), __eof))
+ __err |= ios_base::badbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ unget(void)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 60. What is a formatted input function?
+ _M_gcount = 0;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const int_type __eof = traits_type::eof();
+ __streambuf_type* __sb = this->rdbuf();
+ if (!__sb
+ || traits_type::eq_int_type(__sb->sungetc(), __eof))
+ __err |= ios_base::badbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ int
+ basic_istream<_CharT, _Traits>::
+ sync(void)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR60. Do not change _M_gcount.
+ int __ret = -1;
+ sentry __cerb(*this, true);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ __streambuf_type* __sb = this->rdbuf();
+ if (__sb)
+ {
+ if (__sb->pubsync() == -1)
+ __err |= ios_base::badbit;
+ else
+ __ret = 0;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_istream<_CharT, _Traits>::pos_type
+ basic_istream<_CharT, _Traits>::
+ tellg(void)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR60. Do not change _M_gcount.
+ pos_type __ret = pos_type(-1);
+ __try
+ {
+ if (!this->fail())
+ __ret = this->rdbuf()->pubseekoff(0, ios_base::cur,
+ ios_base::in);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ seekg(pos_type __pos)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR60. Do not change _M_gcount.
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ if (!this->fail())
+ {
+ // 136. seekp, seekg setting wrong streams?
+ const pos_type __p = this->rdbuf()->pubseekpos(__pos,
+ ios_base::in);
+
+ // 129. Need error indication from seekp() and seekg()
+ if (__p == pos_type(off_type(-1)))
+ __err |= ios_base::failbit;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ seekg(off_type __off, ios_base::seekdir __dir)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR60. Do not change _M_gcount.
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ if (!this->fail())
+ {
+ // 136. seekp, seekg setting wrong streams?
+ const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
+ ios_base::in);
+
+ // 129. Need error indication from seekp() and seekg()
+ if (__p == pos_type(off_type(-1)))
+ __err |= ios_base::failbit;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ // 27.6.1.2.3 Character extraction templates
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::int_type __int_type;
+
+ typename __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const __int_type __cb = __in.rdbuf()->sbumpc();
+ if (!_Traits::eq_int_type(__cb, _Traits::eof()))
+ __c = _Traits::to_char_type(__cb);
+ else
+ __err |= (ios_base::eofbit | ios_base::failbit);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __in._M_setstate(ios_base::badbit); }
+ if (__err)
+ __in.setstate(__err);
+ }
+ return __in;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef typename _Traits::int_type int_type;
+ typedef _CharT char_type;
+ typedef ctype<_CharT> __ctype_type;
+
+ streamsize __extracted = 0;
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ typename __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ __try
+ {
+ // Figure out how many characters to extract.
+ streamsize __num = __in.width();
+ if (__num <= 0)
+ __num = __gnu_cxx::__numeric_traits<streamsize>::__max;
+
+ const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
+
+ const int_type __eof = _Traits::eof();
+ __streambuf_type* __sb = __in.rdbuf();
+ int_type __c = __sb->sgetc();
+
+ while (__extracted < __num - 1
+ && !_Traits::eq_int_type(__c, __eof)
+ && !__ct.is(ctype_base::space,
+ _Traits::to_char_type(__c)))
+ {
+ *__s++ = _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __sb->snextc();
+ }
+ if (_Traits::eq_int_type(__c, __eof))
+ __err |= ios_base::eofbit;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 68. Extractors for char* should store null at end
+ *__s = char_type();
+ __in.width(0);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __in._M_setstate(ios_base::badbit); }
+ }
+ if (!__extracted)
+ __err |= ios_base::failbit;
+ if (__err)
+ __in.setstate(__err);
+ return __in;
+ }
+
+ // 27.6.1.4 Standard basic_istream manipulators
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ ws(basic_istream<_CharT, _Traits>& __in)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef typename __istream_type::int_type __int_type;
+ typedef ctype<_CharT> __ctype_type;
+
+ const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
+ const __int_type __eof = _Traits::eof();
+ __streambuf_type* __sb = __in.rdbuf();
+ __int_type __c = __sb->sgetc();
+
+ while (!_Traits::eq_int_type(__c, __eof)
+ && __ct.is(ctype_base::space, _Traits::to_char_type(__c)))
+ __c = __sb->snextc();
+
+ if (_Traits::eq_int_type(__c, __eof))
+ __in.setstate(ios_base::eofbit);
+ return __in;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class basic_istream<char>;
+ extern template istream& ws(istream&);
+ extern template istream& operator>>(istream&, char&);
+ extern template istream& operator>>(istream&, char*);
+ extern template istream& operator>>(istream&, unsigned char&);
+ extern template istream& operator>>(istream&, signed char&);
+ extern template istream& operator>>(istream&, unsigned char*);
+ extern template istream& operator>>(istream&, signed char*);
+
+ extern template istream& istream::_M_extract(unsigned short&);
+ extern template istream& istream::_M_extract(unsigned int&);
+ extern template istream& istream::_M_extract(long&);
+ extern template istream& istream::_M_extract(unsigned long&);
+ extern template istream& istream::_M_extract(bool&);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ extern template istream& istream::_M_extract(long long&);
+ extern template istream& istream::_M_extract(unsigned long long&);
+#endif
+ extern template istream& istream::_M_extract(float&);
+ extern template istream& istream::_M_extract(double&);
+ extern template istream& istream::_M_extract(long double&);
+ extern template istream& istream::_M_extract(void*&);
+
+ extern template class basic_iostream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_istream<wchar_t>;
+ extern template wistream& ws(wistream&);
+ extern template wistream& operator>>(wistream&, wchar_t&);
+ extern template wistream& operator>>(wistream&, wchar_t*);
+
+ extern template wistream& wistream::_M_extract(unsigned short&);
+ extern template wistream& wistream::_M_extract(unsigned int&);
+ extern template wistream& wistream::_M_extract(long&);
+ extern template wistream& wistream::_M_extract(unsigned long&);
+ extern template wistream& wistream::_M_extract(bool&);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ extern template wistream& wistream::_M_extract(long long&);
+ extern template wistream& wistream::_M_extract(unsigned long long&);
+#endif
+ extern template wistream& wistream::_M_extract(float&);
+ extern template wistream& wistream::_M_extract(double&);
+ extern template wistream& wistream::_M_extract(long double&);
+ extern template wistream& wistream::_M_extract(void*&);
+
+ extern template class basic_iostream<wchar_t>;
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/list.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/list.tcc
new file mode 100644
index 000000000..899b41815
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/list.tcc
@@ -0,0 +1,416 @@
+// List implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file list.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _LIST_TCC
+#define _LIST_TCC 1
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ template<typename _Tp, typename _Alloc>
+ void
+ _List_base<_Tp, _Alloc>::
+ _M_clear()
+ {
+ typedef _List_node<_Tp> _Node;
+ _Node* __cur = static_cast<_Node*>(this->_M_impl._M_node._M_next);
+ while (__cur != &this->_M_impl._M_node)
+ {
+ _Node* __tmp = __cur;
+ __cur = static_cast<_Node*>(__cur->_M_next);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _M_get_Node_allocator().destroy(__tmp);
+#else
+ _M_get_Tp_allocator().destroy(&__tmp->_M_data);
+#endif
+ _M_put_node(__tmp);
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ typename list<_Tp, _Alloc>::iterator
+ list<_Tp, _Alloc>::
+ emplace(iterator __position, _Args&&... __args)
+ {
+ _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...);
+ __tmp->hook(__position._M_node);
+ return iterator(__tmp);
+ }
+#endif
+
+ template<typename _Tp, typename _Alloc>
+ typename list<_Tp, _Alloc>::iterator
+ list<_Tp, _Alloc>::
+ insert(iterator __position, const value_type& __x)
+ {
+ _Node* __tmp = _M_create_node(__x);
+ __tmp->hook(__position._M_node);
+ return iterator(__tmp);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ typename list<_Tp, _Alloc>::iterator
+ list<_Tp, _Alloc>::
+ erase(iterator __position)
+ {
+ iterator __ret = iterator(__position._M_node->_M_next);
+ _M_erase(__position);
+ return __ret;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ resize(size_type __new_size, value_type __x)
+ {
+ iterator __i = begin();
+ size_type __len = 0;
+ for (; __i != end() && __len < __new_size; ++__i, ++__len)
+ ;
+ if (__len == __new_size)
+ erase(__i, end());
+ else // __i == end()
+ insert(end(), __new_size - __len, __x);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ list<_Tp, _Alloc>&
+ list<_Tp, _Alloc>::
+ operator=(const list& __x)
+ {
+ if (this != &__x)
+ {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ const_iterator __first2 = __x.begin();
+ const_iterator __last2 = __x.end();
+ for (; __first1 != __last1 && __first2 != __last2;
+ ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+ return *this;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ _M_fill_assign(size_type __n, const value_type& __val)
+ {
+ iterator __i = begin();
+ for (; __i != end() && __n > 0; ++__i, --__n)
+ *__i = __val;
+ if (__n > 0)
+ insert(end(), __n, __val);
+ else
+ erase(__i, end());
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template <typename _InputIterator>
+ void
+ list<_Tp, _Alloc>::
+ _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,
+ __false_type)
+ {
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ for (; __first1 != __last1 && __first2 != __last2;
+ ++__first1, ++__first2)
+ *__first1 = *__first2;
+ if (__first2 == __last2)
+ erase(__first1, __last1);
+ else
+ insert(__last1, __first2, __last2);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ remove(const value_type& __value)
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ iterator __extra = __last;
+ while (__first != __last)
+ {
+ iterator __next = __first;
+ ++__next;
+ if (*__first == __value)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 526. Is it undefined if a function in the standard changes
+ // in parameters?
+ if (&*__first != &__value)
+ _M_erase(__first);
+ else
+ __extra = __first;
+ }
+ __first = __next;
+ }
+ if (__extra != __last)
+ _M_erase(__extra);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ unique()
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ if (__first == __last)
+ return;
+ iterator __next = __first;
+ while (++__next != __last)
+ {
+ if (*__first == *__next)
+ _M_erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ merge(list&& __x)
+#else
+ merge(list& __x)
+#endif
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 300. list::merge() specification incomplete
+ if (this != &__x)
+ {
+ _M_check_equal_allocators(__x);
+
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ iterator __first2 = __x.begin();
+ iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first2 < *__first1)
+ {
+ iterator __next = __first2;
+ _M_transfer(__first1, __first2, ++__next);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ if (__first2 != __last2)
+ _M_transfer(__last1, __first2, __last2);
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template <typename _StrictWeakOrdering>
+ void
+ list<_Tp, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ merge(list&& __x, _StrictWeakOrdering __comp)
+#else
+ merge(list& __x, _StrictWeakOrdering __comp)
+#endif
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 300. list::merge() specification incomplete
+ if (this != &__x)
+ {
+ _M_check_equal_allocators(__x);
+
+ iterator __first1 = begin();
+ iterator __last1 = end();
+ iterator __first2 = __x.begin();
+ iterator __last2 = __x.end();
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(*__first2, *__first1))
+ {
+ iterator __next = __first2;
+ _M_transfer(__first1, __first2, ++__next);
+ __first2 = __next;
+ }
+ else
+ ++__first1;
+ if (__first2 != __last2)
+ _M_transfer(__last1, __first2, __last2);
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ list<_Tp, _Alloc>::
+ sort()
+ {
+ // Do nothing if the list has length 0 or 1.
+ if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
+ && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
+ {
+ list __carry;
+ list __tmp[64];
+ list * __fill = &__tmp[0];
+ list * __counter;
+
+ do
+ {
+ __carry.splice(__carry.begin(), *this, begin());
+
+ for(__counter = &__tmp[0];
+ __counter != __fill && !__counter->empty();
+ ++__counter)
+ {
+ __counter->merge(__carry);
+ __carry.swap(*__counter);
+ }
+ __carry.swap(*__counter);
+ if (__counter == __fill)
+ ++__fill;
+ }
+ while ( !empty() );
+
+ for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
+ __counter->merge(*(__counter - 1));
+ swap( *(__fill - 1) );
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template <typename _Predicate>
+ void
+ list<_Tp, _Alloc>::
+ remove_if(_Predicate __pred)
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ while (__first != __last)
+ {
+ iterator __next = __first;
+ ++__next;
+ if (__pred(*__first))
+ _M_erase(__first);
+ __first = __next;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template <typename _BinaryPredicate>
+ void
+ list<_Tp, _Alloc>::
+ unique(_BinaryPredicate __binary_pred)
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ if (__first == __last)
+ return;
+ iterator __next = __first;
+ while (++__next != __last)
+ {
+ if (__binary_pred(*__first, *__next))
+ _M_erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template <typename _StrictWeakOrdering>
+ void
+ list<_Tp, _Alloc>::
+ sort(_StrictWeakOrdering __comp)
+ {
+ // Do nothing if the list has length 0 or 1.
+ if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node
+ && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)
+ {
+ list __carry;
+ list __tmp[64];
+ list * __fill = &__tmp[0];
+ list * __counter;
+
+ do
+ {
+ __carry.splice(__carry.begin(), *this, begin());
+
+ for(__counter = &__tmp[0];
+ __counter != __fill && !__counter->empty();
+ ++__counter)
+ {
+ __counter->merge(__carry, __comp);
+ __carry.swap(*__counter);
+ }
+ __carry.swap(*__counter);
+ if (__counter == __fill)
+ ++__fill;
+ }
+ while ( !empty() );
+
+ for (__counter = &__tmp[1]; __counter != __fill; ++__counter)
+ __counter->merge(*(__counter - 1), __comp);
+ swap(*(__fill - 1));
+ }
+ }
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _LIST_TCC */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.h b/gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.h
new file mode 100644
index 000000000..4a646937c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.h
@@ -0,0 +1,812 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale_classes.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _LOCALE_CLASSES_H
+#define _LOCALE_CLASSES_H 1
+
+#pragma GCC system_header
+
+#include <bits/localefwd.h>
+#include <string>
+#include <ext/atomicity.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 22.1.1 Class locale
+ /**
+ * @brief Container class for localization functionality.
+ *
+ * The locale class is first a class wrapper for C library locales. It is
+ * also an extensible container for user-defined localization. A locale is
+ * a collection of facets that implement various localization features such
+ * as money, time, and number printing.
+ *
+ * Constructing C++ locales does not change the C library locale.
+ *
+ * This library supports efficient construction and copying of locales
+ * through a reference counting implementation of the locale class.
+ */
+ class locale
+ {
+ public:
+ // Types:
+ /// Definition of locale::category.
+ typedef int category;
+
+ // Forward decls and friends:
+ class facet;
+ class id;
+ class _Impl;
+
+ friend class facet;
+ friend class _Impl;
+
+ template<typename _Facet>
+ friend bool
+ has_facet(const locale&) throw();
+
+ template<typename _Facet>
+ friend const _Facet&
+ use_facet(const locale&);
+
+ template<typename _Cache>
+ friend struct __use_cache;
+
+ //@{
+ /**
+ * @brief Category values.
+ *
+ * The standard category values are none, ctype, numeric, collate, time,
+ * monetary, and messages. They form a bitmask that supports union and
+ * intersection. The category all is the union of these values.
+ *
+ * NB: Order must match _S_facet_categories definition in locale.cc
+ */
+ static const category none = 0;
+ static const category ctype = 1L << 0;
+ static const category numeric = 1L << 1;
+ static const category collate = 1L << 2;
+ static const category time = 1L << 3;
+ static const category monetary = 1L << 4;
+ static const category messages = 1L << 5;
+ static const category all = (ctype | numeric | collate |
+ time | monetary | messages);
+ //@}
+
+ // Construct/copy/destroy:
+
+ /**
+ * @brief Default constructor.
+ *
+ * Constructs a copy of the global locale. If no locale has been
+ * explicitly set, this is the "C" locale.
+ */
+ locale() throw();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * Constructs a copy of @a other.
+ *
+ * @param other The locale to copy.
+ */
+ locale(const locale& __other) throw();
+
+ /**
+ * @brief Named locale constructor.
+ *
+ * Constructs a copy of the named C library locale.
+ *
+ * @param s Name of the locale to construct.
+ * @throw std::runtime_error if s is null or an undefined locale.
+ */
+ explicit
+ locale(const char* __s);
+
+ /**
+ * @brief Construct locale with facets from another locale.
+ *
+ * Constructs a copy of the locale @a base. The facets specified by @a
+ * cat are replaced with those from the locale named by @a s. If base is
+ * named, this locale instance will also be named.
+ *
+ * @param base The locale to copy.
+ * @param s Name of the locale to use facets from.
+ * @param cat Set of categories defining the facets to use from s.
+ * @throw std::runtime_error if s is null or an undefined locale.
+ */
+ locale(const locale& __base, const char* __s, category __cat);
+
+ /**
+ * @brief Construct locale with facets from another locale.
+ *
+ * Constructs a copy of the locale @a base. The facets specified by @a
+ * cat are replaced with those from the locale @a add. If @a base and @a
+ * add are named, this locale instance will also be named.
+ *
+ * @param base The locale to copy.
+ * @param add The locale to use facets from.
+ * @param cat Set of categories defining the facets to use from add.
+ */
+ locale(const locale& __base, const locale& __add, category __cat);
+
+ /**
+ * @brief Construct locale with another facet.
+ *
+ * Constructs a copy of the locale @a other. The facet @f is added to
+ * @other, replacing an existing facet of type Facet if there is one. If
+ * @f is null, this locale is a copy of @a other.
+ *
+ * @param other The locale to copy.
+ * @param f The facet to add in.
+ */
+ template<typename _Facet>
+ locale(const locale& __other, _Facet* __f);
+
+ /// Locale destructor.
+ ~locale() throw();
+
+ /**
+ * @brief Assignment operator.
+ *
+ * Set this locale to be a copy of @a other.
+ *
+ * @param other The locale to copy.
+ * @return A reference to this locale.
+ */
+ const locale&
+ operator=(const locale& __other) throw();
+
+ /**
+ * @brief Construct locale with another facet.
+ *
+ * Constructs and returns a new copy of this locale. Adds or replaces an
+ * existing facet of type Facet from the locale @a other into the new
+ * locale.
+ *
+ * @param Facet The facet type to copy from other
+ * @param other The locale to copy from.
+ * @return Newly constructed locale.
+ * @throw std::runtime_error if other has no facet of type Facet.
+ */
+ template<typename _Facet>
+ locale
+ combine(const locale& __other) const;
+
+ // Locale operations:
+ /**
+ * @brief Return locale name.
+ * @return Locale name or "*" if unnamed.
+ */
+ string
+ name() const;
+
+ /**
+ * @brief Locale equality.
+ *
+ * @param other The locale to compare against.
+ * @return True if other and this refer to the same locale instance, are
+ * copies, or have the same name. False otherwise.
+ */
+ bool
+ operator==(const locale& __other) const throw ();
+
+ /**
+ * @brief Locale inequality.
+ *
+ * @param other The locale to compare against.
+ * @return ! (*this == other)
+ */
+ bool
+ operator!=(const locale& __other) const throw ()
+ { return !(this->operator==(__other)); }
+
+ /**
+ * @brief Compare two strings according to collate.
+ *
+ * Template operator to compare two strings using the compare function of
+ * the collate facet in this locale. One use is to provide the locale to
+ * the sort function. For example, a vector v of strings could be sorted
+ * according to locale loc by doing:
+ * @code
+ * std::sort(v.begin(), v.end(), loc);
+ * @endcode
+ *
+ * @param s1 First string to compare.
+ * @param s2 Second string to compare.
+ * @return True if collate<Char> facet compares s1 < s2, else false.
+ */
+ template<typename _Char, typename _Traits, typename _Alloc>
+ bool
+ operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,
+ const basic_string<_Char, _Traits, _Alloc>& __s2) const;
+
+ // Global locale objects:
+ /**
+ * @brief Set global locale
+ *
+ * This function sets the global locale to the argument and returns a
+ * copy of the previous global locale. If the argument has a name, it
+ * will also call std::setlocale(LC_ALL, loc.name()).
+ *
+ * @param locale The new locale to make global.
+ * @return Copy of the old global locale.
+ */
+ static locale
+ global(const locale&);
+
+ /**
+ * @brief Return reference to the "C" locale.
+ */
+ static const locale&
+ classic();
+
+ private:
+ // The (shared) implementation
+ _Impl* _M_impl;
+
+ // The "C" reference locale
+ static _Impl* _S_classic;
+
+ // Current global locale
+ static _Impl* _S_global;
+
+ // Names of underlying locale categories.
+ // NB: locale::global() has to know how to modify all the
+ // underlying categories, not just the ones required by the C++
+ // standard.
+ static const char* const* const _S_categories;
+
+ // Number of standard categories. For C++, these categories are
+ // collate, ctype, monetary, numeric, time, and messages. These
+ // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,
+ // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE
+ // 1003.1-2001) specifies LC_MESSAGES.
+ // In addition to the standard categories, the underlying
+ // operating system is allowed to define extra LC_*
+ // macros. For GNU systems, the following are also valid:
+ // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,
+ // and LC_IDENTIFICATION.
+ enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES };
+
+#ifdef __GTHREADS
+ static __gthread_once_t _S_once;
+#endif
+
+ explicit
+ locale(_Impl*) throw();
+
+ static void
+ _S_initialize();
+
+ static void
+ _S_initialize_once();
+
+ static category
+ _S_normalize_category(category);
+
+ void
+ _M_coalesce(const locale& __base, const locale& __add, category __cat);
+ };
+
+
+ // 22.1.1.1.2 Class locale::facet
+ /**
+ * @brief Localization functionality base class.
+ *
+ * The facet class is the base class for a localization feature, such as
+ * money, time, and number printing. It provides common support for facets
+ * and reference management.
+ *
+ * Facets may not be copied or assigned.
+ */
+ class locale::facet
+ {
+ private:
+ friend class locale;
+ friend class locale::_Impl;
+
+ mutable _Atomic_word _M_refcount;
+
+ // Contains data from the underlying "C" library for the classic locale.
+ static __c_locale _S_c_locale;
+
+ // String literal for the name of the classic locale.
+ static const char _S_c_name[2];
+
+#ifdef __GTHREADS
+ static __gthread_once_t _S_once;
+#endif
+
+ static void
+ _S_initialize_once();
+
+ protected:
+ /**
+ * @brief Facet constructor.
+ *
+ * This is the constructor provided by the standard. If refs is 0, the
+ * facet is destroyed when the last referencing locale is destroyed.
+ * Otherwise the facet will never be destroyed.
+ *
+ * @param refs The initial value for reference count.
+ */
+ explicit
+ facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)
+ { }
+
+ /// Facet destructor.
+ virtual
+ ~facet();
+
+ static void
+ _S_create_c_locale(__c_locale& __cloc, const char* __s,
+ __c_locale __old = 0);
+
+ static __c_locale
+ _S_clone_c_locale(__c_locale& __cloc);
+
+ static void
+ _S_destroy_c_locale(__c_locale& __cloc);
+
+ // Returns data from the underlying "C" library data for the
+ // classic locale.
+ static __c_locale
+ _S_get_c_locale();
+
+ static const char*
+ _S_get_c_name();
+
+ private:
+ void
+ _M_add_reference() const throw()
+ { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
+
+ void
+ _M_remove_reference() const throw()
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
+ {
+ __try
+ { delete this; }
+ __catch(...)
+ { }
+ }
+ }
+
+ facet(const facet&); // Not defined.
+
+ facet&
+ operator=(const facet&); // Not defined.
+ };
+
+
+ // 22.1.1.1.3 Class locale::id
+ /**
+ * @brief Facet ID class.
+ *
+ * The ID class provides facets with an index used to identify them.
+ * Every facet class must define a public static member locale::id, or be
+ * derived from a facet that provides this member, otherwise the facet
+ * cannot be used in a locale. The locale::id ensures that each class
+ * type gets a unique identifier.
+ */
+ class locale::id
+ {
+ private:
+ friend class locale;
+ friend class locale::_Impl;
+
+ template<typename _Facet>
+ friend const _Facet&
+ use_facet(const locale&);
+
+ template<typename _Facet>
+ friend bool
+ has_facet(const locale&) throw ();
+
+ // NB: There is no accessor for _M_index because it may be used
+ // before the constructor is run; the effect of calling a member
+ // function (even an inline) would be undefined.
+ mutable size_t _M_index;
+
+ // Last id number assigned.
+ static _Atomic_word _S_refcount;
+
+ void
+ operator=(const id&); // Not defined.
+
+ id(const id&); // Not defined.
+
+ public:
+ // NB: This class is always a static data member, and thus can be
+ // counted on to be zero-initialized.
+ /// Constructor.
+ id() { }
+
+ size_t
+ _M_id() const;
+ };
+
+
+ // Implementation object for locale.
+ class locale::_Impl
+ {
+ public:
+ // Friends.
+ friend class locale;
+ friend class locale::facet;
+
+ template<typename _Facet>
+ friend bool
+ has_facet(const locale&) throw();
+
+ template<typename _Facet>
+ friend const _Facet&
+ use_facet(const locale&);
+
+ template<typename _Cache>
+ friend struct __use_cache;
+
+ private:
+ // Data Members.
+ _Atomic_word _M_refcount;
+ const facet** _M_facets;
+ size_t _M_facets_size;
+ const facet** _M_caches;
+ char** _M_names;
+ static const locale::id* const _S_id_ctype[];
+ static const locale::id* const _S_id_numeric[];
+ static const locale::id* const _S_id_collate[];
+ static const locale::id* const _S_id_time[];
+ static const locale::id* const _S_id_monetary[];
+ static const locale::id* const _S_id_messages[];
+ static const locale::id* const* const _S_facet_categories[];
+
+ void
+ _M_add_reference() throw()
+ { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
+
+ void
+ _M_remove_reference() throw()
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)
+ {
+ __try
+ { delete this; }
+ __catch(...)
+ { }
+ }
+ }
+
+ _Impl(const _Impl&, size_t);
+ _Impl(const char*, size_t);
+ _Impl(size_t) throw();
+
+ ~_Impl() throw();
+
+ _Impl(const _Impl&); // Not defined.
+
+ void
+ operator=(const _Impl&); // Not defined.
+
+ bool
+ _M_check_same_name()
+ {
+ bool __ret = true;
+ if (_M_names[1])
+ // We must actually compare all the _M_names: can be all equal!
+ for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)
+ __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0;
+ return __ret;
+ }
+
+ void
+ _M_replace_categories(const _Impl*, category);
+
+ void
+ _M_replace_category(const _Impl*, const locale::id* const*);
+
+ void
+ _M_replace_facet(const _Impl*, const locale::id*);
+
+ void
+ _M_install_facet(const locale::id*, const facet*);
+
+ template<typename _Facet>
+ void
+ _M_init_facet(_Facet* __facet)
+ { _M_install_facet(&_Facet::id, __facet); }
+
+ void
+ _M_install_cache(const facet*, size_t);
+ };
+
+
+ /**
+ * @brief Test for the presence of a facet.
+ *
+ * has_facet tests the locale argument for the presence of the facet type
+ * provided as the template parameter. Facets derived from the facet
+ * parameter will also return true.
+ *
+ * @param Facet The facet type to test the presence of.
+ * @param locale The locale to test.
+ * @return true if locale contains a facet of type Facet, else false.
+ */
+ template<typename _Facet>
+ bool
+ has_facet(const locale& __loc) throw();
+
+ /**
+ * @brief Return a facet.
+ *
+ * use_facet looks for and returns a reference to a facet of type Facet
+ * where Facet is the template parameter. If has_facet(locale) is true,
+ * there is a suitable facet to return. It throws std::bad_cast if the
+ * locale doesn't contain a facet of type Facet.
+ *
+ * @param Facet The facet type to access.
+ * @param locale The locale to use.
+ * @return Reference to facet of type Facet.
+ * @throw std::bad_cast if locale doesn't contain a facet of type Facet.
+ */
+ template<typename _Facet>
+ const _Facet&
+ use_facet(const locale& __loc);
+
+
+ /**
+ * @brief Facet for localized string comparison.
+ *
+ * This facet encapsulates the code to compare strings in a localized
+ * manner.
+ *
+ * The collate template uses protected virtual functions to provide
+ * the actual results. The public accessors forward the call to
+ * the virtual functions. These virtual functions are hooks for
+ * developers to implement the behavior they require from the
+ * collate facet.
+ */
+ template<typename _CharT>
+ class collate : public locale::facet
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+
+ protected:
+ // Underlying "C" library locale information saved from
+ // initialization, needed by collate_byname as well.
+ __c_locale _M_c_locale_collate;
+
+ public:
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ collate(size_t __refs = 0)
+ : facet(__refs), _M_c_locale_collate(_S_get_c_locale())
+ { }
+
+ /**
+ * @brief Internal constructor. Not for general use.
+ *
+ * This is a constructor for use by the library itself to set up new
+ * locales.
+ *
+ * @param cloc The "C" locale.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ collate(__c_locale __cloc, size_t __refs = 0)
+ : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))
+ { }
+
+ /**
+ * @brief Compare two strings.
+ *
+ * This function compares two strings and returns the result by calling
+ * collate::do_compare().
+ *
+ * @param lo1 Start of string 1.
+ * @param hi1 End of string 1.
+ * @param lo2 Start of string 2.
+ * @param hi2 End of string 2.
+ * @return 1 if string1 > string2, -1 if string1 < string2, else 0.
+ */
+ int
+ compare(const _CharT* __lo1, const _CharT* __hi1,
+ const _CharT* __lo2, const _CharT* __hi2) const
+ { return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
+
+ /**
+ * @brief Transform string to comparable form.
+ *
+ * This function is a wrapper for strxfrm functionality. It takes the
+ * input string and returns a modified string that can be directly
+ * compared to other transformed strings. In the "C" locale, this
+ * function just returns a copy of the input string. In some other
+ * locales, it may replace two chars with one, change a char for
+ * another, etc. It does so by returning collate::do_transform().
+ *
+ * @param lo Start of string.
+ * @param hi End of string.
+ * @return Transformed string_type.
+ */
+ string_type
+ transform(const _CharT* __lo, const _CharT* __hi) const
+ { return this->do_transform(__lo, __hi); }
+
+ /**
+ * @brief Return hash of a string.
+ *
+ * This function computes and returns a hash on the input string. It
+ * does so by returning collate::do_hash().
+ *
+ * @param lo Start of string.
+ * @param hi End of string.
+ * @return Hash value.
+ */
+ long
+ hash(const _CharT* __lo, const _CharT* __hi) const
+ { return this->do_hash(__lo, __hi); }
+
+ // Used to abstract out _CharT bits in virtual member functions, below.
+ int
+ _M_compare(const _CharT*, const _CharT*) const;
+
+ size_t
+ _M_transform(_CharT*, const _CharT*, size_t) const;
+
+ protected:
+ /// Destructor.
+ virtual
+ ~collate()
+ { _S_destroy_c_locale(_M_c_locale_collate); }
+
+ /**
+ * @brief Compare two strings.
+ *
+ * This function is a hook for derived classes to change the value
+ * returned. @see compare().
+ *
+ * @param lo1 Start of string 1.
+ * @param hi1 End of string 1.
+ * @param lo2 Start of string 2.
+ * @param hi2 End of string 2.
+ * @return 1 if string1 > string2, -1 if string1 < string2, else 0.
+ */
+ virtual int
+ do_compare(const _CharT* __lo1, const _CharT* __hi1,
+ const _CharT* __lo2, const _CharT* __hi2) const;
+
+ /**
+ * @brief Transform string to comparable form.
+ *
+ * This function is a hook for derived classes to change the value
+ * returned.
+ *
+ * @param lo1 Start of string 1.
+ * @param hi1 End of string 1.
+ * @param lo2 Start of string 2.
+ * @param hi2 End of string 2.
+ * @return 1 if string1 > string2, -1 if string1 < string2, else 0.
+ */
+ virtual string_type
+ do_transform(const _CharT* __lo, const _CharT* __hi) const;
+
+ /**
+ * @brief Return hash of a string.
+ *
+ * This function computes and returns a hash on the input string. This
+ * function is a hook for derived classes to change the value returned.
+ *
+ * @param lo Start of string.
+ * @param hi End of string.
+ * @return Hash value.
+ */
+ virtual long
+ do_hash(const _CharT* __lo, const _CharT* __hi) const;
+ };
+
+ template<typename _CharT>
+ locale::id collate<_CharT>::id;
+
+ // Specializations.
+ template<>
+ int
+ collate<char>::_M_compare(const char*, const char*) const;
+
+ template<>
+ size_t
+ collate<char>::_M_transform(char*, const char*, size_t) const;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ int
+ collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const;
+
+ template<>
+ size_t
+ collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const;
+#endif
+
+ /// class collate_byname [22.2.4.2].
+ template<typename _CharT>
+ class collate_byname : public collate<_CharT>
+ {
+ public:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+
+ explicit
+ collate_byname(const char* __s, size_t __refs = 0)
+ : collate<_CharT>(__refs)
+ {
+ if (__builtin_strcmp(__s, "C") != 0
+ && __builtin_strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_collate);
+ this->_S_create_c_locale(this->_M_c_locale_collate, __s);
+ }
+ }
+
+ protected:
+ virtual
+ ~collate_byname() { }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/locale_classes.tcc>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.tcc
new file mode 100644
index 000000000..c97e555a4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/locale_classes.tcc
@@ -0,0 +1,271 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale_classes.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _LOCALE_CLASSES_TCC
+#define _LOCALE_CLASSES_TCC 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Facet>
+ locale::
+ locale(const locale& __other, _Facet* __f)
+ {
+ _M_impl = new _Impl(*__other._M_impl, 1);
+
+ __try
+ { _M_impl->_M_install_facet(&_Facet::id, __f); }
+ __catch(...)
+ {
+ _M_impl->_M_remove_reference();
+ __throw_exception_again;
+ }
+ delete [] _M_impl->_M_names[0];
+ _M_impl->_M_names[0] = 0; // Unnamed.
+ }
+
+ template<typename _Facet>
+ locale
+ locale::
+ combine(const locale& __other) const
+ {
+ _Impl* __tmp = new _Impl(*_M_impl, 1);
+ __try
+ {
+ __tmp->_M_replace_facet(__other._M_impl, &_Facet::id);
+ }
+ __catch(...)
+ {
+ __tmp->_M_remove_reference();
+ __throw_exception_again;
+ }
+ return locale(__tmp);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ bool
+ locale::
+ operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1,
+ const basic_string<_CharT, _Traits, _Alloc>& __s2) const
+ {
+ typedef std::collate<_CharT> __collate_type;
+ const __collate_type& __collate = use_facet<__collate_type>(*this);
+ return (__collate.compare(__s1.data(), __s1.data() + __s1.length(),
+ __s2.data(), __s2.data() + __s2.length()) < 0);
+ }
+
+
+ template<typename _Facet>
+ bool
+ has_facet(const locale& __loc) throw()
+ {
+ const size_t __i = _Facet::id._M_id();
+ const locale::facet** __facets = __loc._M_impl->_M_facets;
+ return (__i < __loc._M_impl->_M_facets_size
+#ifdef __GXX_RTTI
+ && dynamic_cast<const _Facet*>(__facets[__i]));
+#else
+ && static_cast<const _Facet*>(__facets[__i]));
+#endif
+ }
+
+ template<typename _Facet>
+ const _Facet&
+ use_facet(const locale& __loc)
+ {
+ const size_t __i = _Facet::id._M_id();
+ const locale::facet** __facets = __loc._M_impl->_M_facets;
+ if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i])
+ __throw_bad_cast();
+#ifdef __GXX_RTTI
+ return dynamic_cast<const _Facet&>(*__facets[__i]);
+#else
+ return static_cast<const _Facet&>(*__facets[__i]);
+#endif
+ }
+
+
+ // Generic version does nothing.
+ template<typename _CharT>
+ int
+ collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const
+ { return 0; }
+
+ // Generic version does nothing.
+ template<typename _CharT>
+ size_t
+ collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const
+ { return 0; }
+
+ template<typename _CharT>
+ int
+ collate<_CharT>::
+ do_compare(const _CharT* __lo1, const _CharT* __hi1,
+ const _CharT* __lo2, const _CharT* __hi2) const
+ {
+ // strcoll assumes zero-terminated strings so we make a copy
+ // and then put a zero at the end.
+ const string_type __one(__lo1, __hi1);
+ const string_type __two(__lo2, __hi2);
+
+ const _CharT* __p = __one.c_str();
+ const _CharT* __pend = __one.data() + __one.length();
+ const _CharT* __q = __two.c_str();
+ const _CharT* __qend = __two.data() + __two.length();
+
+ // strcoll stops when it sees a nul character so we break
+ // the strings into zero-terminated substrings and pass those
+ // to strcoll.
+ for (;;)
+ {
+ const int __res = _M_compare(__p, __q);
+ if (__res)
+ return __res;
+
+ __p += char_traits<_CharT>::length(__p);
+ __q += char_traits<_CharT>::length(__q);
+ if (__p == __pend && __q == __qend)
+ return 0;
+ else if (__p == __pend)
+ return -1;
+ else if (__q == __qend)
+ return 1;
+
+ __p++;
+ __q++;
+ }
+ }
+
+ template<typename _CharT>
+ typename collate<_CharT>::string_type
+ collate<_CharT>::
+ do_transform(const _CharT* __lo, const _CharT* __hi) const
+ {
+ string_type __ret;
+
+ // strxfrm assumes zero-terminated strings so we make a copy
+ const string_type __str(__lo, __hi);
+
+ const _CharT* __p = __str.c_str();
+ const _CharT* __pend = __str.data() + __str.length();
+
+ size_t __len = (__hi - __lo) * 2;
+
+ _CharT* __c = new _CharT[__len];
+
+ __try
+ {
+ // strxfrm stops when it sees a nul character so we break
+ // the string into zero-terminated substrings and pass those
+ // to strxfrm.
+ for (;;)
+ {
+ // First try a buffer perhaps big enough.
+ size_t __res = _M_transform(__c, __p, __len);
+ // If the buffer was not large enough, try again with the
+ // correct size.
+ if (__res >= __len)
+ {
+ __len = __res + 1;
+ delete [] __c, __c = 0;
+ __c = new _CharT[__len];
+ __res = _M_transform(__c, __p, __len);
+ }
+
+ __ret.append(__c, __res);
+ __p += char_traits<_CharT>::length(__p);
+ if (__p == __pend)
+ break;
+
+ __p++;
+ __ret.push_back(_CharT());
+ }
+ }
+ __catch(...)
+ {
+ delete [] __c;
+ __throw_exception_again;
+ }
+
+ delete [] __c;
+
+ return __ret;
+ }
+
+ template<typename _CharT>
+ long
+ collate<_CharT>::
+ do_hash(const _CharT* __lo, const _CharT* __hi) const
+ {
+ unsigned long __val = 0;
+ for (; __lo < __hi; ++__lo)
+ __val =
+ *__lo + ((__val << 7)
+ | (__val >> (__gnu_cxx::__numeric_traits<unsigned long>::
+ __digits - 7)));
+ return static_cast<long>(__val);
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class collate<char>;
+ extern template class collate_byname<char>;
+
+ extern template
+ const collate<char>&
+ use_facet<collate<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<collate<char> >(const locale&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class collate<wchar_t>;
+ extern template class collate_byname<wchar_t>;
+
+ extern template
+ const collate<wchar_t>&
+ use_facet<collate<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<collate<wchar_t> >(const locale&);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.h b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.h
new file mode 100644
index 000000000..beed6f1c2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.h
@@ -0,0 +1,2602 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale_facets.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _LOCALE_FACETS_H
+#define _LOCALE_FACETS_H 1
+
+#pragma GCC system_header
+
+#include <cwctype> // For wctype_t
+#include <cctype>
+#include <bits/ctype_base.h>
+#include <iosfwd>
+#include <bits/ios_base.h> // For ios_base, ios_base::iostate
+#include <streambuf>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+#include <ext/numeric_traits.h>
+#include <bits/streambuf_iterator.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // NB: Don't instantiate required wchar_t facets if no wchar_t support.
+#ifdef _GLIBCXX_USE_WCHAR_T
+# define _GLIBCXX_NUM_FACETS 28
+#else
+# define _GLIBCXX_NUM_FACETS 14
+#endif
+
+ // Convert string to numeric value of type _Tv and store results.
+ // NB: This is specialized for all required types, there is no
+ // generic definition.
+ template<typename _Tv>
+ void
+ __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,
+ const __c_locale& __cloc);
+
+ // Explicit specializations for required types.
+ template<>
+ void
+ __convert_to_v(const char*, float&, ios_base::iostate&,
+ const __c_locale&);
+
+ template<>
+ void
+ __convert_to_v(const char*, double&, ios_base::iostate&,
+ const __c_locale&);
+
+ template<>
+ void
+ __convert_to_v(const char*, long double&, ios_base::iostate&,
+ const __c_locale&);
+
+ // NB: __pad is a struct, rather than a function, so it can be
+ // partially-specialized.
+ template<typename _CharT, typename _Traits>
+ struct __pad
+ {
+ static void
+ _S_pad(ios_base& __io, _CharT __fill, _CharT* __news,
+ const _CharT* __olds, streamsize __newlen, streamsize __oldlen);
+ };
+
+ // Used by both numeric and monetary facets.
+ // Inserts "group separator" characters into an array of characters.
+ // It's recursive, one iteration per group. It moves the characters
+ // in the buffer this way: "xxxx12345" -> "12,345xxx". Call this
+ // only with __gsize != 0.
+ template<typename _CharT>
+ _CharT*
+ __add_grouping(_CharT* __s, _CharT __sep,
+ const char* __gbeg, size_t __gsize,
+ const _CharT* __first, const _CharT* __last);
+
+ // This template permits specializing facet output code for
+ // ostreambuf_iterator. For ostreambuf_iterator, sputn is
+ // significantly more efficient than incrementing iterators.
+ template<typename _CharT>
+ inline
+ ostreambuf_iterator<_CharT>
+ __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len)
+ {
+ __s._M_put(__ws, __len);
+ return __s;
+ }
+
+ // This is the unspecialized form of the template.
+ template<typename _CharT, typename _OutIter>
+ inline
+ _OutIter
+ __write(_OutIter __s, const _CharT* __ws, int __len)
+ {
+ for (int __j = 0; __j < __len; __j++, ++__s)
+ *__s = __ws[__j];
+ return __s;
+ }
+
+
+ // 22.2.1.1 Template class ctype
+ // Include host and configuration specific ctype enums for ctype_base.
+
+ // Common base for ctype<_CharT>.
+ /**
+ * @brief Common base for ctype facet
+ *
+ * This template class provides implementations of the public functions
+ * that forward to the protected virtual functions.
+ *
+ * This template also provides abstract stubs for the protected virtual
+ * functions.
+ */
+ template<typename _CharT>
+ class __ctype_abstract_base : public locale::facet, public ctype_base
+ {
+ public:
+ // Types:
+ /// Typedef for the template parameter
+ typedef _CharT char_type;
+
+ /**
+ * @brief Test char_type classification.
+ *
+ * This function finds a mask M for @a c and compares it to mask @a m.
+ * It does so by returning the value of ctype<char_type>::do_is().
+ *
+ * @param c The char_type to compare the mask of.
+ * @param m The mask to compare against.
+ * @return (M & m) != 0.
+ */
+ bool
+ is(mask __m, char_type __c) const
+ { return this->do_is(__m, __c); }
+
+ /**
+ * @brief Return a mask array.
+ *
+ * This function finds the mask for each char_type in the range [lo,hi)
+ * and successively writes it to vec. vec must have as many elements
+ * as the char array. It does so by returning the value of
+ * ctype<char_type>::do_is().
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param vec Pointer to an array of mask storage.
+ * @return @a hi.
+ */
+ const char_type*
+ is(const char_type *__lo, const char_type *__hi, mask *__vec) const
+ { return this->do_is(__lo, __hi, __vec); }
+
+ /**
+ * @brief Find char_type matching a mask
+ *
+ * This function searches for and returns the first char_type c in
+ * [lo,hi) for which is(m,c) is true. It does so by returning
+ * ctype<char_type>::do_scan_is().
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to matching char_type if found, else @a hi.
+ */
+ const char_type*
+ scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
+ { return this->do_scan_is(__m, __lo, __hi); }
+
+ /**
+ * @brief Find char_type not matching a mask
+ *
+ * This function searches for and returns the first char_type c in
+ * [lo,hi) for which is(m,c) is false. It does so by returning
+ * ctype<char_type>::do_scan_not().
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to first char in range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to non-matching char if found, else @a hi.
+ */
+ const char_type*
+ scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
+ { return this->do_scan_not(__m, __lo, __hi); }
+
+ /**
+ * @brief Convert to uppercase.
+ *
+ * This function converts the argument to uppercase if possible.
+ * If not possible (for example, '2'), returns the argument. It does
+ * so by returning ctype<char_type>::do_toupper().
+ *
+ * @param c The char_type to convert.
+ * @return The uppercase char_type if convertible, else @a c.
+ */
+ char_type
+ toupper(char_type __c) const
+ { return this->do_toupper(__c); }
+
+ /**
+ * @brief Convert array to uppercase.
+ *
+ * This function converts each char_type in the range [lo,hi) to
+ * uppercase if possible. Other elements remain untouched. It does so
+ * by returning ctype<char_type>:: do_toupper(lo, hi).
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ const char_type*
+ toupper(char_type *__lo, const char_type* __hi) const
+ { return this->do_toupper(__lo, __hi); }
+
+ /**
+ * @brief Convert to lowercase.
+ *
+ * This function converts the argument to lowercase if possible. If
+ * not possible (for example, '2'), returns the argument. It does so
+ * by returning ctype<char_type>::do_tolower(c).
+ *
+ * @param c The char_type to convert.
+ * @return The lowercase char_type if convertible, else @a c.
+ */
+ char_type
+ tolower(char_type __c) const
+ { return this->do_tolower(__c); }
+
+ /**
+ * @brief Convert array to lowercase.
+ *
+ * This function converts each char_type in the range [lo,hi) to
+ * lowercase if possible. Other elements remain untouched. It does so
+ * by returning ctype<char_type>:: do_tolower(lo, hi).
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ const char_type*
+ tolower(char_type* __lo, const char_type* __hi) const
+ { return this->do_tolower(__lo, __hi); }
+
+ /**
+ * @brief Widen char to char_type
+ *
+ * This function converts the char argument to char_type using the
+ * simplest reasonable transformation. It does so by returning
+ * ctype<char_type>::do_widen(c).
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @return The converted char_type.
+ */
+ char_type
+ widen(char __c) const
+ { return this->do_widen(__c); }
+
+ /**
+ * @brief Widen array to char_type
+ *
+ * This function converts each char in the input to char_type using the
+ * simplest reasonable transformation. It does so by returning
+ * ctype<char_type>::do_widen(c).
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ const char*
+ widen(const char* __lo, const char* __hi, char_type* __to) const
+ { return this->do_widen(__lo, __hi, __to); }
+
+ /**
+ * @brief Narrow char_type to char
+ *
+ * This function converts the char_type to char using the simplest
+ * reasonable transformation. If the conversion fails, dfault is
+ * returned instead. It does so by returning
+ * ctype<char_type>::do_narrow(c).
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char_type to convert.
+ * @param dfault Char to return if conversion fails.
+ * @return The converted char.
+ */
+ char
+ narrow(char_type __c, char __dfault) const
+ { return this->do_narrow(__c, __dfault); }
+
+ /**
+ * @brief Narrow array to char array
+ *
+ * This function converts each char_type in the input to char using the
+ * simplest reasonable transformation and writes the results to the
+ * destination array. For any char_type in the input that cannot be
+ * converted, @a dfault is used instead. It does so by returning
+ * ctype<char_type>::do_narrow(lo, hi, dfault, to).
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param dfault Char to use if conversion fails.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ const char_type*
+ narrow(const char_type* __lo, const char_type* __hi,
+ char __dfault, char *__to) const
+ { return this->do_narrow(__lo, __hi, __dfault, __to); }
+
+ protected:
+ explicit
+ __ctype_abstract_base(size_t __refs = 0): facet(__refs) { }
+
+ virtual
+ ~__ctype_abstract_base() { }
+
+ /**
+ * @brief Test char_type classification.
+ *
+ * This function finds a mask M for @a c and compares it to mask @a m.
+ *
+ * do_is() is a hook for a derived facet to change the behavior of
+ * classifying. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param c The char_type to find the mask of.
+ * @param m The mask to compare against.
+ * @return (M & m) != 0.
+ */
+ virtual bool
+ do_is(mask __m, char_type __c) const = 0;
+
+ /**
+ * @brief Return a mask array.
+ *
+ * This function finds the mask for each char_type in the range [lo,hi)
+ * and successively writes it to vec. vec must have as many elements
+ * as the input.
+ *
+ * do_is() is a hook for a derived facet to change the behavior of
+ * classifying. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param vec Pointer to an array of mask storage.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_is(const char_type* __lo, const char_type* __hi,
+ mask* __vec) const = 0;
+
+ /**
+ * @brief Find char_type matching mask
+ *
+ * This function searches for and returns the first char_type c in
+ * [lo,hi) for which is(m,c) is true.
+ *
+ * do_scan_is() is a hook for a derived facet to change the behavior of
+ * match searching. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to a matching char_type if found, else @a hi.
+ */
+ virtual const char_type*
+ do_scan_is(mask __m, const char_type* __lo,
+ const char_type* __hi) const = 0;
+
+ /**
+ * @brief Find char_type not matching mask
+ *
+ * This function searches for and returns a pointer to the first
+ * char_type c of [lo,hi) for which is(m,c) is false.
+ *
+ * do_scan_is() is a hook for a derived facet to change the behavior of
+ * match searching. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to a non-matching char_type if found, else @a hi.
+ */
+ virtual const char_type*
+ do_scan_not(mask __m, const char_type* __lo,
+ const char_type* __hi) const = 0;
+
+ /**
+ * @brief Convert to uppercase.
+ *
+ * This virtual function converts the char_type argument to uppercase
+ * if possible. If not possible (for example, '2'), returns the
+ * argument.
+ *
+ * do_toupper() is a hook for a derived facet to change the behavior of
+ * uppercasing. do_toupper() must always return the same result for
+ * the same input.
+ *
+ * @param c The char_type to convert.
+ * @return The uppercase char_type if convertible, else @a c.
+ */
+ virtual char_type
+ do_toupper(char_type) const = 0;
+
+ /**
+ * @brief Convert array to uppercase.
+ *
+ * This virtual function converts each char_type in the range [lo,hi)
+ * to uppercase if possible. Other elements remain untouched.
+ *
+ * do_toupper() is a hook for a derived facet to change the behavior of
+ * uppercasing. do_toupper() must always return the same result for
+ * the same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_toupper(char_type* __lo, const char_type* __hi) const = 0;
+
+ /**
+ * @brief Convert to lowercase.
+ *
+ * This virtual function converts the argument to lowercase if
+ * possible. If not possible (for example, '2'), returns the argument.
+ *
+ * do_tolower() is a hook for a derived facet to change the behavior of
+ * lowercasing. do_tolower() must always return the same result for
+ * the same input.
+ *
+ * @param c The char_type to convert.
+ * @return The lowercase char_type if convertible, else @a c.
+ */
+ virtual char_type
+ do_tolower(char_type) const = 0;
+
+ /**
+ * @brief Convert array to lowercase.
+ *
+ * This virtual function converts each char_type in the range [lo,hi)
+ * to lowercase if possible. Other elements remain untouched.
+ *
+ * do_tolower() is a hook for a derived facet to change the behavior of
+ * lowercasing. do_tolower() must always return the same result for
+ * the same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_tolower(char_type* __lo, const char_type* __hi) const = 0;
+
+ /**
+ * @brief Widen char
+ *
+ * This virtual function converts the char to char_type using the
+ * simplest reasonable transformation.
+ *
+ * do_widen() is a hook for a derived facet to change the behavior of
+ * widening. do_widen() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @return The converted char_type
+ */
+ virtual char_type
+ do_widen(char) const = 0;
+
+ /**
+ * @brief Widen char array
+ *
+ * This function converts each char in the input to char_type using the
+ * simplest reasonable transformation.
+ *
+ * do_widen() is a hook for a derived facet to change the behavior of
+ * widening. do_widen() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start range.
+ * @param hi Pointer to end of range.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ virtual const char*
+ do_widen(const char* __lo, const char* __hi,
+ char_type* __dest) const = 0;
+
+ /**
+ * @brief Narrow char_type to char
+ *
+ * This virtual function converts the argument to char using the
+ * simplest reasonable transformation. If the conversion fails, dfault
+ * is returned instead.
+ *
+ * do_narrow() is a hook for a derived facet to change the behavior of
+ * narrowing. do_narrow() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char_type to convert.
+ * @param dfault Char to return if conversion fails.
+ * @return The converted char.
+ */
+ virtual char
+ do_narrow(char_type, char __dfault) const = 0;
+
+ /**
+ * @brief Narrow char_type array to char
+ *
+ * This virtual function converts each char_type in the range [lo,hi) to
+ * char using the simplest reasonable transformation and writes the
+ * results to the destination array. For any element in the input that
+ * cannot be converted, @a dfault is used instead.
+ *
+ * do_narrow() is a hook for a derived facet to change the behavior of
+ * narrowing. do_narrow() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param dfault Char to use if conversion fails.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_narrow(const char_type* __lo, const char_type* __hi,
+ char __dfault, char* __dest) const = 0;
+ };
+
+ // NB: Generic, mostly useless implementation.
+ /**
+ * @brief Template ctype facet
+ *
+ * This template class defines classification and conversion functions for
+ * character sets. It wraps <cctype> functionality. Ctype gets used by
+ * streams for many I/O operations.
+ *
+ * This template provides the protected virtual functions the developer
+ * will have to replace in a derived class or specialization to make a
+ * working facet. The public functions that access them are defined in
+ * __ctype_abstract_base, to allow for implementation flexibility. See
+ * ctype<wchar_t> for an example. The functions are documented in
+ * __ctype_abstract_base.
+ *
+ * Note: implementations are provided for all the protected virtual
+ * functions, but will likely not be useful.
+ */
+ template<typename _CharT>
+ class ctype : public __ctype_abstract_base<_CharT>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef typename __ctype_abstract_base<_CharT>::mask mask;
+
+ /// The facet id for ctype<char_type>
+ static locale::id id;
+
+ explicit
+ ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
+
+ protected:
+ virtual
+ ~ctype();
+
+ virtual bool
+ do_is(mask __m, char_type __c) const;
+
+ virtual const char_type*
+ do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
+
+ virtual const char_type*
+ do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
+
+ virtual const char_type*
+ do_scan_not(mask __m, const char_type* __lo,
+ const char_type* __hi) const;
+
+ virtual char_type
+ do_toupper(char_type __c) const;
+
+ virtual const char_type*
+ do_toupper(char_type* __lo, const char_type* __hi) const;
+
+ virtual char_type
+ do_tolower(char_type __c) const;
+
+ virtual const char_type*
+ do_tolower(char_type* __lo, const char_type* __hi) const;
+
+ virtual char_type
+ do_widen(char __c) const;
+
+ virtual const char*
+ do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
+
+ virtual char
+ do_narrow(char_type, char __dfault) const;
+
+ virtual const char_type*
+ do_narrow(const char_type* __lo, const char_type* __hi,
+ char __dfault, char* __dest) const;
+ };
+
+ template<typename _CharT>
+ locale::id ctype<_CharT>::id;
+
+ // 22.2.1.3 ctype<char> specialization.
+ /**
+ * @brief The ctype<char> specialization.
+ *
+ * This class defines classification and conversion functions for
+ * the char type. It gets used by char streams for many I/O
+ * operations. The char specialization provides a number of
+ * optimizations as well.
+ */
+ template<>
+ class ctype<char> : public locale::facet, public ctype_base
+ {
+ public:
+ // Types:
+ /// Typedef for the template parameter char.
+ typedef char char_type;
+
+ protected:
+ // Data Members:
+ __c_locale _M_c_locale_ctype;
+ bool _M_del;
+ __to_type _M_toupper;
+ __to_type _M_tolower;
+ const mask* _M_table;
+ mutable char _M_widen_ok;
+ mutable char _M_widen[1 + static_cast<unsigned char>(-1)];
+ mutable char _M_narrow[1 + static_cast<unsigned char>(-1)];
+ mutable char _M_narrow_ok; // 0 uninitialized, 1 init,
+ // 2 memcpy can't be used
+
+ public:
+ /// The facet id for ctype<char>
+ static locale::id id;
+ /// The size of the mask table. It is SCHAR_MAX + 1.
+ static const size_t table_size = 1 + static_cast<unsigned char>(-1);
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param table If non-zero, table is used as the per-char mask.
+ * Else classic_table() is used.
+ * @param del If true, passes ownership of table to this facet.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
+
+ /**
+ * @brief Constructor performs static initialization.
+ *
+ * This constructor is used to construct the initial C locale facet.
+ *
+ * @param cloc Handle to C locale data.
+ * @param table If non-zero, table is used as the per-char mask.
+ * @param del If true, passes ownership of table to this facet.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
+ size_t __refs = 0);
+
+ /**
+ * @brief Test char classification.
+ *
+ * This function compares the mask table[c] to @a m.
+ *
+ * @param c The char to compare the mask of.
+ * @param m The mask to compare against.
+ * @return True if m & table[c] is true, false otherwise.
+ */
+ inline bool
+ is(mask __m, char __c) const;
+
+ /**
+ * @brief Return a mask array.
+ *
+ * This function finds the mask for each char in the range [lo, hi) and
+ * successively writes it to vec. vec must have as many elements as
+ * the char array.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param vec Pointer to an array of mask storage.
+ * @return @a hi.
+ */
+ inline const char*
+ is(const char* __lo, const char* __hi, mask* __vec) const;
+
+ /**
+ * @brief Find char matching a mask
+ *
+ * This function searches for and returns the first char in [lo,hi) for
+ * which is(m,char) is true.
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to a matching char if found, else @a hi.
+ */
+ inline const char*
+ scan_is(mask __m, const char* __lo, const char* __hi) const;
+
+ /**
+ * @brief Find char not matching a mask
+ *
+ * This function searches for and returns a pointer to the first char
+ * in [lo,hi) for which is(m,char) is false.
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to a non-matching char if found, else @a hi.
+ */
+ inline const char*
+ scan_not(mask __m, const char* __lo, const char* __hi) const;
+
+ /**
+ * @brief Convert to uppercase.
+ *
+ * This function converts the char argument to uppercase if possible.
+ * If not possible (for example, '2'), returns the argument.
+ *
+ * toupper() acts as if it returns ctype<char>::do_toupper(c).
+ * do_toupper() must always return the same result for the same input.
+ *
+ * @param c The char to convert.
+ * @return The uppercase char if convertible, else @a c.
+ */
+ char_type
+ toupper(char_type __c) const
+ { return this->do_toupper(__c); }
+
+ /**
+ * @brief Convert array to uppercase.
+ *
+ * This function converts each char in the range [lo,hi) to uppercase
+ * if possible. Other chars remain untouched.
+ *
+ * toupper() acts as if it returns ctype<char>:: do_toupper(lo, hi).
+ * do_toupper() must always return the same result for the same input.
+ *
+ * @param lo Pointer to first char in range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ const char_type*
+ toupper(char_type *__lo, const char_type* __hi) const
+ { return this->do_toupper(__lo, __hi); }
+
+ /**
+ * @brief Convert to lowercase.
+ *
+ * This function converts the char argument to lowercase if possible.
+ * If not possible (for example, '2'), returns the argument.
+ *
+ * tolower() acts as if it returns ctype<char>::do_tolower(c).
+ * do_tolower() must always return the same result for the same input.
+ *
+ * @param c The char to convert.
+ * @return The lowercase char if convertible, else @a c.
+ */
+ char_type
+ tolower(char_type __c) const
+ { return this->do_tolower(__c); }
+
+ /**
+ * @brief Convert array to lowercase.
+ *
+ * This function converts each char in the range [lo,hi) to lowercase
+ * if possible. Other chars remain untouched.
+ *
+ * tolower() acts as if it returns ctype<char>:: do_tolower(lo, hi).
+ * do_tolower() must always return the same result for the same input.
+ *
+ * @param lo Pointer to first char in range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ const char_type*
+ tolower(char_type* __lo, const char_type* __hi) const
+ { return this->do_tolower(__lo, __hi); }
+
+ /**
+ * @brief Widen char
+ *
+ * This function converts the char to char_type using the simplest
+ * reasonable transformation. For an underived ctype<char> facet, the
+ * argument will be returned unchanged.
+ *
+ * This function works as if it returns ctype<char>::do_widen(c).
+ * do_widen() must always return the same result for the same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @return The converted character.
+ */
+ char_type
+ widen(char __c) const
+ {
+ if (_M_widen_ok)
+ return _M_widen[static_cast<unsigned char>(__c)];
+ this->_M_widen_init();
+ return this->do_widen(__c);
+ }
+
+ /**
+ * @brief Widen char array
+ *
+ * This function converts each char in the input to char using the
+ * simplest reasonable transformation. For an underived ctype<char>
+ * facet, the argument will be copied unchanged.
+ *
+ * This function works as if it returns ctype<char>::do_widen(c).
+ * do_widen() must always return the same result for the same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to first char in range.
+ * @param hi Pointer to end of range.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ const char*
+ widen(const char* __lo, const char* __hi, char_type* __to) const
+ {
+ if (_M_widen_ok == 1)
+ {
+ __builtin_memcpy(__to, __lo, __hi - __lo);
+ return __hi;
+ }
+ if (!_M_widen_ok)
+ _M_widen_init();
+ return this->do_widen(__lo, __hi, __to);
+ }
+
+ /**
+ * @brief Narrow char
+ *
+ * This function converts the char to char using the simplest
+ * reasonable transformation. If the conversion fails, dfault is
+ * returned instead. For an underived ctype<char> facet, @a c
+ * will be returned unchanged.
+ *
+ * This function works as if it returns ctype<char>::do_narrow(c).
+ * do_narrow() must always return the same result for the same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @param dfault Char to return if conversion fails.
+ * @return The converted character.
+ */
+ char
+ narrow(char_type __c, char __dfault) const
+ {
+ if (_M_narrow[static_cast<unsigned char>(__c)])
+ return _M_narrow[static_cast<unsigned char>(__c)];
+ const char __t = do_narrow(__c, __dfault);
+ if (__t != __dfault)
+ _M_narrow[static_cast<unsigned char>(__c)] = __t;
+ return __t;
+ }
+
+ /**
+ * @brief Narrow char array
+ *
+ * This function converts each char in the input to char using the
+ * simplest reasonable transformation and writes the results to the
+ * destination array. For any char in the input that cannot be
+ * converted, @a dfault is used instead. For an underived ctype<char>
+ * facet, the argument will be copied unchanged.
+ *
+ * This function works as if it returns ctype<char>::do_narrow(lo, hi,
+ * dfault, to). do_narrow() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param dfault Char to use if conversion fails.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ const char_type*
+ narrow(const char_type* __lo, const char_type* __hi,
+ char __dfault, char *__to) const
+ {
+ if (__builtin_expect(_M_narrow_ok == 1, true))
+ {
+ __builtin_memcpy(__to, __lo, __hi - __lo);
+ return __hi;
+ }
+ if (!_M_narrow_ok)
+ _M_narrow_init();
+ return this->do_narrow(__lo, __hi, __dfault, __to);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 695. ctype<char>::classic_table() not accessible.
+ /// Returns a pointer to the mask table provided to the constructor, or
+ /// the default from classic_table() if none was provided.
+ const mask*
+ table() const throw()
+ { return _M_table; }
+
+ /// Returns a pointer to the C locale mask table.
+ static const mask*
+ classic_table() throw();
+ protected:
+
+ /**
+ * @brief Destructor.
+ *
+ * This function deletes table() if @a del was true in the
+ * constructor.
+ */
+ virtual
+ ~ctype();
+
+ /**
+ * @brief Convert to uppercase.
+ *
+ * This virtual function converts the char argument to uppercase if
+ * possible. If not possible (for example, '2'), returns the argument.
+ *
+ * do_toupper() is a hook for a derived facet to change the behavior of
+ * uppercasing. do_toupper() must always return the same result for
+ * the same input.
+ *
+ * @param c The char to convert.
+ * @return The uppercase char if convertible, else @a c.
+ */
+ virtual char_type
+ do_toupper(char_type) const;
+
+ /**
+ * @brief Convert array to uppercase.
+ *
+ * This virtual function converts each char in the range [lo,hi) to
+ * uppercase if possible. Other chars remain untouched.
+ *
+ * do_toupper() is a hook for a derived facet to change the behavior of
+ * uppercasing. do_toupper() must always return the same result for
+ * the same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_toupper(char_type* __lo, const char_type* __hi) const;
+
+ /**
+ * @brief Convert to lowercase.
+ *
+ * This virtual function converts the char argument to lowercase if
+ * possible. If not possible (for example, '2'), returns the argument.
+ *
+ * do_tolower() is a hook for a derived facet to change the behavior of
+ * lowercasing. do_tolower() must always return the same result for
+ * the same input.
+ *
+ * @param c The char to convert.
+ * @return The lowercase char if convertible, else @a c.
+ */
+ virtual char_type
+ do_tolower(char_type) const;
+
+ /**
+ * @brief Convert array to lowercase.
+ *
+ * This virtual function converts each char in the range [lo,hi) to
+ * lowercase if possible. Other chars remain untouched.
+ *
+ * do_tolower() is a hook for a derived facet to change the behavior of
+ * lowercasing. do_tolower() must always return the same result for
+ * the same input.
+ *
+ * @param lo Pointer to first char in range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_tolower(char_type* __lo, const char_type* __hi) const;
+
+ /**
+ * @brief Widen char
+ *
+ * This virtual function converts the char to char using the simplest
+ * reasonable transformation. For an underived ctype<char> facet, the
+ * argument will be returned unchanged.
+ *
+ * do_widen() is a hook for a derived facet to change the behavior of
+ * widening. do_widen() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @return The converted character.
+ */
+ virtual char_type
+ do_widen(char __c) const
+ { return __c; }
+
+ /**
+ * @brief Widen char array
+ *
+ * This function converts each char in the range [lo,hi) to char using
+ * the simplest reasonable transformation. For an underived
+ * ctype<char> facet, the argument will be copied unchanged.
+ *
+ * do_widen() is a hook for a derived facet to change the behavior of
+ * widening. do_widen() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ virtual const char*
+ do_widen(const char* __lo, const char* __hi, char_type* __dest) const
+ {
+ __builtin_memcpy(__dest, __lo, __hi - __lo);
+ return __hi;
+ }
+
+ /**
+ * @brief Narrow char
+ *
+ * This virtual function converts the char to char using the simplest
+ * reasonable transformation. If the conversion fails, dfault is
+ * returned instead. For an underived ctype<char> facet, @a c will be
+ * returned unchanged.
+ *
+ * do_narrow() is a hook for a derived facet to change the behavior of
+ * narrowing. do_narrow() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @param dfault Char to return if conversion fails.
+ * @return The converted char.
+ */
+ virtual char
+ do_narrow(char_type __c, char) const
+ { return __c; }
+
+ /**
+ * @brief Narrow char array to char array
+ *
+ * This virtual function converts each char in the range [lo,hi) to
+ * char using the simplest reasonable transformation and writes the
+ * results to the destination array. For any char in the input that
+ * cannot be converted, @a dfault is used instead. For an underived
+ * ctype<char> facet, the argument will be copied unchanged.
+ *
+ * do_narrow() is a hook for a derived facet to change the behavior of
+ * narrowing. do_narrow() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param dfault Char to use if conversion fails.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_narrow(const char_type* __lo, const char_type* __hi,
+ char, char* __dest) const
+ {
+ __builtin_memcpy(__dest, __lo, __hi - __lo);
+ return __hi;
+ }
+
+ private:
+ void _M_narrow_init() const;
+ void _M_widen_init() const;
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ // 22.2.1.3 ctype<wchar_t> specialization
+ /**
+ * @brief The ctype<wchar_t> specialization.
+ *
+ * This class defines classification and conversion functions for the
+ * wchar_t type. It gets used by wchar_t streams for many I/O operations.
+ * The wchar_t specialization provides a number of optimizations as well.
+ *
+ * ctype<wchar_t> inherits its public methods from
+ * __ctype_abstract_base<wchar_t>.
+ */
+ template<>
+ class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
+ {
+ public:
+ // Types:
+ /// Typedef for the template parameter wchar_t.
+ typedef wchar_t char_type;
+ typedef wctype_t __wmask_type;
+
+ protected:
+ __c_locale _M_c_locale_ctype;
+
+ // Pre-computed narrowed and widened chars.
+ bool _M_narrow_ok;
+ char _M_narrow[128];
+ wint_t _M_widen[1 + static_cast<unsigned char>(-1)];
+
+ // Pre-computed elements for do_is.
+ mask _M_bit[16];
+ __wmask_type _M_wmask[16];
+
+ public:
+ // Data Members:
+ /// The facet id for ctype<wchar_t>
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ ctype(size_t __refs = 0);
+
+ /**
+ * @brief Constructor performs static initialization.
+ *
+ * This constructor is used to construct the initial C locale facet.
+ *
+ * @param cloc Handle to C locale data.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ ctype(__c_locale __cloc, size_t __refs = 0);
+
+ protected:
+ __wmask_type
+ _M_convert_to_wmask(const mask __m) const;
+
+ /// Destructor
+ virtual
+ ~ctype();
+
+ /**
+ * @brief Test wchar_t classification.
+ *
+ * This function finds a mask M for @a c and compares it to mask @a m.
+ *
+ * do_is() is a hook for a derived facet to change the behavior of
+ * classifying. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param c The wchar_t to find the mask of.
+ * @param m The mask to compare against.
+ * @return (M & m) != 0.
+ */
+ virtual bool
+ do_is(mask __m, char_type __c) const;
+
+ /**
+ * @brief Return a mask array.
+ *
+ * This function finds the mask for each wchar_t in the range [lo,hi)
+ * and successively writes it to vec. vec must have as many elements
+ * as the input.
+ *
+ * do_is() is a hook for a derived facet to change the behavior of
+ * classifying. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param vec Pointer to an array of mask storage.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
+
+ /**
+ * @brief Find wchar_t matching mask
+ *
+ * This function searches for and returns the first wchar_t c in
+ * [lo,hi) for which is(m,c) is true.
+ *
+ * do_scan_is() is a hook for a derived facet to change the behavior of
+ * match searching. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to a matching wchar_t if found, else @a hi.
+ */
+ virtual const char_type*
+ do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
+
+ /**
+ * @brief Find wchar_t not matching mask
+ *
+ * This function searches for and returns a pointer to the first
+ * wchar_t c of [lo,hi) for which is(m,c) is false.
+ *
+ * do_scan_is() is a hook for a derived facet to change the behavior of
+ * match searching. do_is() must always return the same result for the
+ * same input.
+ *
+ * @param m The mask to compare against.
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return Pointer to a non-matching wchar_t if found, else @a hi.
+ */
+ virtual const char_type*
+ do_scan_not(mask __m, const char_type* __lo,
+ const char_type* __hi) const;
+
+ /**
+ * @brief Convert to uppercase.
+ *
+ * This virtual function converts the wchar_t argument to uppercase if
+ * possible. If not possible (for example, '2'), returns the argument.
+ *
+ * do_toupper() is a hook for a derived facet to change the behavior of
+ * uppercasing. do_toupper() must always return the same result for
+ * the same input.
+ *
+ * @param c The wchar_t to convert.
+ * @return The uppercase wchar_t if convertible, else @a c.
+ */
+ virtual char_type
+ do_toupper(char_type) const;
+
+ /**
+ * @brief Convert array to uppercase.
+ *
+ * This virtual function converts each wchar_t in the range [lo,hi) to
+ * uppercase if possible. Other elements remain untouched.
+ *
+ * do_toupper() is a hook for a derived facet to change the behavior of
+ * uppercasing. do_toupper() must always return the same result for
+ * the same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_toupper(char_type* __lo, const char_type* __hi) const;
+
+ /**
+ * @brief Convert to lowercase.
+ *
+ * This virtual function converts the argument to lowercase if
+ * possible. If not possible (for example, '2'), returns the argument.
+ *
+ * do_tolower() is a hook for a derived facet to change the behavior of
+ * lowercasing. do_tolower() must always return the same result for
+ * the same input.
+ *
+ * @param c The wchar_t to convert.
+ * @return The lowercase wchar_t if convertible, else @a c.
+ */
+ virtual char_type
+ do_tolower(char_type) const;
+
+ /**
+ * @brief Convert array to lowercase.
+ *
+ * This virtual function converts each wchar_t in the range [lo,hi) to
+ * lowercase if possible. Other elements remain untouched.
+ *
+ * do_tolower() is a hook for a derived facet to change the behavior of
+ * lowercasing. do_tolower() must always return the same result for
+ * the same input.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_tolower(char_type* __lo, const char_type* __hi) const;
+
+ /**
+ * @brief Widen char to wchar_t
+ *
+ * This virtual function converts the char to wchar_t using the
+ * simplest reasonable transformation. For an underived ctype<wchar_t>
+ * facet, the argument will be cast to wchar_t.
+ *
+ * do_widen() is a hook for a derived facet to change the behavior of
+ * widening. do_widen() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The char to convert.
+ * @return The converted wchar_t.
+ */
+ virtual char_type
+ do_widen(char) const;
+
+ /**
+ * @brief Widen char array to wchar_t array
+ *
+ * This function converts each char in the input to wchar_t using the
+ * simplest reasonable transformation. For an underived ctype<wchar_t>
+ * facet, the argument will be copied, casting each element to wchar_t.
+ *
+ * do_widen() is a hook for a derived facet to change the behavior of
+ * widening. do_widen() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start range.
+ * @param hi Pointer to end of range.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ virtual const char*
+ do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
+
+ /**
+ * @brief Narrow wchar_t to char
+ *
+ * This virtual function converts the argument to char using
+ * the simplest reasonable transformation. If the conversion
+ * fails, dfault is returned instead. For an underived
+ * ctype<wchar_t> facet, @a c will be cast to char and
+ * returned.
+ *
+ * do_narrow() is a hook for a derived facet to change the
+ * behavior of narrowing. do_narrow() must always return the
+ * same result for the same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param c The wchar_t to convert.
+ * @param dfault Char to return if conversion fails.
+ * @return The converted char.
+ */
+ virtual char
+ do_narrow(char_type, char __dfault) const;
+
+ /**
+ * @brief Narrow wchar_t array to char array
+ *
+ * This virtual function converts each wchar_t in the range [lo,hi) to
+ * char using the simplest reasonable transformation and writes the
+ * results to the destination array. For any wchar_t in the input that
+ * cannot be converted, @a dfault is used instead. For an underived
+ * ctype<wchar_t> facet, the argument will be copied, casting each
+ * element to char.
+ *
+ * do_narrow() is a hook for a derived facet to change the behavior of
+ * narrowing. do_narrow() must always return the same result for the
+ * same input.
+ *
+ * Note: this is not what you want for codepage conversions. See
+ * codecvt for that.
+ *
+ * @param lo Pointer to start of range.
+ * @param hi Pointer to end of range.
+ * @param dfault Char to use if conversion fails.
+ * @param to Pointer to the destination array.
+ * @return @a hi.
+ */
+ virtual const char_type*
+ do_narrow(const char_type* __lo, const char_type* __hi,
+ char __dfault, char* __dest) const;
+
+ // For use at construction time only.
+ void
+ _M_initialize_ctype();
+ };
+#endif //_GLIBCXX_USE_WCHAR_T
+
+ /// class ctype_byname [22.2.1.2].
+ template<typename _CharT>
+ class ctype_byname : public ctype<_CharT>
+ {
+ public:
+ typedef typename ctype<_CharT>::mask mask;
+
+ explicit
+ ctype_byname(const char* __s, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~ctype_byname() { };
+ };
+
+ /// 22.2.1.4 Class ctype_byname specializations.
+ template<>
+ class ctype_byname<char> : public ctype<char>
+ {
+ public:
+ explicit
+ ctype_byname(const char* __s, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~ctype_byname();
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ class ctype_byname<wchar_t> : public ctype<wchar_t>
+ {
+ public:
+ explicit
+ ctype_byname(const char* __s, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~ctype_byname();
+ };
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+// Include host and configuration specific ctype inlines.
+#include <bits/ctype_inline.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 22.2.2 The numeric category.
+ class __num_base
+ {
+ public:
+ // NB: Code depends on the order of _S_atoms_out elements.
+ // Below are the indices into _S_atoms_out.
+ enum
+ {
+ _S_ominus,
+ _S_oplus,
+ _S_ox,
+ _S_oX,
+ _S_odigits,
+ _S_odigits_end = _S_odigits + 16,
+ _S_oudigits = _S_odigits_end,
+ _S_oudigits_end = _S_oudigits + 16,
+ _S_oe = _S_odigits + 14, // For scientific notation, 'e'
+ _S_oE = _S_oudigits + 14, // For scientific notation, 'E'
+ _S_oend = _S_oudigits_end
+ };
+
+ // A list of valid numeric literals for output. This array
+ // contains chars that will be passed through the current locale's
+ // ctype<_CharT>.widen() and then used to render numbers.
+ // For the standard "C" locale, this is
+ // "-+xX0123456789abcdef0123456789ABCDEF".
+ static const char* _S_atoms_out;
+
+ // String literal of acceptable (narrow) input, for num_get.
+ // "-+xX0123456789abcdefABCDEF"
+ static const char* _S_atoms_in;
+
+ enum
+ {
+ _S_iminus,
+ _S_iplus,
+ _S_ix,
+ _S_iX,
+ _S_izero,
+ _S_ie = _S_izero + 14,
+ _S_iE = _S_izero + 20,
+ _S_iend = 26
+ };
+
+ // num_put
+ // Construct and return valid scanf format for floating point types.
+ static void
+ _S_format_float(const ios_base& __io, char* __fptr, char __mod);
+ };
+
+ template<typename _CharT>
+ struct __numpunct_cache : public locale::facet
+ {
+ const char* _M_grouping;
+ size_t _M_grouping_size;
+ bool _M_use_grouping;
+ const _CharT* _M_truename;
+ size_t _M_truename_size;
+ const _CharT* _M_falsename;
+ size_t _M_falsename_size;
+ _CharT _M_decimal_point;
+ _CharT _M_thousands_sep;
+
+ // A list of valid numeric literals for output: in the standard
+ // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF".
+ // This array contains the chars after having been passed
+ // through the current locale's ctype<_CharT>.widen().
+ _CharT _M_atoms_out[__num_base::_S_oend];
+
+ // A list of valid numeric literals for input: in the standard
+ // "C" locale, this is "-+xX0123456789abcdefABCDEF"
+ // This array contains the chars after having been passed
+ // through the current locale's ctype<_CharT>.widen().
+ _CharT _M_atoms_in[__num_base::_S_iend];
+
+ bool _M_allocated;
+
+ __numpunct_cache(size_t __refs = 0) : facet(__refs),
+ _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),
+ _M_truename(NULL), _M_truename_size(0), _M_falsename(NULL),
+ _M_falsename_size(0), _M_decimal_point(_CharT()),
+ _M_thousands_sep(_CharT()), _M_allocated(false)
+ { }
+
+ ~__numpunct_cache();
+
+ void
+ _M_cache(const locale& __loc);
+
+ private:
+ __numpunct_cache&
+ operator=(const __numpunct_cache&);
+
+ explicit
+ __numpunct_cache(const __numpunct_cache&);
+ };
+
+ template<typename _CharT>
+ __numpunct_cache<_CharT>::~__numpunct_cache()
+ {
+ if (_M_allocated)
+ {
+ delete [] _M_grouping;
+ delete [] _M_truename;
+ delete [] _M_falsename;
+ }
+ }
+
+ /**
+ * @brief Numpunct facet.
+ *
+ * This facet stores several pieces of information related to printing and
+ * scanning numbers, such as the decimal point character. It takes a
+ * template parameter specifying the char type. The numpunct facet is
+ * used by streams for many I/O operations involving numbers.
+ *
+ * The numpunct template uses protected virtual functions to provide the
+ * actual results. The public accessors forward the call to the virtual
+ * functions. These virtual functions are hooks for developers to
+ * implement the behavior they require from a numpunct facet.
+ */
+ template<typename _CharT>
+ class numpunct : public locale::facet
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+ typedef __numpunct_cache<_CharT> __cache_type;
+
+ protected:
+ __cache_type* _M_data;
+
+ public:
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Numpunct constructor.
+ *
+ * @param refs Refcount to pass to the base class.
+ */
+ explicit
+ numpunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
+ { _M_initialize_numpunct(); }
+
+ /**
+ * @brief Internal constructor. Not for general use.
+ *
+ * This is a constructor for use by the library itself to set up the
+ * predefined locale facets.
+ *
+ * @param cache __numpunct_cache object.
+ * @param refs Refcount to pass to the base class.
+ */
+ explicit
+ numpunct(__cache_type* __cache, size_t __refs = 0)
+ : facet(__refs), _M_data(__cache)
+ { _M_initialize_numpunct(); }
+
+ /**
+ * @brief Internal constructor. Not for general use.
+ *
+ * This is a constructor for use by the library itself to set up new
+ * locales.
+ *
+ * @param cloc The "C" locale.
+ * @param refs Refcount to pass to the base class.
+ */
+ explicit
+ numpunct(__c_locale __cloc, size_t __refs = 0)
+ : facet(__refs), _M_data(NULL)
+ { _M_initialize_numpunct(__cloc); }
+
+ /**
+ * @brief Return decimal point character.
+ *
+ * This function returns a char_type to use as a decimal point. It
+ * does so by returning returning
+ * numpunct<char_type>::do_decimal_point().
+ *
+ * @return @a char_type representing a decimal point.
+ */
+ char_type
+ decimal_point() const
+ { return this->do_decimal_point(); }
+
+ /**
+ * @brief Return thousands separator character.
+ *
+ * This function returns a char_type to use as a thousands
+ * separator. It does so by returning returning
+ * numpunct<char_type>::do_thousands_sep().
+ *
+ * @return char_type representing a thousands separator.
+ */
+ char_type
+ thousands_sep() const
+ { return this->do_thousands_sep(); }
+
+ /**
+ * @brief Return grouping specification.
+ *
+ * This function returns a string representing groupings for the
+ * integer part of a number. Groupings indicate where thousands
+ * separators should be inserted in the integer part of a number.
+ *
+ * Each char in the return string is interpret as an integer
+ * rather than a character. These numbers represent the number
+ * of digits in a group. The first char in the string
+ * represents the number of digits in the least significant
+ * group. If a char is negative, it indicates an unlimited
+ * number of digits for the group. If more chars from the
+ * string are required to group a number, the last char is used
+ * repeatedly.
+ *
+ * For example, if the grouping() returns "\003\002" and is
+ * applied to the number 123456789, this corresponds to
+ * 12,34,56,789. Note that if the string was "32", this would
+ * put more than 50 digits into the least significant group if
+ * the character set is ASCII.
+ *
+ * The string is returned by calling
+ * numpunct<char_type>::do_grouping().
+ *
+ * @return string representing grouping specification.
+ */
+ string
+ grouping() const
+ { return this->do_grouping(); }
+
+ /**
+ * @brief Return string representation of bool true.
+ *
+ * This function returns a string_type containing the text
+ * representation for true bool variables. It does so by calling
+ * numpunct<char_type>::do_truename().
+ *
+ * @return string_type representing printed form of true.
+ */
+ string_type
+ truename() const
+ { return this->do_truename(); }
+
+ /**
+ * @brief Return string representation of bool false.
+ *
+ * This function returns a string_type containing the text
+ * representation for false bool variables. It does so by calling
+ * numpunct<char_type>::do_falsename().
+ *
+ * @return string_type representing printed form of false.
+ */
+ string_type
+ falsename() const
+ { return this->do_falsename(); }
+
+ protected:
+ /// Destructor.
+ virtual
+ ~numpunct();
+
+ /**
+ * @brief Return decimal point character.
+ *
+ * Returns a char_type to use as a decimal point. This function is a
+ * hook for derived classes to change the value returned.
+ *
+ * @return @a char_type representing a decimal point.
+ */
+ virtual char_type
+ do_decimal_point() const
+ { return _M_data->_M_decimal_point; }
+
+ /**
+ * @brief Return thousands separator character.
+ *
+ * Returns a char_type to use as a thousands separator. This function
+ * is a hook for derived classes to change the value returned.
+ *
+ * @return @a char_type representing a thousands separator.
+ */
+ virtual char_type
+ do_thousands_sep() const
+ { return _M_data->_M_thousands_sep; }
+
+ /**
+ * @brief Return grouping specification.
+ *
+ * Returns a string representing groupings for the integer part of a
+ * number. This function is a hook for derived classes to change the
+ * value returned. @see grouping() for details.
+ *
+ * @return String representing grouping specification.
+ */
+ virtual string
+ do_grouping() const
+ { return _M_data->_M_grouping; }
+
+ /**
+ * @brief Return string representation of bool true.
+ *
+ * Returns a string_type containing the text representation for true
+ * bool variables. This function is a hook for derived classes to
+ * change the value returned.
+ *
+ * @return string_type representing printed form of true.
+ */
+ virtual string_type
+ do_truename() const
+ { return _M_data->_M_truename; }
+
+ /**
+ * @brief Return string representation of bool false.
+ *
+ * Returns a string_type containing the text representation for false
+ * bool variables. This function is a hook for derived classes to
+ * change the value returned.
+ *
+ * @return string_type representing printed form of false.
+ */
+ virtual string_type
+ do_falsename() const
+ { return _M_data->_M_falsename; }
+
+ // For use at construction time only.
+ void
+ _M_initialize_numpunct(__c_locale __cloc = NULL);
+ };
+
+ template<typename _CharT>
+ locale::id numpunct<_CharT>::id;
+
+ template<>
+ numpunct<char>::~numpunct();
+
+ template<>
+ void
+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ numpunct<wchar_t>::~numpunct();
+
+ template<>
+ void
+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
+#endif
+
+ /// class numpunct_byname [22.2.3.2].
+ template<typename _CharT>
+ class numpunct_byname : public numpunct<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ numpunct_byname(const char* __s, size_t __refs = 0)
+ : numpunct<_CharT>(__refs)
+ {
+ if (__builtin_strcmp(__s, "C") != 0
+ && __builtin_strcmp(__s, "POSIX") != 0)
+ {
+ __c_locale __tmp;
+ this->_S_create_c_locale(__tmp, __s);
+ this->_M_initialize_numpunct(__tmp);
+ this->_S_destroy_c_locale(__tmp);
+ }
+ }
+
+ protected:
+ virtual
+ ~numpunct_byname() { }
+ };
+
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+
+ /**
+ * @brief Facet for parsing number strings.
+ *
+ * This facet encapsulates the code to parse and return a number
+ * from a string. It is used by the istream numeric extraction
+ * operators.
+ *
+ * The num_get template uses protected virtual functions to provide the
+ * actual results. The public accessors forward the call to the virtual
+ * functions. These virtual functions are hooks for developers to
+ * implement the behavior they require from the num_get facet.
+ */
+ template<typename _CharT, typename _InIter>
+ class num_get : public locale::facet
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+ //@}
+
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ num_get(size_t __refs = 0) : facet(__refs) { }
+
+ /**
+ * @brief Numeric parsing.
+ *
+ * Parses the input stream into the bool @a v. It does so by calling
+ * num_get::do_get().
+ *
+ * If ios_base::boolalpha is set, attempts to read
+ * ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets
+ * @a v to true or false if successful. Sets err to
+ * ios_base::failbit if reading the string fails. Sets err to
+ * ios_base::eofbit if the stream is emptied.
+ *
+ * If ios_base::boolalpha is not set, proceeds as with reading a long,
+ * except if the value is 1, sets @a v to true, if the value is 0, sets
+ * @a v to false, and otherwise set err to ios_base::failbit.
+ *
+ * @param in Start of input stream.
+ * @param end End of input stream.
+ * @param io Source of locale and flags.
+ * @param err Error flags to set.
+ * @param v Value to format and insert.
+ * @return Iterator after reading.
+ */
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, bool& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ //@{
+ /**
+ * @brief Numeric parsing.
+ *
+ * Parses the input stream into the integral variable @a v. It does so
+ * by calling num_get::do_get().
+ *
+ * Parsing is affected by the flag settings in @a io.
+ *
+ * The basic parse is affected by the value of io.flags() &
+ * ios_base::basefield. If equal to ios_base::oct, parses like the
+ * scanf %o specifier. Else if equal to ios_base::hex, parses like %X
+ * specifier. Else if basefield equal to 0, parses like the %i
+ * specifier. Otherwise, parses like %d for signed and %u for unsigned
+ * types. The matching type length modifier is also used.
+ *
+ * Digit grouping is interpreted according to numpunct::grouping() and
+ * numpunct::thousands_sep(). If the pattern of digit groups isn't
+ * consistent, sets err to ios_base::failbit.
+ *
+ * If parsing the string yields a valid value for @a v, @a v is set.
+ * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.
+ * Sets err to ios_base::eofbit if the stream is emptied.
+ *
+ * @param in Start of input stream.
+ * @param end End of input stream.
+ * @param io Source of locale and flags.
+ * @param err Error flags to set.
+ * @param v Value to format and insert.
+ * @return Iterator after reading.
+ */
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned short& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned int& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long long& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long long& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+#endif
+ //@}
+
+ //@{
+ /**
+ * @brief Numeric parsing.
+ *
+ * Parses the input stream into the integral variable @a v. It does so
+ * by calling num_get::do_get().
+ *
+ * The input characters are parsed like the scanf %g specifier. The
+ * matching type length modifier is also used.
+ *
+ * The decimal point character used is numpunct::decimal_point().
+ * Digit grouping is interpreted according to numpunct::grouping() and
+ * numpunct::thousands_sep(). If the pattern of digit groups isn't
+ * consistent, sets err to ios_base::failbit.
+ *
+ * If parsing the string yields a valid value for @a v, @a v is set.
+ * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.
+ * Sets err to ios_base::eofbit if the stream is emptied.
+ *
+ * @param in Start of input stream.
+ * @param end End of input stream.
+ * @param io Source of locale and flags.
+ * @param err Error flags to set.
+ * @param v Value to format and insert.
+ * @return Iterator after reading.
+ */
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, float& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, double& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long double& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+ //@}
+
+ /**
+ * @brief Numeric parsing.
+ *
+ * Parses the input stream into the pointer variable @a v. It does so
+ * by calling num_get::do_get().
+ *
+ * The input characters are parsed like the scanf %p specifier.
+ *
+ * Digit grouping is interpreted according to numpunct::grouping() and
+ * numpunct::thousands_sep(). If the pattern of digit groups isn't
+ * consistent, sets err to ios_base::failbit.
+ *
+ * Note that the digit grouping effect for pointers is a bit ambiguous
+ * in the standard and shouldn't be relied on. See DR 344.
+ *
+ * If parsing the string yields a valid value for @a v, @a v is set.
+ * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.
+ * Sets err to ios_base::eofbit if the stream is emptied.
+ *
+ * @param in Start of input stream.
+ * @param end End of input stream.
+ * @param io Source of locale and flags.
+ * @param err Error flags to set.
+ * @param v Value to format and insert.
+ * @return Iterator after reading.
+ */
+ iter_type
+ get(iter_type __in, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, void*& __v) const
+ { return this->do_get(__in, __end, __io, __err, __v); }
+
+ protected:
+ /// Destructor.
+ virtual ~num_get() { }
+
+ iter_type
+ _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
+ string&) const;
+
+ template<typename _ValueT>
+ iter_type
+ _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
+ _ValueT&) const;
+
+ template<typename _CharT2>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type
+ _M_find(const _CharT2*, size_t __len, _CharT2 __c) const
+ {
+ int __ret = -1;
+ if (__len <= 10)
+ {
+ if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len))
+ __ret = __c - _CharT2('0');
+ }
+ else
+ {
+ if (__c >= _CharT2('0') && __c <= _CharT2('9'))
+ __ret = __c - _CharT2('0');
+ else if (__c >= _CharT2('a') && __c <= _CharT2('f'))
+ __ret = 10 + (__c - _CharT2('a'));
+ else if (__c >= _CharT2('A') && __c <= _CharT2('F'))
+ __ret = 10 + (__c - _CharT2('A'));
+ }
+ return __ret;
+ }
+
+ template<typename _CharT2>
+ typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value,
+ int>::__type
+ _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const
+ {
+ int __ret = -1;
+ const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c);
+ if (__q)
+ {
+ __ret = __q - __zero;
+ if (__ret > 15)
+ __ret -= 6;
+ }
+ return __ret;
+ }
+
+ //@{
+ /**
+ * @brief Numeric parsing.
+ *
+ * Parses the input stream into the variable @a v. This function is a
+ * hook for derived classes to change the value returned. @see get()
+ * for more details.
+ *
+ * @param in Start of input stream.
+ * @param end End of input stream.
+ * @param io Source of locale and flags.
+ * @param err Error flags to set.
+ * @param v Value to format and insert.
+ * @return Iterator after reading.
+ */
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
+
+ virtual iter_type
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
+
+ virtual iter_type
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned short& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
+
+ virtual iter_type
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned int& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
+
+ virtual iter_type
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ virtual iter_type
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
+
+ virtual iter_type
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, unsigned long long& __v) const
+ { return _M_extract_int(__beg, __end, __io, __err, __v); }
+#endif
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ float&) const;
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ double&) const;
+
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ __do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ double&) const;
+#else
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ long double&) const;
+#endif
+
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ void*&) const;
+
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
+ long double&) const;
+#endif
+ //@}
+ };
+
+ template<typename _CharT, typename _InIter>
+ locale::id num_get<_CharT, _InIter>::id;
+
+
+ /**
+ * @brief Facet for converting numbers to strings.
+ *
+ * This facet encapsulates the code to convert a number to a string. It is
+ * used by the ostream numeric insertion operators.
+ *
+ * The num_put template uses protected virtual functions to provide the
+ * actual results. The public accessors forward the call to the virtual
+ * functions. These virtual functions are hooks for developers to
+ * implement the behavior they require from the num_put facet.
+ */
+ template<typename _CharT, typename _OutIter>
+ class num_put : public locale::facet
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ //@}
+
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ num_put(size_t __refs = 0) : facet(__refs) { }
+
+ /**
+ * @brief Numeric formatting.
+ *
+ * Formats the boolean @a v and inserts it into a stream. It does so
+ * by calling num_put::do_put().
+ *
+ * If ios_base::boolalpha is set, writes ctype<CharT>::truename() or
+ * ctype<CharT>::falsename(). Otherwise formats @a v as an int.
+ *
+ * @param s Stream to write to.
+ * @param io Source of locale and flags.
+ * @param fill Char_type to use for filling.
+ * @param v Value to format and insert.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+
+ //@{
+ /**
+ * @brief Numeric formatting.
+ *
+ * Formats the integral value @a v and inserts it into a
+ * stream. It does so by calling num_put::do_put().
+ *
+ * Formatting is affected by the flag settings in @a io.
+ *
+ * The basic format is affected by the value of io.flags() &
+ * ios_base::basefield. If equal to ios_base::oct, formats like the
+ * printf %o specifier. Else if equal to ios_base::hex, formats like
+ * %x or %X with ios_base::uppercase unset or set respectively.
+ * Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu
+ * for unsigned values. Note that if both oct and hex are set, neither
+ * will take effect.
+ *
+ * If ios_base::showpos is set, '+' is output before positive values.
+ * If ios_base::showbase is set, '0' precedes octal values (except 0)
+ * and '0[xX]' precedes hex values.
+ *
+ * Thousands separators are inserted according to numpunct::grouping()
+ * and numpunct::thousands_sep(). The decimal point character used is
+ * numpunct::decimal_point().
+ *
+ * If io.width() is non-zero, enough @a fill characters are inserted to
+ * make the result at least that wide. If
+ * (io.flags() & ios_base::adjustfield) == ios_base::left, result is
+ * padded at the end. If ios_base::internal, then padding occurs
+ * immediately after either a '+' or '-' or after '0x' or '0X'.
+ * Otherwise, padding occurs at the beginning.
+ *
+ * @param s Stream to write to.
+ * @param io Source of locale and flags.
+ * @param fill Char_type to use for filling.
+ * @param v Value to format and insert.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ unsigned long long __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+#endif
+ //@}
+
+ //@{
+ /**
+ * @brief Numeric formatting.
+ *
+ * Formats the floating point value @a v and inserts it into a stream.
+ * It does so by calling num_put::do_put().
+ *
+ * Formatting is affected by the flag settings in @a io.
+ *
+ * The basic format is affected by the value of io.flags() &
+ * ios_base::floatfield. If equal to ios_base::fixed, formats like the
+ * printf %f specifier. Else if equal to ios_base::scientific, formats
+ * like %e or %E with ios_base::uppercase unset or set respectively.
+ * Otherwise, formats like %g or %G depending on uppercase. Note that
+ * if both fixed and scientific are set, the effect will also be like
+ * %g or %G.
+ *
+ * The output precision is given by io.precision(). This precision is
+ * capped at numeric_limits::digits10 + 2 (different for double and
+ * long double). The default precision is 6.
+ *
+ * If ios_base::showpos is set, '+' is output before positive values.
+ * If ios_base::showpoint is set, a decimal point will always be
+ * output.
+ *
+ * Thousands separators are inserted according to numpunct::grouping()
+ * and numpunct::thousands_sep(). The decimal point character used is
+ * numpunct::decimal_point().
+ *
+ * If io.width() is non-zero, enough @a fill characters are inserted to
+ * make the result at least that wide. If
+ * (io.flags() & ios_base::adjustfield) == ios_base::left, result is
+ * padded at the end. If ios_base::internal, then padding occurs
+ * immediately after either a '+' or '-' or after '0x' or '0X'.
+ * Otherwise, padding occurs at the beginning.
+ *
+ * @param s Stream to write to.
+ * @param io Source of locale and flags.
+ * @param fill Char_type to use for filling.
+ * @param v Value to format and insert.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ long double __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+ //@}
+
+ /**
+ * @brief Numeric formatting.
+ *
+ * Formats the pointer value @a v and inserts it into a stream. It
+ * does so by calling num_put::do_put().
+ *
+ * This function formats @a v as an unsigned long with ios_base::hex
+ * and ios_base::showbase set.
+ *
+ * @param s Stream to write to.
+ * @param io Source of locale and flags.
+ * @param fill Char_type to use for filling.
+ * @param v Value to format and insert.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, ios_base& __f, char_type __fill,
+ const void* __v) const
+ { return this->do_put(__s, __f, __fill, __v); }
+
+ protected:
+ template<typename _ValueT>
+ iter_type
+ _M_insert_float(iter_type, ios_base& __io, char_type __fill,
+ char __mod, _ValueT __v) const;
+
+ void
+ _M_group_float(const char* __grouping, size_t __grouping_size,
+ char_type __sep, const char_type* __p, char_type* __new,
+ char_type* __cs, int& __len) const;
+
+ template<typename _ValueT>
+ iter_type
+ _M_insert_int(iter_type, ios_base& __io, char_type __fill,
+ _ValueT __v) const;
+
+ void
+ _M_group_int(const char* __grouping, size_t __grouping_size,
+ char_type __sep, ios_base& __io, char_type* __new,
+ char_type* __cs, int& __len) const;
+
+ void
+ _M_pad(char_type __fill, streamsize __w, ios_base& __io,
+ char_type* __new, const char_type* __cs, int& __len) const;
+
+ /// Destructor.
+ virtual
+ ~num_put() { };
+
+ //@{
+ /**
+ * @brief Numeric formatting.
+ *
+ * These functions do the work of formatting numeric values and
+ * inserting them into a stream. This function is a hook for derived
+ * classes to change the value returned.
+ *
+ * @param s Stream to write to.
+ * @param io Source of locale and flags.
+ * @param fill Char_type to use for filling.
+ * @param v Value to format and insert.
+ * @return Iterator after writing.
+ */
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
+
+ virtual iter_type
+ do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
+
+ virtual iter_type
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ unsigned long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ virtual iter_type
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ long long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
+
+ virtual iter_type
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ unsigned long long __v) const
+ { return _M_insert_int(__s, __io, __fill, __v); }
+#endif
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, double __v) const;
+
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ __do_put(iter_type, ios_base&, char_type __fill, double __v) const;
+#else
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
+#endif
+
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
+
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
+#endif
+ //@}
+ };
+
+ template <typename _CharT, typename _OutIter>
+ locale::id num_put<_CharT, _OutIter>::id;
+
+_GLIBCXX_END_LDBL_NAMESPACE
+
+ // Subclause convenience interfaces, inlines.
+ // NB: These are inline because, when used in a loop, some compilers
+ // can hoist the body out of the loop; then it's just as fast as the
+ // C is*() function.
+
+ /// Convenience interface to ctype.is(ctype_base::space, __c).
+ template<typename _CharT>
+ inline bool
+ isspace(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::print, __c).
+ template<typename _CharT>
+ inline bool
+ isprint(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::cntrl, __c).
+ template<typename _CharT>
+ inline bool
+ iscntrl(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::upper, __c).
+ template<typename _CharT>
+ inline bool
+ isupper(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::lower, __c).
+ template<typename _CharT>
+ inline bool
+ islower(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::alpha, __c).
+ template<typename _CharT>
+ inline bool
+ isalpha(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::digit, __c).
+ template<typename _CharT>
+ inline bool
+ isdigit(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::punct, __c).
+ template<typename _CharT>
+ inline bool
+ ispunct(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::xdigit, __c).
+ template<typename _CharT>
+ inline bool
+ isxdigit(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::alnum, __c).
+ template<typename _CharT>
+ inline bool
+ isalnum(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }
+
+ /// Convenience interface to ctype.is(ctype_base::graph, __c).
+ template<typename _CharT>
+ inline bool
+ isgraph(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }
+
+ /// Convenience interface to ctype.toupper(__c).
+ template<typename _CharT>
+ inline _CharT
+ toupper(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
+
+ /// Convenience interface to ctype.tolower(__c).
+ template<typename _CharT>
+ inline _CharT
+ tolower(_CharT __c, const locale& __loc)
+ { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/locale_facets.tcc>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.tcc
new file mode 100644
index 000000000..47eac6a44
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets.tcc
@@ -0,0 +1,1344 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale_facets.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _LOCALE_FACETS_TCC
+#define _LOCALE_FACETS_TCC 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Routine to access a cache for the facet. If the cache didn't
+ // exist before, it gets constructed on the fly.
+ template<typename _Facet>
+ struct __use_cache
+ {
+ const _Facet*
+ operator() (const locale& __loc) const;
+ };
+
+ // Specializations.
+ template<typename _CharT>
+ struct __use_cache<__numpunct_cache<_CharT> >
+ {
+ const __numpunct_cache<_CharT>*
+ operator() (const locale& __loc) const
+ {
+ const size_t __i = numpunct<_CharT>::id._M_id();
+ const locale::facet** __caches = __loc._M_impl->_M_caches;
+ if (!__caches[__i])
+ {
+ __numpunct_cache<_CharT>* __tmp = NULL;
+ __try
+ {
+ __tmp = new __numpunct_cache<_CharT>;
+ __tmp->_M_cache(__loc);
+ }
+ __catch(...)
+ {
+ delete __tmp;
+ __throw_exception_again;
+ }
+ __loc._M_impl->_M_install_cache(__tmp, __i);
+ }
+ return static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]);
+ }
+ };
+
+ template<typename _CharT>
+ void
+ __numpunct_cache<_CharT>::_M_cache(const locale& __loc)
+ {
+ _M_allocated = true;
+
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+
+ _M_grouping_size = __np.grouping().size();
+ char* __grouping = new char[_M_grouping_size];
+ __np.grouping().copy(__grouping, _M_grouping_size);
+ _M_grouping = __grouping;
+ _M_use_grouping = (_M_grouping_size
+ && static_cast<signed char>(_M_grouping[0]) > 0
+ && (_M_grouping[0]
+ != __gnu_cxx::__numeric_traits<char>::__max));
+
+ _M_truename_size = __np.truename().size();
+ _CharT* __truename = new _CharT[_M_truename_size];
+ __np.truename().copy(__truename, _M_truename_size);
+ _M_truename = __truename;
+
+ _M_falsename_size = __np.falsename().size();
+ _CharT* __falsename = new _CharT[_M_falsename_size];
+ __np.falsename().copy(__falsename, _M_falsename_size);
+ _M_falsename = __falsename;
+
+ _M_decimal_point = __np.decimal_point();
+ _M_thousands_sep = __np.thousands_sep();
+
+ const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
+ __ct.widen(__num_base::_S_atoms_out,
+ __num_base::_S_atoms_out + __num_base::_S_oend, _M_atoms_out);
+ __ct.widen(__num_base::_S_atoms_in,
+ __num_base::_S_atoms_in + __num_base::_S_iend, _M_atoms_in);
+ }
+
+ // Used by both numeric and monetary facets.
+ // Check to make sure that the __grouping_tmp string constructed in
+ // money_get or num_get matches the canonical grouping for a given
+ // locale.
+ // __grouping_tmp is parsed L to R
+ // 1,222,444 == __grouping_tmp of "\1\3\3"
+ // __grouping is parsed R to L
+ // 1,222,444 == __grouping of "\3" == "\3\3\3"
+ bool
+ __verify_grouping(const char* __grouping, size_t __grouping_size,
+ const string& __grouping_tmp);
+
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,
+ ios_base::iostate& __err, string& __xtrc) const
+ {
+ typedef char_traits<_CharT> __traits_type;
+ typedef __numpunct_cache<_CharT> __cache_type;
+ __use_cache<__cache_type> __uc;
+ const locale& __loc = __io._M_getloc();
+ const __cache_type* __lc = __uc(__loc);
+ const _CharT* __lit = __lc->_M_atoms_in;
+ char_type __c = char_type();
+
+ // True if __beg becomes equal to __end.
+ bool __testeof = __beg == __end;
+
+ // First check for sign.
+ if (!__testeof)
+ {
+ __c = *__beg;
+ const bool __plus = __c == __lit[__num_base::_S_iplus];
+ if ((__plus || __c == __lit[__num_base::_S_iminus])
+ && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+ && !(__c == __lc->_M_decimal_point))
+ {
+ __xtrc += __plus ? '+' : '-';
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+ }
+
+ // Next, look for leading zeros.
+ bool __found_mantissa = false;
+ int __sep_pos = 0;
+ while (!__testeof)
+ {
+ if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+ || __c == __lc->_M_decimal_point)
+ break;
+ else if (__c == __lit[__num_base::_S_izero])
+ {
+ if (!__found_mantissa)
+ {
+ __xtrc += '0';
+ __found_mantissa = true;
+ }
+ ++__sep_pos;
+
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+ else
+ break;
+ }
+
+ // Only need acceptable digits for floating point numbers.
+ bool __found_dec = false;
+ bool __found_sci = false;
+ string __found_grouping;
+ if (__lc->_M_use_grouping)
+ __found_grouping.reserve(32);
+ const char_type* __lit_zero = __lit + __num_base::_S_izero;
+
+ if (!__lc->_M_allocated)
+ // "C" locale
+ while (!__testeof)
+ {
+ const int __digit = _M_find(__lit_zero, 10, __c);
+ if (__digit != -1)
+ {
+ __xtrc += '0' + __digit;
+ __found_mantissa = true;
+ }
+ else if (__c == __lc->_M_decimal_point
+ && !__found_dec && !__found_sci)
+ {
+ __xtrc += '.';
+ __found_dec = true;
+ }
+ else if ((__c == __lit[__num_base::_S_ie]
+ || __c == __lit[__num_base::_S_iE])
+ && !__found_sci && __found_mantissa)
+ {
+ // Scientific notation.
+ __xtrc += 'e';
+ __found_sci = true;
+
+ // Remove optional plus or minus sign, if they exist.
+ if (++__beg != __end)
+ {
+ __c = *__beg;
+ const bool __plus = __c == __lit[__num_base::_S_iplus];
+ if (__plus || __c == __lit[__num_base::_S_iminus])
+ __xtrc += __plus ? '+' : '-';
+ else
+ continue;
+ }
+ else
+ {
+ __testeof = true;
+ break;
+ }
+ }
+ else
+ break;
+
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+ else
+ while (!__testeof)
+ {
+ // According to 22.2.2.1.2, p8-9, first look for thousands_sep
+ // and decimal_point.
+ if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+ {
+ if (!__found_dec && !__found_sci)
+ {
+ // NB: Thousands separator at the beginning of a string
+ // is a no-no, as is two consecutive thousands separators.
+ if (__sep_pos)
+ {
+ __found_grouping += static_cast<char>(__sep_pos);
+ __sep_pos = 0;
+ }
+ else
+ {
+ // NB: __convert_to_v will not assign __v and will
+ // set the failbit.
+ __xtrc.clear();
+ break;
+ }
+ }
+ else
+ break;
+ }
+ else if (__c == __lc->_M_decimal_point)
+ {
+ if (!__found_dec && !__found_sci)
+ {
+ // If no grouping chars are seen, no grouping check
+ // is applied. Therefore __found_grouping is adjusted
+ // only if decimal_point comes after some thousands_sep.
+ if (__found_grouping.size())
+ __found_grouping += static_cast<char>(__sep_pos);
+ __xtrc += '.';
+ __found_dec = true;
+ }
+ else
+ break;
+ }
+ else
+ {
+ const char_type* __q =
+ __traits_type::find(__lit_zero, 10, __c);
+ if (__q)
+ {
+ __xtrc += '0' + (__q - __lit_zero);
+ __found_mantissa = true;
+ ++__sep_pos;
+ }
+ else if ((__c == __lit[__num_base::_S_ie]
+ || __c == __lit[__num_base::_S_iE])
+ && !__found_sci && __found_mantissa)
+ {
+ // Scientific notation.
+ if (__found_grouping.size() && !__found_dec)
+ __found_grouping += static_cast<char>(__sep_pos);
+ __xtrc += 'e';
+ __found_sci = true;
+
+ // Remove optional plus or minus sign, if they exist.
+ if (++__beg != __end)
+ {
+ __c = *__beg;
+ const bool __plus = __c == __lit[__num_base::_S_iplus];
+ if ((__plus || __c == __lit[__num_base::_S_iminus])
+ && !(__lc->_M_use_grouping
+ && __c == __lc->_M_thousands_sep)
+ && !(__c == __lc->_M_decimal_point))
+ __xtrc += __plus ? '+' : '-';
+ else
+ continue;
+ }
+ else
+ {
+ __testeof = true;
+ break;
+ }
+ }
+ else
+ break;
+ }
+
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+
+ // Digit grouping is checked. If grouping and found_grouping don't
+ // match, then get very very upset, and set failbit.
+ if (__found_grouping.size())
+ {
+ // Add the ending grouping if a decimal or 'e'/'E' wasn't found.
+ if (!__found_dec && !__found_sci)
+ __found_grouping += static_cast<char>(__sep_pos);
+
+ if (!std::__verify_grouping(__lc->_M_grouping,
+ __lc->_M_grouping_size,
+ __found_grouping))
+ __err = ios_base::failbit;
+ }
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ template<typename _ValueT>
+ _InIter
+ num_get<_CharT, _InIter>::
+ _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,
+ ios_base::iostate& __err, _ValueT& __v) const
+ {
+ typedef char_traits<_CharT> __traits_type;
+ using __gnu_cxx::__add_unsigned;
+ typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
+ typedef __numpunct_cache<_CharT> __cache_type;
+ __use_cache<__cache_type> __uc;
+ const locale& __loc = __io._M_getloc();
+ const __cache_type* __lc = __uc(__loc);
+ const _CharT* __lit = __lc->_M_atoms_in;
+ char_type __c = char_type();
+
+ // NB: Iff __basefield == 0, __base can change based on contents.
+ const ios_base::fmtflags __basefield = __io.flags()
+ & ios_base::basefield;
+ const bool __oct = __basefield == ios_base::oct;
+ int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10);
+
+ // True if __beg becomes equal to __end.
+ bool __testeof = __beg == __end;
+
+ // First check for sign.
+ bool __negative = false;
+ if (!__testeof)
+ {
+ __c = *__beg;
+ if (__gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
+ __negative = __c == __lit[__num_base::_S_iminus];
+ if ((__negative || __c == __lit[__num_base::_S_iplus])
+ && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+ && !(__c == __lc->_M_decimal_point))
+ {
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+ }
+
+ // Next, look for leading zeros and check required digits
+ // for base formats.
+ bool __found_zero = false;
+ int __sep_pos = 0;
+ while (!__testeof)
+ {
+ if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+ || __c == __lc->_M_decimal_point)
+ break;
+ else if (__c == __lit[__num_base::_S_izero]
+ && (!__found_zero || __base == 10))
+ {
+ __found_zero = true;
+ ++__sep_pos;
+ if (__basefield == 0)
+ __base = 8;
+ if (__base == 8)
+ __sep_pos = 0;
+ }
+ else if (__found_zero
+ && (__c == __lit[__num_base::_S_ix]
+ || __c == __lit[__num_base::_S_iX]))
+ {
+ if (__basefield == 0)
+ __base = 16;
+ if (__base == 16)
+ {
+ __found_zero = false;
+ __sep_pos = 0;
+ }
+ else
+ break;
+ }
+ else
+ break;
+
+ if (++__beg != __end)
+ {
+ __c = *__beg;
+ if (!__found_zero)
+ break;
+ }
+ else
+ __testeof = true;
+ }
+
+ // At this point, base is determined. If not hex, only allow
+ // base digits as valid input.
+ const size_t __len = (__base == 16 ? __num_base::_S_iend
+ - __num_base::_S_izero : __base);
+
+ // Extract.
+ string __found_grouping;
+ if (__lc->_M_use_grouping)
+ __found_grouping.reserve(32);
+ bool __testfail = false;
+ bool __testoverflow = false;
+ const __unsigned_type __max = __negative
+ ? -__gnu_cxx::__numeric_traits<_ValueT>::__min
+ : __gnu_cxx::__numeric_traits<_ValueT>::__max;
+ const __unsigned_type __smax = __max / __base;
+ __unsigned_type __result = 0;
+ int __digit = 0;
+ const char_type* __lit_zero = __lit + __num_base::_S_izero;
+
+ if (!__lc->_M_allocated)
+ // "C" locale
+ while (!__testeof)
+ {
+ __digit = _M_find(__lit_zero, __len, __c);
+ if (__digit == -1)
+ break;
+
+ if (__result > __smax)
+ __testoverflow = true;
+ else
+ {
+ __result *= __base;
+ __testoverflow |= __result > __max - __digit;
+ __result += __digit;
+ ++__sep_pos;
+ }
+
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+ else
+ while (!__testeof)
+ {
+ // According to 22.2.2.1.2, p8-9, first look for thousands_sep
+ // and decimal_point.
+ if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+ {
+ // NB: Thousands separator at the beginning of a string
+ // is a no-no, as is two consecutive thousands separators.
+ if (__sep_pos)
+ {
+ __found_grouping += static_cast<char>(__sep_pos);
+ __sep_pos = 0;
+ }
+ else
+ {
+ __testfail = true;
+ break;
+ }
+ }
+ else if (__c == __lc->_M_decimal_point)
+ break;
+ else
+ {
+ const char_type* __q =
+ __traits_type::find(__lit_zero, __len, __c);
+ if (!__q)
+ break;
+
+ __digit = __q - __lit_zero;
+ if (__digit > 15)
+ __digit -= 6;
+ if (__result > __smax)
+ __testoverflow = true;
+ else
+ {
+ __result *= __base;
+ __testoverflow |= __result > __max - __digit;
+ __result += __digit;
+ ++__sep_pos;
+ }
+ }
+
+ if (++__beg != __end)
+ __c = *__beg;
+ else
+ __testeof = true;
+ }
+
+ // Digit grouping is checked. If grouping and found_grouping don't
+ // match, then get very very upset, and set failbit.
+ if (__found_grouping.size())
+ {
+ // Add the ending grouping.
+ __found_grouping += static_cast<char>(__sep_pos);
+
+ if (!std::__verify_grouping(__lc->_M_grouping,
+ __lc->_M_grouping_size,
+ __found_grouping))
+ __err = ios_base::failbit;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 23. Num_get overflow result.
+ if ((!__sep_pos && !__found_zero && !__found_grouping.size())
+ || __testfail)
+ {
+ __v = 0;
+ __err = ios_base::failbit;
+ }
+ else if (__testoverflow)
+ {
+ if (__negative)
+ __v = __gnu_cxx::__numeric_traits<_ValueT>::__min;
+ else
+ __v = __gnu_cxx::__numeric_traits<_ValueT>::__max;
+ __err = ios_base::failbit;
+ }
+ else
+ __v = __negative ? -__result : __result;
+
+ if (__testeof)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 17. Bad bool parsing
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, bool& __v) const
+ {
+ if (!(__io.flags() & ios_base::boolalpha))
+ {
+ // Parse bool values as long.
+ // NB: We can't just call do_get(long) here, as it might
+ // refer to a derived class.
+ long __l = -1;
+ __beg = _M_extract_int(__beg, __end, __io, __err, __l);
+ if (__l == 0 || __l == 1)
+ __v = bool(__l);
+ else
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 23. Num_get overflow result.
+ __v = true;
+ __err = ios_base::failbit;
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ }
+ }
+ else
+ {
+ // Parse bool values as alphanumeric.
+ typedef __numpunct_cache<_CharT> __cache_type;
+ __use_cache<__cache_type> __uc;
+ const locale& __loc = __io._M_getloc();
+ const __cache_type* __lc = __uc(__loc);
+
+ bool __testf = true;
+ bool __testt = true;
+ bool __donef = __lc->_M_falsename_size == 0;
+ bool __donet = __lc->_M_truename_size == 0;
+ bool __testeof = false;
+ size_t __n = 0;
+ while (!__donef || !__donet)
+ {
+ if (__beg == __end)
+ {
+ __testeof = true;
+ break;
+ }
+
+ const char_type __c = *__beg;
+
+ if (!__donef)
+ __testf = __c == __lc->_M_falsename[__n];
+
+ if (!__testf && __donet)
+ break;
+
+ if (!__donet)
+ __testt = __c == __lc->_M_truename[__n];
+
+ if (!__testt && __donef)
+ break;
+
+ if (!__testt && !__testf)
+ break;
+
+ ++__n;
+ ++__beg;
+
+ __donef = !__testf || __n >= __lc->_M_falsename_size;
+ __donet = !__testt || __n >= __lc->_M_truename_size;
+ }
+ if (__testf && __n == __lc->_M_falsename_size && __n)
+ {
+ __v = false;
+ if (__testt && __n == __lc->_M_truename_size)
+ __err = ios_base::failbit;
+ else
+ __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
+ }
+ else if (__testt && __n == __lc->_M_truename_size && __n)
+ {
+ __v = true;
+ __err = __testeof ? ios_base::eofbit : ios_base::goodbit;
+ }
+ else
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 23. Num_get overflow result.
+ __v = false;
+ __err = ios_base::failbit;
+ if (__testeof)
+ __err |= ios_base::eofbit;
+ }
+ }
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, float& __v) const
+ {
+ string __xtrc;
+ __xtrc.reserve(32);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, double& __v) const
+ {
+ string __xtrc;
+ __xtrc.reserve(32);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ __do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, double& __v) const
+ {
+ string __xtrc;
+ __xtrc.reserve(32);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+#endif
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, long double& __v) const
+ {
+ string __xtrc;
+ __xtrc.reserve(32);
+ __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);
+ std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ num_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, void*& __v) const
+ {
+ // Prepare for hex formatted input.
+ typedef ios_base::fmtflags fmtflags;
+ const fmtflags __fmt = __io.flags();
+ __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex);
+
+ typedef __gnu_cxx::__conditional_type<(sizeof(void*)
+ <= sizeof(unsigned long)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+
+ _UIntPtrType __ul;
+ __beg = _M_extract_int(__beg, __end, __io, __err, __ul);
+
+ // Reset from hex formatted input.
+ __io.flags(__fmt);
+
+ __v = reinterpret_cast<void*>(__ul);
+ return __beg;
+ }
+
+ // For use by integer and floating-point types after they have been
+ // converted into a char_type string.
+ template<typename _CharT, typename _OutIter>
+ void
+ num_put<_CharT, _OutIter>::
+ _M_pad(_CharT __fill, streamsize __w, ios_base& __io,
+ _CharT* __new, const _CharT* __cs, int& __len) const
+ {
+ // [22.2.2.2.2] Stage 3.
+ // If necessary, pad.
+ __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new,
+ __cs, __w, __len);
+ __len = static_cast<int>(__w);
+ }
+
+_GLIBCXX_END_LDBL_NAMESPACE
+
+ template<typename _CharT, typename _ValueT>
+ int
+ __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
+ ios_base::fmtflags __flags, bool __dec)
+ {
+ _CharT* __buf = __bufend;
+ if (__builtin_expect(__dec, true))
+ {
+ // Decimal.
+ do
+ {
+ *--__buf = __lit[(__v % 10) + __num_base::_S_odigits];
+ __v /= 10;
+ }
+ while (__v != 0);
+ }
+ else if ((__flags & ios_base::basefield) == ios_base::oct)
+ {
+ // Octal.
+ do
+ {
+ *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits];
+ __v >>= 3;
+ }
+ while (__v != 0);
+ }
+ else
+ {
+ // Hex.
+ const bool __uppercase = __flags & ios_base::uppercase;
+ const int __case_offset = __uppercase ? __num_base::_S_oudigits
+ : __num_base::_S_odigits;
+ do
+ {
+ *--__buf = __lit[(__v & 0xf) + __case_offset];
+ __v >>= 4;
+ }
+ while (__v != 0);
+ }
+ return __bufend - __buf;
+ }
+
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+
+ template<typename _CharT, typename _OutIter>
+ void
+ num_put<_CharT, _OutIter>::
+ _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep,
+ ios_base&, _CharT* __new, _CharT* __cs, int& __len) const
+ {
+ _CharT* __p = std::__add_grouping(__new, __sep, __grouping,
+ __grouping_size, __cs, __cs + __len);
+ __len = __p - __new;
+ }
+
+ template<typename _CharT, typename _OutIter>
+ template<typename _ValueT>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,
+ _ValueT __v) const
+ {
+ using __gnu_cxx::__add_unsigned;
+ typedef typename __add_unsigned<_ValueT>::__type __unsigned_type;
+ typedef __numpunct_cache<_CharT> __cache_type;
+ __use_cache<__cache_type> __uc;
+ const locale& __loc = __io._M_getloc();
+ const __cache_type* __lc = __uc(__loc);
+ const _CharT* __lit = __lc->_M_atoms_out;
+ const ios_base::fmtflags __flags = __io.flags();
+
+ // Long enough to hold hex, dec, and octal representations.
+ const int __ilen = 5 * sizeof(_ValueT);
+ _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __ilen));
+
+ // [22.2.2.2.2] Stage 1, numeric conversion to character.
+ // Result is returned right-justified in the buffer.
+ const ios_base::fmtflags __basefield = __flags & ios_base::basefield;
+ const bool __dec = (__basefield != ios_base::oct
+ && __basefield != ios_base::hex);
+ const __unsigned_type __u = ((__v > 0 || !__dec)
+ ? __unsigned_type(__v)
+ : -__unsigned_type(__v));
+ int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);
+ __cs += __ilen - __len;
+
+ // Add grouping, if necessary.
+ if (__lc->_M_use_grouping)
+ {
+ // Grouping can add (almost) as many separators as the number
+ // of digits + space is reserved for numeric base or sign.
+ _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * (__len + 1)
+ * 2));
+ _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,
+ __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len);
+ __cs = __cs2 + 2;
+ }
+
+ // Complete Stage 1, prepend numeric base or sign.
+ if (__builtin_expect(__dec, true))
+ {
+ // Decimal.
+ if (__v >= 0)
+ {
+ if (bool(__flags & ios_base::showpos)
+ && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed)
+ *--__cs = __lit[__num_base::_S_oplus], ++__len;
+ }
+ else
+ *--__cs = __lit[__num_base::_S_ominus], ++__len;
+ }
+ else if (bool(__flags & ios_base::showbase) && __v)
+ {
+ if (__basefield == ios_base::oct)
+ *--__cs = __lit[__num_base::_S_odigits], ++__len;
+ else
+ {
+ // 'x' or 'X'
+ const bool __uppercase = __flags & ios_base::uppercase;
+ *--__cs = __lit[__num_base::_S_ox + __uppercase];
+ // '0'
+ *--__cs = __lit[__num_base::_S_odigits];
+ __len += 2;
+ }
+ }
+
+ // Pad.
+ const streamsize __w = __io.width();
+ if (__w > static_cast<streamsize>(__len))
+ {
+ _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __w));
+ _M_pad(__fill, __w, __io, __cs3, __cs, __len);
+ __cs = __cs3;
+ }
+ __io.width(0);
+
+ // [22.2.2.2.2] Stage 4.
+ // Write resulting, fully-formatted string to output iterator.
+ return std::__write(__s, __cs, __len);
+ }
+
+ template<typename _CharT, typename _OutIter>
+ void
+ num_put<_CharT, _OutIter>::
+ _M_group_float(const char* __grouping, size_t __grouping_size,
+ _CharT __sep, const _CharT* __p, _CharT* __new,
+ _CharT* __cs, int& __len) const
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 282. What types does numpunct grouping refer to?
+ // Add grouping, if necessary.
+ const int __declen = __p ? __p - __cs : __len;
+ _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping,
+ __grouping_size,
+ __cs, __cs + __declen);
+
+ // Tack on decimal part.
+ int __newlen = __p2 - __new;
+ if (__p)
+ {
+ char_traits<_CharT>::copy(__p2, __p, __len - __declen);
+ __newlen += __len - __declen;
+ }
+ __len = __newlen;
+ }
+
+ // The following code uses vsnprintf (or vsprintf(), when
+ // _GLIBCXX_USE_C99 is not defined) to convert floating point values
+ // for insertion into a stream. An optimization would be to replace
+ // them with code that works directly on a wide buffer and then use
+ // __pad to do the padding. It would be good to replace them anyway
+ // to gain back the efficiency that C++ provides by knowing up front
+ // the type of the values to insert. Also, sprintf is dangerous
+ // since may lead to accidental buffer overruns. This
+ // implementation follows the C++ standard fairly directly as
+ // outlined in 22.2.2.2 [lib.locale.num.put]
+ template<typename _CharT, typename _OutIter>
+ template<typename _ValueT>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod,
+ _ValueT __v) const
+ {
+ typedef __numpunct_cache<_CharT> __cache_type;
+ __use_cache<__cache_type> __uc;
+ const locale& __loc = __io._M_getloc();
+ const __cache_type* __lc = __uc(__loc);
+
+ // Use default precision if out of range.
+ const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision();
+
+ const int __max_digits =
+ __gnu_cxx::__numeric_traits<_ValueT>::__digits10;
+
+ // [22.2.2.2.2] Stage 1, numeric conversion to character.
+ int __len;
+ // Long enough for the max format spec.
+ char __fbuf[16];
+ __num_base::_S_format_float(__io, __fbuf, __mod);
+
+#ifdef _GLIBCXX_USE_C99
+ // First try a buffer perhaps big enough (most probably sufficient
+ // for non-ios_base::fixed outputs)
+ int __cs_size = __max_digits * 3;
+ char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ __fbuf, __prec, __v);
+
+ // If the buffer was not large enough, try again with the correct size.
+ if (__len >= __cs_size)
+ {
+ __cs_size = __len + 1;
+ __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ __fbuf, __prec, __v);
+ }
+#else
+ // Consider the possibility of long ios_base::fixed outputs
+ const bool __fixed = __io.flags() & ios_base::fixed;
+ const int __max_exp =
+ __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10;
+
+ // The size of the output string is computed as follows.
+ // ios_base::fixed outputs may need up to __max_exp + 1 chars
+ // for the integer part + __prec chars for the fractional part
+ // + 3 chars for sign, decimal point, '\0'. On the other hand,
+ // for non-fixed outputs __max_digits * 2 + __prec chars are
+ // largely sufficient.
+ const int __cs_size = __fixed ? __max_exp + __prec + 4
+ : __max_digits * 2 + __prec;
+ char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
+ __prec, __v);
+#endif
+
+ // [22.2.2.2.2] Stage 2, convert to char_type, using correct
+ // numpunct.decimal_point() values for '.' and adding grouping.
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __len));
+ __ctype.widen(__cs, __cs + __len, __ws);
+
+ // Replace decimal point.
+ _CharT* __wp = 0;
+ const char* __p = char_traits<char>::find(__cs, __len, '.');
+ if (__p)
+ {
+ __wp = __ws + (__p - __cs);
+ *__wp = __lc->_M_decimal_point;
+ }
+
+ // Add grouping, if necessary.
+ // N.B. Make sure to not group things like 2e20, i.e., no decimal
+ // point, scientific notation.
+ if (__lc->_M_use_grouping
+ && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9'
+ && __cs[1] >= '0' && __cs[2] >= '0')))
+ {
+ // Grouping can add (almost) as many separators as the
+ // number of digits, but no more.
+ _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __len * 2));
+
+ streamsize __off = 0;
+ if (__cs[0] == '-' || __cs[0] == '+')
+ {
+ __off = 1;
+ __ws2[0] = __ws[0];
+ __len -= 1;
+ }
+
+ _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size,
+ __lc->_M_thousands_sep, __wp, __ws2 + __off,
+ __ws + __off, __len);
+ __len += __off;
+
+ __ws = __ws2;
+ }
+
+ // Pad.
+ const streamsize __w = __io.width();
+ if (__w > static_cast<streamsize>(__len))
+ {
+ _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __w));
+ _M_pad(__fill, __w, __io, __ws3, __ws, __len);
+ __ws = __ws3;
+ }
+ __io.width(0);
+
+ // [22.2.2.2.2] Stage 4.
+ // Write resulting, fully-formatted string to output iterator.
+ return std::__write(__s, __ws, __len);
+ }
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const
+ {
+ const ios_base::fmtflags __flags = __io.flags();
+ if ((__flags & ios_base::boolalpha) == 0)
+ {
+ const long __l = __v;
+ __s = _M_insert_int(__s, __io, __fill, __l);
+ }
+ else
+ {
+ typedef __numpunct_cache<_CharT> __cache_type;
+ __use_cache<__cache_type> __uc;
+ const locale& __loc = __io._M_getloc();
+ const __cache_type* __lc = __uc(__loc);
+
+ const _CharT* __name = __v ? __lc->_M_truename
+ : __lc->_M_falsename;
+ int __len = __v ? __lc->_M_truename_size
+ : __lc->_M_falsename_size;
+
+ const streamsize __w = __io.width();
+ if (__w > static_cast<streamsize>(__len))
+ {
+ const streamsize __plen = __w - __len;
+ _CharT* __ps
+ = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __plen));
+
+ char_traits<_CharT>::assign(__ps, __plen, __fill);
+ __io.width(0);
+
+ if ((__flags & ios_base::adjustfield) == ios_base::left)
+ {
+ __s = std::__write(__s, __name, __len);
+ __s = std::__write(__s, __ps, __plen);
+ }
+ else
+ {
+ __s = std::__write(__s, __ps, __plen);
+ __s = std::__write(__s, __name, __len);
+ }
+ return __s;
+ }
+ __io.width(0);
+ __s = std::__write(__s, __name, __len);
+ }
+ return __s;
+ }
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
+ { return _M_insert_float(__s, __io, __fill, char(), __v); }
+
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ __do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const
+ { return _M_insert_float(__s, __io, __fill, char(), __v); }
+#endif
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ long double __v) const
+ { return _M_insert_float(__s, __io, __fill, 'L', __v); }
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type __fill,
+ const void* __v) const
+ {
+ const ios_base::fmtflags __flags = __io.flags();
+ const ios_base::fmtflags __fmt = ~(ios_base::basefield
+ | ios_base::uppercase);
+ __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase));
+
+ typedef __gnu_cxx::__conditional_type<(sizeof(const void*)
+ <= sizeof(unsigned long)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+
+ __s = _M_insert_int(__s, __io, __fill,
+ reinterpret_cast<_UIntPtrType>(__v));
+ __io.flags(__flags);
+ return __s;
+ }
+
+_GLIBCXX_END_LDBL_NAMESPACE
+
+ // Construct correctly padded string, as per 22.2.2.2.2
+ // Assumes
+ // __newlen > __oldlen
+ // __news is allocated for __newlen size
+
+ // NB: Of the two parameters, _CharT can be deduced from the
+ // function arguments. The other (_Traits) has to be explicitly specified.
+ template<typename _CharT, typename _Traits>
+ void
+ __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,
+ _CharT* __news, const _CharT* __olds,
+ streamsize __newlen, streamsize __oldlen)
+ {
+ const size_t __plen = static_cast<size_t>(__newlen - __oldlen);
+ const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield;
+
+ // Padding last.
+ if (__adjust == ios_base::left)
+ {
+ _Traits::copy(__news, __olds, __oldlen);
+ _Traits::assign(__news + __oldlen, __plen, __fill);
+ return;
+ }
+
+ size_t __mod = 0;
+ if (__adjust == ios_base::internal)
+ {
+ // Pad after the sign, if there is one.
+ // Pad after 0[xX], if there is one.
+ // Who came up with these rules, anyway? Jeeze.
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ if (__ctype.widen('-') == __olds[0]
+ || __ctype.widen('+') == __olds[0])
+ {
+ __news[0] = __olds[0];
+ __mod = 1;
+ ++__news;
+ }
+ else if (__ctype.widen('0') == __olds[0]
+ && __oldlen > 1
+ && (__ctype.widen('x') == __olds[1]
+ || __ctype.widen('X') == __olds[1]))
+ {
+ __news[0] = __olds[0];
+ __news[1] = __olds[1];
+ __mod = 2;
+ __news += 2;
+ }
+ // else Padding first.
+ }
+ _Traits::assign(__news, __plen, __fill);
+ _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod);
+ }
+
+ template<typename _CharT>
+ _CharT*
+ __add_grouping(_CharT* __s, _CharT __sep,
+ const char* __gbeg, size_t __gsize,
+ const _CharT* __first, const _CharT* __last)
+ {
+ size_t __idx = 0;
+ size_t __ctr = 0;
+
+ while (__last - __first > __gbeg[__idx]
+ && static_cast<signed char>(__gbeg[__idx]) > 0
+ && __gbeg[__idx] != __gnu_cxx::__numeric_traits<char>::__max)
+ {
+ __last -= __gbeg[__idx];
+ __idx < __gsize - 1 ? ++__idx : ++__ctr;
+ }
+
+ while (__first != __last)
+ *__s++ = *__first++;
+
+ while (__ctr--)
+ {
+ *__s++ = __sep;
+ for (char __i = __gbeg[__idx]; __i > 0; --__i)
+ *__s++ = *__first++;
+ }
+
+ while (__idx--)
+ {
+ *__s++ = __sep;
+ for (char __i = __gbeg[__idx]; __i > 0; --__i)
+ *__s++ = *__first++;
+ }
+
+ return __s;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class numpunct<char>;
+ extern template class numpunct_byname<char>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;
+ extern template class ctype_byname<char>;
+
+ extern template
+ const ctype<char>&
+ use_facet<ctype<char> >(const locale&);
+
+ extern template
+ const numpunct<char>&
+ use_facet<numpunct<char> >(const locale&);
+
+ extern template
+ const num_put<char>&
+ use_facet<num_put<char> >(const locale&);
+
+ extern template
+ const num_get<char>&
+ use_facet<num_get<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<ctype<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<numpunct<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<num_put<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<num_get<char> >(const locale&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class numpunct<wchar_t>;
+ extern template class numpunct_byname<wchar_t>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;
+ extern template class ctype_byname<wchar_t>;
+
+ extern template
+ const ctype<wchar_t>&
+ use_facet<ctype<wchar_t> >(const locale&);
+
+ extern template
+ const numpunct<wchar_t>&
+ use_facet<numpunct<wchar_t> >(const locale&);
+
+ extern template
+ const num_put<wchar_t>&
+ use_facet<num_put<wchar_t> >(const locale&);
+
+ extern template
+ const num_get<wchar_t>&
+ use_facet<num_get<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<ctype<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<numpunct<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<num_put<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<num_get<wchar_t> >(const locale&);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.h b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.h
new file mode 100644
index 000000000..aba96d6c1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -0,0 +1,1914 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale_facets_nonio.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _LOCALE_FACETS_NONIO_H
+#define _LOCALE_FACETS_NONIO_H 1
+
+#pragma GCC system_header
+
+#include <ctime> // For struct tm
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Time format ordering data.
+ *
+ * This class provides an enum representing different orderings of day,
+ * month, and year.
+ */
+ class time_base
+ {
+ public:
+ enum dateorder { no_order, dmy, mdy, ymd, ydm };
+ };
+
+ template<typename _CharT>
+ struct __timepunct_cache : public locale::facet
+ {
+ // List of all known timezones, with GMT first.
+ static const _CharT* _S_timezones[14];
+
+ const _CharT* _M_date_format;
+ const _CharT* _M_date_era_format;
+ const _CharT* _M_time_format;
+ const _CharT* _M_time_era_format;
+ const _CharT* _M_date_time_format;
+ const _CharT* _M_date_time_era_format;
+ const _CharT* _M_am;
+ const _CharT* _M_pm;
+ const _CharT* _M_am_pm_format;
+
+ // Day names, starting with "C"'s Sunday.
+ const _CharT* _M_day1;
+ const _CharT* _M_day2;
+ const _CharT* _M_day3;
+ const _CharT* _M_day4;
+ const _CharT* _M_day5;
+ const _CharT* _M_day6;
+ const _CharT* _M_day7;
+
+ // Abbreviated day names, starting with "C"'s Sun.
+ const _CharT* _M_aday1;
+ const _CharT* _M_aday2;
+ const _CharT* _M_aday3;
+ const _CharT* _M_aday4;
+ const _CharT* _M_aday5;
+ const _CharT* _M_aday6;
+ const _CharT* _M_aday7;
+
+ // Month names, starting with "C"'s January.
+ const _CharT* _M_month01;
+ const _CharT* _M_month02;
+ const _CharT* _M_month03;
+ const _CharT* _M_month04;
+ const _CharT* _M_month05;
+ const _CharT* _M_month06;
+ const _CharT* _M_month07;
+ const _CharT* _M_month08;
+ const _CharT* _M_month09;
+ const _CharT* _M_month10;
+ const _CharT* _M_month11;
+ const _CharT* _M_month12;
+
+ // Abbreviated month names, starting with "C"'s Jan.
+ const _CharT* _M_amonth01;
+ const _CharT* _M_amonth02;
+ const _CharT* _M_amonth03;
+ const _CharT* _M_amonth04;
+ const _CharT* _M_amonth05;
+ const _CharT* _M_amonth06;
+ const _CharT* _M_amonth07;
+ const _CharT* _M_amonth08;
+ const _CharT* _M_amonth09;
+ const _CharT* _M_amonth10;
+ const _CharT* _M_amonth11;
+ const _CharT* _M_amonth12;
+
+ bool _M_allocated;
+
+ __timepunct_cache(size_t __refs = 0) : facet(__refs),
+ _M_date_format(NULL), _M_date_era_format(NULL), _M_time_format(NULL),
+ _M_time_era_format(NULL), _M_date_time_format(NULL),
+ _M_date_time_era_format(NULL), _M_am(NULL), _M_pm(NULL),
+ _M_am_pm_format(NULL), _M_day1(NULL), _M_day2(NULL), _M_day3(NULL),
+ _M_day4(NULL), _M_day5(NULL), _M_day6(NULL), _M_day7(NULL),
+ _M_aday1(NULL), _M_aday2(NULL), _M_aday3(NULL), _M_aday4(NULL),
+ _M_aday5(NULL), _M_aday6(NULL), _M_aday7(NULL), _M_month01(NULL),
+ _M_month02(NULL), _M_month03(NULL), _M_month04(NULL), _M_month05(NULL),
+ _M_month06(NULL), _M_month07(NULL), _M_month08(NULL), _M_month09(NULL),
+ _M_month10(NULL), _M_month11(NULL), _M_month12(NULL), _M_amonth01(NULL),
+ _M_amonth02(NULL), _M_amonth03(NULL), _M_amonth04(NULL),
+ _M_amonth05(NULL), _M_amonth06(NULL), _M_amonth07(NULL),
+ _M_amonth08(NULL), _M_amonth09(NULL), _M_amonth10(NULL),
+ _M_amonth11(NULL), _M_amonth12(NULL), _M_allocated(false)
+ { }
+
+ ~__timepunct_cache();
+
+ void
+ _M_cache(const locale& __loc);
+
+ private:
+ __timepunct_cache&
+ operator=(const __timepunct_cache&);
+
+ explicit
+ __timepunct_cache(const __timepunct_cache&);
+ };
+
+ template<typename _CharT>
+ __timepunct_cache<_CharT>::~__timepunct_cache()
+ {
+ if (_M_allocated)
+ {
+ // Unused.
+ }
+ }
+
+ // Specializations.
+ template<>
+ const char*
+ __timepunct_cache<char>::_S_timezones[14];
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ const wchar_t*
+ __timepunct_cache<wchar_t>::_S_timezones[14];
+#endif
+
+ // Generic.
+ template<typename _CharT>
+ const _CharT* __timepunct_cache<_CharT>::_S_timezones[14];
+
+ template<typename _CharT>
+ class __timepunct : public locale::facet
+ {
+ public:
+ // Types:
+ typedef _CharT __char_type;
+ typedef basic_string<_CharT> __string_type;
+ typedef __timepunct_cache<_CharT> __cache_type;
+
+ protected:
+ __cache_type* _M_data;
+ __c_locale _M_c_locale_timepunct;
+ const char* _M_name_timepunct;
+
+ public:
+ /// Numpunct facet id.
+ static locale::id id;
+
+ explicit
+ __timepunct(size_t __refs = 0);
+
+ explicit
+ __timepunct(__cache_type* __cache, size_t __refs = 0);
+
+ /**
+ * @brief Internal constructor. Not for general use.
+ *
+ * This is a constructor for use by the library itself to set up new
+ * locales.
+ *
+ * @param cloc The "C" locale.
+ * @param s The name of a locale.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0);
+
+ // FIXME: for error checking purposes _M_put should return the return
+ // value of strftime/wcsftime.
+ void
+ _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format,
+ const tm* __tm) const;
+
+ void
+ _M_date_formats(const _CharT** __date) const
+ {
+ // Always have default first.
+ __date[0] = _M_data->_M_date_format;
+ __date[1] = _M_data->_M_date_era_format;
+ }
+
+ void
+ _M_time_formats(const _CharT** __time) const
+ {
+ // Always have default first.
+ __time[0] = _M_data->_M_time_format;
+ __time[1] = _M_data->_M_time_era_format;
+ }
+
+ void
+ _M_date_time_formats(const _CharT** __dt) const
+ {
+ // Always have default first.
+ __dt[0] = _M_data->_M_date_time_format;
+ __dt[1] = _M_data->_M_date_time_era_format;
+ }
+
+ void
+ _M_am_pm_format(const _CharT* __ampm) const
+ { __ampm = _M_data->_M_am_pm_format; }
+
+ void
+ _M_am_pm(const _CharT** __ampm) const
+ {
+ __ampm[0] = _M_data->_M_am;
+ __ampm[1] = _M_data->_M_pm;
+ }
+
+ void
+ _M_days(const _CharT** __days) const
+ {
+ __days[0] = _M_data->_M_day1;
+ __days[1] = _M_data->_M_day2;
+ __days[2] = _M_data->_M_day3;
+ __days[3] = _M_data->_M_day4;
+ __days[4] = _M_data->_M_day5;
+ __days[5] = _M_data->_M_day6;
+ __days[6] = _M_data->_M_day7;
+ }
+
+ void
+ _M_days_abbreviated(const _CharT** __days) const
+ {
+ __days[0] = _M_data->_M_aday1;
+ __days[1] = _M_data->_M_aday2;
+ __days[2] = _M_data->_M_aday3;
+ __days[3] = _M_data->_M_aday4;
+ __days[4] = _M_data->_M_aday5;
+ __days[5] = _M_data->_M_aday6;
+ __days[6] = _M_data->_M_aday7;
+ }
+
+ void
+ _M_months(const _CharT** __months) const
+ {
+ __months[0] = _M_data->_M_month01;
+ __months[1] = _M_data->_M_month02;
+ __months[2] = _M_data->_M_month03;
+ __months[3] = _M_data->_M_month04;
+ __months[4] = _M_data->_M_month05;
+ __months[5] = _M_data->_M_month06;
+ __months[6] = _M_data->_M_month07;
+ __months[7] = _M_data->_M_month08;
+ __months[8] = _M_data->_M_month09;
+ __months[9] = _M_data->_M_month10;
+ __months[10] = _M_data->_M_month11;
+ __months[11] = _M_data->_M_month12;
+ }
+
+ void
+ _M_months_abbreviated(const _CharT** __months) const
+ {
+ __months[0] = _M_data->_M_amonth01;
+ __months[1] = _M_data->_M_amonth02;
+ __months[2] = _M_data->_M_amonth03;
+ __months[3] = _M_data->_M_amonth04;
+ __months[4] = _M_data->_M_amonth05;
+ __months[5] = _M_data->_M_amonth06;
+ __months[6] = _M_data->_M_amonth07;
+ __months[7] = _M_data->_M_amonth08;
+ __months[8] = _M_data->_M_amonth09;
+ __months[9] = _M_data->_M_amonth10;
+ __months[10] = _M_data->_M_amonth11;
+ __months[11] = _M_data->_M_amonth12;
+ }
+
+ protected:
+ virtual
+ ~__timepunct();
+
+ // For use at construction time only.
+ void
+ _M_initialize_timepunct(__c_locale __cloc = NULL);
+ };
+
+ template<typename _CharT>
+ locale::id __timepunct<_CharT>::id;
+
+ // Specializations.
+ template<>
+ void
+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);
+
+ template<>
+ void
+ __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ void
+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);
+
+ template<>
+ void
+ __timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*,
+ const tm*) const;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+ // Include host and configuration specific timepunct functions.
+ #include <bits/time_members.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Facet for parsing dates and times.
+ *
+ * This facet encapsulates the code to parse and return a date or
+ * time from a string. It is used by the istream numeric
+ * extraction operators.
+ *
+ * The time_get template uses protected virtual functions to provide the
+ * actual results. The public accessors forward the call to the virtual
+ * functions. These virtual functions are hooks for developers to
+ * implement the behavior they require from the time_get facet.
+ */
+ template<typename _CharT, typename _InIter>
+ class time_get : public locale::facet, public time_base
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+ //@}
+ typedef basic_string<_CharT> __string_type;
+
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ time_get(size_t __refs = 0)
+ : facet (__refs) { }
+
+ /**
+ * @brief Return preferred order of month, day, and year.
+ *
+ * This function returns an enum from timebase::dateorder giving the
+ * preferred ordering if the format "x" given to time_put::put() only
+ * uses month, day, and year. If the format "x" for the associated
+ * locale uses other fields, this function returns
+ * timebase::dateorder::noorder.
+ *
+ * NOTE: The library always returns noorder at the moment.
+ *
+ * @return A member of timebase::dateorder.
+ */
+ dateorder
+ date_order() const
+ { return this->do_date_order(); }
+
+ /**
+ * @brief Parse input time string.
+ *
+ * This function parses a time according to the format "x" and puts the
+ * results into a user-supplied struct tm. The result is returned by
+ * calling time_get::do_get_time().
+ *
+ * If there is a valid time string according to format "x", @a tm will
+ * be filled in accordingly and the returned iterator will point to the
+ * first character beyond the time string. If an error occurs before
+ * the end, err |= ios_base::failbit. If parsing reads all the
+ * characters, err |= ios_base::eofbit.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond time string.
+ */
+ iter_type
+ get_time(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ { return this->do_get_time(__beg, __end, __io, __err, __tm); }
+
+ /**
+ * @brief Parse input date string.
+ *
+ * This function parses a date according to the format "X" and puts the
+ * results into a user-supplied struct tm. The result is returned by
+ * calling time_get::do_get_date().
+ *
+ * If there is a valid date string according to format "X", @a tm will
+ * be filled in accordingly and the returned iterator will point to the
+ * first character beyond the date string. If an error occurs before
+ * the end, err |= ios_base::failbit. If parsing reads all the
+ * characters, err |= ios_base::eofbit.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond date string.
+ */
+ iter_type
+ get_date(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ { return this->do_get_date(__beg, __end, __io, __err, __tm); }
+
+ /**
+ * @brief Parse input weekday string.
+ *
+ * This function parses a weekday name and puts the results into a
+ * user-supplied struct tm. The result is returned by calling
+ * time_get::do_get_weekday().
+ *
+ * Parsing starts by parsing an abbreviated weekday name. If a valid
+ * abbreviation is followed by a character that would lead to the full
+ * weekday name, parsing continues until the full name is found or an
+ * error occurs. Otherwise parsing finishes at the end of the
+ * abbreviated name.
+ *
+ * If an error occurs before the end, err |= ios_base::failbit. If
+ * parsing reads all the characters, err |= ios_base::eofbit.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond weekday name.
+ */
+ iter_type
+ get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ { return this->do_get_weekday(__beg, __end, __io, __err, __tm); }
+
+ /**
+ * @brief Parse input month string.
+ *
+ * This function parses a month name and puts the results into a
+ * user-supplied struct tm. The result is returned by calling
+ * time_get::do_get_monthname().
+ *
+ * Parsing starts by parsing an abbreviated month name. If a valid
+ * abbreviation is followed by a character that would lead to the full
+ * month name, parsing continues until the full name is found or an
+ * error occurs. Otherwise parsing finishes at the end of the
+ * abbreviated name.
+ *
+ * If an error occurs before the end, err |= ios_base::failbit. If
+ * parsing reads all the characters, err |=
+ * ios_base::eofbit.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond month name.
+ */
+ iter_type
+ get_monthname(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ { return this->do_get_monthname(__beg, __end, __io, __err, __tm); }
+
+ /**
+ * @brief Parse input year string.
+ *
+ * This function reads up to 4 characters to parse a year string and
+ * puts the results into a user-supplied struct tm. The result is
+ * returned by calling time_get::do_get_year().
+ *
+ * 4 consecutive digits are interpreted as a full year. If there are
+ * exactly 2 consecutive digits, the library interprets this as the
+ * number of years since 1900.
+ *
+ * If an error occurs before the end, err |= ios_base::failbit. If
+ * parsing reads all the characters, err |= ios_base::eofbit.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond year.
+ */
+ iter_type
+ get_year(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ { return this->do_get_year(__beg, __end, __io, __err, __tm); }
+
+ protected:
+ /// Destructor.
+ virtual
+ ~time_get() { }
+
+ /**
+ * @brief Return preferred order of month, day, and year.
+ *
+ * This function returns an enum from timebase::dateorder giving the
+ * preferred ordering if the format "x" given to time_put::put() only
+ * uses month, day, and year. This function is a hook for derived
+ * classes to change the value returned.
+ *
+ * @return A member of timebase::dateorder.
+ */
+ virtual dateorder
+ do_date_order() const;
+
+ /**
+ * @brief Parse input time string.
+ *
+ * This function parses a time according to the format "x" and puts the
+ * results into a user-supplied struct tm. This function is a hook for
+ * derived classes to change the value returned. @see get_time() for
+ * details.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond time string.
+ */
+ virtual iter_type
+ do_get_time(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const;
+
+ /**
+ * @brief Parse input date string.
+ *
+ * This function parses a date according to the format "X" and puts the
+ * results into a user-supplied struct tm. This function is a hook for
+ * derived classes to change the value returned. @see get_date() for
+ * details.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond date string.
+ */
+ virtual iter_type
+ do_get_date(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const;
+
+ /**
+ * @brief Parse input weekday string.
+ *
+ * This function parses a weekday name and puts the results into a
+ * user-supplied struct tm. This function is a hook for derived
+ * classes to change the value returned. @see get_weekday() for
+ * details.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond weekday name.
+ */
+ virtual iter_type
+ do_get_weekday(iter_type __beg, iter_type __end, ios_base&,
+ ios_base::iostate& __err, tm* __tm) const;
+
+ /**
+ * @brief Parse input month string.
+ *
+ * This function parses a month name and puts the results into a
+ * user-supplied struct tm. This function is a hook for derived
+ * classes to change the value returned. @see get_monthname() for
+ * details.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond month name.
+ */
+ virtual iter_type
+ do_get_monthname(iter_type __beg, iter_type __end, ios_base&,
+ ios_base::iostate& __err, tm* __tm) const;
+
+ /**
+ * @brief Parse input year string.
+ *
+ * This function reads up to 4 characters to parse a year string and
+ * puts the results into a user-supplied struct tm. This function is a
+ * hook for derived classes to change the value returned. @see
+ * get_year() for details.
+ *
+ * @param beg Start of string to parse.
+ * @param end End of string to parse.
+ * @param io Source of the locale.
+ * @param err Error flags to set.
+ * @param tm Pointer to struct tm to fill in.
+ * @return Iterator to first char beyond year.
+ */
+ virtual iter_type
+ do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const;
+
+ // Extract numeric component of length __len.
+ iter_type
+ _M_extract_num(iter_type __beg, iter_type __end, int& __member,
+ int __min, int __max, size_t __len,
+ ios_base& __io, ios_base::iostate& __err) const;
+
+ // Extract day or month name, or any unique array of string
+ // literals in a const _CharT* array.
+ iter_type
+ _M_extract_name(iter_type __beg, iter_type __end, int& __member,
+ const _CharT** __names, size_t __indexlen,
+ ios_base& __io, ios_base::iostate& __err) const;
+
+ // Extract on a component-by-component basis, via __format argument.
+ iter_type
+ _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm,
+ const _CharT* __format) const;
+ };
+
+ template<typename _CharT, typename _InIter>
+ locale::id time_get<_CharT, _InIter>::id;
+
+ /// class time_get_byname [22.2.5.2].
+ template<typename _CharT, typename _InIter>
+ class time_get_byname : public time_get<_CharT, _InIter>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+
+ explicit
+ time_get_byname(const char*, size_t __refs = 0)
+ : time_get<_CharT, _InIter>(__refs) { }
+
+ protected:
+ virtual
+ ~time_get_byname() { }
+ };
+
+ /**
+ * @brief Facet for outputting dates and times.
+ *
+ * This facet encapsulates the code to format and output dates and times
+ * according to formats used by strftime().
+ *
+ * The time_put template uses protected virtual functions to provide the
+ * actual results. The public accessors forward the call to the virtual
+ * functions. These virtual functions are hooks for developers to
+ * implement the behavior they require from the time_put facet.
+ */
+ template<typename _CharT, typename _OutIter>
+ class time_put : public locale::facet
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ //@}
+
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ time_put(size_t __refs = 0)
+ : facet(__refs) { }
+
+ /**
+ * @brief Format and output a time or date.
+ *
+ * This function formats the data in struct tm according to the
+ * provided format string. The format string is interpreted as by
+ * strftime().
+ *
+ * @param s The stream to write to.
+ * @param io Source of locale.
+ * @param fill char_type to use for padding.
+ * @param tm Struct tm with date and time info to format.
+ * @param beg Start of format string.
+ * @param end End of format string.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
+ const _CharT* __beg, const _CharT* __end) const;
+
+ /**
+ * @brief Format and output a time or date.
+ *
+ * This function formats the data in struct tm according to the
+ * provided format char and optional modifier. The format and modifier
+ * are interpreted as by strftime(). It does so by returning
+ * time_put::do_put().
+ *
+ * @param s The stream to write to.
+ * @param io Source of locale.
+ * @param fill char_type to use for padding.
+ * @param tm Struct tm with date and time info to format.
+ * @param format Format char.
+ * @param mod Optional modifier char.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, ios_base& __io, char_type __fill,
+ const tm* __tm, char __format, char __mod = 0) const
+ { return this->do_put(__s, __io, __fill, __tm, __format, __mod); }
+
+ protected:
+ /// Destructor.
+ virtual
+ ~time_put()
+ { }
+
+ /**
+ * @brief Format and output a time or date.
+ *
+ * This function formats the data in struct tm according to the
+ * provided format char and optional modifier. This function is a hook
+ * for derived classes to change the value returned. @see put() for
+ * more details.
+ *
+ * @param s The stream to write to.
+ * @param io Source of locale.
+ * @param fill char_type to use for padding.
+ * @param tm Struct tm with date and time info to format.
+ * @param format Format char.
+ * @param mod Optional modifier char.
+ * @return Iterator after writing.
+ */
+ virtual iter_type
+ do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
+ char __format, char __mod) const;
+ };
+
+ template<typename _CharT, typename _OutIter>
+ locale::id time_put<_CharT, _OutIter>::id;
+
+ /// class time_put_byname [22.2.5.4].
+ template<typename _CharT, typename _OutIter>
+ class time_put_byname : public time_put<_CharT, _OutIter>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+
+ explicit
+ time_put_byname(const char*, size_t __refs = 0)
+ : time_put<_CharT, _OutIter>(__refs)
+ { };
+
+ protected:
+ virtual
+ ~time_put_byname() { }
+ };
+
+
+ /**
+ * @brief Money format ordering data.
+ *
+ * This class contains an ordered array of 4 fields to represent the
+ * pattern for formatting a money amount. Each field may contain one entry
+ * from the part enum. symbol, sign, and value must be present and the
+ * remaining field must contain either none or space. @see
+ * moneypunct::pos_format() and moneypunct::neg_format() for details of how
+ * these fields are interpreted.
+ */
+ class money_base
+ {
+ public:
+ enum part { none, space, symbol, sign, value };
+ struct pattern { char field[4]; };
+
+ static const pattern _S_default_pattern;
+
+ enum
+ {
+ _S_minus,
+ _S_zero,
+ _S_end = 11
+ };
+
+ // String literal of acceptable (narrow) input/output, for
+ // money_get/money_put. "-0123456789"
+ static const char* _S_atoms;
+
+ // Construct and return valid pattern consisting of some combination of:
+ // space none symbol sign value
+ static pattern
+ _S_construct_pattern(char __precedes, char __space, char __posn);
+ };
+
+ template<typename _CharT, bool _Intl>
+ struct __moneypunct_cache : public locale::facet
+ {
+ const char* _M_grouping;
+ size_t _M_grouping_size;
+ bool _M_use_grouping;
+ _CharT _M_decimal_point;
+ _CharT _M_thousands_sep;
+ const _CharT* _M_curr_symbol;
+ size_t _M_curr_symbol_size;
+ const _CharT* _M_positive_sign;
+ size_t _M_positive_sign_size;
+ const _CharT* _M_negative_sign;
+ size_t _M_negative_sign_size;
+ int _M_frac_digits;
+ money_base::pattern _M_pos_format;
+ money_base::pattern _M_neg_format;
+
+ // A list of valid numeric literals for input and output: in the standard
+ // "C" locale, this is "-0123456789". This array contains the chars after
+ // having been passed through the current locale's ctype<_CharT>.widen().
+ _CharT _M_atoms[money_base::_S_end];
+
+ bool _M_allocated;
+
+ __moneypunct_cache(size_t __refs = 0) : facet(__refs),
+ _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),
+ _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()),
+ _M_curr_symbol(NULL), _M_curr_symbol_size(0),
+ _M_positive_sign(NULL), _M_positive_sign_size(0),
+ _M_negative_sign(NULL), _M_negative_sign_size(0),
+ _M_frac_digits(0),
+ _M_pos_format(money_base::pattern()),
+ _M_neg_format(money_base::pattern()), _M_allocated(false)
+ { }
+
+ ~__moneypunct_cache();
+
+ void
+ _M_cache(const locale& __loc);
+
+ private:
+ __moneypunct_cache&
+ operator=(const __moneypunct_cache&);
+
+ explicit
+ __moneypunct_cache(const __moneypunct_cache&);
+ };
+
+ template<typename _CharT, bool _Intl>
+ __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache()
+ {
+ if (_M_allocated)
+ {
+ delete [] _M_grouping;
+ delete [] _M_curr_symbol;
+ delete [] _M_positive_sign;
+ delete [] _M_negative_sign;
+ }
+ }
+
+ /**
+ * @brief Facet for formatting data for money amounts.
+ *
+ * This facet encapsulates the punctuation, grouping and other formatting
+ * features of money amount string representations.
+ */
+ template<typename _CharT, bool _Intl>
+ class moneypunct : public locale::facet, public money_base
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+ typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
+
+ private:
+ __cache_type* _M_data;
+
+ public:
+ /// This value is provided by the standard, but no reason for its
+ /// existence.
+ static const bool intl = _Intl;
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ moneypunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)
+ { _M_initialize_moneypunct(); }
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is an internal constructor.
+ *
+ * @param cache Cache for optimization.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ moneypunct(__cache_type* __cache, size_t __refs = 0)
+ : facet(__refs), _M_data(__cache)
+ { _M_initialize_moneypunct(); }
+
+ /**
+ * @brief Internal constructor. Not for general use.
+ *
+ * This is a constructor for use by the library itself to set up new
+ * locales.
+ *
+ * @param cloc The "C" locale.
+ * @param s The name of a locale.
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
+ : facet(__refs), _M_data(NULL)
+ { _M_initialize_moneypunct(__cloc, __s); }
+
+ /**
+ * @brief Return decimal point character.
+ *
+ * This function returns a char_type to use as a decimal point. It
+ * does so by returning returning
+ * moneypunct<char_type>::do_decimal_point().
+ *
+ * @return @a char_type representing a decimal point.
+ */
+ char_type
+ decimal_point() const
+ { return this->do_decimal_point(); }
+
+ /**
+ * @brief Return thousands separator character.
+ *
+ * This function returns a char_type to use as a thousands
+ * separator. It does so by returning returning
+ * moneypunct<char_type>::do_thousands_sep().
+ *
+ * @return char_type representing a thousands separator.
+ */
+ char_type
+ thousands_sep() const
+ { return this->do_thousands_sep(); }
+
+ /**
+ * @brief Return grouping specification.
+ *
+ * This function returns a string representing groupings for the
+ * integer part of an amount. Groupings indicate where thousands
+ * separators should be inserted.
+ *
+ * Each char in the return string is interpret as an integer rather
+ * than a character. These numbers represent the number of digits in a
+ * group. The first char in the string represents the number of digits
+ * in the least significant group. If a char is negative, it indicates
+ * an unlimited number of digits for the group. If more chars from the
+ * string are required to group a number, the last char is used
+ * repeatedly.
+ *
+ * For example, if the grouping() returns "\003\002" and is applied to
+ * the number 123456789, this corresponds to 12,34,56,789. Note that
+ * if the string was "32", this would put more than 50 digits into the
+ * least significant group if the character set is ASCII.
+ *
+ * The string is returned by calling
+ * moneypunct<char_type>::do_grouping().
+ *
+ * @return string representing grouping specification.
+ */
+ string
+ grouping() const
+ { return this->do_grouping(); }
+
+ /**
+ * @brief Return currency symbol string.
+ *
+ * This function returns a string_type to use as a currency symbol. It
+ * does so by returning returning
+ * moneypunct<char_type>::do_curr_symbol().
+ *
+ * @return @a string_type representing a currency symbol.
+ */
+ string_type
+ curr_symbol() const
+ { return this->do_curr_symbol(); }
+
+ /**
+ * @brief Return positive sign string.
+ *
+ * This function returns a string_type to use as a sign for positive
+ * amounts. It does so by returning returning
+ * moneypunct<char_type>::do_positive_sign().
+ *
+ * If the return value contains more than one character, the first
+ * character appears in the position indicated by pos_format() and the
+ * remainder appear at the end of the formatted string.
+ *
+ * @return @a string_type representing a positive sign.
+ */
+ string_type
+ positive_sign() const
+ { return this->do_positive_sign(); }
+
+ /**
+ * @brief Return negative sign string.
+ *
+ * This function returns a string_type to use as a sign for negative
+ * amounts. It does so by returning returning
+ * moneypunct<char_type>::do_negative_sign().
+ *
+ * If the return value contains more than one character, the first
+ * character appears in the position indicated by neg_format() and the
+ * remainder appear at the end of the formatted string.
+ *
+ * @return @a string_type representing a negative sign.
+ */
+ string_type
+ negative_sign() const
+ { return this->do_negative_sign(); }
+
+ /**
+ * @brief Return number of digits in fraction.
+ *
+ * This function returns the exact number of digits that make up the
+ * fractional part of a money amount. It does so by returning
+ * returning moneypunct<char_type>::do_frac_digits().
+ *
+ * The fractional part of a money amount is optional. But if it is
+ * present, there must be frac_digits() digits.
+ *
+ * @return Number of digits in amount fraction.
+ */
+ int
+ frac_digits() const
+ { return this->do_frac_digits(); }
+
+ //@{
+ /**
+ * @brief Return pattern for money values.
+ *
+ * This function returns a pattern describing the formatting of a
+ * positive or negative valued money amount. It does so by returning
+ * returning moneypunct<char_type>::do_pos_format() or
+ * moneypunct<char_type>::do_neg_format().
+ *
+ * The pattern has 4 fields describing the ordering of symbol, sign,
+ * value, and none or space. There must be one of each in the pattern.
+ * The none and space enums may not appear in the first field and space
+ * may not appear in the final field.
+ *
+ * The parts of a money string must appear in the order indicated by
+ * the fields of the pattern. The symbol field indicates that the
+ * value of curr_symbol() may be present. The sign field indicates
+ * that the value of positive_sign() or negative_sign() must be
+ * present. The value field indicates that the absolute value of the
+ * money amount is present. none indicates 0 or more whitespace
+ * characters, except at the end, where it permits no whitespace.
+ * space indicates that 1 or more whitespace characters must be
+ * present.
+ *
+ * For example, for the US locale and pos_format() pattern
+ * {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() ==
+ * '+', and value 10.01, and options set to force the symbol, the
+ * corresponding string is "$+10.01".
+ *
+ * @return Pattern for money values.
+ */
+ pattern
+ pos_format() const
+ { return this->do_pos_format(); }
+
+ pattern
+ neg_format() const
+ { return this->do_neg_format(); }
+ //@}
+
+ protected:
+ /// Destructor.
+ virtual
+ ~moneypunct();
+
+ /**
+ * @brief Return decimal point character.
+ *
+ * Returns a char_type to use as a decimal point. This function is a
+ * hook for derived classes to change the value returned.
+ *
+ * @return @a char_type representing a decimal point.
+ */
+ virtual char_type
+ do_decimal_point() const
+ { return _M_data->_M_decimal_point; }
+
+ /**
+ * @brief Return thousands separator character.
+ *
+ * Returns a char_type to use as a thousands separator. This function
+ * is a hook for derived classes to change the value returned.
+ *
+ * @return @a char_type representing a thousands separator.
+ */
+ virtual char_type
+ do_thousands_sep() const
+ { return _M_data->_M_thousands_sep; }
+
+ /**
+ * @brief Return grouping specification.
+ *
+ * Returns a string representing groupings for the integer part of a
+ * number. This function is a hook for derived classes to change the
+ * value returned. @see grouping() for details.
+ *
+ * @return String representing grouping specification.
+ */
+ virtual string
+ do_grouping() const
+ { return _M_data->_M_grouping; }
+
+ /**
+ * @brief Return currency symbol string.
+ *
+ * This function returns a string_type to use as a currency symbol.
+ * This function is a hook for derived classes to change the value
+ * returned. @see curr_symbol() for details.
+ *
+ * @return @a string_type representing a currency symbol.
+ */
+ virtual string_type
+ do_curr_symbol() const
+ { return _M_data->_M_curr_symbol; }
+
+ /**
+ * @brief Return positive sign string.
+ *
+ * This function returns a string_type to use as a sign for positive
+ * amounts. This function is a hook for derived classes to change the
+ * value returned. @see positive_sign() for details.
+ *
+ * @return @a string_type representing a positive sign.
+ */
+ virtual string_type
+ do_positive_sign() const
+ { return _M_data->_M_positive_sign; }
+
+ /**
+ * @brief Return negative sign string.
+ *
+ * This function returns a string_type to use as a sign for negative
+ * amounts. This function is a hook for derived classes to change the
+ * value returned. @see negative_sign() for details.
+ *
+ * @return @a string_type representing a negative sign.
+ */
+ virtual string_type
+ do_negative_sign() const
+ { return _M_data->_M_negative_sign; }
+
+ /**
+ * @brief Return number of digits in fraction.
+ *
+ * This function returns the exact number of digits that make up the
+ * fractional part of a money amount. This function is a hook for
+ * derived classes to change the value returned. @see frac_digits()
+ * for details.
+ *
+ * @return Number of digits in amount fraction.
+ */
+ virtual int
+ do_frac_digits() const
+ { return _M_data->_M_frac_digits; }
+
+ /**
+ * @brief Return pattern for money values.
+ *
+ * This function returns a pattern describing the formatting of a
+ * positive valued money amount. This function is a hook for derived
+ * classes to change the value returned. @see pos_format() for
+ * details.
+ *
+ * @return Pattern for money values.
+ */
+ virtual pattern
+ do_pos_format() const
+ { return _M_data->_M_pos_format; }
+
+ /**
+ * @brief Return pattern for money values.
+ *
+ * This function returns a pattern describing the formatting of a
+ * negative valued money amount. This function is a hook for derived
+ * classes to change the value returned. @see neg_format() for
+ * details.
+ *
+ * @return Pattern for money values.
+ */
+ virtual pattern
+ do_neg_format() const
+ { return _M_data->_M_neg_format; }
+
+ // For use at construction time only.
+ void
+ _M_initialize_moneypunct(__c_locale __cloc = NULL,
+ const char* __name = NULL);
+ };
+
+ template<typename _CharT, bool _Intl>
+ locale::id moneypunct<_CharT, _Intl>::id;
+
+ template<typename _CharT, bool _Intl>
+ const bool moneypunct<_CharT, _Intl>::intl;
+
+ template<>
+ moneypunct<char, true>::~moneypunct();
+
+ template<>
+ moneypunct<char, false>::~moneypunct();
+
+ template<>
+ void
+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);
+
+ template<>
+ void
+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ moneypunct<wchar_t, true>::~moneypunct();
+
+ template<>
+ moneypunct<wchar_t, false>::~moneypunct();
+
+ template<>
+ void
+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
+ const char*);
+
+ template<>
+ void
+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
+ const char*);
+#endif
+
+ /// class moneypunct_byname [22.2.6.4].
+ template<typename _CharT, bool _Intl>
+ class moneypunct_byname : public moneypunct<_CharT, _Intl>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ static const bool intl = _Intl;
+
+ explicit
+ moneypunct_byname(const char* __s, size_t __refs = 0)
+ : moneypunct<_CharT, _Intl>(__refs)
+ {
+ if (__builtin_strcmp(__s, "C") != 0
+ && __builtin_strcmp(__s, "POSIX") != 0)
+ {
+ __c_locale __tmp;
+ this->_S_create_c_locale(__tmp, __s);
+ this->_M_initialize_moneypunct(__tmp);
+ this->_S_destroy_c_locale(__tmp);
+ }
+ }
+
+ protected:
+ virtual
+ ~moneypunct_byname() { }
+ };
+
+ template<typename _CharT, bool _Intl>
+ const bool moneypunct_byname<_CharT, _Intl>::intl;
+
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+
+ /**
+ * @brief Facet for parsing monetary amounts.
+ *
+ * This facet encapsulates the code to parse and return a monetary
+ * amount from a string.
+ *
+ * The money_get template uses protected virtual functions to
+ * provide the actual results. The public accessors forward the
+ * call to the virtual functions. These virtual functions are
+ * hooks for developers to implement the behavior they require from
+ * the money_get facet.
+ */
+ template<typename _CharT, typename _InIter>
+ class money_get : public locale::facet
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _InIter iter_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ money_get(size_t __refs = 0) : facet(__refs) { }
+
+ /**
+ * @brief Read and parse a monetary value.
+ *
+ * This function reads characters from @a s, interprets them as a
+ * monetary value according to moneypunct and ctype facets retrieved
+ * from io.getloc(), and returns the result in @a units as an integral
+ * value moneypunct::frac_digits() * the actual amount. For example,
+ * the string $10.01 in a US locale would store 1001 in @a units.
+ *
+ * Any characters not part of a valid money amount are not consumed.
+ *
+ * If a money value cannot be parsed from the input stream, sets
+ * err=(err|io.failbit). If the stream is consumed before finishing
+ * parsing, sets err=(err|io.failbit|io.eofbit). @a units is
+ * unchanged if parsing fails.
+ *
+ * This function works by returning the result of do_get().
+ *
+ * @param s Start of characters to parse.
+ * @param end End of characters to parse.
+ * @param intl Parameter to use_facet<moneypunct<CharT,intl> >.
+ * @param io Source of facets and io state.
+ * @param err Error field to set if parsing fails.
+ * @param units Place to store result of parsing.
+ * @return Iterator referencing first character beyond valid money
+ * amount.
+ */
+ iter_type
+ get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, long double& __units) const
+ { return this->do_get(__s, __end, __intl, __io, __err, __units); }
+
+ /**
+ * @brief Read and parse a monetary value.
+ *
+ * This function reads characters from @a s, interprets them as a
+ * monetary value according to moneypunct and ctype facets retrieved
+ * from io.getloc(), and returns the result in @a digits. For example,
+ * the string $10.01 in a US locale would store "1001" in @a digits.
+ *
+ * Any characters not part of a valid money amount are not consumed.
+ *
+ * If a money value cannot be parsed from the input stream, sets
+ * err=(err|io.failbit). If the stream is consumed before finishing
+ * parsing, sets err=(err|io.failbit|io.eofbit).
+ *
+ * This function works by returning the result of do_get().
+ *
+ * @param s Start of characters to parse.
+ * @param end End of characters to parse.
+ * @param intl Parameter to use_facet<moneypunct<CharT,intl> >.
+ * @param io Source of facets and io state.
+ * @param err Error field to set if parsing fails.
+ * @param digits Place to store result of parsing.
+ * @return Iterator referencing first character beyond valid money
+ * amount.
+ */
+ iter_type
+ get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, string_type& __digits) const
+ { return this->do_get(__s, __end, __intl, __io, __err, __digits); }
+
+ protected:
+ /// Destructor.
+ virtual
+ ~money_get() { }
+
+ /**
+ * @brief Read and parse a monetary value.
+ *
+ * This function reads and parses characters representing a monetary
+ * value. This function is a hook for derived classes to change the
+ * value returned. @see get() for details.
+ */
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, double& __units) const;
+#else
+ virtual iter_type
+ do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, long double& __units) const;
+#endif
+
+ /**
+ * @brief Read and parse a monetary value.
+ *
+ * This function reads and parses characters representing a monetary
+ * value. This function is a hook for derived classes to change the
+ * value returned. @see get() for details.
+ */
+ virtual iter_type
+ do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, string_type& __digits) const;
+
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, long double& __units) const;
+#endif
+
+ template<bool _Intl>
+ iter_type
+ _M_extract(iter_type __s, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, string& __digits) const;
+ };
+
+ template<typename _CharT, typename _InIter>
+ locale::id money_get<_CharT, _InIter>::id;
+
+ /**
+ * @brief Facet for outputting monetary amounts.
+ *
+ * This facet encapsulates the code to format and output a monetary
+ * amount.
+ *
+ * The money_put template uses protected virtual functions to
+ * provide the actual results. The public accessors forward the
+ * call to the virtual functions. These virtual functions are
+ * hooks for developers to implement the behavior they require from
+ * the money_put facet.
+ */
+ template<typename _CharT, typename _OutIter>
+ class money_put : public locale::facet
+ {
+ public:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ money_put(size_t __refs = 0) : facet(__refs) { }
+
+ /**
+ * @brief Format and output a monetary value.
+ *
+ * This function formats @a units as a monetary value according to
+ * moneypunct and ctype facets retrieved from io.getloc(), and writes
+ * the resulting characters to @a s. For example, the value 1001 in a
+ * US locale would write "$10.01" to @a s.
+ *
+ * This function works by returning the result of do_put().
+ *
+ * @param s The stream to write to.
+ * @param intl Parameter to use_facet<moneypunct<CharT,intl> >.
+ * @param io Source of facets and io state.
+ * @param fill char_type to use for padding.
+ * @param units Place to store result of parsing.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, bool __intl, ios_base& __io,
+ char_type __fill, long double __units) const
+ { return this->do_put(__s, __intl, __io, __fill, __units); }
+
+ /**
+ * @brief Format and output a monetary value.
+ *
+ * This function formats @a digits as a monetary value according to
+ * moneypunct and ctype facets retrieved from io.getloc(), and writes
+ * the resulting characters to @a s. For example, the string "1001" in
+ * a US locale would write "$10.01" to @a s.
+ *
+ * This function works by returning the result of do_put().
+ *
+ * @param s The stream to write to.
+ * @param intl Parameter to use_facet<moneypunct<CharT,intl> >.
+ * @param io Source of facets and io state.
+ * @param fill char_type to use for padding.
+ * @param units Place to store result of parsing.
+ * @return Iterator after writing.
+ */
+ iter_type
+ put(iter_type __s, bool __intl, ios_base& __io,
+ char_type __fill, const string_type& __digits) const
+ { return this->do_put(__s, __intl, __io, __fill, __digits); }
+
+ protected:
+ /// Destructor.
+ virtual
+ ~money_put() { }
+
+ /**
+ * @brief Format and output a monetary value.
+ *
+ * This function formats @a units as a monetary value according to
+ * moneypunct and ctype facets retrieved from io.getloc(), and writes
+ * the resulting characters to @a s. For example, the value 1001 in a
+ * US locale would write "$10.01" to @a s.
+ *
+ * This function is a hook for derived classes to change the value
+ * returned. @see put().
+ *
+ * @param s The stream to write to.
+ * @param intl Parameter to use_facet<moneypunct<CharT,intl> >.
+ * @param io Source of facets and io state.
+ * @param fill char_type to use for padding.
+ * @param units Place to store result of parsing.
+ * @return Iterator after writing.
+ */
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ double __units) const;
+#else
+ virtual iter_type
+ do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ long double __units) const;
+#endif
+
+ /**
+ * @brief Format and output a monetary value.
+ *
+ * This function formats @a digits as a monetary value according to
+ * moneypunct and ctype facets retrieved from io.getloc(), and writes
+ * the resulting characters to @a s. For example, the string "1001" in
+ * a US locale would write "$10.01" to @a s.
+ *
+ * This function is a hook for derived classes to change the value
+ * returned. @see put().
+ *
+ * @param s The stream to write to.
+ * @param intl Parameter to use_facet<moneypunct<CharT,intl> >.
+ * @param io Source of facets and io state.
+ * @param fill char_type to use for padding.
+ * @param units Place to store result of parsing.
+ * @return Iterator after writing.
+ */
+ virtual iter_type
+ do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ const string_type& __digits) const;
+
+ // XXX GLIBCXX_ABI Deprecated
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ virtual iter_type
+ do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ long double __units) const;
+#endif
+
+ template<bool _Intl>
+ iter_type
+ _M_insert(iter_type __s, ios_base& __io, char_type __fill,
+ const string_type& __digits) const;
+ };
+
+ template<typename _CharT, typename _OutIter>
+ locale::id money_put<_CharT, _OutIter>::id;
+
+_GLIBCXX_END_LDBL_NAMESPACE
+
+ /**
+ * @brief Messages facet base class providing catalog typedef.
+ */
+ struct messages_base
+ {
+ typedef int catalog;
+ };
+
+ /**
+ * @brief Facet for handling message catalogs
+ *
+ * This facet encapsulates the code to retrieve messages from
+ * message catalogs. The only thing defined by the standard for this facet
+ * is the interface. All underlying functionality is
+ * implementation-defined.
+ *
+ * This library currently implements 3 versions of the message facet. The
+ * first version (gnu) is a wrapper around gettext, provided by libintl.
+ * The second version (ieee) is a wrapper around catgets. The final
+ * version (default) does no actual translation. These implementations are
+ * only provided for char and wchar_t instantiations.
+ *
+ * The messages template uses protected virtual functions to
+ * provide the actual results. The public accessors forward the
+ * call to the virtual functions. These virtual functions are
+ * hooks for developers to implement the behavior they require from
+ * the messages facet.
+ */
+ template<typename _CharT>
+ class messages : public locale::facet, public messages_base
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+ //@}
+
+ protected:
+ // Underlying "C" library locale information saved from
+ // initialization, needed by messages_byname as well.
+ __c_locale _M_c_locale_messages;
+ const char* _M_name_messages;
+
+ public:
+ /// Numpunct facet id.
+ static locale::id id;
+
+ /**
+ * @brief Constructor performs initialization.
+ *
+ * This is the constructor provided by the standard.
+ *
+ * @param refs Passed to the base facet class.
+ */
+ explicit
+ messages(size_t __refs = 0);
+
+ // Non-standard.
+ /**
+ * @brief Internal constructor. Not for general use.
+ *
+ * This is a constructor for use by the library itself to set up new
+ * locales.
+ *
+ * @param cloc The "C" locale.
+ * @param s The name of a locale.
+ * @param refs Refcount to pass to the base class.
+ */
+ explicit
+ messages(__c_locale __cloc, const char* __s, size_t __refs = 0);
+
+ /*
+ * @brief Open a message catalog.
+ *
+ * This function opens and returns a handle to a message catalog by
+ * returning do_open(s, loc).
+ *
+ * @param s The catalog to open.
+ * @param loc Locale to use for character set conversions.
+ * @return Handle to the catalog or value < 0 if open fails.
+ */
+ catalog
+ open(const basic_string<char>& __s, const locale& __loc) const
+ { return this->do_open(__s, __loc); }
+
+ // Non-standard and unorthodox, yet effective.
+ /*
+ * @brief Open a message catalog.
+ *
+ * This non-standard function opens and returns a handle to a message
+ * catalog by returning do_open(s, loc). The third argument provides a
+ * message catalog root directory for gnu gettext and is ignored
+ * otherwise.
+ *
+ * @param s The catalog to open.
+ * @param loc Locale to use for character set conversions.
+ * @param dir Message catalog root directory.
+ * @return Handle to the catalog or value < 0 if open fails.
+ */
+ catalog
+ open(const basic_string<char>&, const locale&, const char*) const;
+
+ /*
+ * @brief Look up a string in a message catalog.
+ *
+ * This function retrieves and returns a message from a catalog by
+ * returning do_get(c, set, msgid, s).
+ *
+ * For gnu, @a set and @a msgid are ignored. Returns gettext(s).
+ * For default, returns s. For ieee, returns catgets(c,set,msgid,s).
+ *
+ * @param c The catalog to access.
+ * @param set Implementation-defined.
+ * @param msgid Implementation-defined.
+ * @param s Default return value if retrieval fails.
+ * @return Retrieved message or @a s if get fails.
+ */
+ string_type
+ get(catalog __c, int __set, int __msgid, const string_type& __s) const
+ { return this->do_get(__c, __set, __msgid, __s); }
+
+ /*
+ * @brief Close a message catalog.
+ *
+ * Closes catalog @a c by calling do_close(c).
+ *
+ * @param c The catalog to close.
+ */
+ void
+ close(catalog __c) const
+ { return this->do_close(__c); }
+
+ protected:
+ /// Destructor.
+ virtual
+ ~messages();
+
+ /*
+ * @brief Open a message catalog.
+ *
+ * This function opens and returns a handle to a message catalog in an
+ * implementation-defined manner. This function is a hook for derived
+ * classes to change the value returned.
+ *
+ * @param s The catalog to open.
+ * @param loc Locale to use for character set conversions.
+ * @return Handle to the opened catalog, value < 0 if open failed.
+ */
+ virtual catalog
+ do_open(const basic_string<char>&, const locale&) const;
+
+ /*
+ * @brief Look up a string in a message catalog.
+ *
+ * This function retrieves and returns a message from a catalog in an
+ * implementation-defined manner. This function is a hook for derived
+ * classes to change the value returned.
+ *
+ * For gnu, @a set and @a msgid are ignored. Returns gettext(s).
+ * For default, returns s. For ieee, returns catgets(c,set,msgid,s).
+ *
+ * @param c The catalog to access.
+ * @param set Implementation-defined.
+ * @param msgid Implementation-defined.
+ * @param s Default return value if retrieval fails.
+ * @return Retrieved message or @a s if get fails.
+ */
+ virtual string_type
+ do_get(catalog, int, int, const string_type& __dfault) const;
+
+ /*
+ * @brief Close a message catalog.
+ *
+ * @param c The catalog to close.
+ */
+ virtual void
+ do_close(catalog) const;
+
+ // Returns a locale and codeset-converted string, given a char* message.
+ char*
+ _M_convert_to_char(const string_type& __msg) const
+ {
+ // XXX
+ return reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str()));
+ }
+
+ // Returns a locale and codeset-converted string, given a char* message.
+ string_type
+ _M_convert_from_char(char*) const
+ {
+#if 0
+ // Length of message string without terminating null.
+ size_t __len = char_traits<char>::length(__msg) - 1;
+
+ // "everybody can easily convert the string using
+ // mbsrtowcs/wcsrtombs or with iconv()"
+
+ // Convert char* to _CharT in locale used to open catalog.
+ // XXX need additional template parameter on messages class for this..
+ // typedef typename codecvt<char, _CharT, _StateT> __codecvt_type;
+ typedef typename codecvt<char, _CharT, mbstate_t> __codecvt_type;
+
+ __codecvt_type::state_type __state;
+ // XXX may need to initialize state.
+ //initialize_state(__state._M_init());
+
+ char* __from_next;
+ // XXX what size for this string?
+ _CharT* __to = static_cast<_CharT*>(__builtin_alloca(__len + 1));
+ const __codecvt_type& __cvt = use_facet<__codecvt_type>(_M_locale_conv);
+ __cvt.out(__state, __msg, __msg + __len, __from_next,
+ __to, __to + __len + 1, __to_next);
+ return string_type(__to);
+#endif
+#if 0
+ typedef ctype<_CharT> __ctype_type;
+ // const __ctype_type& __cvt = use_facet<__ctype_type>(_M_locale_msg);
+ const __ctype_type& __cvt = use_facet<__ctype_type>(locale());
+ // XXX Again, proper length of converted string an issue here.
+ // For now, assume the converted length is not larger.
+ _CharT* __dest = static_cast<_CharT*>(__builtin_alloca(__len + 1));
+ __cvt.widen(__msg, __msg + __len, __dest);
+ return basic_string<_CharT>(__dest);
+#endif
+ return string_type();
+ }
+ };
+
+ template<typename _CharT>
+ locale::id messages<_CharT>::id;
+
+ // Specializations for required instantiations.
+ template<>
+ string
+ messages<char>::do_get(catalog, int, int, const string&) const;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ wstring
+ messages<wchar_t>::do_get(catalog, int, int, const wstring&) const;
+#endif
+
+ /// class messages_byname [22.2.7.2].
+ template<typename _CharT>
+ class messages_byname : public messages<_CharT>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef basic_string<_CharT> string_type;
+
+ explicit
+ messages_byname(const char* __s, size_t __refs = 0);
+
+ protected:
+ virtual
+ ~messages_byname()
+ { }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+// Include host and configuration specific messages functions.
+#include <bits/messages_members.h>
+
+// 22.2.1.5 Template class codecvt
+#include <bits/codecvt.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/locale_facets_nonio.tcc>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.tcc
new file mode 100644
index 000000000..06bbfcf44
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -0,0 +1,1330 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale_facets_nonio.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _LOCALE_FACETS_NONIO_TCC
+#define _LOCALE_FACETS_NONIO_TCC 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, bool _Intl>
+ struct __use_cache<__moneypunct_cache<_CharT, _Intl> >
+ {
+ const __moneypunct_cache<_CharT, _Intl>*
+ operator() (const locale& __loc) const
+ {
+ const size_t __i = moneypunct<_CharT, _Intl>::id._M_id();
+ const locale::facet** __caches = __loc._M_impl->_M_caches;
+ if (!__caches[__i])
+ {
+ __moneypunct_cache<_CharT, _Intl>* __tmp = NULL;
+ __try
+ {
+ __tmp = new __moneypunct_cache<_CharT, _Intl>;
+ __tmp->_M_cache(__loc);
+ }
+ __catch(...)
+ {
+ delete __tmp;
+ __throw_exception_again;
+ }
+ __loc._M_impl->_M_install_cache(__tmp, __i);
+ }
+ return static_cast<
+ const __moneypunct_cache<_CharT, _Intl>*>(__caches[__i]);
+ }
+ };
+
+ template<typename _CharT, bool _Intl>
+ void
+ __moneypunct_cache<_CharT, _Intl>::_M_cache(const locale& __loc)
+ {
+ _M_allocated = true;
+
+ const moneypunct<_CharT, _Intl>& __mp =
+ use_facet<moneypunct<_CharT, _Intl> >(__loc);
+
+ _M_grouping_size = __mp.grouping().size();
+ char* __grouping = new char[_M_grouping_size];
+ __mp.grouping().copy(__grouping, _M_grouping_size);
+ _M_grouping = __grouping;
+ _M_use_grouping = (_M_grouping_size
+ && static_cast<signed char>(_M_grouping[0]) > 0
+ && (_M_grouping[0]
+ != __gnu_cxx::__numeric_traits<char>::__max));
+
+ _M_decimal_point = __mp.decimal_point();
+ _M_thousands_sep = __mp.thousands_sep();
+ _M_frac_digits = __mp.frac_digits();
+
+ _M_curr_symbol_size = __mp.curr_symbol().size();
+ _CharT* __curr_symbol = new _CharT[_M_curr_symbol_size];
+ __mp.curr_symbol().copy(__curr_symbol, _M_curr_symbol_size);
+ _M_curr_symbol = __curr_symbol;
+
+ _M_positive_sign_size = __mp.positive_sign().size();
+ _CharT* __positive_sign = new _CharT[_M_positive_sign_size];
+ __mp.positive_sign().copy(__positive_sign, _M_positive_sign_size);
+ _M_positive_sign = __positive_sign;
+
+ _M_negative_sign_size = __mp.negative_sign().size();
+ _CharT* __negative_sign = new _CharT[_M_negative_sign_size];
+ __mp.negative_sign().copy(__negative_sign, _M_negative_sign_size);
+ _M_negative_sign = __negative_sign;
+
+ _M_pos_format = __mp.pos_format();
+ _M_neg_format = __mp.neg_format();
+
+ const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);
+ __ct.widen(money_base::_S_atoms,
+ money_base::_S_atoms + money_base::_S_end, _M_atoms);
+ }
+
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+
+ template<typename _CharT, typename _InIter>
+ template<bool _Intl>
+ _InIter
+ money_get<_CharT, _InIter>::
+ _M_extract(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, string& __units) const
+ {
+ typedef char_traits<_CharT> __traits_type;
+ typedef typename string_type::size_type size_type;
+ typedef money_base::part part;
+ typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
+
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ __use_cache<__cache_type> __uc;
+ const __cache_type* __lc = __uc(__loc);
+ const char_type* __lit = __lc->_M_atoms;
+
+ // Deduced sign.
+ bool __negative = false;
+ // Sign size.
+ size_type __sign_size = 0;
+ // True if sign is mandatory.
+ const bool __mandatory_sign = (__lc->_M_positive_sign_size
+ && __lc->_M_negative_sign_size);
+ // String of grouping info from thousands_sep plucked from __units.
+ string __grouping_tmp;
+ if (__lc->_M_use_grouping)
+ __grouping_tmp.reserve(32);
+ // Last position before the decimal point.
+ int __last_pos = 0;
+ // Separator positions, then, possibly, fractional digits.
+ int __n = 0;
+ // If input iterator is in a valid state.
+ bool __testvalid = true;
+ // Flag marking when a decimal point is found.
+ bool __testdecfound = false;
+
+ // The tentative returned string is stored here.
+ string __res;
+ __res.reserve(32);
+
+ const char_type* __lit_zero = __lit + money_base::_S_zero;
+ const money_base::pattern __p = __lc->_M_neg_format;
+ for (int __i = 0; __i < 4 && __testvalid; ++__i)
+ {
+ const part __which = static_cast<part>(__p.field[__i]);
+ switch (__which)
+ {
+ case money_base::symbol:
+ // According to 22.2.6.1.2, p2, symbol is required
+ // if (__io.flags() & ios_base::showbase), otherwise
+ // is optional and consumed only if other characters
+ // are needed to complete the format.
+ if (__io.flags() & ios_base::showbase || __sign_size > 1
+ || __i == 0
+ || (__i == 1 && (__mandatory_sign
+ || (static_cast<part>(__p.field[0])
+ == money_base::sign)
+ || (static_cast<part>(__p.field[2])
+ == money_base::space)))
+ || (__i == 2 && ((static_cast<part>(__p.field[3])
+ == money_base::value)
+ || (__mandatory_sign
+ && (static_cast<part>(__p.field[3])
+ == money_base::sign)))))
+ {
+ const size_type __len = __lc->_M_curr_symbol_size;
+ size_type __j = 0;
+ for (; __beg != __end && __j < __len
+ && *__beg == __lc->_M_curr_symbol[__j];
+ ++__beg, ++__j);
+ if (__j != __len
+ && (__j || __io.flags() & ios_base::showbase))
+ __testvalid = false;
+ }
+ break;
+ case money_base::sign:
+ // Sign might not exist, or be more than one character long.
+ if (__lc->_M_positive_sign_size && __beg != __end
+ && *__beg == __lc->_M_positive_sign[0])
+ {
+ __sign_size = __lc->_M_positive_sign_size;
+ ++__beg;
+ }
+ else if (__lc->_M_negative_sign_size && __beg != __end
+ && *__beg == __lc->_M_negative_sign[0])
+ {
+ __negative = true;
+ __sign_size = __lc->_M_negative_sign_size;
+ ++__beg;
+ }
+ else if (__lc->_M_positive_sign_size
+ && !__lc->_M_negative_sign_size)
+ // "... if no sign is detected, the result is given the sign
+ // that corresponds to the source of the empty string"
+ __negative = true;
+ else if (__mandatory_sign)
+ __testvalid = false;
+ break;
+ case money_base::value:
+ // Extract digits, remove and stash away the
+ // grouping of found thousands separators.
+ for (; __beg != __end; ++__beg)
+ {
+ const char_type __c = *__beg;
+ const char_type* __q = __traits_type::find(__lit_zero,
+ 10, __c);
+ if (__q != 0)
+ {
+ __res += money_base::_S_atoms[__q - __lit];
+ ++__n;
+ }
+ else if (__c == __lc->_M_decimal_point
+ && !__testdecfound)
+ {
+ if (__lc->_M_frac_digits <= 0)
+ break;
+
+ __last_pos = __n;
+ __n = 0;
+ __testdecfound = true;
+ }
+ else if (__lc->_M_use_grouping
+ && __c == __lc->_M_thousands_sep
+ && !__testdecfound)
+ {
+ if (__n)
+ {
+ // Mark position for later analysis.
+ __grouping_tmp += static_cast<char>(__n);
+ __n = 0;
+ }
+ else
+ {
+ __testvalid = false;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ if (__res.empty())
+ __testvalid = false;
+ break;
+ case money_base::space:
+ // At least one space is required.
+ if (__beg != __end && __ctype.is(ctype_base::space, *__beg))
+ ++__beg;
+ else
+ __testvalid = false;
+ case money_base::none:
+ // Only if not at the end of the pattern.
+ if (__i != 3)
+ for (; __beg != __end
+ && __ctype.is(ctype_base::space, *__beg); ++__beg);
+ break;
+ }
+ }
+
+ // Need to get the rest of the sign characters, if they exist.
+ if (__sign_size > 1 && __testvalid)
+ {
+ const char_type* __sign = __negative ? __lc->_M_negative_sign
+ : __lc->_M_positive_sign;
+ size_type __i = 1;
+ for (; __beg != __end && __i < __sign_size
+ && *__beg == __sign[__i]; ++__beg, ++__i);
+
+ if (__i != __sign_size)
+ __testvalid = false;
+ }
+
+ if (__testvalid)
+ {
+ // Strip leading zeros.
+ if (__res.size() > 1)
+ {
+ const size_type __first = __res.find_first_not_of('0');
+ const bool __only_zeros = __first == string::npos;
+ if (__first)
+ __res.erase(0, __only_zeros ? __res.size() - 1 : __first);
+ }
+
+ // 22.2.6.1.2, p4
+ if (__negative && __res[0] != '0')
+ __res.insert(__res.begin(), '-');
+
+ // Test for grouping fidelity.
+ if (__grouping_tmp.size())
+ {
+ // Add the ending grouping.
+ __grouping_tmp += static_cast<char>(__testdecfound ? __last_pos
+ : __n);
+ if (!std::__verify_grouping(__lc->_M_grouping,
+ __lc->_M_grouping_size,
+ __grouping_tmp))
+ __err |= ios_base::failbit;
+ }
+
+ // Iff not enough digits were supplied after the decimal-point.
+ if (__testdecfound && __n != __lc->_M_frac_digits)
+ __testvalid = false;
+ }
+
+ // Iff valid sequence is not recognized.
+ if (!__testvalid)
+ __err |= ios_base::failbit;
+ else
+ __units.swap(__res);
+
+ // Iff no more characters are available.
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ template<typename _CharT, typename _InIter>
+ _InIter
+ money_get<_CharT, _InIter>::
+ __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, double& __units) const
+ {
+ string __str;
+ __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
+ : _M_extract<false>(__beg, __end, __io, __err, __str);
+ std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
+ return __beg;
+ }
+#endif
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ money_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, long double& __units) const
+ {
+ string __str;
+ __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
+ : _M_extract<false>(__beg, __end, __io, __err, __str);
+ std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ money_get<_CharT, _InIter>::
+ do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,
+ ios_base::iostate& __err, string_type& __digits) const
+ {
+ typedef typename string::size_type size_type;
+
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ string __str;
+ __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)
+ : _M_extract<false>(__beg, __end, __io, __err, __str);
+ const size_type __len = __str.size();
+ if (__len)
+ {
+ __digits.resize(__len);
+ __ctype.widen(__str.data(), __str.data() + __len, &__digits[0]);
+ }
+ return __beg;
+ }
+
+ template<typename _CharT, typename _OutIter>
+ template<bool _Intl>
+ _OutIter
+ money_put<_CharT, _OutIter>::
+ _M_insert(iter_type __s, ios_base& __io, char_type __fill,
+ const string_type& __digits) const
+ {
+ typedef typename string_type::size_type size_type;
+ typedef money_base::part part;
+ typedef __moneypunct_cache<_CharT, _Intl> __cache_type;
+
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ __use_cache<__cache_type> __uc;
+ const __cache_type* __lc = __uc(__loc);
+ const char_type* __lit = __lc->_M_atoms;
+
+ // Determine if negative or positive formats are to be used, and
+ // discard leading negative_sign if it is present.
+ const char_type* __beg = __digits.data();
+
+ money_base::pattern __p;
+ const char_type* __sign;
+ size_type __sign_size;
+ if (!(*__beg == __lit[money_base::_S_minus]))
+ {
+ __p = __lc->_M_pos_format;
+ __sign = __lc->_M_positive_sign;
+ __sign_size = __lc->_M_positive_sign_size;
+ }
+ else
+ {
+ __p = __lc->_M_neg_format;
+ __sign = __lc->_M_negative_sign;
+ __sign_size = __lc->_M_negative_sign_size;
+ if (__digits.size())
+ ++__beg;
+ }
+
+ // Look for valid numbers in the ctype facet within input digits.
+ size_type __len = __ctype.scan_not(ctype_base::digit, __beg,
+ __beg + __digits.size()) - __beg;
+ if (__len)
+ {
+ // Assume valid input, and attempt to format.
+ // Break down input numbers into base components, as follows:
+ // final_value = grouped units + (decimal point) + (digits)
+ string_type __value;
+ __value.reserve(2 * __len);
+
+ // Add thousands separators to non-decimal digits, per
+ // grouping rules.
+ long __paddec = __len - __lc->_M_frac_digits;
+ if (__paddec > 0)
+ {
+ if (__lc->_M_frac_digits < 0)
+ __paddec = __len;
+ if (__lc->_M_grouping_size)
+ {
+ __value.assign(2 * __paddec, char_type());
+ _CharT* __vend =
+ std::__add_grouping(&__value[0], __lc->_M_thousands_sep,
+ __lc->_M_grouping,
+ __lc->_M_grouping_size,
+ __beg, __beg + __paddec);
+ __value.erase(__vend - &__value[0]);
+ }
+ else
+ __value.assign(__beg, __paddec);
+ }
+
+ // Deal with decimal point, decimal digits.
+ if (__lc->_M_frac_digits > 0)
+ {
+ __value += __lc->_M_decimal_point;
+ if (__paddec >= 0)
+ __value.append(__beg + __paddec, __lc->_M_frac_digits);
+ else
+ {
+ // Have to pad zeros in the decimal position.
+ __value.append(-__paddec, __lit[money_base::_S_zero]);
+ __value.append(__beg, __len);
+ }
+ }
+
+ // Calculate length of resulting string.
+ const ios_base::fmtflags __f = __io.flags()
+ & ios_base::adjustfield;
+ __len = __value.size() + __sign_size;
+ __len += ((__io.flags() & ios_base::showbase)
+ ? __lc->_M_curr_symbol_size : 0);
+
+ string_type __res;
+ __res.reserve(2 * __len);
+
+ const size_type __width = static_cast<size_type>(__io.width());
+ const bool __testipad = (__f == ios_base::internal
+ && __len < __width);
+ // Fit formatted digits into the required pattern.
+ for (int __i = 0; __i < 4; ++__i)
+ {
+ const part __which = static_cast<part>(__p.field[__i]);
+ switch (__which)
+ {
+ case money_base::symbol:
+ if (__io.flags() & ios_base::showbase)
+ __res.append(__lc->_M_curr_symbol,
+ __lc->_M_curr_symbol_size);
+ break;
+ case money_base::sign:
+ // Sign might not exist, or be more than one
+ // character long. In that case, add in the rest
+ // below.
+ if (__sign_size)
+ __res += __sign[0];
+ break;
+ case money_base::value:
+ __res += __value;
+ break;
+ case money_base::space:
+ // At least one space is required, but if internal
+ // formatting is required, an arbitrary number of
+ // fill spaces will be necessary.
+ if (__testipad)
+ __res.append(__width - __len, __fill);
+ else
+ __res += __fill;
+ break;
+ case money_base::none:
+ if (__testipad)
+ __res.append(__width - __len, __fill);
+ break;
+ }
+ }
+
+ // Special case of multi-part sign parts.
+ if (__sign_size > 1)
+ __res.append(__sign + 1, __sign_size - 1);
+
+ // Pad, if still necessary.
+ __len = __res.size();
+ if (__width > __len)
+ {
+ if (__f == ios_base::left)
+ // After.
+ __res.append(__width - __len, __fill);
+ else
+ // Before.
+ __res.insert(0, __width - __len, __fill);
+ __len = __width;
+ }
+
+ // Write resulting, fully-formatted string to output iterator.
+ __s = std::__write(__s, __res.data(), __len);
+ }
+ __io.width(0);
+ return __s;
+ }
+
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ money_put<_CharT, _OutIter>::
+ __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ double __units) const
+ { return this->do_put(__s, __intl, __io, __fill, (long double) __units); }
+#endif
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ money_put<_CharT, _OutIter>::
+ do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ long double __units) const
+ {
+ const locale __loc = __io.getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+#ifdef _GLIBCXX_USE_C99
+ // First try a buffer perhaps big enough.
+ int __cs_size = 64;
+ char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 328. Bad sprintf format modifier in money_put<>::do_put()
+ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ "%.*Lf", 0, __units);
+ // If the buffer was not large enough, try again with the correct size.
+ if (__len >= __cs_size)
+ {
+ __cs_size = __len + 1;
+ __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,
+ "%.*Lf", 0, __units);
+ }
+#else
+ // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
+ const int __cs_size =
+ __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 3;
+ char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
+ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
+ 0, __units);
+#endif
+ string_type __digits(__len, char_type());
+ __ctype.widen(__cs, __cs + __len, &__digits[0]);
+ return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
+ : _M_insert<false>(__s, __io, __fill, __digits);
+ }
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ money_put<_CharT, _OutIter>::
+ do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
+ const string_type& __digits) const
+ { return __intl ? _M_insert<true>(__s, __io, __fill, __digits)
+ : _M_insert<false>(__s, __io, __fill, __digits); }
+
+_GLIBCXX_END_LDBL_NAMESPACE
+
+ // NB: Not especially useful. Without an ios_base object or some
+ // kind of locale reference, we are left clawing at the air where
+ // the side of the mountain used to be...
+ template<typename _CharT, typename _InIter>
+ time_base::dateorder
+ time_get<_CharT, _InIter>::do_date_order() const
+ { return time_base::no_order; }
+
+ // Expand a strftime format string and parse it. E.g., do_get_date() may
+ // pass %m/%d/%Y => extracted characters.
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm,
+ const _CharT* __format) const
+ {
+ const locale& __loc = __io._M_getloc();
+ const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+ const size_t __len = char_traits<_CharT>::length(__format);
+
+ ios_base::iostate __tmperr = ios_base::goodbit;
+ for (size_t __i = 0; __beg != __end && __i < __len && !__tmperr; ++__i)
+ {
+ if (__ctype.narrow(__format[__i], 0) == '%')
+ {
+ // Verify valid formatting code, attempt to extract.
+ char __c = __ctype.narrow(__format[++__i], 0);
+ int __mem = 0;
+ if (__c == 'E' || __c == 'O')
+ __c = __ctype.narrow(__format[++__i], 0);
+ switch (__c)
+ {
+ const char* __cs;
+ _CharT __wcs[10];
+ case 'a':
+ // Abbreviated weekday name [tm_wday]
+ const char_type* __days1[7];
+ __tp._M_days_abbreviated(__days1);
+ __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1,
+ 7, __io, __tmperr);
+ break;
+ case 'A':
+ // Weekday name [tm_wday].
+ const char_type* __days2[7];
+ __tp._M_days(__days2);
+ __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2,
+ 7, __io, __tmperr);
+ break;
+ case 'h':
+ case 'b':
+ // Abbreviated month name [tm_mon]
+ const char_type* __months1[12];
+ __tp._M_months_abbreviated(__months1);
+ __beg = _M_extract_name(__beg, __end, __tm->tm_mon,
+ __months1, 12, __io, __tmperr);
+ break;
+ case 'B':
+ // Month name [tm_mon].
+ const char_type* __months2[12];
+ __tp._M_months(__months2);
+ __beg = _M_extract_name(__beg, __end, __tm->tm_mon,
+ __months2, 12, __io, __tmperr);
+ break;
+ case 'c':
+ // Default time and date representation.
+ const char_type* __dt[2];
+ __tp._M_date_time_formats(__dt);
+ __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
+ __tm, __dt[0]);
+ break;
+ case 'd':
+ // Day [01, 31]. [tm_mday]
+ __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2,
+ __io, __tmperr);
+ break;
+ case 'e':
+ // Day [1, 31], with single digits preceded by
+ // space. [tm_mday]
+ if (__ctype.is(ctype_base::space, *__beg))
+ __beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9,
+ 1, __io, __tmperr);
+ else
+ __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31,
+ 2, __io, __tmperr);
+ break;
+ case 'D':
+ // Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year]
+ __cs = "%m/%d/%y";
+ __ctype.widen(__cs, __cs + 9, __wcs);
+ __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
+ __tm, __wcs);
+ break;
+ case 'H':
+ // Hour [00, 23]. [tm_hour]
+ __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2,
+ __io, __tmperr);
+ break;
+ case 'I':
+ // Hour [01, 12]. [tm_hour]
+ __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2,
+ __io, __tmperr);
+ break;
+ case 'm':
+ // Month [01, 12]. [tm_mon]
+ __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2,
+ __io, __tmperr);
+ if (!__tmperr)
+ __tm->tm_mon = __mem - 1;
+ break;
+ case 'M':
+ // Minute [00, 59]. [tm_min]
+ __beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2,
+ __io, __tmperr);
+ break;
+ case 'n':
+ if (__ctype.narrow(*__beg, 0) == '\n')
+ ++__beg;
+ else
+ __tmperr |= ios_base::failbit;
+ break;
+ case 'R':
+ // Equivalent to (%H:%M).
+ __cs = "%H:%M";
+ __ctype.widen(__cs, __cs + 6, __wcs);
+ __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
+ __tm, __wcs);
+ break;
+ case 'S':
+ // Seconds. [tm_sec]
+ // [00, 60] in C99 (one leap-second), [00, 61] in C89.
+#ifdef _GLIBCXX_USE_C99
+ __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2,
+#else
+ __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2,
+#endif
+ __io, __tmperr);
+ break;
+ case 't':
+ if (__ctype.narrow(*__beg, 0) == '\t')
+ ++__beg;
+ else
+ __tmperr |= ios_base::failbit;
+ break;
+ case 'T':
+ // Equivalent to (%H:%M:%S).
+ __cs = "%H:%M:%S";
+ __ctype.widen(__cs, __cs + 9, __wcs);
+ __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
+ __tm, __wcs);
+ break;
+ case 'x':
+ // Locale's date.
+ const char_type* __dates[2];
+ __tp._M_date_formats(__dates);
+ __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
+ __tm, __dates[0]);
+ break;
+ case 'X':
+ // Locale's time.
+ const char_type* __times[2];
+ __tp._M_time_formats(__times);
+ __beg = _M_extract_via_format(__beg, __end, __io, __tmperr,
+ __tm, __times[0]);
+ break;
+ case 'y':
+ case 'C': // C99
+ // Two digit year. [tm_year]
+ __beg = _M_extract_num(__beg, __end, __tm->tm_year, 0, 99, 2,
+ __io, __tmperr);
+ break;
+ case 'Y':
+ // Year [1900). [tm_year]
+ __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,
+ __io, __tmperr);
+ if (!__tmperr)
+ __tm->tm_year = __mem - 1900;
+ break;
+ case 'Z':
+ // Timezone info.
+ if (__ctype.is(ctype_base::upper, *__beg))
+ {
+ int __tmp;
+ __beg = _M_extract_name(__beg, __end, __tmp,
+ __timepunct_cache<_CharT>::_S_timezones,
+ 14, __io, __tmperr);
+
+ // GMT requires special effort.
+ if (__beg != __end && !__tmperr && __tmp == 0
+ && (*__beg == __ctype.widen('-')
+ || *__beg == __ctype.widen('+')))
+ {
+ __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,
+ __io, __tmperr);
+ __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,
+ __io, __tmperr);
+ }
+ }
+ else
+ __tmperr |= ios_base::failbit;
+ break;
+ default:
+ // Not recognized.
+ __tmperr |= ios_base::failbit;
+ }
+ }
+ else
+ {
+ // Verify format and input match, extract and discard.
+ if (__format[__i] == *__beg)
+ ++__beg;
+ else
+ __tmperr |= ios_base::failbit;
+ }
+ }
+
+ if (__tmperr)
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ _M_extract_num(iter_type __beg, iter_type __end, int& __member,
+ int __min, int __max, size_t __len,
+ ios_base& __io, ios_base::iostate& __err) const
+ {
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ // As-is works for __len = 1, 2, 4, the values actually used.
+ int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1);
+
+ ++__min;
+ size_t __i = 0;
+ int __value = 0;
+ for (; __beg != __end && __i < __len; ++__beg, ++__i)
+ {
+ const char __c = __ctype.narrow(*__beg, '*');
+ if (__c >= '0' && __c <= '9')
+ {
+ __value = __value * 10 + (__c - '0');
+ const int __valuec = __value * __mult;
+ if (__valuec > __max || __valuec + __mult < __min)
+ break;
+ __mult /= 10;
+ }
+ else
+ break;
+ }
+ if (__i == __len)
+ __member = __value;
+ else
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ // Assumptions:
+ // All elements in __names are unique.
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ _M_extract_name(iter_type __beg, iter_type __end, int& __member,
+ const _CharT** __names, size_t __indexlen,
+ ios_base& __io, ios_base::iostate& __err) const
+ {
+ typedef char_traits<_CharT> __traits_type;
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ int* __matches = static_cast<int*>(__builtin_alloca(sizeof(int)
+ * __indexlen));
+ size_t __nmatches = 0;
+ size_t __pos = 0;
+ bool __testvalid = true;
+ const char_type* __name;
+
+ // Look for initial matches.
+ // NB: Some of the locale data is in the form of all lowercase
+ // names, and some is in the form of initially-capitalized
+ // names. Look for both.
+ if (__beg != __end)
+ {
+ const char_type __c = *__beg;
+ for (size_t __i1 = 0; __i1 < __indexlen; ++__i1)
+ if (__c == __names[__i1][0]
+ || __c == __ctype.toupper(__names[__i1][0]))
+ __matches[__nmatches++] = __i1;
+ }
+
+ while (__nmatches > 1)
+ {
+ // Find smallest matching string.
+ size_t __minlen = __traits_type::length(__names[__matches[0]]);
+ for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)
+ __minlen = std::min(__minlen,
+ __traits_type::length(__names[__matches[__i2]]));
+ ++__beg, ++__pos;
+ if (__pos < __minlen && __beg != __end)
+ for (size_t __i3 = 0; __i3 < __nmatches;)
+ {
+ __name = __names[__matches[__i3]];
+ if (!(__name[__pos] == *__beg))
+ __matches[__i3] = __matches[--__nmatches];
+ else
+ ++__i3;
+ }
+ else
+ break;
+ }
+
+ if (__nmatches == 1)
+ {
+ // Make sure found name is completely extracted.
+ ++__beg, ++__pos;
+ __name = __names[__matches[0]];
+ const size_t __len = __traits_type::length(__name);
+ while (__pos < __len && __beg != __end && __name[__pos] == *__beg)
+ ++__beg, ++__pos;
+
+ if (__len == __pos)
+ __member = __matches[0];
+ else
+ __testvalid = false;
+ }
+ else
+ __testvalid = false;
+ if (!__testvalid)
+ __err |= ios_base::failbit;
+
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_time(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ {
+ const locale& __loc = __io._M_getloc();
+ const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
+ const char_type* __times[2];
+ __tp._M_time_formats(__times);
+ __beg = _M_extract_via_format(__beg, __end, __io, __err,
+ __tm, __times[0]);
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_date(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ {
+ const locale& __loc = __io._M_getloc();
+ const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
+ const char_type* __dates[2];
+ __tp._M_date_formats(__dates);
+ __beg = _M_extract_via_format(__beg, __end, __io, __err,
+ __tm, __dates[0]);
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ {
+ typedef char_traits<_CharT> __traits_type;
+ const locale& __loc = __io._M_getloc();
+ const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+ const char_type* __days[7];
+ __tp._M_days_abbreviated(__days);
+ int __tmpwday;
+ ios_base::iostate __tmperr = ios_base::goodbit;
+ __beg = _M_extract_name(__beg, __end, __tmpwday, __days, 7,
+ __io, __tmperr);
+
+ // Check to see if non-abbreviated name exists, and extract.
+ // NB: Assumes both _M_days and _M_days_abbreviated organized in
+ // exact same order, first to last, such that the resulting
+ // __days array with the same index points to a day, and that
+ // day's abbreviated form.
+ // NB: Also assumes that an abbreviated name is a subset of the name.
+ if (!__tmperr && __beg != __end)
+ {
+ size_t __pos = __traits_type::length(__days[__tmpwday]);
+ __tp._M_days(__days);
+ const char_type* __name = __days[__tmpwday];
+ if (__name[__pos] == *__beg)
+ {
+ // Extract the rest of it.
+ const size_t __len = __traits_type::length(__name);
+ while (__pos < __len && __beg != __end
+ && __name[__pos] == *__beg)
+ ++__beg, ++__pos;
+ if (__len != __pos)
+ __tmperr |= ios_base::failbit;
+ }
+ }
+ if (!__tmperr)
+ __tm->tm_wday = __tmpwday;
+ else
+ __err |= ios_base::failbit;
+
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_monthname(iter_type __beg, iter_type __end,
+ ios_base& __io, ios_base::iostate& __err, tm* __tm) const
+ {
+ typedef char_traits<_CharT> __traits_type;
+ const locale& __loc = __io._M_getloc();
+ const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+ const char_type* __months[12];
+ __tp._M_months_abbreviated(__months);
+ int __tmpmon;
+ ios_base::iostate __tmperr = ios_base::goodbit;
+ __beg = _M_extract_name(__beg, __end, __tmpmon, __months, 12,
+ __io, __tmperr);
+
+ // Check to see if non-abbreviated name exists, and extract.
+ // NB: Assumes both _M_months and _M_months_abbreviated organized in
+ // exact same order, first to last, such that the resulting
+ // __months array with the same index points to a month, and that
+ // month's abbreviated form.
+ // NB: Also assumes that an abbreviated name is a subset of the name.
+ if (!__tmperr && __beg != __end)
+ {
+ size_t __pos = __traits_type::length(__months[__tmpmon]);
+ __tp._M_months(__months);
+ const char_type* __name = __months[__tmpmon];
+ if (__name[__pos] == *__beg)
+ {
+ // Extract the rest of it.
+ const size_t __len = __traits_type::length(__name);
+ while (__pos < __len && __beg != __end
+ && __name[__pos] == *__beg)
+ ++__beg, ++__pos;
+ if (__len != __pos)
+ __tmperr |= ios_base::failbit;
+ }
+ }
+ if (!__tmperr)
+ __tm->tm_mon = __tmpmon;
+ else
+ __err |= ios_base::failbit;
+
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _InIter>
+ _InIter
+ time_get<_CharT, _InIter>::
+ do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
+ ios_base::iostate& __err, tm* __tm) const
+ {
+ const locale& __loc = __io._M_getloc();
+ const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
+
+ size_t __i = 0;
+ int __value = 0;
+ for (; __beg != __end && __i < 4; ++__beg, ++__i)
+ {
+ const char __c = __ctype.narrow(*__beg, '*');
+ if (__c >= '0' && __c <= '9')
+ __value = __value * 10 + (__c - '0');
+ else
+ break;
+ }
+ if (__i == 2 || __i == 4)
+ __tm->tm_year = __i == 2 ? __value : __value - 1900;
+ else
+ __err |= ios_base::failbit;
+
+ if (__beg == __end)
+ __err |= ios_base::eofbit;
+ return __beg;
+ }
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ time_put<_CharT, _OutIter>::
+ put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
+ const _CharT* __beg, const _CharT* __end) const
+ {
+ const locale& __loc = __io._M_getloc();
+ ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
+ for (; __beg != __end; ++__beg)
+ if (__ctype.narrow(*__beg, 0) != '%')
+ {
+ *__s = *__beg;
+ ++__s;
+ }
+ else if (++__beg != __end)
+ {
+ char __format;
+ char __mod = 0;
+ const char __c = __ctype.narrow(*__beg, 0);
+ if (__c != 'E' && __c != 'O')
+ __format = __c;
+ else if (++__beg != __end)
+ {
+ __mod = __c;
+ __format = __ctype.narrow(*__beg, 0);
+ }
+ else
+ break;
+ __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);
+ }
+ else
+ break;
+ return __s;
+ }
+
+ template<typename _CharT, typename _OutIter>
+ _OutIter
+ time_put<_CharT, _OutIter>::
+ do_put(iter_type __s, ios_base& __io, char_type, const tm* __tm,
+ char __format, char __mod) const
+ {
+ const locale& __loc = __io._M_getloc();
+ ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);
+ __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc);
+
+ // NB: This size is arbitrary. Should this be a data member,
+ // initialized at construction?
+ const size_t __maxlen = 128;
+ char_type* __res =
+ static_cast<char_type*>(__builtin_alloca(sizeof(char_type) * __maxlen));
+
+ // NB: In IEE 1003.1-200x, and perhaps other locale models, it
+ // is possible that the format character will be longer than one
+ // character. Possibilities include 'E' or 'O' followed by a
+ // format character: if __mod is not the default argument, assume
+ // it's a valid modifier.
+ char_type __fmt[4];
+ __fmt[0] = __ctype.widen('%');
+ if (!__mod)
+ {
+ __fmt[1] = __format;
+ __fmt[2] = char_type();
+ }
+ else
+ {
+ __fmt[1] = __mod;
+ __fmt[2] = __format;
+ __fmt[3] = char_type();
+ }
+
+ __tp._M_put(__res, __maxlen, __fmt, __tm);
+
+ // Write resulting, fully-formatted string to output iterator.
+ return std::__write(__s, __res, char_traits<char_type>::length(__res));
+ }
+
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class moneypunct<char, false>;
+ extern template class moneypunct<char, true>;
+ extern template class moneypunct_byname<char, false>;
+ extern template class moneypunct_byname<char, true>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE money_get<char>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE money_put<char>;
+ extern template class __timepunct<char>;
+ extern template class time_put<char>;
+ extern template class time_put_byname<char>;
+ extern template class time_get<char>;
+ extern template class time_get_byname<char>;
+ extern template class messages<char>;
+ extern template class messages_byname<char>;
+
+ extern template
+ const moneypunct<char, true>&
+ use_facet<moneypunct<char, true> >(const locale&);
+
+ extern template
+ const moneypunct<char, false>&
+ use_facet<moneypunct<char, false> >(const locale&);
+
+ extern template
+ const money_put<char>&
+ use_facet<money_put<char> >(const locale&);
+
+ extern template
+ const money_get<char>&
+ use_facet<money_get<char> >(const locale&);
+
+ extern template
+ const __timepunct<char>&
+ use_facet<__timepunct<char> >(const locale&);
+
+ extern template
+ const time_put<char>&
+ use_facet<time_put<char> >(const locale&);
+
+ extern template
+ const time_get<char>&
+ use_facet<time_get<char> >(const locale&);
+
+ extern template
+ const messages<char>&
+ use_facet<messages<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<moneypunct<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<money_put<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<money_get<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<__timepunct<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<time_put<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<time_get<char> >(const locale&);
+
+ extern template
+ bool
+ has_facet<messages<char> >(const locale&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class moneypunct<wchar_t, false>;
+ extern template class moneypunct<wchar_t, true>;
+ extern template class moneypunct_byname<wchar_t, false>;
+ extern template class moneypunct_byname<wchar_t, true>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;
+ extern template class _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;
+ extern template class __timepunct<wchar_t>;
+ extern template class time_put<wchar_t>;
+ extern template class time_put_byname<wchar_t>;
+ extern template class time_get<wchar_t>;
+ extern template class time_get_byname<wchar_t>;
+ extern template class messages<wchar_t>;
+ extern template class messages_byname<wchar_t>;
+
+ extern template
+ const moneypunct<wchar_t, true>&
+ use_facet<moneypunct<wchar_t, true> >(const locale&);
+
+ extern template
+ const moneypunct<wchar_t, false>&
+ use_facet<moneypunct<wchar_t, false> >(const locale&);
+
+ extern template
+ const money_put<wchar_t>&
+ use_facet<money_put<wchar_t> >(const locale&);
+
+ extern template
+ const money_get<wchar_t>&
+ use_facet<money_get<wchar_t> >(const locale&);
+
+ extern template
+ const __timepunct<wchar_t>&
+ use_facet<__timepunct<wchar_t> >(const locale&);
+
+ extern template
+ const time_put<wchar_t>&
+ use_facet<time_put<wchar_t> >(const locale&);
+
+ extern template
+ const time_get<wchar_t>&
+ use_facet<time_get<wchar_t> >(const locale&);
+
+ extern template
+ const messages<wchar_t>&
+ use_facet<messages<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<moneypunct<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<money_put<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<money_get<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<__timepunct<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<time_put<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<time_get<wchar_t> >(const locale&);
+
+ extern template
+ bool
+ has_facet<messages<wchar_t> >(const locale&);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/localefwd.h b/gcc-4.4.0/libstdc++-v3/include/bits/localefwd.h
new file mode 100644
index 000000000..909df1ec4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/localefwd.h
@@ -0,0 +1,183 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file localefwd.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#ifndef _LOCALE_FWD_H
+#define _LOCALE_FWD_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/c++locale.h> // Defines __c_locale, config-specific include
+#include <iosfwd> // For ostreambuf_iterator, istreambuf_iterator
+#include <cctype>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 22.1.1 Locale
+ class locale;
+
+ template<typename _Facet>
+ bool
+ has_facet(const locale&) throw();
+
+ template<typename _Facet>
+ const _Facet&
+ use_facet(const locale&);
+
+ // 22.1.3 Convenience interfaces
+ template<typename _CharT>
+ bool
+ isspace(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isprint(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ iscntrl(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isupper(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ islower(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isalpha(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isdigit(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ ispunct(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isxdigit(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isalnum(_CharT, const locale&);
+
+ template<typename _CharT>
+ bool
+ isgraph(_CharT, const locale&);
+
+ template<typename _CharT>
+ _CharT
+ toupper(_CharT, const locale&);
+
+ template<typename _CharT>
+ _CharT
+ tolower(_CharT, const locale&);
+
+ // 22.2.1 and 22.2.1.3 ctype
+ class ctype_base;
+ template<typename _CharT>
+ class ctype;
+ template<> class ctype<char>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<> class ctype<wchar_t>;
+#endif
+ template<typename _CharT>
+ class ctype_byname;
+ // NB: Specialized for char and wchar_t in locale_facets.h.
+
+ class codecvt_base;
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt;
+ template<> class codecvt<char, char, mbstate_t>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<> class codecvt<wchar_t, char, mbstate_t>;
+#endif
+ template<typename _InternT, typename _ExternT, typename _StateT>
+ class codecvt_byname;
+
+ // 22.2.2 and 22.2.3 numeric
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class num_get;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class num_put;
+_GLIBCXX_END_LDBL_NAMESPACE
+ template<typename _CharT> class numpunct;
+ template<typename _CharT> class numpunct_byname;
+
+ // 22.2.4 collation
+ template<typename _CharT>
+ class collate;
+ template<typename _CharT> class
+ collate_byname;
+
+ // 22.2.5 date and time
+ class time_base;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class time_get;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class time_get_byname;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class time_put;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class time_put_byname;
+
+ // 22.2.6 money
+ class money_base;
+_GLIBCXX_BEGIN_LDBL_NAMESPACE
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class money_get;
+ template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
+ class money_put;
+_GLIBCXX_END_LDBL_NAMESPACE
+ template<typename _CharT, bool _Intl = false>
+ class moneypunct;
+ template<typename _CharT, bool _Intl = false>
+ class moneypunct_byname;
+
+ // 22.2.7 message retrieval
+ class messages_base;
+ template<typename _CharT>
+ class messages;
+ template<typename _CharT>
+ class messages_byname;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/mask_array.h b/gcc-4.4.0/libstdc++-v3/include/bits/mask_array.h
new file mode 100644
index 000000000..f915dd911
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/mask_array.h
@@ -0,0 +1,206 @@
+// The template and inlines for the -*- C++ -*- mask_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file mask_array.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _MASK_ARRAY_H
+#define _MASK_ARRAY_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup numeric_arrays
+ * @{
+ */
+
+ /**
+ * @brief Reference to selected subset of an array.
+ *
+ * A mask_array is a reference to the actual elements of an array specified
+ * by a bitmask in the form of an array of bool. The way to get a
+ * mask_array is to call operator[](valarray<bool>) on a valarray. The
+ * returned mask_array then permits carrying operations out on the
+ * referenced subset of elements in the original valarray.
+ *
+ * For example, if a mask_array is obtained using the array (false, true,
+ * false, true) as an argument, the mask array has two elements referring
+ * to array[1] and array[3] in the underlying array.
+ *
+ * @param Tp Element type.
+ */
+ template <class _Tp>
+ class mask_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 253. valarray helper functions are almost entirely useless
+
+ /// Copy constructor. Both slices refer to the same underlying array.
+ mask_array (const mask_array&);
+
+ /// Assignment operator. Assigns elements to corresponding elements
+ /// of @a a.
+ mask_array& operator=(const mask_array&);
+
+ void operator=(const valarray<_Tp>&) const;
+ /// Multiply slice elements by corresponding elements of @a v.
+ void operator*=(const valarray<_Tp>&) const;
+ /// Divide slice elements by corresponding elements of @a v.
+ void operator/=(const valarray<_Tp>&) const;
+ /// Modulo slice elements by corresponding elements of @a v.
+ void operator%=(const valarray<_Tp>&) const;
+ /// Add corresponding elements of @a v to slice elements.
+ void operator+=(const valarray<_Tp>&) const;
+ /// Subtract corresponding elements of @a v from slice elements.
+ void operator-=(const valarray<_Tp>&) const;
+ /// Logical xor slice elements with corresponding elements of @a v.
+ void operator^=(const valarray<_Tp>&) const;
+ /// Logical and slice elements with corresponding elements of @a v.
+ void operator&=(const valarray<_Tp>&) const;
+ /// Logical or slice elements with corresponding elements of @a v.
+ void operator|=(const valarray<_Tp>&) const;
+ /// Left shift slice elements by corresponding elements of @a v.
+ void operator<<=(const valarray<_Tp>&) const;
+ /// Right shift slice elements by corresponding elements of @a v.
+ void operator>>=(const valarray<_Tp>&) const;
+ /// Assign all slice elements to @a t.
+ void operator=(const _Tp&) const;
+
+ // ~mask_array ();
+
+ template<class _Dom>
+ void operator=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator*=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator/=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator%=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator+=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator-=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator^=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator&=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator|=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator<<=(const _Expr<_Dom,_Tp>&) const;
+ template<class _Dom>
+ void operator>>=(const _Expr<_Dom,_Tp>&) const;
+
+ private:
+ mask_array(_Array<_Tp>, size_t, _Array<bool>);
+ friend class valarray<_Tp>;
+
+ const size_t _M_sz;
+ const _Array<bool> _M_mask;
+ const _Array<_Tp> _M_array;
+
+ // not implemented
+ mask_array();
+ };
+
+ template<typename _Tp>
+ inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a)
+ : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}
+
+ template<typename _Tp>
+ inline
+ mask_array<_Tp>::mask_array(_Array<_Tp> __a, size_t __s, _Array<bool> __m)
+ : _M_sz(__s), _M_mask(__m), _M_array(__a) {}
+
+ template<typename _Tp>
+ inline mask_array<_Tp>&
+ mask_array<_Tp>::operator=(const mask_array<_Tp>& __a)
+ {
+ std::__valarray_copy(__a._M_array, __a._M_mask,
+ _M_sz, _M_array, _M_mask);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline void
+ mask_array<_Tp>::operator=(const _Tp& __t) const
+ { std::__valarray_fill(_M_array, _M_sz, _M_mask, __t); }
+
+ template<typename _Tp>
+ inline void
+ mask_array<_Tp>::operator=(const valarray<_Tp>& __v) const
+ { std::__valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _M_mask); }
+
+ template<typename _Tp>
+ template<class _Ex>
+ inline void
+ mask_array<_Tp>::operator=(const _Expr<_Ex, _Tp>& __e) const
+ { std::__valarray_copy(__e, __e.size(), _M_array, _M_mask); }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \
+ template<typename _Tp> \
+ inline void \
+ mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \
+ { \
+ _Array_augmented_##_Name(_M_array, _M_mask, \
+ _Array<_Tp>(__v), __v.size()); \
+ } \
+ \
+ template<typename _Tp> \
+ template<class _Dom> \
+ inline void \
+ mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\
+ { \
+ _Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size()); \
+ }
+
+_DEFINE_VALARRAY_OPERATOR(*, __multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, __divides)
+_DEFINE_VALARRAY_OPERATOR(%, __modulus)
+_DEFINE_VALARRAY_OPERATOR(+, __plus)
+_DEFINE_VALARRAY_OPERATOR(-, __minus)
+_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
+_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
+_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
+_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _MASK_ARRAY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/move.h b/gcc-4.4.0/libstdc++-v3/include/bits/move.h
new file mode 100644
index 000000000..ef86c4d12
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/move.h
@@ -0,0 +1,98 @@
+// Move, forward and identity for C++0x + swap -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file move.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _MOVE_H
+#define _MOVE_H 1
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <bits/concept_check.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <type_traits>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 20.2.2, forward/move
+ template<typename _Tp>
+ struct identity
+ {
+ typedef _Tp type;
+ };
+
+ template<typename _Tp>
+ inline _Tp&&
+ forward(typename std::identity<_Tp>::type&& __t)
+ { return __t; }
+
+ template<typename _Tp>
+ inline typename std::remove_reference<_Tp>::type&&
+ move(_Tp&& __t)
+ { return __t; }
+
+_GLIBCXX_END_NAMESPACE
+
+#define _GLIBCXX_MOVE(_Tp) std::move(_Tp)
+#else
+#define _GLIBCXX_MOVE(_Tp) (_Tp)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Swaps two values.
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @return Nothing.
+ */
+ template<typename _Tp>
+ inline void
+ swap(_Tp& __a, _Tp& __b)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
+
+ _Tp __tmp = _GLIBCXX_MOVE(__a);
+ __a = _GLIBCXX_MOVE(__b);
+ __b = _GLIBCXX_MOVE(__tmp);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 809. std::swap should be overloaded for array types.
+ template<typename _Tp, size_t _Nm>
+ inline void
+ swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
+ {
+ for (size_t __n = 0; __n < _Nm; ++__n)
+ swap(__a[__n], __b[__n]);
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _MOVE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/ostream.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/ostream.tcc
new file mode 100644
index 000000000..e2cbb585a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/ostream.tcc
@@ -0,0 +1,407 @@
+// ostream classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ostream.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.6.2 Output streams
+//
+
+#ifndef _OSTREAM_TCC
+#define _OSTREAM_TCC 1
+
+#pragma GCC system_header
+
+#include <cxxabi-forced.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>::sentry::
+ sentry(basic_ostream<_CharT, _Traits>& __os)
+ : _M_ok(false), _M_os(__os)
+ {
+ // XXX MT
+ if (__os.tie() && __os.good())
+ __os.tie()->flush();
+
+ if (__os.good())
+ _M_ok = true;
+ else
+ __os.setstate(ios_base::failbit);
+ }
+
+ template<typename _CharT, typename _Traits>
+ template<typename _ValueT>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ _M_insert(_ValueT __v)
+ {
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const __num_put_type& __np = __check_facet(this->_M_num_put);
+ if (__np.put(*this, *this, this->fill(), __v).failed())
+ __err |= ios_base::badbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ operator<<(short __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 117. basic_ostream uses nonexistent num_put member functions.
+ const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+ if (__fmt == ios_base::oct || __fmt == ios_base::hex)
+ return _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));
+ else
+ return _M_insert(static_cast<long>(__n));
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ operator<<(int __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 117. basic_ostream uses nonexistent num_put member functions.
+ const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
+ if (__fmt == ios_base::oct || __fmt == ios_base::hex)
+ return _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));
+ else
+ return _M_insert(static_cast<long>(__n));
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ operator<<(__streambuf_type* __sbin)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ sentry __cerb(*this);
+ if (__cerb && __sbin)
+ {
+ __try
+ {
+ if (!__copy_streambufs(__sbin, this->rdbuf()))
+ __err |= ios_base::failbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::failbit); }
+ }
+ else if (!__sbin)
+ __err |= ios_base::badbit;
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ put(char_type __c)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 60. What is a formatted input function?
+ // basic_ostream::put(char_type) is an unformatted output function.
+ // DR 63. Exception-handling policy for unformatted output.
+ // Unformatted output functions should catch exceptions thrown
+ // from streambuf members.
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ const int_type __put = this->rdbuf()->sputc(__c);
+ if (traits_type::eq_int_type(__put, traits_type::eof()))
+ __err |= ios_base::badbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ write(const _CharT* __s, streamsize __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 60. What is a formatted input function?
+ // basic_ostream::write(const char_type*, streamsize) is an
+ // unformatted output function.
+ // DR 63. Exception-handling policy for unformatted output.
+ // Unformatted output functions should catch exceptions thrown
+ // from streambuf members.
+ sentry __cerb(*this);
+ if (__cerb)
+ {
+ __try
+ { _M_write(__s, __n); }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ }
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ flush()
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 60. What is a formatted input function?
+ // basic_ostream::flush() is *not* an unformatted output function.
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ if (this->rdbuf() && this->rdbuf()->pubsync() == -1)
+ __err |= ios_base::badbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ typename basic_ostream<_CharT, _Traits>::pos_type
+ basic_ostream<_CharT, _Traits>::
+ tellp()
+ {
+ pos_type __ret = pos_type(-1);
+ __try
+ {
+ if (!this->fail())
+ __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ seekp(pos_type __pos)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ if (!this->fail())
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 136. seekp, seekg setting wrong streams?
+ const pos_type __p = this->rdbuf()->pubseekpos(__pos,
+ ios_base::out);
+
+ // 129. Need error indication from seekp() and seekg()
+ if (__p == pos_type(off_type(-1)))
+ __err |= ios_base::failbit;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ basic_ostream<_CharT, _Traits>::
+ seekp(off_type __off, ios_base::seekdir __dir)
+ {
+ ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
+ __try
+ {
+ if (!this->fail())
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 136. seekp, seekg setting wrong streams?
+ const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
+ ios_base::out);
+
+ // 129. Need error indication from seekp() and seekg()
+ if (__p == pos_type(off_type(-1)))
+ __err |= ios_base::failbit;
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ this->_M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { this->_M_setstate(ios_base::badbit); }
+ if (__err)
+ this->setstate(__err);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
+ {
+ if (!__s)
+ __out.setstate(ios_base::badbit);
+ else
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 167. Improper use of traits_type::length()
+ const size_t __clen = char_traits<char>::length(__s);
+ __try
+ {
+ struct __ptr_guard
+ {
+ _CharT *__p;
+ __ptr_guard (_CharT *__ip): __p(__ip) { }
+ ~__ptr_guard() { delete[] __p; }
+ _CharT* __get() { return __p; }
+ } __pg (new _CharT[__clen]);
+
+ _CharT *__ws = __pg.__get();
+ for (size_t __i = 0; __i < __clen; ++__i)
+ __ws[__i] = __out.widen(__s[__i]);
+ __ostream_insert(__out, __ws, __clen);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __out._M_setstate(ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __out._M_setstate(ios_base::badbit); }
+ }
+ return __out;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class basic_ostream<char>;
+ extern template ostream& endl(ostream&);
+ extern template ostream& ends(ostream&);
+ extern template ostream& flush(ostream&);
+ extern template ostream& operator<<(ostream&, char);
+ extern template ostream& operator<<(ostream&, unsigned char);
+ extern template ostream& operator<<(ostream&, signed char);
+ extern template ostream& operator<<(ostream&, const char*);
+ extern template ostream& operator<<(ostream&, const unsigned char*);
+ extern template ostream& operator<<(ostream&, const signed char*);
+
+ extern template ostream& ostream::_M_insert(long);
+ extern template ostream& ostream::_M_insert(unsigned long);
+ extern template ostream& ostream::_M_insert(bool);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ extern template ostream& ostream::_M_insert(long long);
+ extern template ostream& ostream::_M_insert(unsigned long long);
+#endif
+ extern template ostream& ostream::_M_insert(double);
+ extern template ostream& ostream::_M_insert(long double);
+ extern template ostream& ostream::_M_insert(const void*);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_ostream<wchar_t>;
+ extern template wostream& endl(wostream&);
+ extern template wostream& ends(wostream&);
+ extern template wostream& flush(wostream&);
+ extern template wostream& operator<<(wostream&, wchar_t);
+ extern template wostream& operator<<(wostream&, char);
+ extern template wostream& operator<<(wostream&, const wchar_t*);
+ extern template wostream& operator<<(wostream&, const char*);
+
+ extern template wostream& wostream::_M_insert(long);
+ extern template wostream& wostream::_M_insert(unsigned long);
+ extern template wostream& wostream::_M_insert(bool);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ extern template wostream& wostream::_M_insert(long long);
+ extern template wostream& wostream::_M_insert(unsigned long long);
+#endif
+ extern template wostream& wostream::_M_insert(double);
+ extern template wostream& wostream::_M_insert(long double);
+ extern template wostream& wostream::_M_insert(const void*);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/ostream_insert.h b/gcc-4.4.0/libstdc++-v3/include/bits/ostream_insert.h
new file mode 100644
index 000000000..e0017ee7c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/ostream_insert.h
@@ -0,0 +1,127 @@
+// Helpers for ostream inserters -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ostream_insert.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _OSTREAM_INSERT_H
+#define _OSTREAM_INSERT_H 1
+
+#pragma GCC system_header
+
+#include <iosfwd>
+#include <cxxabi-forced.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ inline void
+ __ostream_write(basic_ostream<_CharT, _Traits>& __out,
+ const _CharT* __s, streamsize __n)
+ {
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const streamsize __put = __out.rdbuf()->sputn(__s, __n);
+ if (__put != __n)
+ __out.setstate(__ios_base::badbit);
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline void
+ __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n)
+ {
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const _CharT __c = __out.fill();
+ for (; __n > 0; --__n)
+ {
+ const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c);
+ if (_Traits::eq_int_type(__put, _Traits::eof()))
+ {
+ __out.setstate(__ios_base::badbit);
+ break;
+ }
+ }
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ __ostream_insert(basic_ostream<_CharT, _Traits>& __out,
+ const _CharT* __s, streamsize __n)
+ {
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ typename __ostream_type::sentry __cerb(__out);
+ if (__cerb)
+ {
+ __try
+ {
+ const streamsize __w = __out.width();
+ if (__w > __n)
+ {
+ const bool __left = ((__out.flags()
+ & __ios_base::adjustfield)
+ == __ios_base::left);
+ if (!__left)
+ __ostream_fill(__out, __w - __n);
+ if (__out.good())
+ __ostream_write(__out, __s, __n);
+ if (__left && __out.good())
+ __ostream_fill(__out, __w - __n);
+ }
+ else
+ __ostream_write(__out, __s, __n);
+ __out.width(0);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __out._M_setstate(__ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __out._M_setstate(__ios_base::badbit); }
+ }
+ return __out;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template wostream& __ostream_insert(wostream&, const wchar_t*,
+ streamsize);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _OSTREAM_INSERT_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/postypes.h b/gcc-4.4.0/libstdc++-v3/include/bits/postypes.h
new file mode 100644
index 000000000..8066d9b00
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/postypes.h
@@ -0,0 +1,241 @@
+// Position types -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file postypes.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.4.1 - Types
+// ISO C++ 14882: 27.4.3 - Template class fpos
+//
+
+#ifndef _GLIBCXX_POSTYPES_H
+#define _GLIBCXX_POSTYPES_H 1
+
+#pragma GCC system_header
+
+#include <cwchar> // For mbstate_t
+
+// XXX If <stdint.h> is really needed, make sure to define the macros
+// before including it, in order not to break <tr1/cstdint> (and <cstdint>
+// in C++0x). Reconsider all this as soon as possible...
+#if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \
+ && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG))
+
+#ifndef __STDC_LIMIT_MACROS
+# define _UNDEF__STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_CONSTANT_MACROS
+# define _UNDEF__STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
+#include <stdint.h> // For int64_t
+#ifdef _UNDEF__STDC_LIMIT_MACROS
+# undef __STDC_LIMIT_MACROS
+# undef _UNDEF__STDC_LIMIT_MACROS
+#endif
+#ifdef _UNDEF__STDC_CONSTANT_MACROS
+# undef __STDC_CONSTANT_MACROS
+# undef _UNDEF__STDC_CONSTANT_MACROS
+#endif
+
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // The types streamoff, streampos and wstreampos and the class
+ // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2,
+ // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbiage, the
+ // behaviour of these types is mostly implementation defined or
+ // unspecified. The behaviour in this implementation is as noted
+ // below.
+
+ /**
+ * @brief Type used by fpos, char_traits<char>, and char_traits<wchar_t>.
+ *
+ * In clauses 21.1.3.1 and 27.4.1 streamoff is described as an
+ * implementation defined type.
+ * Note: In versions of GCC up to and including GCC 3.3, streamoff
+ * was typedef long.
+ */
+#ifdef _GLIBCXX_HAVE_INT64_T_LONG
+ typedef long streamoff;
+#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)
+ typedef long long streamoff;
+#elif defined(_GLIBCXX_HAVE_INT64_T)
+ typedef int64_t streamoff;
+#else
+ typedef long long streamoff;
+#endif
+
+ /// Integral type for I/O operation counts and buffer sizes.
+ typedef ptrdiff_t streamsize; // Signed integral type
+
+ /**
+ * @brief Class representing stream positions.
+ *
+ * The standard places no requirements upon the template parameter StateT.
+ * In this implementation StateT must be DefaultConstructible,
+ * CopyConstructible and Assignable. The standard only requires that fpos
+ * should contain a member of type StateT. In this implementation it also
+ * contains an offset stored as a signed integer.
+ *
+ * @param StateT Type passed to and returned from state().
+ */
+ template<typename _StateT>
+ class fpos
+ {
+ private:
+ streamoff _M_off;
+ _StateT _M_state;
+
+ public:
+ // The standard doesn't require that fpos objects can be default
+ // constructed. This implementation provides a default
+ // constructor that initializes the offset to 0 and default
+ // constructs the state.
+ fpos()
+ : _M_off(0), _M_state() { }
+
+ // The standard requires that fpos objects can be constructed
+ // from streamoff objects using the constructor syntax, and
+ // fails to give any meaningful semantics. In this
+ // implementation implicit conversion is also allowed, and this
+ // constructor stores the streamoff as the offset and default
+ // constructs the state.
+ /// Construct position from offset.
+ fpos(streamoff __off)
+ : _M_off(__off), _M_state() { }
+
+ /// Convert to streamoff.
+ operator streamoff() const { return _M_off; }
+
+ /// Remember the value of @a st.
+ void
+ state(_StateT __st)
+ { _M_state = __st; }
+
+ /// Return the last set value of @a st.
+ _StateT
+ state() const
+ { return _M_state; }
+
+ // The standard requires that this operator must be defined, but
+ // gives no semantics. In this implementation it just adds its
+ // argument to the stored offset and returns *this.
+ /// Add offset to this position.
+ fpos&
+ operator+=(streamoff __off)
+ {
+ _M_off += __off;
+ return *this;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // gives no semantics. In this implementation it just subtracts
+ // its argument from the stored offset and returns *this.
+ /// Subtract offset from this position.
+ fpos&
+ operator-=(streamoff __off)
+ {
+ _M_off -= __off;
+ return *this;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // defines its semantics only in terms of operator-. In this
+ // implementation it constructs a copy of *this, adds the
+ // argument to that copy using operator+= and then returns the
+ // copy.
+ /// Add position and offset.
+ fpos
+ operator+(streamoff __off) const
+ {
+ fpos __pos(*this);
+ __pos += __off;
+ return __pos;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // defines its semantics only in terms of operator+. In this
+ // implementation it constructs a copy of *this, subtracts the
+ // argument from that copy using operator-= and then returns the
+ // copy.
+ /// Subtract offset from position.
+ fpos
+ operator-(streamoff __off) const
+ {
+ fpos __pos(*this);
+ __pos -= __off;
+ return __pos;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // defines its semantics only in terms of operator+. In this
+ // implementation it returns the difference between the offset
+ // stored in *this and in the argument.
+ /// Subtract position to return offset.
+ streamoff
+ operator-(const fpos& __other) const
+ { return _M_off - __other._M_off; }
+ };
+
+ // The standard only requires that operator== must be an
+ // equivalence relation. In this implementation two fpos<StateT>
+ // objects belong to the same equivalence class if the contained
+ // offsets compare equal.
+ /// Test if equivalent to another position.
+ template<typename _StateT>
+ inline bool
+ operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
+ { return streamoff(__lhs) == streamoff(__rhs); }
+
+ template<typename _StateT>
+ inline bool
+ operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
+ { return streamoff(__lhs) != streamoff(__rhs); }
+
+ // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos
+ // as implementation defined types, but clause 27.2 requires that
+ // they must both be typedefs for fpos<mbstate_t>
+ /// File position for char streams.
+ typedef fpos<mbstate_t> streampos;
+ /// File position for wchar_t streams.
+ typedef fpos<mbstate_t> wstreampos;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// File position for char16_t streams.
+ typedef fpos<mbstate_t> u16streampos;
+ /// File position for char32_t streams.
+ typedef fpos<mbstate_t> u32streampos;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/shared_ptr.h b/gcc-4.4.0/libstdc++-v3/include/bits/shared_ptr.h
new file mode 100644
index 000000000..a378ae01d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/shared_ptr.h
@@ -0,0 +1,1591 @@
+// shared_ptr and weak_ptr implementation -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// shared_count.hpp
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+
+// shared_ptr.hpp
+// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
+// Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+// weak_ptr.hpp
+// Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+// enable_shared_from_this.hpp
+// Copyright (C) 2002 Peter Dimov
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// GCC Note: based on version 1.32.0 of the Boost library.
+
+/** @file bits/shared_ptr.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _SHARED_PTR_H
+#define _SHARED_PTR_H 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup pointer_abstractions
+ * @{
+ */
+
+ // counted ptr with no deleter or allocator support
+ template<typename _Ptr, _Lock_policy _Lp>
+ class _Sp_counted_ptr
+ : public _Sp_counted_base<_Lp>
+ {
+ public:
+ _Sp_counted_ptr(_Ptr __p)
+ : _M_ptr(__p) { }
+
+ virtual void
+ _M_dispose() // nothrow
+ { delete _M_ptr; }
+
+ virtual void
+ _M_destroy() // nothrow
+ { delete this; }
+
+ virtual void*
+ _M_get_deleter(const std::type_info& __ti)
+ { return 0; }
+
+ _Sp_counted_ptr(const _Sp_counted_ptr&) = delete;
+ _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete;
+
+ protected:
+ _Ptr _M_ptr; // copy constructor must not throw
+ };
+
+ // support for custom deleter and/or allocator
+ template<typename _Ptr, typename _Deleter, typename _Alloc, _Lock_policy _Lp>
+ class _Sp_counted_deleter
+ : public _Sp_counted_ptr<_Ptr, _Lp>
+ {
+ typedef typename _Alloc::template
+ rebind<_Sp_counted_deleter>::other _My_alloc_type;
+
+ // Helper class that stores the Deleter and also acts as an allocator.
+ // Used to dispose of the owned pointer and the internal refcount
+ // Requires that copies of _Alloc can free each other's memory.
+ struct _My_Deleter
+ : public _My_alloc_type // copy constructor must not throw
+ {
+ _Deleter _M_del; // copy constructor must not throw
+ _My_Deleter(_Deleter __d, const _Alloc& __a)
+ : _My_alloc_type(__a), _M_del(__d) { }
+ };
+
+ protected:
+ typedef _Sp_counted_ptr<_Ptr, _Lp> _Base_type;
+
+ public:
+ /**
+ * @brief
+ * @pre __d(__p) must not throw.
+ */
+ _Sp_counted_deleter(_Ptr __p, _Deleter __d)
+ : _Base_type(__p), _M_del(__d, _Alloc()) { }
+
+ /**
+ * @brief
+ * @pre __d(__p) must not throw.
+ */
+ _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a)
+ : _Base_type(__p), _M_del(__d, __a) { }
+
+ virtual void
+ _M_dispose() // nothrow
+ { _M_del._M_del(_Base_type::_M_ptr); }
+
+ virtual void
+ _M_destroy() // nothrow
+ {
+ _My_alloc_type __a(_M_del);
+ this->~_Sp_counted_deleter();
+ __a.deallocate(this, 1);
+ }
+
+ virtual void*
+ _M_get_deleter(const std::type_info& __ti)
+ { return __ti == typeid(_Deleter) ? &_M_del._M_del : 0; }
+
+ protected:
+ _My_Deleter _M_del; // copy constructor must not throw
+ };
+
+ // helpers for make_shared / allocate_shared
+
+ template<typename _Tp>
+ struct _Sp_destroy_inplace
+ {
+ void operator()(_Tp* __p) const { if (__p) __p->~_Tp(); }
+ };
+
+ struct _Sp_make_shared_tag { };
+
+ template<typename _Tp, typename _Alloc, _Lock_policy _Lp>
+ class _Sp_counted_ptr_inplace
+ : public _Sp_counted_deleter<_Tp*, _Sp_destroy_inplace<_Tp>, _Alloc, _Lp>
+ {
+ typedef _Sp_counted_deleter<_Tp*, _Sp_destroy_inplace<_Tp>, _Alloc, _Lp>
+ _Base_type;
+
+ public:
+ _Sp_counted_ptr_inplace(_Alloc __a)
+ : _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
+ , _M_storage()
+ {
+ void* __p = &_M_storage;
+ ::new (__p) _Tp(); // might throw
+ _Base_type::_Base_type::_M_ptr = static_cast<_Tp*>(__p);
+ }
+
+ template<typename... _Args>
+ _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args)
+ : _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
+ , _M_storage()
+ {
+ void* __p = &_M_storage;
+ ::new (__p) _Tp(std::forward<_Args>(__args)...); // might throw
+ _Base_type::_Base_type::_M_ptr = static_cast<_Tp*>(__p);
+ }
+
+ // override because the allocator needs to know the dynamic type
+ virtual void
+ _M_destroy() // nothrow
+ {
+ typedef typename _Alloc::template
+ rebind<_Sp_counted_ptr_inplace>::other _My_alloc_type;
+ _My_alloc_type __a(_Base_type::_M_del);
+ this->~_Sp_counted_ptr_inplace();
+ __a.deallocate(this, 1);
+ }
+
+ // sneaky trick so __shared_ptr can get the managed pointer
+ virtual void*
+ _M_get_deleter(const std::type_info& __ti)
+ {
+ return __ti == typeid(_Sp_make_shared_tag)
+ ? static_cast<void*>(&_M_storage)
+ : _Base_type::_M_get_deleter(__ti);
+ }
+
+ private:
+ typename aligned_storage<sizeof(_Tp), alignment_of<_Tp>::value>::type
+ _M_storage;
+ };
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class __weak_count;
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class __shared_count
+ {
+ public:
+ __shared_count()
+ : _M_pi(0) // nothrow
+ { }
+
+ template<typename _Ptr>
+ __shared_count(_Ptr __p) : _M_pi(0)
+ {
+ __try
+ {
+ _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p);
+ }
+ __catch(...)
+ {
+ delete __p;
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Ptr, typename _Deleter>
+ __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0)
+ {
+ // allocator's value_type doesn't matter, will rebind it anyway
+ typedef std::allocator<int> _Alloc;
+ typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type;
+ typedef std::allocator<_Sp_cd_type> _Alloc2;
+ _Alloc2 __a2;
+ __try
+ {
+ _M_pi = __a2.allocate(1);
+ ::new(static_cast<void*>(_M_pi)) _Sp_cd_type(__p, __d);
+ }
+ __catch(...)
+ {
+ __d(__p); // Call _Deleter on __p.
+ if (_M_pi)
+ __a2.deallocate(static_cast<_Sp_cd_type*>(_M_pi), 1);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Ptr, typename _Deleter, typename _Alloc>
+ __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0)
+ {
+ typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type;
+ typedef typename _Alloc::template rebind<_Sp_cd_type>::other _Alloc2;
+ _Alloc2 __a2(__a);
+ __try
+ {
+ _M_pi = __a2.allocate(1);
+ ::new(static_cast<void*>(_M_pi)) _Sp_cd_type(__p, __d, __a);
+ }
+ __catch(...)
+ {
+ __d(__p); // Call _Deleter on __p.
+ if (_M_pi)
+ __a2.deallocate(static_cast<_Sp_cd_type*>(_M_pi), 1);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ __shared_count(_Sp_make_shared_tag, _Tp*, _Alloc __a, _Args&&... __args)
+ : _M_pi(0)
+ {
+ typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type;
+ typedef typename _Alloc::template rebind<_Sp_cp_type>::other _Alloc2;
+ _Alloc2 __a2(__a);
+ __try
+ {
+ _M_pi = __a2.allocate(1);
+ ::new(static_cast<void*>(_M_pi)) _Sp_cp_type(__a,
+ std::forward<_Args>(__args)...);
+ }
+ __catch(...)
+ {
+ if (_M_pi)
+ __a2.deallocate(static_cast<_Sp_cp_type*>(_M_pi), 1);
+ __throw_exception_again;
+ }
+ }
+
+#if _GLIBCXX_DEPRECATED
+ // Special case for auto_ptr<_Tp> to provide the strong guarantee.
+ template<typename _Tp>
+ explicit
+ __shared_count(std::auto_ptr<_Tp>&& __r)
+ : _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get()))
+ { __r.release(); }
+#endif
+
+ // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee.
+ template<typename _Tp, typename _Del>
+ explicit
+ __shared_count(std::unique_ptr<_Tp, _Del>&& __r)
+ : _M_pi(_S_create_from_up(std::move(__r)))
+ { __r.release(); }
+
+ // Throw bad_weak_ptr when __r._M_get_use_count() == 0.
+ explicit
+ __shared_count(const __weak_count<_Lp>& __r);
+
+ ~__shared_count() // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_release();
+ }
+
+ __shared_count(const __shared_count& __r)
+ : _M_pi(__r._M_pi) // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_add_ref_copy();
+ }
+
+ __shared_count&
+ operator=(const __shared_count& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ if (__tmp != _M_pi)
+ {
+ if (__tmp != 0)
+ __tmp->_M_add_ref_copy();
+ if (_M_pi != 0)
+ _M_pi->_M_release();
+ _M_pi = __tmp;
+ }
+ return *this;
+ }
+
+ void
+ _M_swap(__shared_count& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ __r._M_pi = _M_pi;
+ _M_pi = __tmp;
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
+
+ bool
+ _M_unique() const // nothrow
+ { return this->_M_get_use_count() == 1; }
+
+ void*
+ _M_get_deleter(const std::type_info& __ti) const
+ { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; }
+
+ bool
+ _M_less(const __shared_count& __rhs) const
+ { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+ bool
+ _M_less(const __weak_count<_Lp>& __rhs) const
+ { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+ // friend function injected into enclosing namespace and found by ADL
+ friend inline bool
+ operator==(const __shared_count& __a, const __shared_count& __b)
+ { return __a._M_pi == __b._M_pi; }
+
+ private:
+ friend class __weak_count<_Lp>;
+
+ template<typename _Tp, typename _Del>
+ static _Sp_counted_base<_Lp>*
+ _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r,
+ typename std::enable_if<!std::is_reference<_Del>::value>::type* = 0)
+ {
+ return new _Sp_counted_deleter<_Tp*, _Del, std::allocator<_Tp>,
+ _Lp>(__r.get(), __r.get_deleter());
+ }
+
+ template<typename _Tp, typename _Del>
+ static _Sp_counted_base<_Lp>*
+ _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r,
+ typename std::enable_if<std::is_reference<_Del>::value>::type* = 0)
+ {
+ typedef typename std::remove_reference<_Del>::type _Del1;
+ typedef std::reference_wrapper<_Del1> _Del2;
+ return new _Sp_counted_deleter<_Tp*, _Del2, std::allocator<_Tp>,
+ _Lp>(__r.get(), std::ref(__r.get_deleter()));
+ }
+
+ _Sp_counted_base<_Lp>* _M_pi;
+ };
+
+
+ template<_Lock_policy _Lp>
+ class __weak_count
+ {
+ public:
+ __weak_count()
+ : _M_pi(0) // nothrow
+ { }
+
+ __weak_count(const __shared_count<_Lp>& __r)
+ : _M_pi(__r._M_pi) // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_weak_add_ref();
+ }
+
+ __weak_count(const __weak_count<_Lp>& __r)
+ : _M_pi(__r._M_pi) // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_weak_add_ref();
+ }
+
+ ~__weak_count() // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_weak_release();
+ }
+
+ __weak_count<_Lp>&
+ operator=(const __shared_count<_Lp>& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ if (__tmp != 0)
+ __tmp->_M_weak_add_ref();
+ if (_M_pi != 0)
+ _M_pi->_M_weak_release();
+ _M_pi = __tmp;
+ return *this;
+ }
+
+ __weak_count<_Lp>&
+ operator=(const __weak_count<_Lp>& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ if (__tmp != 0)
+ __tmp->_M_weak_add_ref();
+ if (_M_pi != 0)
+ _M_pi->_M_weak_release();
+ _M_pi = __tmp;
+ return *this;
+ }
+
+ void
+ _M_swap(__weak_count<_Lp>& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ __r._M_pi = _M_pi;
+ _M_pi = __tmp;
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
+
+ bool
+ _M_less(const __weak_count& __rhs) const
+ { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+ bool
+ _M_less(const __shared_count<_Lp>& __rhs) const
+ { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+ // friend function injected into enclosing namespace and found by ADL
+ friend inline bool
+ operator==(const __weak_count& __a, const __weak_count& __b)
+ { return __a._M_pi == __b._M_pi; }
+
+ private:
+ friend class __shared_count<_Lp>;
+
+ _Sp_counted_base<_Lp>* _M_pi;
+ };
+
+ // now that __weak_count is defined we can define this constructor:
+ template<_Lock_policy _Lp>
+ inline
+ __shared_count<_Lp>::
+ __shared_count(const __weak_count<_Lp>& __r)
+ : _M_pi(__r._M_pi)
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_add_ref_lock();
+ else
+ __throw_bad_weak_ptr();
+ }
+
+ // Forward declarations.
+ template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+ class __shared_ptr;
+
+ template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+ class __weak_ptr;
+
+ template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+ class __enable_shared_from_this;
+
+ template<typename _Tp>
+ class shared_ptr;
+
+ template<typename _Tp>
+ class weak_ptr;
+
+ template<typename _Tp>
+ class enable_shared_from_this;
+
+ // Support for enable_shared_from_this.
+
+ // Friend of __enable_shared_from_this.
+ template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
+ void
+ __enable_shared_from_this_helper(const __shared_count<_Lp>&,
+ const __enable_shared_from_this<_Tp1,
+ _Lp>*, const _Tp2*);
+
+ // Friend of enable_shared_from_this.
+ template<typename _Tp1, typename _Tp2>
+ void
+ __enable_shared_from_this_helper(const __shared_count<>&,
+ const enable_shared_from_this<_Tp1>*,
+ const _Tp2*);
+
+ template<_Lock_policy _Lp>
+ inline void
+ __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...)
+ { }
+
+
+ template<typename _Tp, _Lock_policy _Lp>
+ class __shared_ptr
+ {
+ public:
+ typedef _Tp element_type;
+
+ /** @brief Construct an empty %__shared_ptr.
+ * @post use_count()==0 && get()==0
+ */
+ __shared_ptr()
+ : _M_ptr(0), _M_refcount() // never throws
+ { }
+
+ /** @brief Construct a %__shared_ptr that owns the pointer @a __p.
+ * @param __p A pointer that is convertible to element_type*.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @c delete @a __p is called.
+ */
+ template<typename _Tp1>
+ explicit
+ __shared_ptr(_Tp1* __p)
+ : _M_ptr(__p), _M_refcount(__p)
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // __glibcxx_function_requires(_CompleteConcept<_Tp1*>)
+ __enable_shared_from_this_helper(_M_refcount, __p, __p);
+ }
+
+ //
+ // Requirements: _Deleter's copy constructor and destructor must
+ // not throw
+ //
+ // __shared_ptr will release __p by calling __d(__p)
+ //
+ /** @brief Construct a %__shared_ptr that owns the pointer @a __p
+ * and the deleter @a __d.
+ * @param __p A pointer.
+ * @param __d A deleter.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @a __d(__p) is called.
+ */
+ template<typename _Tp1, typename _Deleter>
+ __shared_ptr(_Tp1* __p, _Deleter __d)
+ : _M_ptr(__p), _M_refcount(__p, __d)
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
+ __enable_shared_from_this_helper(_M_refcount, __p, __p);
+ }
+
+ //
+ // Requirements: _Deleter's copy constructor and destructor must
+ // not throw _Alloc's copy constructor and destructor must not
+ // throw.
+ //
+ // __shared_ptr will release __p by calling __d(__p)
+ //
+ /** @brief Construct a %__shared_ptr that owns the pointer @a __p
+ * and the deleter @a __d.
+ * @param __p A pointer.
+ * @param __d A deleter.
+ * @param __a An allocator.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @a __d(__p) is called.
+ */
+ template<typename _Tp1, typename _Deleter, typename _Alloc>
+ __shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
+ : _M_ptr(__p), _M_refcount(__p, __d, __a)
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
+ __enable_shared_from_this_helper(_M_refcount, __p, __p);
+ }
+
+ /** @brief Constructs a %__shared_ptr instance that stores @a __p
+ * and shares ownership with @a __r.
+ * @param __r A %__shared_ptr.
+ * @param __p A pointer that will remain valid while @a *__r is valid.
+ * @post get() == __p && use_count() == __r.use_count()
+ *
+ * This can be used to construct a @c shared_ptr to a sub-object
+ * of an object managed by an existing @c shared_ptr.
+ *
+ * @code
+ * shared_ptr< pair<int,int> > pii(new pair<int,int>());
+ * shared_ptr<int> pi(pii, &pii->first);
+ * assert(pii.use_count() == 2);
+ * @endcode
+ */
+ template<typename _Tp1>
+ __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p)
+ : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws
+ { }
+
+ // generated copy constructor, assignment, destructor are fine.
+
+ /** @brief If @a __r is empty, constructs an empty %__shared_ptr;
+ * otherwise construct a %__shared_ptr that shares ownership
+ * with @a __r.
+ * @param __r A %__shared_ptr.
+ * @post get() == __r.get() && use_count() == __r.use_count()
+ */
+ template<typename _Tp1>
+ __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+ : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+ { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+
+ /** @brief Move-constructs a %__shared_ptr instance from @a __r.
+ * @param __r A %__shared_ptr rvalue.
+ * @post *this contains the old value of @a __r, @a __r is empty.
+ */
+ __shared_ptr(__shared_ptr&& __r)
+ : _M_ptr(__r._M_ptr), _M_refcount() // never throws
+ {
+ _M_refcount._M_swap(__r._M_refcount);
+ __r._M_ptr = 0;
+ }
+
+ /** @brief Move-constructs a %__shared_ptr instance from @a __r.
+ * @param __r A %__shared_ptr rvalue.
+ * @post *this contains the old value of @a __r, @a __r is empty.
+ */
+ template<typename _Tp1>
+ __shared_ptr(__shared_ptr<_Tp1, _Lp>&& __r)
+ : _M_ptr(__r._M_ptr), _M_refcount() // never throws
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ _M_refcount._M_swap(__r._M_refcount);
+ __r._M_ptr = 0;
+ }
+
+ /** @brief Constructs a %__shared_ptr that shares ownership with @a __r
+ * and stores a copy of the pointer stored in @a __r.
+ * @param __r A weak_ptr.
+ * @post use_count() == __r.use_count()
+ * @throw bad_weak_ptr when __r.expired(),
+ * in which case the constructor has no effect.
+ */
+ template<typename _Tp1>
+ explicit
+ __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+ : _M_refcount(__r._M_refcount) // may throw
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // It is now safe to copy __r._M_ptr, as _M_refcount(__r._M_refcount)
+ // did not throw.
+ _M_ptr = __r._M_ptr;
+ }
+
+ template<typename _Tp1, typename _Del>
+ explicit
+ __shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete;
+
+ /**
+ * If an exception is thrown this constructor has no effect.
+ */
+ template<typename _Tp1, typename _Del>
+ explicit
+ __shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
+ : _M_ptr(__r.get()), _M_refcount()
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ _Tp1* __tmp = __r.get();
+ _M_refcount = __shared_count<_Lp>(std::move(__r));
+ __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+ }
+
+#if _GLIBCXX_DEPRECATED
+ /**
+ * @post use_count() == 1 and __r.get() == 0
+ */
+ template<typename _Tp1>
+ explicit
+ __shared_ptr(std::auto_ptr<_Tp1>&& __r)
+ : _M_ptr(__r.get()), _M_refcount()
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // TODO requires _Tp1 is complete, delete __r.release() well-formed
+ _Tp1* __tmp = __r.get();
+ _M_refcount = __shared_count<_Lp>(std::move(__r));
+ __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+ }
+#endif
+
+ template<typename _Tp1>
+ __shared_ptr&
+ operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
+ {
+ _M_ptr = __r._M_ptr;
+ _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw
+ return *this;
+ }
+
+#if _GLIBCXX_DEPRECATED
+ template<typename _Tp1>
+ __shared_ptr&
+ operator=(std::auto_ptr<_Tp1>&& __r)
+ {
+ __shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
+#endif
+
+ __shared_ptr&
+ operator=(__shared_ptr&& __r)
+ {
+ __shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
+
+ template<class _Tp1>
+ __shared_ptr&
+ operator=(__shared_ptr<_Tp1, _Lp>&& __r)
+ {
+ __shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
+
+ template<typename _Tp1, typename _Del>
+ __shared_ptr&
+ operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete;
+
+ template<typename _Tp1, typename _Del>
+ __shared_ptr&
+ operator=(std::unique_ptr<_Tp1, _Del>&& __r)
+ {
+ __shared_ptr(std::move(__r)).swap(*this);
+ return *this;
+ }
+
+ void
+ reset() // never throws
+ { __shared_ptr().swap(*this); }
+
+ template<typename _Tp1>
+ void
+ reset(_Tp1* __p) // _Tp1 must be complete.
+ {
+ // Catch self-reset errors.
+ _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr);
+ __shared_ptr(__p).swap(*this);
+ }
+
+ template<typename _Tp1, typename _Deleter>
+ void
+ reset(_Tp1* __p, _Deleter __d)
+ { __shared_ptr(__p, __d).swap(*this); }
+
+ template<typename _Tp1, typename _Deleter, typename _Alloc>
+ void
+ reset(_Tp1* __p, _Deleter __d, const _Alloc& __a)
+ { __shared_ptr(__p, __d, __a).swap(*this); }
+
+ // Allow class instantiation when _Tp is [cv-qual] void.
+ typename std::add_lvalue_reference<_Tp>::type
+ operator*() const // never throws
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return *_M_ptr;
+ }
+
+ _Tp*
+ operator->() const // never throws
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return _M_ptr;
+ }
+
+ _Tp*
+ get() const // never throws
+ { return _M_ptr; }
+
+ // Implicit conversion to "bool"
+ private:
+ typedef _Tp* __shared_ptr::*__unspecified_bool_type;
+
+ public:
+ operator __unspecified_bool_type() const // never throws
+ { return _M_ptr == 0 ? 0 : &__shared_ptr::_M_ptr; }
+
+ bool
+ unique() const // never throws
+ { return _M_refcount._M_unique(); }
+
+ long
+ use_count() const // never throws
+ { return _M_refcount._M_get_use_count(); }
+
+ void
+ swap(__shared_ptr<_Tp, _Lp>&& __other) // never throws
+ {
+ std::swap(_M_ptr, __other._M_ptr);
+ _M_refcount._M_swap(__other._M_refcount);
+ }
+
+ template<typename _Tp1>
+ bool
+ owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const
+ { return _M_refcount._M_less(__rhs._M_refcount); }
+
+ template<typename _Tp1>
+ bool
+ owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const
+ { return _M_refcount._M_less(__rhs._M_refcount); }
+
+ protected:
+ // This constructor is non-standard, it is used by allocate_shared.
+ template<typename _Alloc, typename... _Args>
+ __shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+ : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
+ std::forward<_Args>(__args)...)
+ {
+ // _M_ptr needs to point to the newly constructed object.
+ // This relies on _Sp_counted_ptr_inplace::_M_get_deleter.
+ void* __p = _M_refcount._M_get_deleter(typeid(__tag));
+ _M_ptr = static_cast<_Tp*>(__p);
+ __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
+ }
+
+ template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc,
+ typename... _Args>
+ friend __shared_ptr<_Tp1, _Lp1>
+ __allocate_shared(_Alloc __a, _Args&&... __args);
+
+ private:
+ void*
+ _M_get_deleter(const std::type_info& __ti) const
+ { return _M_refcount._M_get_deleter(__ti); }
+
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
+
+ template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
+ friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&);
+
+ _Tp* _M_ptr; // Contained pointer.
+ __shared_count<_Lp> _M_refcount; // Reference counter.
+ };
+
+ // 20.8.13.2.7 shared_ptr comparisons
+ template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
+ inline bool
+ operator==(const __shared_ptr<_Tp1, _Lp>& __a,
+ const __shared_ptr<_Tp2, _Lp>& __b)
+ { return __a.get() == __b.get(); }
+
+ template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
+ inline bool
+ operator!=(const __shared_ptr<_Tp1, _Lp>& __a,
+ const __shared_ptr<_Tp2, _Lp>& __b)
+ { return __a.get() != __b.get(); }
+
+ template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
+ inline bool
+ operator<(const __shared_ptr<_Tp1, _Lp>& __a,
+ const __shared_ptr<_Tp2, _Lp>& __b)
+ { return __a.get() < __b.get(); }
+
+ template<typename _Sp>
+ struct _Sp_less : public binary_function<_Sp, _Sp, bool>
+ {
+ bool
+ operator()(const _Sp& __lhs, const _Sp& __rhs) const
+ {
+ return std::less<typename _Sp::element_type*>()(__lhs.get(),
+ __rhs.get());
+ }
+ };
+
+ template<typename _Tp, _Lock_policy _Lp>
+ struct less<__shared_ptr<_Tp, _Lp>>
+ : public _Sp_less<__shared_ptr<_Tp, _Lp>>
+ { };
+
+ // XXX LessThanComparable<_Tp> concept should provide >, >= and <=
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ operator>(const __shared_ptr<_Tp, _Lp>& __a,
+ const __shared_ptr<_Tp, _Lp>& __b)
+ { return __a.get() > __b.get(); }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ operator>=(const __shared_ptr<_Tp, _Lp>& __a,
+ const __shared_ptr<_Tp, _Lp>& __b)
+ { return __a.get() >= __b.get(); }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline bool
+ operator<=(const __shared_ptr<_Tp, _Lp>& __a,
+ const __shared_ptr<_Tp, _Lp>& __b)
+ { return __a.get() <= __b.get(); }
+
+ // 2.2.3.8 shared_ptr specialized algorithms.
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
+ { __a.swap(__b); }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ swap(__shared_ptr<_Tp, _Lp>&& __a, __shared_ptr<_Tp, _Lp>& __b)
+ { __a.swap(__b); }
+
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>&& __b)
+ { __a.swap(__b); }
+
+ // 2.2.3.9 shared_ptr casts
+ /** @warning The seemingly equivalent
+ * <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>
+ * will eventually result in undefined behaviour,
+ * attempting to delete the same object twice.
+ */
+ template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+ { return __shared_ptr<_Tp, _Lp>(__r, static_cast<_Tp*>(__r.get())); }
+
+ /** @warning The seemingly equivalent
+ * <code>shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))</code>
+ * will eventually result in undefined behaviour,
+ * attempting to delete the same object twice.
+ */
+ template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+ { return __shared_ptr<_Tp, _Lp>(__r, const_cast<_Tp*>(__r.get())); }
+
+ /** @warning The seemingly equivalent
+ * <code>shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))</code>
+ * will eventually result in undefined behaviour,
+ * attempting to delete the same object twice.
+ */
+ template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+ {
+ if (_Tp* __p = dynamic_cast<_Tp*>(__r.get()))
+ return __shared_ptr<_Tp, _Lp>(__r, __p);
+ return __shared_ptr<_Tp, _Lp>();
+ }
+
+ // 2.2.3.7 shared_ptr I/O
+ template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
+ std::basic_ostream<_Ch, _Tr>&
+ operator<<(std::basic_ostream<_Ch, _Tr>& __os,
+ const __shared_ptr<_Tp, _Lp>& __p)
+ {
+ __os << __p.get();
+ return __os;
+ }
+
+ // 2.2.3.10 shared_ptr get_deleter (experimental)
+ template<typename _Del, typename _Tp, _Lock_policy _Lp>
+ inline _Del*
+ get_deleter(const __shared_ptr<_Tp, _Lp>& __p)
+ { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); }
+
+
+ template<typename _Tp, _Lock_policy _Lp>
+ class __weak_ptr
+ {
+ public:
+ typedef _Tp element_type;
+
+ __weak_ptr()
+ : _M_ptr(0), _M_refcount() // never throws
+ { }
+
+ // Generated copy constructor, assignment, destructor are fine.
+
+ // The "obvious" converting constructor implementation:
+ //
+ // template<typename _Tp1>
+ // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+ // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+ // { }
+ //
+ // has a serious problem.
+ //
+ // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr)
+ // conversion may require access to *__r._M_ptr (virtual inheritance).
+ //
+ // It is not possible to avoid spurious access violations since
+ // in multithreaded programs __r._M_ptr may be invalidated at any point.
+ template<typename _Tp1>
+ __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+ : _M_refcount(__r._M_refcount) // never throws
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ _M_ptr = __r.lock().get();
+ }
+
+ template<typename _Tp1>
+ __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+ : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+ { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+
+ template<typename _Tp1>
+ __weak_ptr&
+ operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws
+ {
+ _M_ptr = __r.lock().get();
+ _M_refcount = __r._M_refcount;
+ return *this;
+ }
+
+ template<typename _Tp1>
+ __weak_ptr&
+ operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
+ {
+ _M_ptr = __r._M_ptr;
+ _M_refcount = __r._M_refcount;
+ return *this;
+ }
+
+ __shared_ptr<_Tp, _Lp>
+ lock() const // never throws
+ {
+#ifdef __GTHREADS
+ // Optimization: avoid throw overhead.
+ if (expired())
+ return __shared_ptr<element_type, _Lp>();
+
+ __try
+ {
+ return __shared_ptr<element_type, _Lp>(*this);
+ }
+ __catch(const bad_weak_ptr&)
+ {
+ // Q: How can we get here?
+ // A: Another thread may have invalidated r after the
+ // use_count test above.
+ return __shared_ptr<element_type, _Lp>();
+ }
+
+#else
+ // Optimization: avoid try/catch overhead when single threaded.
+ return expired() ? __shared_ptr<element_type, _Lp>()
+ : __shared_ptr<element_type, _Lp>(*this);
+
+#endif
+ } // XXX MT
+
+ long
+ use_count() const // never throws
+ { return _M_refcount._M_get_use_count(); }
+
+ bool
+ expired() const // never throws
+ { return _M_refcount._M_get_use_count() == 0; }
+
+ template<typename _Tp1>
+ bool
+ owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const
+ { return _M_refcount._M_less(__rhs._M_refcount); }
+
+ template<typename _Tp1>
+ bool
+ owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const
+ { return _M_refcount._M_less(__rhs._M_refcount); }
+
+ void
+ reset() // never throws
+ { __weak_ptr().swap(*this); }
+
+ void
+ swap(__weak_ptr& __s) // never throws
+ {
+ std::swap(_M_ptr, __s._M_ptr);
+ _M_refcount._M_swap(__s._M_refcount);
+ }
+
+ // comparisons
+ template<typename _Tp1>
+ bool operator<(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+ template<typename _Tp1>
+ bool operator<=(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+ template<typename _Tp1>
+ bool operator>(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+ template<typename _Tp1>
+ bool operator>=(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+
+ private:
+ // Used by __enable_shared_from_this.
+ void
+ _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount)
+ {
+ _M_ptr = __ptr;
+ _M_refcount = __refcount;
+ }
+
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
+ friend class __enable_shared_from_this<_Tp, _Lp>;
+ friend class enable_shared_from_this<_Tp>;
+
+ _Tp* _M_ptr; // Contained pointer.
+ __weak_count<_Lp> _M_refcount; // Reference counter.
+ };
+
+ // 20.8.13.3.7 weak_ptr specialized algorithms.
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b)
+ { __a.swap(__b); }
+
+ /// owner_less
+ template<typename _Tp> struct owner_less;
+
+ template<typename _Tp, typename _Tp1>
+ struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __lhs, const _Tp& __rhs) const
+ { return __lhs.owner_before(__rhs); }
+ bool
+ operator()(const _Tp& __lhs, const _Tp1& __rhs) const
+ { return __lhs.owner_before(__rhs); }
+ bool
+ operator()(const _Tp1& __lhs, const _Tp& __rhs) const
+ { return __lhs.owner_before(__rhs); }
+ };
+
+ template<typename _Tp, _Lock_policy _Lp>
+ struct owner_less<__shared_ptr<_Tp, _Lp>>
+ : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>>
+ { };
+
+ template<typename _Tp, _Lock_policy _Lp>
+ struct owner_less<__weak_ptr<_Tp, _Lp>>
+ : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>>
+ {
+ };
+
+
+ template<typename _Tp, _Lock_policy _Lp>
+ class __enable_shared_from_this
+ {
+ protected:
+ __enable_shared_from_this() { }
+
+ __enable_shared_from_this(const __enable_shared_from_this&) { }
+
+ __enable_shared_from_this&
+ operator=(const __enable_shared_from_this&)
+ { return *this; }
+
+ ~__enable_shared_from_this() { }
+
+ public:
+ __shared_ptr<_Tp, _Lp>
+ shared_from_this()
+ { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); }
+
+ __shared_ptr<const _Tp, _Lp>
+ shared_from_this() const
+ { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); }
+
+ private:
+ template<typename _Tp1>
+ void
+ _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const
+ { _M_weak_this._M_assign(__p, __n); }
+
+ template<typename _Tp1>
+ friend void
+ __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn,
+ const __enable_shared_from_this* __pe,
+ const _Tp1* __px)
+ {
+ if (__pe != 0)
+ __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
+ }
+
+ mutable __weak_ptr<_Tp, _Lp> _M_weak_this;
+ };
+
+ /**
+ * @brief A smart pointer with reference-counted copy semantics.
+ *
+ * The object pointed to is deleted when the last shared_ptr pointing to
+ * it is destroyed or reset.
+ */
+ template<typename _Tp>
+ class shared_ptr
+ : public __shared_ptr<_Tp>
+ {
+ public:
+ shared_ptr()
+ : __shared_ptr<_Tp>() { }
+
+ template<typename _Tp1>
+ explicit
+ shared_ptr(_Tp1* __p)
+ : __shared_ptr<_Tp>(__p) { }
+
+ template<typename _Tp1, typename _Deleter>
+ shared_ptr(_Tp1* __p, _Deleter __d)
+ : __shared_ptr<_Tp>(__p, __d) { }
+
+ template<typename _Tp1, typename _Deleter, typename _Alloc>
+ shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
+ : __shared_ptr<_Tp>(__p, __d, __a) { }
+
+ // Aliasing constructor
+ template<typename _Tp1>
+ shared_ptr(const shared_ptr<_Tp1>& __r, _Tp* __p)
+ : __shared_ptr<_Tp>(__r, __p) { }
+
+ template<typename _Tp1>
+ shared_ptr(const shared_ptr<_Tp1>& __r)
+ : __shared_ptr<_Tp>(__r) { }
+
+ shared_ptr(shared_ptr&& __r)
+ : __shared_ptr<_Tp>(std::move(__r)) { }
+
+ template<typename _Tp1>
+ shared_ptr(shared_ptr<_Tp1>&& __r)
+ : __shared_ptr<_Tp>(std::move(__r)) { }
+
+ template<typename _Tp1>
+ explicit
+ shared_ptr(const weak_ptr<_Tp1>& __r)
+ : __shared_ptr<_Tp>(__r) { }
+
+#if _GLIBCXX_DEPRECATED
+ template<typename _Tp1>
+ explicit
+ shared_ptr(std::auto_ptr<_Tp1>&& __r)
+ : __shared_ptr<_Tp>(std::move(__r)) { }
+#endif
+
+ template<typename _Tp1, typename _Del>
+ explicit
+ shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete;
+
+ template<typename _Tp1, typename _Del>
+ explicit
+ shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
+ : __shared_ptr<_Tp>(std::move(__r)) { }
+
+ template<typename _Tp1>
+ shared_ptr&
+ operator=(const shared_ptr<_Tp1>& __r) // never throws
+ {
+ this->__shared_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+
+#if _GLIBCXX_DEPRECATED
+ template<typename _Tp1>
+ shared_ptr&
+ operator=(std::auto_ptr<_Tp1>&& __r)
+ {
+ this->__shared_ptr<_Tp>::operator=(std::move(__r));
+ return *this;
+ }
+#endif
+
+ shared_ptr&
+ operator=(shared_ptr&& __r)
+ {
+ this->__shared_ptr<_Tp>::operator=(std::move(__r));
+ return *this;
+ }
+
+ template<class _Tp1>
+ shared_ptr&
+ operator=(shared_ptr<_Tp1>&& __r)
+ {
+ this->__shared_ptr<_Tp>::operator=(std::move(__r));
+ return *this;
+ }
+
+ template<typename _Tp1, typename _Del>
+ shared_ptr&
+ operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete;
+
+ template<typename _Tp1, typename _Del>
+ shared_ptr&
+ operator=(std::unique_ptr<_Tp1, _Del>&& __r)
+ {
+ this->__shared_ptr<_Tp>::operator=(std::move(__r));
+ return *this;
+ }
+
+ private:
+ // This constructor is non-standard, it is used by allocate_shared.
+ template<typename _Alloc, typename... _Args>
+ shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+ : __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...)
+ { }
+
+ template<typename _Tp1, typename _Alloc, typename... _Args>
+ friend shared_ptr<_Tp1>
+ allocate_shared(_Alloc __a, _Args&&... __args);
+ };
+
+ // 20.8.13.2.7 shared_ptr comparisons
+ template<typename _Tp1, typename _Tp2>
+ inline bool
+ operator==(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b)
+ { return __a.get() == __b.get(); }
+
+ template<typename _Tp1, typename _Tp2>
+ inline bool
+ operator!=(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b)
+ { return __a.get() != __b.get(); }
+
+ template<typename _Tp1, typename _Tp2>
+ inline bool
+ operator<(const shared_ptr<_Tp1>& __a, const shared_ptr<_Tp2>& __b)
+ { return __a.get() < __b.get(); }
+
+ template<typename _Tp>
+ struct less<shared_ptr<_Tp>>
+ : public _Sp_less<shared_ptr<_Tp>>
+ { };
+
+ // 20.8.13.2.9 shared_ptr specialized algorithms.
+ template<typename _Tp>
+ inline void
+ swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b)
+ { __a.swap(__b); }
+
+ template<typename _Tp>
+ inline void
+ swap(shared_ptr<_Tp>&& __a, shared_ptr<_Tp>& __b)
+ { __a.swap(__b); }
+
+ template<typename _Tp>
+ inline void
+ swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>&& __b)
+ { __a.swap(__b); }
+
+ // 20.8.13.2.10 shared_ptr casts.
+ template<typename _Tp, typename _Tp1>
+ inline shared_ptr<_Tp>
+ static_pointer_cast(const shared_ptr<_Tp1>& __r)
+ { return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get())); }
+
+ template<typename _Tp, typename _Tp1>
+ inline shared_ptr<_Tp>
+ const_pointer_cast(const shared_ptr<_Tp1>& __r)
+ { return shared_ptr<_Tp>(__r, const_cast<_Tp*>(__r.get())); }
+
+ template<typename _Tp, typename _Tp1>
+ inline shared_ptr<_Tp>
+ dynamic_pointer_cast(const shared_ptr<_Tp1>& __r)
+ {
+ if (_Tp* __p = dynamic_cast<_Tp*>(__r.get()))
+ return shared_ptr<_Tp>(__r, __p);
+ return shared_ptr<_Tp>();
+ }
+
+
+ /**
+ * @brief A smart pointer with weak semantics.
+ *
+ * With forwarding constructors and assignment operators.
+ */
+ template<typename _Tp>
+ class weak_ptr
+ : public __weak_ptr<_Tp>
+ {
+ public:
+ weak_ptr()
+ : __weak_ptr<_Tp>() { }
+
+ template<typename _Tp1>
+ weak_ptr(const weak_ptr<_Tp1>& __r)
+ : __weak_ptr<_Tp>(__r) { }
+
+ template<typename _Tp1>
+ weak_ptr(const shared_ptr<_Tp1>& __r)
+ : __weak_ptr<_Tp>(__r) { }
+
+ template<typename _Tp1>
+ weak_ptr&
+ operator=(const weak_ptr<_Tp1>& __r) // never throws
+ {
+ this->__weak_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+
+ template<typename _Tp1>
+ weak_ptr&
+ operator=(const shared_ptr<_Tp1>& __r) // never throws
+ {
+ this->__weak_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+
+ shared_ptr<_Tp>
+ lock() const // never throws
+ {
+#ifdef __GTHREADS
+ if (this->expired())
+ return shared_ptr<_Tp>();
+
+ __try
+ {
+ return shared_ptr<_Tp>(*this);
+ }
+ __catch(const bad_weak_ptr&)
+ {
+ return shared_ptr<_Tp>();
+ }
+#else
+ return this->expired() ? shared_ptr<_Tp>()
+ : shared_ptr<_Tp>(*this);
+#endif
+ }
+
+ // comparisons
+ template<typename _Tp1>
+ bool operator<(const weak_ptr<_Tp1>&) const = delete;
+ template<typename _Tp1>
+ bool operator<=(const weak_ptr<_Tp1>&) const = delete;
+ template<typename _Tp1>
+ bool operator>(const weak_ptr<_Tp1>&) const = delete;
+ template<typename _Tp1>
+ bool operator>=(const weak_ptr<_Tp1>&) const = delete;
+ };
+
+ // 20.8.13.3.7 weak_ptr specialized algorithms.
+ template<typename _Tp>
+ inline void
+ swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b)
+ { __a.swap(__b); }
+
+ /// owner_less
+ template<typename _Tp>
+ struct owner_less<shared_ptr<_Tp>>
+ : public _Sp_owner_less<shared_ptr<_Tp>, weak_ptr<_Tp>>
+ { };
+
+ template<typename _Tp>
+ struct owner_less<weak_ptr<_Tp>>
+ : public _Sp_owner_less<weak_ptr<_Tp>, shared_ptr<_Tp>>
+ { };
+
+ /**
+ * @brief Base class allowing use of member function shared_from_this.
+ */
+ template<typename _Tp>
+ class enable_shared_from_this
+ {
+ protected:
+ enable_shared_from_this() { }
+
+ enable_shared_from_this(const enable_shared_from_this&) { }
+
+ enable_shared_from_this&
+ operator=(const enable_shared_from_this&)
+ { return *this; }
+
+ ~enable_shared_from_this() { }
+
+ public:
+ shared_ptr<_Tp>
+ shared_from_this()
+ { return shared_ptr<_Tp>(this->_M_weak_this); }
+
+ shared_ptr<const _Tp>
+ shared_from_this() const
+ { return shared_ptr<const _Tp>(this->_M_weak_this); }
+
+ private:
+ template<typename _Tp1>
+ void
+ _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const
+ { _M_weak_this._M_assign(__p, __n); }
+
+ template<typename _Tp1>
+ friend void
+ __enable_shared_from_this_helper(const __shared_count<>& __pn,
+ const enable_shared_from_this* __pe,
+ const _Tp1* __px)
+ {
+ if (__pe != 0)
+ __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
+ }
+
+ mutable weak_ptr<_Tp> _M_weak_this;
+ };
+
+ template<typename _Tp, _Lock_policy _Lp, typename _Alloc, typename... _Args>
+ inline __shared_ptr<_Tp, _Lp>
+ __allocate_shared(_Alloc __a, _Args&&... __args)
+ {
+ return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(),
+ std::forward<_Alloc>(__a), std::forward<_Args>(__args)...);
+ }
+
+ template<typename _Tp, _Lock_policy _Lp, typename... _Args>
+ inline __shared_ptr<_Tp, _Lp>
+ __make_shared(_Args&&... __args)
+ {
+ typedef typename std::remove_const<_Tp>::type _Tp_nc;
+ return __allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(),
+ std::forward<_Args>(__args)...);
+ }
+
+ /** @brief Create an object that is owned by a shared_ptr.
+ * @param __a An allocator.
+ * @param __args Arguments for the @a _Tp object's constructor.
+ * @return A shared_ptr that owns the newly created object.
+ * @throw An exception thrown from @a _Alloc::allocate or from the
+ * constructor of @a _Tp.
+ *
+ * A copy of @a __a will be used to allocate memory for the shared_ptr
+ * and the new object.
+ */
+ template<typename _Tp, typename _Alloc, typename... _Args>
+ inline shared_ptr<_Tp>
+ allocate_shared(_Alloc __a, _Args&&... __args)
+ {
+ return shared_ptr<_Tp>(_Sp_make_shared_tag(), std::forward<_Alloc>(__a),
+ std::forward<_Args>(__args)...);
+ }
+
+ /** @brief Create an object that is owned by a shared_ptr.
+ * @param __args Arguments for the @a _Tp object's constructor.
+ * @return A shared_ptr that owns the newly created object.
+ * @throw std::bad_alloc, or an exception thrown from the
+ * constructor of @a _Tp.
+ */
+ template<typename _Tp, typename... _Args>
+ inline shared_ptr<_Tp>
+ make_shared(_Args&&... __args)
+ {
+ typedef typename std::remove_const<_Tp>::type _Tp_nc;
+ return allocate_shared<_Tp>(std::allocator<_Tp_nc>(),
+ std::forward<_Args>(__args)...);
+ }
+
+ // @} group pointer_abstractions
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _SHARED_PTR_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/slice_array.h b/gcc-4.4.0/libstdc++-v3/include/bits/slice_array.h
new file mode 100644
index 000000000..566c764e9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/slice_array.h
@@ -0,0 +1,272 @@
+// The template and inlines for the -*- C++ -*- slice_array class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file slice_array.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _SLICE_ARRAY_H
+#define _SLICE_ARRAY_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup numeric_arrays
+ * @{
+ */
+
+ /**
+ * @brief Class defining one-dimensional subset of an array.
+ *
+ * The slice class represents a one-dimensional subset of an array,
+ * specified by three parameters: start offset, size, and stride. The
+ * start offset is the index of the first element of the array that is part
+ * of the subset. The size is the total number of elements in the subset.
+ * Stride is the distance between each successive array element to include
+ * in the subset.
+ *
+ * For example, with an array of size 10, and a slice with offset 1, size 3
+ * and stride 2, the subset consists of array elements 1, 3, and 5.
+ */
+ class slice
+ {
+ public:
+ /// Construct an empty slice.
+ slice();
+
+ /**
+ * @brief Construct a slice.
+ *
+ * @param o Offset in array of first element.
+ * @param d Number of elements in slice.
+ * @param s Stride between array elements.
+ */
+ slice(size_t, size_t, size_t);
+
+ /// Return array offset of first slice element.
+ size_t start() const;
+ /// Return size of slice.
+ size_t size() const;
+ /// Return array stride of slice.
+ size_t stride() const;
+
+ private:
+ size_t _M_off; // offset
+ size_t _M_sz; // size
+ size_t _M_st; // stride unit
+ };
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 543. valarray slice default constructor
+ inline
+ slice::slice()
+ : _M_off(0), _M_sz(0), _M_st(0) {}
+
+ inline
+ slice::slice(size_t __o, size_t __d, size_t __s)
+ : _M_off(__o), _M_sz(__d), _M_st(__s) {}
+
+ inline size_t
+ slice::start() const
+ { return _M_off; }
+
+ inline size_t
+ slice::size() const
+ { return _M_sz; }
+
+ inline size_t
+ slice::stride() const
+ { return _M_st; }
+
+ /**
+ * @brief Reference to one-dimensional subset of an array.
+ *
+ * A slice_array is a reference to the actual elements of an array
+ * specified by a slice. The way to get a slice_array is to call
+ * operator[](slice) on a valarray. The returned slice_array then permits
+ * carrying operations out on the referenced subset of elements in the
+ * original valarray. For example, operator+=(valarray) will add values
+ * to the subset of elements in the underlying valarray this slice_array
+ * refers to.
+ *
+ * @param Tp Element type.
+ */
+ template<typename _Tp>
+ class slice_array
+ {
+ public:
+ typedef _Tp value_type;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 253. valarray helper functions are almost entirely useless
+
+ /// Copy constructor. Both slices refer to the same underlying array.
+ slice_array(const slice_array&);
+
+ /// Assignment operator. Assigns slice elements to corresponding
+ /// elements of @a a.
+ slice_array& operator=(const slice_array&);
+
+ /// Assign slice elements to corresponding elements of @a v.
+ void operator=(const valarray<_Tp>&) const;
+ /// Multiply slice elements by corresponding elements of @a v.
+ void operator*=(const valarray<_Tp>&) const;
+ /// Divide slice elements by corresponding elements of @a v.
+ void operator/=(const valarray<_Tp>&) const;
+ /// Modulo slice elements by corresponding elements of @a v.
+ void operator%=(const valarray<_Tp>&) const;
+ /// Add corresponding elements of @a v to slice elements.
+ void operator+=(const valarray<_Tp>&) const;
+ /// Subtract corresponding elements of @a v from slice elements.
+ void operator-=(const valarray<_Tp>&) const;
+ /// Logical xor slice elements with corresponding elements of @a v.
+ void operator^=(const valarray<_Tp>&) const;
+ /// Logical and slice elements with corresponding elements of @a v.
+ void operator&=(const valarray<_Tp>&) const;
+ /// Logical or slice elements with corresponding elements of @a v.
+ void operator|=(const valarray<_Tp>&) const;
+ /// Left shift slice elements by corresponding elements of @a v.
+ void operator<<=(const valarray<_Tp>&) const;
+ /// Right shift slice elements by corresponding elements of @a v.
+ void operator>>=(const valarray<_Tp>&) const;
+ /// Assign all slice elements to @a t.
+ void operator=(const _Tp &) const;
+ // ~slice_array ();
+
+ template<class _Dom>
+ void operator=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator*=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator/=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator%=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator+=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator-=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator^=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator&=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator|=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator<<=(const _Expr<_Dom, _Tp>&) const;
+ template<class _Dom>
+ void operator>>=(const _Expr<_Dom, _Tp>&) const;
+
+ private:
+ friend class valarray<_Tp>;
+ slice_array(_Array<_Tp>, const slice&);
+
+ const size_t _M_sz;
+ const size_t _M_stride;
+ const _Array<_Tp> _M_array;
+
+ // not implemented
+ slice_array();
+ };
+
+ template<typename _Tp>
+ inline
+ slice_array<_Tp>::slice_array(_Array<_Tp> __a, const slice& __s)
+ : _M_sz(__s.size()), _M_stride(__s.stride()),
+ _M_array(__a.begin() + __s.start()) {}
+
+ template<typename _Tp>
+ inline
+ slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
+ : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
+
+ // template<typename _Tp>
+ // inline slice_array<_Tp>::~slice_array () {}
+
+ template<typename _Tp>
+ inline slice_array<_Tp>&
+ slice_array<_Tp>::operator=(const slice_array<_Tp>& __a)
+ {
+ std::__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride,
+ _M_array, _M_stride);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline void
+ slice_array<_Tp>::operator=(const _Tp& __t) const
+ { std::__valarray_fill(_M_array, _M_sz, _M_stride, __t); }
+
+ template<typename _Tp>
+ inline void
+ slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const
+ { std::__valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); }
+
+ template<typename _Tp>
+ template<class _Dom>
+ inline void
+ slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const
+ { std::__valarray_copy(__e, _M_sz, _M_array, _M_stride); }
+
+#undef _DEFINE_VALARRAY_OPERATOR
+#define _DEFINE_VALARRAY_OPERATOR(_Op,_Name) \
+ template<typename _Tp> \
+ inline void \
+ slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \
+ { \
+ _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\
+ } \
+ \
+ template<typename _Tp> \
+ template<class _Dom> \
+ inline void \
+ slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\
+ { \
+ _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz); \
+ }
+
+
+_DEFINE_VALARRAY_OPERATOR(*, __multiplies)
+_DEFINE_VALARRAY_OPERATOR(/, __divides)
+_DEFINE_VALARRAY_OPERATOR(%, __modulus)
+_DEFINE_VALARRAY_OPERATOR(+, __plus)
+_DEFINE_VALARRAY_OPERATOR(-, __minus)
+_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)
+_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)
+_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)
+_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)
+_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)
+
+#undef _DEFINE_VALARRAY_OPERATOR
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _SLICE_ARRAY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/sstream.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/sstream.tcc
new file mode 100644
index 000000000..0f9db8e93
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/sstream.tcc
@@ -0,0 +1,273 @@
+// String based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file sstream.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.7 String-based streams
+//
+
+#ifndef _SSTREAM_TCC
+#define _SSTREAM_TCC 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template <class _CharT, class _Traits, class _Alloc>
+ typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ pbackfail(int_type __c)
+ {
+ int_type __ret = traits_type::eof();
+ if (this->eback() < this->gptr())
+ {
+ // Try to put back __c into input sequence in one of three ways.
+ // Order these tests done in is unspecified by the standard.
+ const bool __testeof = traits_type::eq_int_type(__c, __ret);
+ if (!__testeof)
+ {
+ const bool __testeq = traits_type::eq(traits_type::
+ to_char_type(__c),
+ this->gptr()[-1]);
+ const bool __testout = this->_M_mode & ios_base::out;
+ if (__testeq || __testout)
+ {
+ this->gbump(-1);
+ if (!__testeq)
+ *this->gptr() = traits_type::to_char_type(__c);
+ __ret = __c;
+ }
+ }
+ else
+ {
+ this->gbump(-1);
+ __ret = traits_type::not_eof(__c);
+ }
+ }
+ return __ret;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ overflow(int_type __c)
+ {
+ const bool __testout = this->_M_mode & ios_base::out;
+ if (__builtin_expect(!__testout, false))
+ return traits_type::eof();
+
+ const bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
+ if (__builtin_expect(__testeof, false))
+ return traits_type::not_eof(__c);
+
+ const __size_type __capacity = _M_string.capacity();
+ const __size_type __max_size = _M_string.max_size();
+ const bool __testput = this->pptr() < this->epptr();
+ if (__builtin_expect(!__testput && __capacity == __max_size, false))
+ return traits_type::eof();
+
+ // Try to append __c into output sequence in one of two ways.
+ // Order these tests done in is unspecified by the standard.
+ const char_type __conv = traits_type::to_char_type(__c);
+ if (!__testput)
+ {
+ // NB: Start ostringstream buffers at 512 chars. This is an
+ // experimental value (pronounced "arbitrary" in some of the
+ // hipper English-speaking countries), and can be changed to
+ // suit particular needs.
+ //
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 169. Bad efficiency of overflow() mandated
+ // 432. stringbuf::overflow() makes only one write position
+ // available
+ const __size_type __opt_len = std::max(__size_type(2 * __capacity),
+ __size_type(512));
+ const __size_type __len = std::min(__opt_len, __max_size);
+ __string_type __tmp;
+ __tmp.reserve(__len);
+ if (this->pbase())
+ __tmp.assign(this->pbase(), this->epptr() - this->pbase());
+ __tmp.push_back(__conv);
+ _M_string.swap(__tmp);
+ _M_sync(const_cast<char_type*>(_M_string.data()),
+ this->gptr() - this->eback(), this->pptr() - this->pbase());
+ }
+ else
+ *this->pptr() = __conv;
+ this->pbump(1);
+ return __c;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ underflow()
+ {
+ int_type __ret = traits_type::eof();
+ const bool __testin = this->_M_mode & ios_base::in;
+ if (__testin)
+ {
+ // Update egptr() to match the actual string end.
+ _M_update_egptr();
+
+ if (this->gptr() < this->egptr())
+ __ret = traits_type::to_int_type(*this->gptr());
+ }
+ return __ret;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
+ {
+ pos_type __ret = pos_type(off_type(-1));
+ bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
+ bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
+ const bool __testboth = __testin && __testout && __way != ios_base::cur;
+ __testin &= !(__mode & ios_base::out);
+ __testout &= !(__mode & ios_base::in);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 453. basic_stringbuf::seekoff need not always fail for an empty stream.
+ const char_type* __beg = __testin ? this->eback() : this->pbase();
+ if ((__beg || !__off) && (__testin || __testout || __testboth))
+ {
+ _M_update_egptr();
+
+ off_type __newoffi = __off;
+ off_type __newoffo = __newoffi;
+ if (__way == ios_base::cur)
+ {
+ __newoffi += this->gptr() - __beg;
+ __newoffo += this->pptr() - __beg;
+ }
+ else if (__way == ios_base::end)
+ __newoffo = __newoffi += this->egptr() - __beg;
+
+ if ((__testin || __testboth)
+ && __newoffi >= 0
+ && this->egptr() - __beg >= __newoffi)
+ {
+ this->gbump((__beg + __newoffi) - this->gptr());
+ __ret = pos_type(__newoffi);
+ }
+ if ((__testout || __testboth)
+ && __newoffo >= 0
+ && this->egptr() - __beg >= __newoffo)
+ {
+ this->pbump((__beg + __newoffo) - this->pptr());
+ __ret = pos_type(__newoffo);
+ }
+ }
+ return __ret;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ seekpos(pos_type __sp, ios_base::openmode __mode)
+ {
+ pos_type __ret = pos_type(off_type(-1));
+ const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
+ const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
+
+ const char_type* __beg = __testin ? this->eback() : this->pbase();
+ if ((__beg || !off_type(__sp)) && (__testin || __testout))
+ {
+ _M_update_egptr();
+
+ const off_type __pos(__sp);
+ const bool __testpos = (0 <= __pos
+ && __pos <= this->egptr() - __beg);
+ if (__testpos)
+ {
+ if (__testin)
+ this->gbump((__beg + __pos) - this->gptr());
+ if (__testout)
+ this->pbump((__beg + __pos) - this->pptr());
+ __ret = __sp;
+ }
+ }
+ return __ret;
+ }
+
+ template <class _CharT, class _Traits, class _Alloc>
+ void
+ basic_stringbuf<_CharT, _Traits, _Alloc>::
+ _M_sync(char_type* __base, __size_type __i, __size_type __o)
+ {
+ const bool __testin = _M_mode & ios_base::in;
+ const bool __testout = _M_mode & ios_base::out;
+ char_type* __endg = __base + _M_string.size();
+ char_type* __endp = __base + _M_string.capacity();
+
+ if (__base != _M_string.data())
+ {
+ // setbuf: __i == size of buffer area (_M_string.size() == 0).
+ __endg += __i;
+ __i = 0;
+ __endp = __endg;
+ }
+
+ if (__testin)
+ this->setg(__base, __base + __i, __endg);
+ if (__testout)
+ {
+ this->setp(__base, __endp);
+ this->pbump(__o);
+ // egptr() always tracks the string end. When !__testin,
+ // for the correct functioning of the streambuf inlines
+ // the other get area pointers are identical.
+ if (!__testin)
+ this->setg(__endg, __endg, __endg);
+ }
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class basic_stringbuf<char>;
+ extern template class basic_istringstream<char>;
+ extern template class basic_ostringstream<char>;
+ extern template class basic_stringstream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_stringbuf<wchar_t>;
+ extern template class basic_istringstream<wchar_t>;
+ extern template class basic_ostringstream<wchar_t>;
+ extern template class basic_stringstream<wchar_t>;
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_algo.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_algo.h
new file mode 100644
index 000000000..f54b1cd77
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_algo.h
@@ -0,0 +1,6139 @@
+// Algorithm implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_algo.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_ALGO_H
+#define _STL_ALGO_H 1
+
+#include <cstdlib> // for rand
+#include <bits/algorithmfwd.h>
+#include <bits/stl_heap.h>
+#include <bits/stl_tempbuf.h> // for _Temporary_buffer
+#include <debug/debug.h>
+#include <initializer_list>
+
+// See concept_check.h for the __glibcxx_*_requires macros.
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+// Local modification: if __google_stl_debug_compare is defined to
+// non-zero value, check sort predicate for strict weak ordering.
+// See http://b/1731200.
+#if __google_stl_debug_compare
+ template<typename _Compare>
+ struct _CheckedCompare {
+ // Mutable because some clients use non-const operator().
+ mutable _Compare _M_compare;
+
+ _CheckedCompare(const _Compare & __comp): _M_compare(__comp) { }
+
+ template <typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const {
+ if (_M_compare(__x, __x))
+ __throw_runtime_error("strict weak ordering: (__x LT __x) != false");
+ if (_M_compare(__y, __y))
+ __throw_runtime_error("strict weak ordering: (__y LT __y) != false");
+ bool lt = _M_compare(__x, __y);
+ if (lt && _M_compare(__y, __x))
+ __throw_runtime_error("strict weak ordering: ((__x LT __y) && (__y LT __x)) != false");
+ return lt;
+ }
+
+ // Different types; can't perform any checks.
+ // When building //indexterm/internal:indexterm,
+ // indexterm/internal/numericterms.cc
+ // fails without this.
+ template <typename _Tp1, typename _Tp2>
+ bool operator()(const _Tp1& __x, const _Tp2& __y) const {
+ return _M_compare(__x, __y);
+ }
+ };
+# define __CheckedCompare(__comp) _CheckedCompare<__typeof__(__comp)>(__comp)
+#else
+# define __CheckedCompare(__comp) __comp
+#endif
+
+ /**
+ * @brief Find the median of three values.
+ * @param a A value.
+ * @param b A value.
+ * @param c A value.
+ * @return One of @p a, @p b or @p c.
+ *
+ * If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n
+ * then the value returned will be @c m.
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ */
+ template<typename _Tp>
+ inline const _Tp&
+ __median(const _Tp& __a, const _Tp& __b, const _Tp& __c)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
+ if (__a < __b)
+ if (__b < __c)
+ return __b;
+ else if (__a < __c)
+ return __c;
+ else
+ return __a;
+ else if (__a < __c)
+ return __a;
+ else if (__b < __c)
+ return __c;
+ else
+ return __b;
+ }
+
+ /**
+ * @brief Find the median of three values using a predicate for comparison.
+ * @param a A value.
+ * @param b A value.
+ * @param c A value.
+ * @param comp A binary predicate.
+ * @return One of @p a, @p b or @p c.
+ *
+ * If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)
+ * and @p comp(m,n) are both true then the value returned will be @c m.
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ */
+ template<typename _Tp, typename _Compare>
+ inline const _Tp&
+ __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
+ _Tp, _Tp>)
+ if (__comp(__a, __b))
+ if (__comp(__b, __c))
+ return __b;
+ else if (__comp(__a, __c))
+ return __c;
+ else
+ return __a;
+ else if (__comp(__a, __c))
+ return __a;
+ else if (__comp(__b, __c))
+ return __c;
+ else
+ return __b;
+ }
+
+ // for_each
+
+ /// This is an overload used by find() for the Input Iterator case.
+ template<typename _InputIterator, typename _Tp>
+ inline _InputIterator
+ __find(_InputIterator __first, _InputIterator __last,
+ const _Tp& __val, input_iterator_tag)
+ {
+ while (__first != __last && !(*__first == __val))
+ ++__first;
+ return __first;
+ }
+
+ /// This is an overload used by find_if() for the Input Iterator case.
+ template<typename _InputIterator, typename _Predicate>
+ inline _InputIterator
+ __find_if(_InputIterator __first, _InputIterator __last,
+ _Predicate __pred, input_iterator_tag)
+ {
+ while (__first != __last && !bool(__pred(*__first)))
+ ++__first;
+ return __first;
+ }
+
+ /// This is an overload used by find() for the RAI case.
+ template<typename _RandomAccessIterator, typename _Tp>
+ _RandomAccessIterator
+ __find(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ const _Tp& __val, random_access_iterator_tag)
+ {
+ typename iterator_traits<_RandomAccessIterator>::difference_type
+ __trip_count = (__last - __first) >> 2;
+
+ for (; __trip_count > 0; --__trip_count)
+ {
+ if (*__first == __val)
+ return __first;
+ ++__first;
+
+ if (*__first == __val)
+ return __first;
+ ++__first;
+
+ if (*__first == __val)
+ return __first;
+ ++__first;
+
+ if (*__first == __val)
+ return __first;
+ ++__first;
+ }
+
+ switch (__last - __first)
+ {
+ case 3:
+ if (*__first == __val)
+ return __first;
+ ++__first;
+ case 2:
+ if (*__first == __val)
+ return __first;
+ ++__first;
+ case 1:
+ if (*__first == __val)
+ return __first;
+ ++__first;
+ case 0:
+ default:
+ return __last;
+ }
+ }
+
+ /// This is an overload used by find_if() for the RAI case.
+ template<typename _RandomAccessIterator, typename _Predicate>
+ _RandomAccessIterator
+ __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Predicate __pred, random_access_iterator_tag)
+ {
+ typename iterator_traits<_RandomAccessIterator>::difference_type
+ __trip_count = (__last - __first) >> 2;
+
+ for (; __trip_count > 0; --__trip_count)
+ {
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+ }
+
+ switch (__last - __first)
+ {
+ case 3:
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+ case 2:
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+ case 1:
+ if (__pred(*__first))
+ return __first;
+ ++__first;
+ case 0:
+ default:
+ return __last;
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// This is an overload used by find_if_not() for the Input Iterator case.
+ template<typename _InputIterator, typename _Predicate>
+ inline _InputIterator
+ __find_if_not(_InputIterator __first, _InputIterator __last,
+ _Predicate __pred, input_iterator_tag)
+ {
+ while (__first != __last && bool(__pred(*__first)))
+ ++__first;
+ return __first;
+ }
+
+ /// This is an overload used by find_if_not() for the RAI case.
+ template<typename _RandomAccessIterator, typename _Predicate>
+ _RandomAccessIterator
+ __find_if_not(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Predicate __pred, random_access_iterator_tag)
+ {
+ typename iterator_traits<_RandomAccessIterator>::difference_type
+ __trip_count = (__last - __first) >> 2;
+
+ for (; __trip_count > 0; --__trip_count)
+ {
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+ }
+
+ switch (__last - __first)
+ {
+ case 3:
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+ case 2:
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+ case 1:
+ if (!bool(__pred(*__first)))
+ return __first;
+ ++__first;
+ case 0:
+ default:
+ return __last;
+ }
+ }
+#endif
+
+ // set_difference
+ // set_intersection
+ // set_symmetric_difference
+ // set_union
+ // for_each
+ // find
+ // find_if
+ // find_first_of
+ // adjacent_find
+ // count
+ // count_if
+ // search
+
+ /**
+ * This is an uglified
+ * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&)
+ * overloaded for forward iterators.
+ */
+ template<typename _ForwardIterator, typename _Integer, typename _Tp>
+ _ForwardIterator
+ __search_n(_ForwardIterator __first, _ForwardIterator __last,
+ _Integer __count, const _Tp& __val,
+ std::forward_iterator_tag)
+ {
+ __first = _GLIBCXX_STD_P::find(__first, __last, __val);
+ while (__first != __last)
+ {
+ typename iterator_traits<_ForwardIterator>::difference_type
+ __n = __count;
+ _ForwardIterator __i = __first;
+ ++__i;
+ while (__i != __last && __n != 1 && *__i == __val)
+ {
+ ++__i;
+ --__n;
+ }
+ if (__n == 1)
+ return __first;
+ if (__i == __last)
+ return __last;
+ __first = _GLIBCXX_STD_P::find(++__i, __last, __val);
+ }
+ return __last;
+ }
+
+ /**
+ * This is an uglified
+ * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&)
+ * overloaded for random access iterators.
+ */
+ template<typename _RandomAccessIter, typename _Integer, typename _Tp>
+ _RandomAccessIter
+ __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Integer __count, const _Tp& __val,
+ std::random_access_iterator_tag)
+ {
+
+ typedef typename std::iterator_traits<_RandomAccessIter>::difference_type
+ _DistanceType;
+
+ _DistanceType __tailSize = __last - __first;
+ const _DistanceType __pattSize = __count;
+
+ if (__tailSize < __pattSize)
+ return __last;
+
+ const _DistanceType __skipOffset = __pattSize - 1;
+ _RandomAccessIter __lookAhead = __first + __skipOffset;
+ __tailSize -= __pattSize;
+
+ while (1) // the main loop...
+ {
+ // __lookAhead here is always pointing to the last element of next
+ // possible match.
+ while (!(*__lookAhead == __val)) // the skip loop...
+ {
+ if (__tailSize < __pattSize)
+ return __last; // Failure
+ __lookAhead += __pattSize;
+ __tailSize -= __pattSize;
+ }
+ _DistanceType __remainder = __skipOffset;
+ for (_RandomAccessIter __backTrack = __lookAhead - 1;
+ *__backTrack == __val; --__backTrack)
+ {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); // Success
+ }
+ if (__remainder > __tailSize)
+ return __last; // Failure
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+ }
+ }
+
+ // search_n
+
+ /**
+ * This is an uglified
+ * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&,
+ * _BinaryPredicate)
+ * overloaded for forward iterators.
+ */
+ template<typename _ForwardIterator, typename _Integer, typename _Tp,
+ typename _BinaryPredicate>
+ _ForwardIterator
+ __search_n(_ForwardIterator __first, _ForwardIterator __last,
+ _Integer __count, const _Tp& __val,
+ _BinaryPredicate __binary_pred, std::forward_iterator_tag)
+ {
+ while (__first != __last && !bool(__binary_pred(*__first, __val)))
+ ++__first;
+
+ while (__first != __last)
+ {
+ typename iterator_traits<_ForwardIterator>::difference_type
+ __n = __count;
+ _ForwardIterator __i = __first;
+ ++__i;
+ while (__i != __last && __n != 1 && bool(__binary_pred(*__i, __val)))
+ {
+ ++__i;
+ --__n;
+ }
+ if (__n == 1)
+ return __first;
+ if (__i == __last)
+ return __last;
+ __first = ++__i;
+ while (__first != __last
+ && !bool(__binary_pred(*__first, __val)))
+ ++__first;
+ }
+ return __last;
+ }
+
+ /**
+ * This is an uglified
+ * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&,
+ * _BinaryPredicate)
+ * overloaded for random access iterators.
+ */
+ template<typename _RandomAccessIter, typename _Integer, typename _Tp,
+ typename _BinaryPredicate>
+ _RandomAccessIter
+ __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Integer __count, const _Tp& __val,
+ _BinaryPredicate __binary_pred, std::random_access_iterator_tag)
+ {
+
+ typedef typename std::iterator_traits<_RandomAccessIter>::difference_type
+ _DistanceType;
+
+ _DistanceType __tailSize = __last - __first;
+ const _DistanceType __pattSize = __count;
+
+ if (__tailSize < __pattSize)
+ return __last;
+
+ const _DistanceType __skipOffset = __pattSize - 1;
+ _RandomAccessIter __lookAhead = __first + __skipOffset;
+ __tailSize -= __pattSize;
+
+ while (1) // the main loop...
+ {
+ // __lookAhead here is always pointing to the last element of next
+ // possible match.
+ while (!bool(__binary_pred(*__lookAhead, __val))) // the skip loop...
+ {
+ if (__tailSize < __pattSize)
+ return __last; // Failure
+ __lookAhead += __pattSize;
+ __tailSize -= __pattSize;
+ }
+ _DistanceType __remainder = __skipOffset;
+ for (_RandomAccessIter __backTrack = __lookAhead - 1;
+ __binary_pred(*__backTrack, __val); --__backTrack)
+ {
+ if (--__remainder == 0)
+ return (__lookAhead - __skipOffset); // Success
+ }
+ if (__remainder > __tailSize)
+ return __last; // Failure
+ __lookAhead += __remainder;
+ __tailSize -= __remainder;
+ }
+ }
+
+ // find_end for forward iterators.
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _ForwardIterator1
+ __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ forward_iterator_tag, forward_iterator_tag)
+ {
+ if (__first2 == __last2)
+ return __last1;
+ else
+ {
+ _ForwardIterator1 __result = __last1;
+ while (1)
+ {
+ _ForwardIterator1 __new_result
+ = _GLIBCXX_STD_P::search(__first1, __last1, __first2, __last2);
+ if (__new_result == __last1)
+ return __result;
+ else
+ {
+ __result = __new_result;
+ __first1 = __new_result;
+ ++__first1;
+ }
+ }
+ }
+ }
+
+ template<typename _ForwardIterator1, typename _ForwardIterator2,
+ typename _BinaryPredicate>
+ _ForwardIterator1
+ __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ forward_iterator_tag, forward_iterator_tag,
+ _BinaryPredicate __comp)
+ {
+ if (__first2 == __last2)
+ return __last1;
+ else
+ {
+ _ForwardIterator1 __result = __last1;
+ while (1)
+ {
+ _ForwardIterator1 __new_result
+ = _GLIBCXX_STD_P::search(__first1, __last1, __first2,
+ __last2, __comp);
+ if (__new_result == __last1)
+ return __result;
+ else
+ {
+ __result = __new_result;
+ __first1 = __new_result;
+ ++__first1;
+ }
+ }
+ }
+ }
+
+ // find_end for bidirectional iterators (much faster).
+ template<typename _BidirectionalIterator1, typename _BidirectionalIterator2>
+ _BidirectionalIterator1
+ __find_end(_BidirectionalIterator1 __first1,
+ _BidirectionalIterator1 __last1,
+ _BidirectionalIterator2 __first2,
+ _BidirectionalIterator2 __last2,
+ bidirectional_iterator_tag, bidirectional_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator1>)
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator2>)
+
+ typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1;
+ typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2;
+
+ _RevIterator1 __rlast1(__first1);
+ _RevIterator2 __rlast2(__first2);
+ _RevIterator1 __rresult = _GLIBCXX_STD_P::search(_RevIterator1(__last1),
+ __rlast1,
+ _RevIterator2(__last2),
+ __rlast2);
+
+ if (__rresult == __rlast1)
+ return __last1;
+ else
+ {
+ _BidirectionalIterator1 __result = __rresult.base();
+ std::advance(__result, -std::distance(__first2, __last2));
+ return __result;
+ }
+ }
+
+ template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
+ typename _BinaryPredicate>
+ _BidirectionalIterator1
+ __find_end(_BidirectionalIterator1 __first1,
+ _BidirectionalIterator1 __last1,
+ _BidirectionalIterator2 __first2,
+ _BidirectionalIterator2 __last2,
+ bidirectional_iterator_tag, bidirectional_iterator_tag,
+ _BinaryPredicate __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator1>)
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator2>)
+
+ typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1;
+ typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2;
+
+ _RevIterator1 __rlast1(__first1);
+ _RevIterator2 __rlast2(__first2);
+ _RevIterator1 __rresult = std::search(_RevIterator1(__last1), __rlast1,
+ _RevIterator2(__last2), __rlast2,
+ __comp);
+
+ if (__rresult == __rlast1)
+ return __last1;
+ else
+ {
+ _BidirectionalIterator1 __result = __rresult.base();
+ std::advance(__result, -std::distance(__first2, __last2));
+ return __result;
+ }
+ }
+
+ /**
+ * @brief Find last matching subsequence in a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first1 Start of range to search.
+ * @param last1 End of range to search.
+ * @param first2 Start of sequence to match.
+ * @param last2 End of sequence to match.
+ * @return The last iterator @c i in the range
+ * @p [first1,last1-(last2-first2)) such that @c *(i+N) == @p *(first2+N)
+ * for each @c N in the range @p [0,last2-first2), or @p last1 if no
+ * such iterator exists.
+ *
+ * Searches the range @p [first1,last1) for a sub-sequence that compares
+ * equal value-by-value with the sequence given by @p [first2,last2) and
+ * returns an iterator to the first element of the sub-sequence, or
+ * @p last1 if the sub-sequence is not found. The sub-sequence will be the
+ * last such subsequence contained in [first,last1).
+ *
+ * Because the sub-sequence must lie completely within the range
+ * @p [first1,last1) it must start at a position less than
+ * @p last1-(last2-first2) where @p last2-first2 is the length of the
+ * sub-sequence.
+ * This means that the returned iterator @c i will be in the range
+ * @p [first1,last1-(last2-first2))
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ inline _ForwardIterator1
+ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_ForwardIterator1>::value_type,
+ typename iterator_traits<_ForwardIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ return std::__find_end(__first1, __last1, __first2, __last2,
+ std::__iterator_category(__first1),
+ std::__iterator_category(__first2));
+ }
+
+ /**
+ * @brief Find last matching subsequence in a sequence using a predicate.
+ * @ingroup non_mutating_algorithms
+ * @param first1 Start of range to search.
+ * @param last1 End of range to search.
+ * @param first2 Start of sequence to match.
+ * @param last2 End of sequence to match.
+ * @param comp The predicate to use.
+ * @return The last iterator @c i in the range
+ * @p [first1,last1-(last2-first2)) such that @c predicate(*(i+N), @p
+ * (first2+N)) is true for each @c N in the range @p [0,last2-first2), or
+ * @p last1 if no such iterator exists.
+ *
+ * Searches the range @p [first1,last1) for a sub-sequence that compares
+ * equal value-by-value with the sequence given by @p [first2,last2) using
+ * comp as a predicate and returns an iterator to the first element of the
+ * sub-sequence, or @p last1 if the sub-sequence is not found. The
+ * sub-sequence will be the last such subsequence contained in
+ * [first,last1).
+ *
+ * Because the sub-sequence must lie completely within the range
+ * @p [first1,last1) it must start at a position less than
+ * @p last1-(last2-first2) where @p last2-first2 is the length of the
+ * sub-sequence.
+ * This means that the returned iterator @c i will be in the range
+ * @p [first1,last1-(last2-first2))
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2,
+ typename _BinaryPredicate>
+ inline _ForwardIterator1
+ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator1>::value_type,
+ typename iterator_traits<_ForwardIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ return std::__find_end(__first1, __last1, __first2, __last2,
+ std::__iterator_category(__first1),
+ std::__iterator_category(__first2),
+ __comp);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Checks that a predicate is true for all the elements
+ * of a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return True if the check is true, false otherwise.
+ *
+ * Returns true if @p pred is true for each element in the range
+ * @p [first,last), and false otherwise.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+ { return __last == std::find_if_not(__first, __last, __pred); }
+
+ /**
+ * @brief Checks that a predicate is false for all the elements
+ * of a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return True if the check is true, false otherwise.
+ *
+ * Returns true if @p pred is false for each element in the range
+ * @p [first,last), and false otherwise.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+ { return __last == _GLIBCXX_STD_P::find_if(__first, __last, __pred); }
+
+ /**
+ * @brief Checks that a predicate is false for at least an element
+ * of a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return True if the check is true, false otherwise.
+ *
+ * Returns true if an element exists in the range @p [first,last) such that
+ * @p pred is true, and false otherwise.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+ { return !std::none_of(__first, __last, __pred); }
+
+ /**
+ * @brief Find the first element in a sequence for which a
+ * predicate is false.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return The first iterator @c i in the range @p [first,last)
+ * such that @p pred(*i) is false, or @p last if no such iterator exists.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ inline _InputIterator
+ find_if_not(_InputIterator __first, _InputIterator __last,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+ return std::__find_if_not(__first, __last, __pred,
+ std::__iterator_category(__first));
+ }
+
+ /**
+ * @brief Checks whether the sequence is partitioned.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return True if the range @p [first,last) is partioned by @p pred,
+ * i.e. if all elements that satisfy @p pred appear before those that
+ * do not.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ is_partitioned(_InputIterator __first, _InputIterator __last,
+ _Predicate __pred)
+ {
+ __first = std::find_if_not(__first, __last, __pred);
+ return std::none_of(__first, __last, __pred);
+ }
+
+ /**
+ * @brief Find the partition point of a partitioned range.
+ * @ingroup mutating_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param pred A predicate.
+ * @return An iterator @p mid such that @p all_of(first, mid, pred)
+ * and @p none_of(mid, last, pred) are both true.
+ */
+ template<typename _ForwardIterator, typename _Predicate>
+ _ForwardIterator
+ partition_point(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+
+ // A specific debug-mode test will be necessary...
+ __glibcxx_requires_valid_range(__first, __last);
+
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (__pred(*__middle))
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+ }
+#endif
+
+
+ /**
+ * @brief Copy a sequence, removing elements of a given value.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param value The value to be removed.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies each element in the range @p [first,last) not equal to @p value
+ * to the range beginning at @p result.
+ * remove_copy() is stable, so the relative order of elements that are
+ * copied is unchanged.
+ */
+ template<typename _InputIterator, typename _OutputIterator, typename _Tp>
+ _OutputIterator
+ remove_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, const _Tp& __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (!(*__first == __value))
+ {
+ *__result = *__first;
+ ++__result;
+ }
+ return __result;
+ }
+
+ /**
+ * @brief Copy a sequence, removing elements for which a predicate is true.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param pred A predicate.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies each element in the range @p [first,last) for which
+ * @p pred returns false to the range beginning at @p result.
+ *
+ * remove_copy_if() is stable, so the relative order of elements that are
+ * copied is unchanged.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _Predicate>
+ _OutputIterator
+ remove_copy_if(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (!bool(__pred(*__first)))
+ {
+ *__result = *__first;
+ ++__result;
+ }
+ return __result;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Copy the elements of a sequence for which a predicate is true.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param pred A predicate.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies each element in the range @p [first,last) for which
+ * @p pred returns true to the range beginning at @p result.
+ *
+ * copy_if() is stable, so the relative order of elements that are
+ * copied is unchanged.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _Predicate>
+ _OutputIterator
+ copy_if(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ {
+ *__result = *__first;
+ ++__result;
+ }
+ return __result;
+ }
+
+
+ template<typename _InputIterator, typename _Size, typename _OutputIterator>
+ _OutputIterator
+ __copy_n(_InputIterator __first, _Size __n,
+ _OutputIterator __result, input_iterator_tag)
+ {
+ for (; __n > 0; --__n)
+ {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return __result;
+ }
+
+ template<typename _RandomAccessIterator, typename _Size,
+ typename _OutputIterator>
+ inline _OutputIterator
+ __copy_n(_RandomAccessIterator __first, _Size __n,
+ _OutputIterator __result, random_access_iterator_tag)
+ { return std::copy(__first, __first + __n, __result); }
+
+ /**
+ * @brief Copies the range [first,first+n) into [result,result+n).
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param n The number of elements to copy.
+ * @param result An output iterator.
+ * @return result+n.
+ *
+ * This inline function will boil down to a call to @c memmove whenever
+ * possible. Failing that, if random access iterators are passed, then the
+ * loop count will be known (and therefore a candidate for compiler
+ * optimizations such as unrolling).
+ */
+ template<typename _InputIterator, typename _Size, typename _OutputIterator>
+ inline _OutputIterator
+ copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+
+ return std::__copy_n(__first, __n, __result,
+ std::__iterator_category(__first));
+ }
+
+ /**
+ * @brief Copy the elements of a sequence to separate output sequences
+ * depending on the truth value of a predicate.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param out_true An output iterator.
+ * @param out_false An output iterator.
+ * @param pred A predicate.
+ * @return A pair designating the ends of the resulting sequences.
+ *
+ * Copies each element in the range @p [first,last) for which
+ * @p pred returns true to the range beginning at @p out_true
+ * and each element for which @p pred returns false to @p out_false.
+ */
+ template<typename _InputIterator, typename _OutputIterator1,
+ typename _OutputIterator2, typename _Predicate>
+ pair<_OutputIterator1, _OutputIterator2>
+ partition_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator1 __out_true, _OutputIterator2 __out_false,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator1,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator2,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ {
+ *__out_true = *__first;
+ ++__out_true;
+ }
+ else
+ {
+ *__out_false = *__first;
+ ++__out_false;
+ }
+
+ return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false);
+ }
+#endif
+
+ /**
+ * @brief Remove elements from a sequence.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param value The value to be removed.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * All elements equal to @p value are removed from the range
+ * @p [first,last).
+ *
+ * remove() is stable, so the relative order of elements that are
+ * not removed is unchanged.
+ *
+ * Elements between the end of the resulting sequence and @p last
+ * are still present, but their value is unspecified.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ _ForwardIterator
+ remove(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ __first = _GLIBCXX_STD_P::find(__first, __last, __value);
+ if(__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ ++__first;
+ for(; __first != __last; ++__first)
+ if(!(*__first == __value))
+ {
+ *__result = _GLIBCXX_MOVE(*__first);
+ ++__result;
+ }
+ return __result;
+ }
+
+ /**
+ * @brief Remove elements from a sequence using a predicate.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param pred A predicate.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * All elements for which @p pred returns true are removed from the range
+ * @p [first,last).
+ *
+ * remove_if() is stable, so the relative order of elements that are
+ * not removed is unchanged.
+ *
+ * Elements between the end of the resulting sequence and @p last
+ * are still present, but their value is unspecified.
+ */
+ template<typename _ForwardIterator, typename _Predicate>
+ _ForwardIterator
+ remove_if(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ __first = _GLIBCXX_STD_P::find_if(__first, __last, __pred);
+ if(__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ ++__first;
+ for(; __first != __last; ++__first)
+ if(!bool(__pred(*__first)))
+ {
+ *__result = _GLIBCXX_MOVE(*__first);
+ ++__result;
+ }
+ return __result;
+ }
+
+ /**
+ * @brief Remove consecutive duplicate values from a sequence.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Removes all but the first element from each group of consecutive
+ * values that compare equal.
+ * unique() is stable, so the relative order of elements that are
+ * not removed is unchanged.
+ * Elements between the end of the resulting sequence and @p last
+ * are still present, but their value is unspecified.
+ */
+ template<typename _ForwardIterator>
+ _ForwardIterator
+ unique(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_EqualityComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ // Skip the beginning, if already unique.
+ __first = _GLIBCXX_STD_P::adjacent_find(__first, __last);
+ if (__first == __last)
+ return __last;
+
+ // Do the real copy work.
+ _ForwardIterator __dest = __first;
+ ++__first;
+ while (++__first != __last)
+ if (!(*__dest == *__first))
+ *++__dest = _GLIBCXX_MOVE(*__first);
+ return ++__dest;
+ }
+
+ /**
+ * @brief Remove consecutive values from a sequence using a predicate.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param binary_pred A binary predicate.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Removes all but the first element from each group of consecutive
+ * values for which @p binary_pred returns true.
+ * unique() is stable, so the relative order of elements that are
+ * not removed is unchanged.
+ * Elements between the end of the resulting sequence and @p last
+ * are still present, but their value is unspecified.
+ */
+ template<typename _ForwardIterator, typename _BinaryPredicate>
+ _ForwardIterator
+ unique(_ForwardIterator __first, _ForwardIterator __last,
+ _BinaryPredicate __binary_pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ // Skip the beginning, if already unique.
+ __first = _GLIBCXX_STD_P::adjacent_find(__first, __last, __binary_pred);
+ if (__first == __last)
+ return __last;
+
+ // Do the real copy work.
+ _ForwardIterator __dest = __first;
+ ++__first;
+ while (++__first != __last)
+ if (!bool(__binary_pred(*__dest, *__first)))
+ *++__dest = _GLIBCXX_MOVE(*__first);
+ return ++__dest;
+ }
+
+ /**
+ * This is an uglified unique_copy(_InputIterator, _InputIterator,
+ * _OutputIterator)
+ * overloaded for forward iterators and output iterator as result.
+ */
+ template<typename _ForwardIterator, typename _OutputIterator>
+ _OutputIterator
+ __unique_copy(_ForwardIterator __first, _ForwardIterator __last,
+ _OutputIterator __result,
+ forward_iterator_tag, output_iterator_tag)
+ {
+ // concept requirements -- taken care of in dispatching function
+ _ForwardIterator __next = __first;
+ *__result = *__first;
+ while (++__next != __last)
+ if (!(*__first == *__next))
+ {
+ __first = __next;
+ *++__result = *__first;
+ }
+ return ++__result;
+ }
+
+ /**
+ * This is an uglified unique_copy(_InputIterator, _InputIterator,
+ * _OutputIterator)
+ * overloaded for input iterators and output iterator as result.
+ */
+ template<typename _InputIterator, typename _OutputIterator>
+ _OutputIterator
+ __unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ input_iterator_tag, output_iterator_tag)
+ {
+ // concept requirements -- taken care of in dispatching function
+ typename iterator_traits<_InputIterator>::value_type __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ if (!(__value == *__first))
+ {
+ __value = *__first;
+ *++__result = __value;
+ }
+ return ++__result;
+ }
+
+ /**
+ * This is an uglified unique_copy(_InputIterator, _InputIterator,
+ * _OutputIterator)
+ * overloaded for input iterators and forward iterator as result.
+ */
+ template<typename _InputIterator, typename _ForwardIterator>
+ _ForwardIterator
+ __unique_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result,
+ input_iterator_tag, forward_iterator_tag)
+ {
+ // concept requirements -- taken care of in dispatching function
+ *__result = *__first;
+ while (++__first != __last)
+ if (!(*__result == *__first))
+ *++__result = *__first;
+ return ++__result;
+ }
+
+ /**
+ * This is an uglified
+ * unique_copy(_InputIterator, _InputIterator, _OutputIterator,
+ * _BinaryPredicate)
+ * overloaded for forward iterators and output iterator as result.
+ */
+ template<typename _ForwardIterator, typename _OutputIterator,
+ typename _BinaryPredicate>
+ _OutputIterator
+ __unique_copy(_ForwardIterator __first, _ForwardIterator __last,
+ _OutputIterator __result, _BinaryPredicate __binary_pred,
+ forward_iterator_tag, output_iterator_tag)
+ {
+ // concept requirements -- iterators already checked
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+
+ _ForwardIterator __next = __first;
+ *__result = *__first;
+ while (++__next != __last)
+ if (!bool(__binary_pred(*__first, *__next)))
+ {
+ __first = __next;
+ *++__result = *__first;
+ }
+ return ++__result;
+ }
+
+ /**
+ * This is an uglified
+ * unique_copy(_InputIterator, _InputIterator, _OutputIterator,
+ * _BinaryPredicate)
+ * overloaded for input iterators and output iterator as result.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _BinaryPredicate>
+ _OutputIterator
+ __unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryPredicate __binary_pred,
+ input_iterator_tag, output_iterator_tag)
+ {
+ // concept requirements -- iterators already checked
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_InputIterator>::value_type,
+ typename iterator_traits<_InputIterator>::value_type>)
+
+ typename iterator_traits<_InputIterator>::value_type __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ if (!bool(__binary_pred(__value, *__first)))
+ {
+ __value = *__first;
+ *++__result = __value;
+ }
+ return ++__result;
+ }
+
+ /**
+ * This is an uglified
+ * unique_copy(_InputIterator, _InputIterator, _OutputIterator,
+ * _BinaryPredicate)
+ * overloaded for input iterators and forward iterator as result.
+ */
+ template<typename _InputIterator, typename _ForwardIterator,
+ typename _BinaryPredicate>
+ _ForwardIterator
+ __unique_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result, _BinaryPredicate __binary_pred,
+ input_iterator_tag, forward_iterator_tag)
+ {
+ // concept requirements -- iterators already checked
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_InputIterator>::value_type>)
+
+ *__result = *__first;
+ while (++__first != __last)
+ if (!bool(__binary_pred(*__result, *__first)))
+ *++__result = *__first;
+ return ++__result;
+ }
+
+ /**
+ * This is an uglified reverse(_BidirectionalIterator,
+ * _BidirectionalIterator)
+ * overloaded for bidirectional iterators.
+ */
+ template<typename _BidirectionalIterator>
+ void
+ __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last,
+ bidirectional_iterator_tag)
+ {
+ while (true)
+ if (__first == __last || __first == --__last)
+ return;
+ else
+ {
+ std::iter_swap(__first, __last);
+ ++__first;
+ }
+ }
+
+ /**
+ * This is an uglified reverse(_BidirectionalIterator,
+ * _BidirectionalIterator)
+ * overloaded for random access iterators.
+ */
+ template<typename _RandomAccessIterator>
+ void
+ __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ random_access_iterator_tag)
+ {
+ if (__first == __last)
+ return;
+ --__last;
+ while (__first < __last)
+ {
+ std::iter_swap(__first, __last);
+ ++__first;
+ --__last;
+ }
+ }
+
+ /**
+ * @brief Reverse a sequence.
+ * @ingroup mutating_algorithms
+ * @param first A bidirectional iterator.
+ * @param last A bidirectional iterator.
+ * @return reverse() returns no value.
+ *
+ * Reverses the order of the elements in the range @p [first,last),
+ * so that the first element becomes the last etc.
+ * For every @c i such that @p 0<=i<=(last-first)/2), @p reverse()
+ * swaps @p *(first+i) and @p *(last-(i+1))
+ */
+ template<typename _BidirectionalIterator>
+ inline void
+ reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ std::__reverse(__first, __last, std::__iterator_category(__first));
+ }
+
+ /**
+ * @brief Copy a sequence, reversing its elements.
+ * @ingroup mutating_algorithms
+ * @param first A bidirectional iterator.
+ * @param last A bidirectional iterator.
+ * @param result An output iterator.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies the elements in the range @p [first,last) to the range
+ * @p [result,result+(last-first)) such that the order of the
+ * elements is reversed.
+ * For every @c i such that @p 0<=i<=(last-first), @p reverse_copy()
+ * performs the assignment @p *(result+(last-first)-i) = *(first+i).
+ * The ranges @p [first,last) and @p [result,result+(last-first))
+ * must not overlap.
+ */
+ template<typename _BidirectionalIterator, typename _OutputIterator>
+ _OutputIterator
+ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last,
+ _OutputIterator __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ while (__first != __last)
+ {
+ --__last;
+ *__result = *__last;
+ ++__result;
+ }
+ return __result;
+ }
+
+ /**
+ * This is a helper function for the rotate algorithm specialized on RAIs.
+ * It returns the greatest common divisor of two integer values.
+ */
+ template<typename _EuclideanRingElement>
+ _EuclideanRingElement
+ __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
+ {
+ while (__n != 0)
+ {
+ _EuclideanRingElement __t = __m % __n;
+ __m = __n;
+ __n = __t;
+ }
+ return __m;
+ }
+
+ /// This is a helper function for the rotate algorithm.
+ template<typename _ForwardIterator>
+ void
+ __rotate(_ForwardIterator __first,
+ _ForwardIterator __middle,
+ _ForwardIterator __last,
+ forward_iterator_tag)
+ {
+ if (__first == __middle || __last == __middle)
+ return;
+
+ _ForwardIterator __first2 = __middle;
+ do
+ {
+ std::iter_swap(__first, __first2);
+ ++__first;
+ ++__first2;
+ if (__first == __middle)
+ __middle = __first2;
+ }
+ while (__first2 != __last);
+
+ __first2 = __middle;
+
+ while (__first2 != __last)
+ {
+ std::iter_swap(__first, __first2);
+ ++__first;
+ ++__first2;
+ if (__first == __middle)
+ __middle = __first2;
+ else if (__first2 == __last)
+ __first2 = __middle;
+ }
+ }
+
+ /// This is a helper function for the rotate algorithm.
+ template<typename _BidirectionalIterator>
+ void
+ __rotate(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ bidirectional_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+
+ if (__first == __middle || __last == __middle)
+ return;
+
+ std::__reverse(__first, __middle, bidirectional_iterator_tag());
+ std::__reverse(__middle, __last, bidirectional_iterator_tag());
+
+ while (__first != __middle && __middle != __last)
+ {
+ std::iter_swap(__first, --__last);
+ ++__first;
+ }
+
+ if (__first == __middle)
+ std::__reverse(__middle, __last, bidirectional_iterator_tag());
+ else
+ std::__reverse(__first, __middle, bidirectional_iterator_tag());
+ }
+
+ /// This is a helper function for the rotate algorithm.
+ template<typename _RandomAccessIterator>
+ void
+ __rotate(_RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last,
+ random_access_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+
+ if (__first == __middle || __last == __middle)
+ return;
+
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _Distance;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ const _Distance __n = __last - __first;
+ const _Distance __k = __middle - __first;
+ const _Distance __l = __n - __k;
+
+ if (__k == __l)
+ {
+ std::swap_ranges(__first, __middle, __middle);
+ return;
+ }
+
+ const _Distance __d = std::__gcd(__n, __k);
+
+ for (_Distance __i = 0; __i < __d; __i++)
+ {
+ _ValueType __tmp = _GLIBCXX_MOVE(*__first);
+ _RandomAccessIterator __p = __first;
+
+ if (__k < __l)
+ {
+ for (_Distance __j = 0; __j < __l / __d; __j++)
+ {
+ if (__p > __first + __l)
+ {
+ *__p = _GLIBCXX_MOVE(*(__p - __l));
+ __p -= __l;
+ }
+
+ *__p = _GLIBCXX_MOVE(*(__p + __k));
+ __p += __k;
+ }
+ }
+ else
+ {
+ for (_Distance __j = 0; __j < __k / __d - 1; __j ++)
+ {
+ if (__p < __last - __k)
+ {
+ *__p = _GLIBCXX_MOVE(*(__p + __k));
+ __p += __k;
+ }
+ *__p = _GLIBCXX_MOVE(*(__p - __l));
+ __p -= __l;
+ }
+ }
+
+ *__p = _GLIBCXX_MOVE(__tmp);
+ ++__first;
+ }
+ }
+
+ /**
+ * @brief Rotate the elements of a sequence.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param middle A forward iterator.
+ * @param last A forward iterator.
+ * @return Nothing.
+ *
+ * Rotates the elements of the range @p [first,last) by @p (middle-first)
+ * positions so that the element at @p middle is moved to @p first, the
+ * element at @p middle+1 is moved to @first+1 and so on for each element
+ * in the range @p [first,last).
+ *
+ * This effectively swaps the ranges @p [first,middle) and
+ * @p [middle,last).
+ *
+ * Performs @p *(first+(n+(last-middle))%(last-first))=*(first+n) for
+ * each @p n in the range @p [0,last-first).
+ */
+ template<typename _ForwardIterator>
+ inline void
+ rotate(_ForwardIterator __first, _ForwardIterator __middle,
+ _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_requires_valid_range(__first, __middle);
+ __glibcxx_requires_valid_range(__middle, __last);
+
+ typedef typename iterator_traits<_ForwardIterator>::iterator_category
+ _IterType;
+ std::__rotate(__first, __middle, __last, _IterType());
+ }
+
+ /**
+ * @brief Copy a sequence, rotating its elements.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param middle A forward iterator.
+ * @param last A forward iterator.
+ * @param result An output iterator.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies the elements of the range @p [first,last) to the range
+ * beginning at @result, rotating the copied elements by @p (middle-first)
+ * positions so that the element at @p middle is moved to @p result, the
+ * element at @p middle+1 is moved to @result+1 and so on for each element
+ * in the range @p [first,last).
+ *
+ * Performs @p *(result+(n+(last-middle))%(last-first))=*(first+n) for
+ * each @p n in the range @p [0,last-first).
+ */
+ template<typename _ForwardIterator, typename _OutputIterator>
+ _OutputIterator
+ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle,
+ _ForwardIterator __last, _OutputIterator __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __middle);
+ __glibcxx_requires_valid_range(__middle, __last);
+
+ return std::copy(__first, __middle,
+ std::copy(__middle, __last, __result));
+ }
+
+ /// This is a helper function...
+ template<typename _ForwardIterator, typename _Predicate>
+ _ForwardIterator
+ __partition(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred, forward_iterator_tag)
+ {
+ if (__first == __last)
+ return __first;
+
+ while (__pred(*__first))
+ if (++__first == __last)
+ return __first;
+
+ _ForwardIterator __next = __first;
+
+ while (++__next != __last)
+ if (__pred(*__next))
+ {
+ std::iter_swap(__first, __next);
+ ++__first;
+ }
+
+ return __first;
+ }
+
+ /// This is a helper function...
+ template<typename _BidirectionalIterator, typename _Predicate>
+ _BidirectionalIterator
+ __partition(_BidirectionalIterator __first, _BidirectionalIterator __last,
+ _Predicate __pred, bidirectional_iterator_tag)
+ {
+ while (true)
+ {
+ while (true)
+ if (__first == __last)
+ return __first;
+ else if (__pred(*__first))
+ ++__first;
+ else
+ break;
+ --__last;
+ while (true)
+ if (__first == __last)
+ return __first;
+ else if (!bool(__pred(*__last)))
+ --__last;
+ else
+ break;
+ std::iter_swap(__first, __last);
+ ++__first;
+ }
+ }
+
+ // partition
+
+ /// This is a helper function...
+ template<typename _ForwardIterator, typename _Predicate, typename _Distance>
+ _ForwardIterator
+ __inplace_stable_partition(_ForwardIterator __first,
+ _ForwardIterator __last,
+ _Predicate __pred, _Distance __len)
+ {
+ if (__len == 1)
+ return __pred(*__first) ? __last : __first;
+ _ForwardIterator __middle = __first;
+ std::advance(__middle, __len / 2);
+ _ForwardIterator __begin = std::__inplace_stable_partition(__first,
+ __middle,
+ __pred,
+ __len / 2);
+ _ForwardIterator __end = std::__inplace_stable_partition(__middle, __last,
+ __pred,
+ __len
+ - __len / 2);
+ std::rotate(__begin, __middle, __end);
+ std::advance(__begin, std::distance(__middle, __end));
+ return __begin;
+ }
+
+ /// This is a helper function...
+ template<typename _ForwardIterator, typename _Pointer, typename _Predicate,
+ typename _Distance>
+ _ForwardIterator
+ __stable_partition_adaptive(_ForwardIterator __first,
+ _ForwardIterator __last,
+ _Predicate __pred, _Distance __len,
+ _Pointer __buffer,
+ _Distance __buffer_size)
+ {
+ if (__len <= __buffer_size)
+ {
+ _ForwardIterator __result1 = __first;
+ _Pointer __result2 = __buffer;
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ {
+ *__result1 = *__first;
+ ++__result1;
+ }
+ else
+ {
+ *__result2 = *__first;
+ ++__result2;
+ }
+ std::copy(__buffer, __result2, __result1);
+ return __result1;
+ }
+ else
+ {
+ _ForwardIterator __middle = __first;
+ std::advance(__middle, __len / 2);
+ _ForwardIterator __begin =
+ std::__stable_partition_adaptive(__first, __middle, __pred,
+ __len / 2, __buffer,
+ __buffer_size);
+ _ForwardIterator __end =
+ std::__stable_partition_adaptive(__middle, __last, __pred,
+ __len - __len / 2,
+ __buffer, __buffer_size);
+ std::rotate(__begin, __middle, __end);
+ std::advance(__begin, std::distance(__middle, __end));
+ return __begin;
+ }
+ }
+
+ /**
+ * @brief Move elements for which a predicate is true to the beginning
+ * of a sequence, preserving relative ordering.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param pred A predicate functor.
+ * @return An iterator @p middle such that @p pred(i) is true for each
+ * iterator @p i in the range @p [first,middle) and false for each @p i
+ * in the range @p [middle,last).
+ *
+ * Performs the same function as @p partition() with the additional
+ * guarantee that the relative ordering of elements in each group is
+ * preserved, so any two elements @p x and @p y in the range
+ * @p [first,last) such that @p pred(x)==pred(y) will have the same
+ * relative ordering after calling @p stable_partition().
+ */
+ template<typename _ForwardIterator, typename _Predicate>
+ _ForwardIterator
+ stable_partition(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __first;
+ else
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first,
+ __last);
+ if (__buf.size() > 0)
+ return
+ std::__stable_partition_adaptive(__first, __last, __pred,
+ _DistanceType(__buf.requested_size()),
+ __buf.begin(),
+ _DistanceType(__buf.size()));
+ else
+ return
+ std::__inplace_stable_partition(__first, __last, __pred,
+ _DistanceType(__buf.requested_size()));
+ }
+ }
+
+ /// This is a helper function for the sort routines.
+ template<typename _RandomAccessIterator>
+ void
+ __heap_select(_RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last)
+ {
+ std::make_heap(__first, __middle);
+ for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)
+ if (*__i < *__first)
+ std::__pop_heap(__first, __middle, __i);
+ }
+
+ /// This is a helper function for the sort routines.
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ __heap_select(_RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ std::make_heap(__first, __middle, __comp);
+ for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)
+ if (__comp(*__i, *__first))
+ std::__pop_heap(__first, __middle, __i, __comp);
+ }
+
+ // partial_sort
+
+ /**
+ * @brief Copy the smallest elements of a sequence.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param result_first A random-access iterator.
+ * @param result_last Another random-access iterator.
+ * @return An iterator indicating the end of the resulting sequence.
+ *
+ * Copies and sorts the smallest N values from the range @p [first,last)
+ * to the range beginning at @p result_first, where the number of
+ * elements to be copied, @p N, is the smaller of @p (last-first) and
+ * @p (result_last-result_first).
+ * After the sort if @p i and @j are iterators in the range
+ * @p [result_first,result_first+N) such that @i precedes @j then
+ * @p *j<*i is false.
+ * The value returned is @p result_first+N.
+ */
+ template<typename _InputIterator, typename _RandomAccessIterator>
+ _RandomAccessIterator
+ partial_sort_copy(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type
+ _InputValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _OutputValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_ConvertibleConcept<_InputValueType,
+ _OutputValueType>)
+ __glibcxx_function_requires(_LessThanOpConcept<_InputValueType,
+ _OutputValueType>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_OutputValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_valid_range(__result_first, __result_last);
+
+ if (__result_first == __result_last)
+ return __result_last;
+ _RandomAccessIterator __result_real_last = __result_first;
+ while(__first != __last && __result_real_last != __result_last)
+ {
+ *__result_real_last = *__first;
+ ++__result_real_last;
+ ++__first;
+ }
+ std::make_heap(__result_first, __result_real_last);
+ while (__first != __last)
+ {
+ if (*__first < *__result_first)
+ std::__adjust_heap(__result_first, _DistanceType(0),
+ _DistanceType(__result_real_last
+ - __result_first),
+ _InputValueType(*__first));
+ ++__first;
+ }
+ std::sort_heap(__result_first, __result_real_last);
+ return __result_real_last;
+ }
+
+ /**
+ * @brief Copy the smallest elements of a sequence using a predicate for
+ * comparison.
+ * @ingroup sorting_algorithms
+ * @param first An input iterator.
+ * @param last Another input iterator.
+ * @param result_first A random-access iterator.
+ * @param result_last Another random-access iterator.
+ * @param comp A comparison functor.
+ * @return An iterator indicating the end of the resulting sequence.
+ *
+ * Copies and sorts the smallest N values from the range @p [first,last)
+ * to the range beginning at @p result_first, where the number of
+ * elements to be copied, @p N, is the smaller of @p (last-first) and
+ * @p (result_last-result_first).
+ * After the sort if @p i and @j are iterators in the range
+ * @p [result_first,result_first+N) such that @i precedes @j then
+ * @p comp(*j,*i) is false.
+ * The value returned is @p result_first+N.
+ */
+ template<typename _InputIterator, typename _RandomAccessIterator, typename _Compare>
+ _RandomAccessIterator
+ partial_sort_copy(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type
+ _InputValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _OutputValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_ConvertibleConcept<_InputValueType,
+ _OutputValueType>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _InputValueType, _OutputValueType>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _OutputValueType, _OutputValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_valid_range(__result_first, __result_last);
+
+ if (__result_first == __result_last)
+ return __result_last;
+ _RandomAccessIterator __result_real_last = __result_first;
+ while(__first != __last && __result_real_last != __result_last)
+ {
+ *__result_real_last = *__first;
+ ++__result_real_last;
+ ++__first;
+ }
+ std::make_heap(__result_first, __result_real_last,
+ __CheckedCompare(__comp));
+ while (__first != __last)
+ {
+ if (__CheckedCompare(__comp)(*__first, *__result_first))
+ std::__adjust_heap(__result_first, _DistanceType(0),
+ _DistanceType(__result_real_last
+ - __result_first),
+ _InputValueType(*__first),
+ __CheckedCompare(__comp));
+ ++__first;
+ }
+ std::sort_heap(__result_first, __result_real_last,
+ __CheckedCompare(__comp));
+ return __result_real_last;
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Tp>
+ void
+ __unguarded_linear_insert(_RandomAccessIterator __last, _Tp __val)
+ {
+ _RandomAccessIterator __next = __last;
+ --__next;
+ while (__val < *__next)
+ {
+ *__last = *__next;
+ __last = __next;
+ --__next;
+ }
+ *__last = __val;
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Tp, typename _Compare>
+ void
+ __unguarded_linear_insert(_RandomAccessIterator __last, _Tp __val,
+ _Compare __comp)
+ {
+ _RandomAccessIterator __next = __last;
+ --__next;
+ while (__comp(__val, *__next))
+ {
+ *__last = *__next;
+ __last = __next;
+ --__next;
+ }
+ *__last = __val;
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator>
+ void
+ __insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last)
+ {
+ if (__first == __last)
+ return;
+
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ {
+ typename iterator_traits<_RandomAccessIterator>::value_type
+ __val = *__i;
+ if (__val < *__first)
+ {
+ std::copy_backward(__first, __i, __i + 1);
+ *__first = __val;
+ }
+ else
+ std::__unguarded_linear_insert(__i, __val);
+ }
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ __insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ if (__first == __last) return;
+
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ {
+ typename iterator_traits<_RandomAccessIterator>::value_type
+ __val = *__i;
+ if (__comp(__val, *__first))
+ {
+ std::copy_backward(__first, __i, __i + 1);
+ *__first = __val;
+ }
+ else
+ std::__unguarded_linear_insert(__i, __val, __comp);
+ }
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator>
+ inline void
+ __unguarded_insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ for (_RandomAccessIterator __i = __first; __i != __last; ++__i)
+ std::__unguarded_linear_insert(__i, _ValueType(*__i));
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ __unguarded_insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ for (_RandomAccessIterator __i = __first; __i != __last; ++__i)
+ std::__unguarded_linear_insert(__i, _ValueType(*__i), __comp);
+ }
+
+ /**
+ * @doctodo
+ * This controls some aspect of the sort routines.
+ */
+ enum { _S_threshold = 16 };
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator>
+ void
+ __final_insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last)
+ {
+ if (__last - __first > int(_S_threshold))
+ {
+ std::__insertion_sort(__first, __first + int(_S_threshold));
+ std::__unguarded_insertion_sort(__first + int(_S_threshold), __last);
+ }
+ else
+ std::__insertion_sort(__first, __last);
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ __final_insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ if (__last - __first > int(_S_threshold))
+ {
+ std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
+ std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,
+ __comp);
+ }
+ else
+ std::__insertion_sort(__first, __last, __comp);
+ }
+
+ /// This is a helper function...
+ template<typename _RandomAccessIterator, typename _Tp>
+ _RandomAccessIterator
+ __unguarded_partition(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Tp __pivot)
+ {
+ while (true)
+ {
+ while (*__first < __pivot)
+ ++__first;
+ --__last;
+ while (__pivot < *__last)
+ --__last;
+ if (!(__first < __last))
+ return __first;
+ std::iter_swap(__first, __last);
+ ++__first;
+ }
+ }
+
+ /// This is a helper function...
+ template<typename _RandomAccessIterator, typename _Tp, typename _Compare>
+ _RandomAccessIterator
+ __unguarded_partition(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Tp __pivot, _Compare __comp)
+ {
+ while (true)
+ {
+ while (__comp(*__first, __pivot))
+ ++__first;
+ --__last;
+ while (__comp(__pivot, *__last))
+ --__last;
+ if (!(__first < __last))
+ return __first;
+ std::iter_swap(__first, __last);
+ ++__first;
+ }
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Size>
+ void
+ __introsort_loop(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Size __depth_limit)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ while (__last - __first > int(_S_threshold))
+ {
+ if (__depth_limit == 0)
+ {
+ _GLIBCXX_STD_P::partial_sort(__first, __last, __last);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIterator __cut =
+ std::__unguarded_partition(__first, __last,
+ _ValueType(std::__median(*__first,
+ *(__first
+ + (__last
+ - __first)
+ / 2),
+ *(__last
+ - 1))));
+ std::__introsort_loop(__cut, __last, __depth_limit);
+ __last = __cut;
+ }
+ }
+
+ /// This is a helper function for the sort routine.
+ template<typename _RandomAccessIterator, typename _Size, typename _Compare>
+ void
+ __introsort_loop(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Size __depth_limit, _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ while (__last - __first > int(_S_threshold))
+ {
+ if (__depth_limit == 0)
+ {
+ _GLIBCXX_STD_P::partial_sort(__first, __last, __last, __comp);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIterator __cut =
+ std::__unguarded_partition(__first, __last,
+ _ValueType(std::__median(*__first,
+ *(__first
+ + (__last
+ - __first)
+ / 2),
+ *(__last - 1),
+ __comp)),
+ __comp);
+ std::__introsort_loop(__cut, __last, __depth_limit, __comp);
+ __last = __cut;
+ }
+ }
+
+ /// This is a helper function for the sort routines. Precondition: __n > 0.
+ template<typename _Size>
+ inline _Size
+ __lg(_Size __n)
+ {
+ _Size __k;
+ for (__k = 0; __n != 0; __n >>= 1)
+ ++__k;
+ return __k - 1;
+ }
+
+ inline int
+ __lg(int __n)
+ { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
+
+ inline long
+ __lg(long __n)
+ { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }
+
+ inline long long
+ __lg(long long __n)
+ { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
+
+ // sort
+
+ template<typename _RandomAccessIterator, typename _Size>
+ void
+ __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth,
+ _RandomAccessIterator __last, _Size __depth_limit)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ while (__last - __first > 3)
+ {
+ if (__depth_limit == 0)
+ {
+ std::__heap_select(__first, __nth + 1, __last);
+
+ // Place the nth largest element in its final position.
+ std::iter_swap(__first, __nth);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIterator __cut =
+ std::__unguarded_partition(__first, __last,
+ _ValueType(std::__median(*__first,
+ *(__first
+ + (__last
+ - __first)
+ / 2),
+ *(__last
+ - 1))));
+ if (__cut <= __nth)
+ __first = __cut;
+ else
+ __last = __cut;
+ }
+ std::__insertion_sort(__first, __last);
+ }
+
+ template<typename _RandomAccessIterator, typename _Size, typename _Compare>
+ void
+ __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth,
+ _RandomAccessIterator __last, _Size __depth_limit,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ while (__last - __first > 3)
+ {
+ if (__depth_limit == 0)
+ {
+ std::__heap_select(__first, __nth + 1, __last, __comp);
+ // Place the nth largest element in its final position.
+ std::iter_swap(__first, __nth);
+ return;
+ }
+ --__depth_limit;
+ _RandomAccessIterator __cut =
+ std::__unguarded_partition(__first, __last,
+ _ValueType(std::__median(*__first,
+ *(__first
+ + (__last
+ - __first)
+ / 2),
+ *(__last - 1),
+ __comp)),
+ __comp);
+ if (__cut <= __nth)
+ __first = __cut;
+ else
+ __last = __cut;
+ }
+ std::__insertion_sort(__first, __last, __comp);
+ }
+
+ // nth_element
+
+ /**
+ * @brief Finds the first position in which @a val could be inserted
+ * without changing the ordering.
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @return An iterator pointing to the first element "not less
+ * than" @a val, or end() if every element is less than
+ * @a val.
+ * @ingroup binary_search_algorithms
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ _ForwardIterator
+ lower_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)
+ __glibcxx_requires_partitioned_lower(__first, __last, __val);
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (*__middle < __val)
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+ }
+
+ /**
+ * @brief Finds the first position in which @a val could be inserted
+ * without changing the ordering.
+ * @ingroup binary_search_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @param comp A functor to use for comparisons.
+ * @return An iterator pointing to the first element "not less than" @a val,
+ * or end() if every element is less than @a val.
+ * @ingroup binary_search_algorithms
+ *
+ * The comparison function should have the same effects on ordering as
+ * the function used for the initial sort.
+ */
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _ForwardIterator
+ lower_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val, _Compare __comp)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType, _Tp>)
+ __glibcxx_requires_partitioned_lower_pred(__first, __last,
+ __val, __comp);
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (__CheckedCompare(__comp)(*__middle, __val))
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+ }
+
+ /**
+ * @brief Finds the last position in which @a val could be inserted
+ * without changing the ordering.
+ * @ingroup binary_search_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @return An iterator pointing to the first element greater than @a val,
+ * or end() if no elements are greater than @a val.
+ * @ingroup binary_search_algorithms
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ _ForwardIterator
+ upper_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)
+ __glibcxx_requires_partitioned_upper(__first, __last, __val);
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (__val < *__middle)
+ __len = __half;
+ else
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ }
+ return __first;
+ }
+
+ /**
+ * @brief Finds the last position in which @a val could be inserted
+ * without changing the ordering.
+ * @ingroup binary_search_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @param comp A functor to use for comparisons.
+ * @return An iterator pointing to the first element greater than @a val,
+ * or end() if no elements are greater than @a val.
+ * @ingroup binary_search_algorithms
+ *
+ * The comparison function should have the same effects on ordering as
+ * the function used for the initial sort.
+ */
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _ForwardIterator
+ upper_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val, _Compare __comp)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _Tp, _ValueType>)
+ __glibcxx_requires_partitioned_upper_pred(__first, __last,
+ __val, __comp);
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (__CheckedCompare(__comp)(__val, *__middle))
+ __len = __half;
+ else
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ }
+ return __first;
+ }
+
+ /**
+ * @brief Finds the largest subrange in which @a val could be inserted
+ * at any place in it without changing the ordering.
+ * @ingroup binary_search_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @return An pair of iterators defining the subrange.
+ * @ingroup binary_search_algorithms
+ *
+ * This is equivalent to
+ * @code
+ * std::make_pair(lower_bound(first, last, val),
+ * upper_bound(first, last, val))
+ * @endcode
+ * but does not actually call those functions.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ pair<_ForwardIterator, _ForwardIterator>
+ equal_range(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)
+ __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)
+ __glibcxx_requires_partitioned_lower(__first, __last, __val);
+ __glibcxx_requires_partitioned_upper(__first, __last, __val);
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle, __left, __right;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (*__middle < __val)
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else if (__val < *__middle)
+ __len = __half;
+ else
+ {
+ __left = std::lower_bound(__first, __middle, __val);
+ std::advance(__first, __len);
+ __right = std::upper_bound(++__middle, __first, __val);
+ return pair<_ForwardIterator, _ForwardIterator>(__left, __right);
+ }
+ }
+ return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
+ }
+
+ /**
+ * @brief Finds the largest subrange in which @a val could be inserted
+ * at any place in it without changing the ordering.
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @param comp A functor to use for comparisons.
+ * @return An pair of iterators defining the subrange.
+ * @ingroup binary_search_algorithms
+ *
+ * This is equivalent to
+ * @code
+ * std::make_pair(lower_bound(first, last, val, comp),
+ * upper_bound(first, last, val, comp))
+ * @endcode
+ * but does not actually call those functions.
+ */
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ pair<_ForwardIterator, _ForwardIterator>
+ equal_range(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType, _Tp>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _Tp, _ValueType>)
+ __glibcxx_requires_partitioned_lower_pred(__first, __last,
+ __val, __comp);
+ __glibcxx_requires_partitioned_upper_pred(__first, __last,
+ __val, __comp);
+
+ _DistanceType __len = std::distance(__first, __last);
+ _DistanceType __half;
+ _ForwardIterator __middle, __left, __right;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ std::advance(__middle, __half);
+ if (__CheckedCompare(__comp)(*__middle, __val))
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else if (__CheckedCompare(__comp)(__val, *__middle))
+ __len = __half;
+ else
+ {
+ __left = std::lower_bound(__first, __middle, __val,
+ __CheckedCompare(__comp));
+ std::advance(__first, __len);
+ __right = std::upper_bound(++__middle, __first, __val,
+ __CheckedCompare(__comp));
+ return pair<_ForwardIterator, _ForwardIterator>(__left, __right);
+ }
+ }
+ return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
+ }
+
+ /**
+ * @brief Determines whether an element exists in a range.
+ * @ingroup binary_search_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @return True if @a val (or its equivalent) is in [@a first,@a last ].
+ *
+ * Note that this does not actually return an iterator to @a val. For
+ * that, use std::find or a container's specialized find member functions.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ bool
+ binary_search(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)
+ __glibcxx_requires_partitioned_lower(__first, __last, __val);
+ __glibcxx_requires_partitioned_upper(__first, __last, __val);
+
+ _ForwardIterator __i = std::lower_bound(__first, __last, __val);
+ return __i != __last && !(__val < *__i);
+ }
+
+ /**
+ * @brief Determines whether an element exists in a range.
+ * @ingroup binary_search_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param val The search term.
+ * @param comp A functor to use for comparisons.
+ * @return True if @a val (or its equivalent) is in [@a first,@a last ].
+ *
+ * Note that this does not actually return an iterator to @a val. For
+ * that, use std::find or a container's specialized find member functions.
+ *
+ * The comparison function should have the same effects on ordering as
+ * the function used for the initial sort.
+ */
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ bool
+ binary_search(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val, _Compare __comp)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _Tp, _ValueType>)
+ __glibcxx_requires_partitioned_lower_pred(__first, __last,
+ __val, __comp);
+ __glibcxx_requires_partitioned_upper_pred(__first, __last,
+ __val, __comp);
+
+ _ForwardIterator __i = std::lower_bound(__first, __last, __val,
+ __CheckedCompare(__comp));
+ return __i != __last && !bool(__CheckedCompare(__comp)(__val, *__i));
+ }
+
+ // merge
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
+ typename _BidirectionalIterator3>
+ _BidirectionalIterator3
+ __merge_backward(_BidirectionalIterator1 __first1,
+ _BidirectionalIterator1 __last1,
+ _BidirectionalIterator2 __first2,
+ _BidirectionalIterator2 __last2,
+ _BidirectionalIterator3 __result)
+ {
+ if (__first1 == __last1)
+ return std::copy_backward(__first2, __last2, __result);
+ if (__first2 == __last2)
+ return std::copy_backward(__first1, __last1, __result);
+ --__last1;
+ --__last2;
+ while (true)
+ {
+ if (*__last2 < *__last1)
+ {
+ *--__result = *__last1;
+ if (__first1 == __last1)
+ return std::copy_backward(__first2, ++__last2, __result);
+ --__last1;
+ }
+ else
+ {
+ *--__result = *__last2;
+ if (__first2 == __last2)
+ return std::copy_backward(__first1, ++__last1, __result);
+ --__last2;
+ }
+ }
+ }
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
+ typename _BidirectionalIterator3, typename _Compare>
+ _BidirectionalIterator3
+ __merge_backward(_BidirectionalIterator1 __first1,
+ _BidirectionalIterator1 __last1,
+ _BidirectionalIterator2 __first2,
+ _BidirectionalIterator2 __last2,
+ _BidirectionalIterator3 __result,
+ _Compare __comp)
+ {
+ if (__first1 == __last1)
+ return std::copy_backward(__first2, __last2, __result);
+ if (__first2 == __last2)
+ return std::copy_backward(__first1, __last1, __result);
+ --__last1;
+ --__last2;
+ while (true)
+ {
+ if (__comp(*__last2, *__last1))
+ {
+ *--__result = *__last1;
+ if (__first1 == __last1)
+ return std::copy_backward(__first2, ++__last2, __result);
+ --__last1;
+ }
+ else
+ {
+ *--__result = *__last2;
+ if (__first2 == __last2)
+ return std::copy_backward(__first1, ++__last1, __result);
+ --__last2;
+ }
+ }
+ }
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
+ typename _Distance>
+ _BidirectionalIterator1
+ __rotate_adaptive(_BidirectionalIterator1 __first,
+ _BidirectionalIterator1 __middle,
+ _BidirectionalIterator1 __last,
+ _Distance __len1, _Distance __len2,
+ _BidirectionalIterator2 __buffer,
+ _Distance __buffer_size)
+ {
+ _BidirectionalIterator2 __buffer_end;
+ if (__len1 > __len2 && __len2 <= __buffer_size)
+ {
+ __buffer_end = std::copy(__middle, __last, __buffer);
+ std::copy_backward(__first, __middle, __last);
+ return std::copy(__buffer, __buffer_end, __first);
+ }
+ else if (__len1 <= __buffer_size)
+ {
+ __buffer_end = std::copy(__first, __middle, __buffer);
+ std::copy(__middle, __last, __first);
+ return std::copy_backward(__buffer, __buffer_end, __last);
+ }
+ else
+ {
+ std::rotate(__first, __middle, __last);
+ std::advance(__first, std::distance(__middle, __last));
+ return __first;
+ }
+ }
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator, typename _Distance,
+ typename _Pointer>
+ void
+ __merge_adaptive(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ _Distance __len1, _Distance __len2,
+ _Pointer __buffer, _Distance __buffer_size)
+ {
+ if (__len1 <= __len2 && __len1 <= __buffer_size)
+ {
+ _Pointer __buffer_end = std::copy(__first, __middle, __buffer);
+ _GLIBCXX_STD_P::merge(__buffer, __buffer_end, __middle, __last,
+ __first);
+ }
+ else if (__len2 <= __buffer_size)
+ {
+ _Pointer __buffer_end = std::copy(__middle, __last, __buffer);
+ std::__merge_backward(__first, __middle, __buffer,
+ __buffer_end, __last);
+ }
+ else
+ {
+ _BidirectionalIterator __first_cut = __first;
+ _BidirectionalIterator __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2)
+ {
+ __len11 = __len1 / 2;
+ std::advance(__first_cut, __len11);
+ __second_cut = std::lower_bound(__middle, __last,
+ *__first_cut);
+ __len22 = std::distance(__middle, __second_cut);
+ }
+ else
+ {
+ __len22 = __len2 / 2;
+ std::advance(__second_cut, __len22);
+ __first_cut = std::upper_bound(__first, __middle,
+ *__second_cut);
+ __len11 = std::distance(__first, __first_cut);
+ }
+ _BidirectionalIterator __new_middle =
+ std::__rotate_adaptive(__first_cut, __middle, __second_cut,
+ __len1 - __len11, __len22, __buffer,
+ __buffer_size);
+ std::__merge_adaptive(__first, __first_cut, __new_middle, __len11,
+ __len22, __buffer, __buffer_size);
+ std::__merge_adaptive(__new_middle, __second_cut, __last,
+ __len1 - __len11,
+ __len2 - __len22, __buffer, __buffer_size);
+ }
+ }
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator, typename _Distance,
+ typename _Pointer, typename _Compare>
+ void
+ __merge_adaptive(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ _Distance __len1, _Distance __len2,
+ _Pointer __buffer, _Distance __buffer_size,
+ _Compare __comp)
+ {
+ if (__len1 <= __len2 && __len1 <= __buffer_size)
+ {
+ _Pointer __buffer_end = std::copy(__first, __middle, __buffer);
+ _GLIBCXX_STD_P::merge(__buffer, __buffer_end, __middle, __last,
+ __first, __comp);
+ }
+ else if (__len2 <= __buffer_size)
+ {
+ _Pointer __buffer_end = std::copy(__middle, __last, __buffer);
+ std::__merge_backward(__first, __middle, __buffer, __buffer_end,
+ __last, __comp);
+ }
+ else
+ {
+ _BidirectionalIterator __first_cut = __first;
+ _BidirectionalIterator __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2)
+ {
+ __len11 = __len1 / 2;
+ std::advance(__first_cut, __len11);
+ __second_cut = std::lower_bound(__middle, __last, *__first_cut,
+ __comp);
+ __len22 = std::distance(__middle, __second_cut);
+ }
+ else
+ {
+ __len22 = __len2 / 2;
+ std::advance(__second_cut, __len22);
+ __first_cut = std::upper_bound(__first, __middle, *__second_cut,
+ __comp);
+ __len11 = std::distance(__first, __first_cut);
+ }
+ _BidirectionalIterator __new_middle =
+ std::__rotate_adaptive(__first_cut, __middle, __second_cut,
+ __len1 - __len11, __len22, __buffer,
+ __buffer_size);
+ std::__merge_adaptive(__first, __first_cut, __new_middle, __len11,
+ __len22, __buffer, __buffer_size, __comp);
+ std::__merge_adaptive(__new_middle, __second_cut, __last,
+ __len1 - __len11,
+ __len2 - __len22, __buffer,
+ __buffer_size, __comp);
+ }
+ }
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator, typename _Distance>
+ void
+ __merge_without_buffer(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ _Distance __len1, _Distance __len2)
+ {
+ if (__len1 == 0 || __len2 == 0)
+ return;
+ if (__len1 + __len2 == 2)
+ {
+ if (*__middle < *__first)
+ std::iter_swap(__first, __middle);
+ return;
+ }
+ _BidirectionalIterator __first_cut = __first;
+ _BidirectionalIterator __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2)
+ {
+ __len11 = __len1 / 2;
+ std::advance(__first_cut, __len11);
+ __second_cut = std::lower_bound(__middle, __last, *__first_cut);
+ __len22 = std::distance(__middle, __second_cut);
+ }
+ else
+ {
+ __len22 = __len2 / 2;
+ std::advance(__second_cut, __len22);
+ __first_cut = std::upper_bound(__first, __middle, *__second_cut);
+ __len11 = std::distance(__first, __first_cut);
+ }
+ std::rotate(__first_cut, __middle, __second_cut);
+ _BidirectionalIterator __new_middle = __first_cut;
+ std::advance(__new_middle, std::distance(__middle, __second_cut));
+ std::__merge_without_buffer(__first, __first_cut, __new_middle,
+ __len11, __len22);
+ std::__merge_without_buffer(__new_middle, __second_cut, __last,
+ __len1 - __len11, __len2 - __len22);
+ }
+
+ /// This is a helper function for the merge routines.
+ template<typename _BidirectionalIterator, typename _Distance,
+ typename _Compare>
+ void
+ __merge_without_buffer(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ _Distance __len1, _Distance __len2,
+ _Compare __comp)
+ {
+ if (__len1 == 0 || __len2 == 0)
+ return;
+ if (__len1 + __len2 == 2)
+ {
+ if (__comp(*__middle, *__first))
+ std::iter_swap(__first, __middle);
+ return;
+ }
+ _BidirectionalIterator __first_cut = __first;
+ _BidirectionalIterator __second_cut = __middle;
+ _Distance __len11 = 0;
+ _Distance __len22 = 0;
+ if (__len1 > __len2)
+ {
+ __len11 = __len1 / 2;
+ std::advance(__first_cut, __len11);
+ __second_cut = std::lower_bound(__middle, __last, *__first_cut,
+ __comp);
+ __len22 = std::distance(__middle, __second_cut);
+ }
+ else
+ {
+ __len22 = __len2 / 2;
+ std::advance(__second_cut, __len22);
+ __first_cut = std::upper_bound(__first, __middle, *__second_cut,
+ __comp);
+ __len11 = std::distance(__first, __first_cut);
+ }
+ std::rotate(__first_cut, __middle, __second_cut);
+ _BidirectionalIterator __new_middle = __first_cut;
+ std::advance(__new_middle, std::distance(__middle, __second_cut));
+ std::__merge_without_buffer(__first, __first_cut, __new_middle,
+ __len11, __len22, __comp);
+ std::__merge_without_buffer(__new_middle, __second_cut, __last,
+ __len1 - __len11, __len2 - __len22, __comp);
+ }
+
+ /**
+ * @brief Merges two sorted ranges in place.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param middle Another iterator.
+ * @param last Another iterator.
+ * @return Nothing.
+ *
+ * Merges two sorted and consecutive ranges, [first,middle) and
+ * [middle,last), and puts the result in [first,last). The output will
+ * be sorted. The sort is @e stable, that is, for equivalent
+ * elements in the two ranges, elements from the first range will always
+ * come before elements from the second.
+ *
+ * If enough additional memory is available, this takes (last-first)-1
+ * comparisons. Otherwise an NlogN algorithm is used, where N is
+ * distance(first,last).
+ */
+ template<typename _BidirectionalIterator>
+ void
+ inplace_merge(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last)
+ {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_sorted(__first, __middle);
+ __glibcxx_requires_sorted(__middle, __last);
+
+ if (__first == __middle || __middle == __last)
+ return;
+
+ _DistanceType __len1 = std::distance(__first, __middle);
+ _DistanceType __len2 = std::distance(__middle, __last);
+
+ _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first,
+ __last);
+ if (__buf.begin() == 0)
+ std::__merge_without_buffer(__first, __middle, __last, __len1, __len2);
+ else
+ std::__merge_adaptive(__first, __middle, __last, __len1, __len2,
+ __buf.begin(), _DistanceType(__buf.size()));
+ }
+
+ /**
+ * @brief Merges two sorted ranges in place.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param middle Another iterator.
+ * @param last Another iterator.
+ * @param comp A functor to use for comparisons.
+ * @return Nothing.
+ *
+ * Merges two sorted and consecutive ranges, [first,middle) and
+ * [middle,last), and puts the result in [first,last). The output will
+ * be sorted. The sort is @e stable, that is, for equivalent
+ * elements in the two ranges, elements from the first range will always
+ * come before elements from the second.
+ *
+ * If enough additional memory is available, this takes (last-first)-1
+ * comparisons. Otherwise an NlogN algorithm is used, where N is
+ * distance(first,last).
+ *
+ * The comparison function should have the same effects on ordering as
+ * the function used for the initial sort.
+ */
+ template<typename _BidirectionalIterator, typename _Compare>
+ void
+ inplace_merge(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType, _ValueType>)
+ __glibcxx_requires_sorted_pred(__first, __middle, __comp);
+ __glibcxx_requires_sorted_pred(__middle, __last, __comp);
+
+ if (__first == __middle || __middle == __last)
+ return;
+
+ const _DistanceType __len1 = std::distance(__first, __middle);
+ const _DistanceType __len2 = std::distance(__middle, __last);
+
+ _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first,
+ __last);
+ if (__buf.begin() == 0)
+ std::__merge_without_buffer(__first, __middle, __last, __len1,
+ __len2, __CheckedCompare(__comp));
+ else
+ std::__merge_adaptive(__first, __middle, __last, __len1, __len2,
+ __buf.begin(), _DistanceType(__buf.size()),
+ __CheckedCompare(__comp));
+ }
+
+ template<typename _RandomAccessIterator1, typename _RandomAccessIterator2,
+ typename _Distance>
+ void
+ __merge_sort_loop(_RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _RandomAccessIterator2 __result,
+ _Distance __step_size)
+ {
+ const _Distance __two_step = 2 * __step_size;
+
+ while (__last - __first >= __two_step)
+ {
+ __result = _GLIBCXX_STD_P::merge(__first, __first + __step_size,
+ __first + __step_size,
+ __first + __two_step,
+ __result);
+ __first += __two_step;
+ }
+
+ __step_size = std::min(_Distance(__last - __first), __step_size);
+ _GLIBCXX_STD_P::merge(__first, __first + __step_size,
+ __first + __step_size, __last,
+ __result);
+ }
+
+ template<typename _RandomAccessIterator1, typename _RandomAccessIterator2,
+ typename _Distance, typename _Compare>
+ void
+ __merge_sort_loop(_RandomAccessIterator1 __first,
+ _RandomAccessIterator1 __last,
+ _RandomAccessIterator2 __result, _Distance __step_size,
+ _Compare __comp)
+ {
+ const _Distance __two_step = 2 * __step_size;
+
+ while (__last - __first >= __two_step)
+ {
+ __result = _GLIBCXX_STD_P::merge(__first, __first + __step_size,
+ __first + __step_size, __first + __two_step,
+ __result,
+ __comp);
+ __first += __two_step;
+ }
+ __step_size = std::min(_Distance(__last - __first), __step_size);
+
+ _GLIBCXX_STD_P::merge(__first, __first + __step_size,
+ __first + __step_size, __last, __result, __comp);
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance>
+ void
+ __chunk_insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Distance __chunk_size)
+ {
+ while (__last - __first >= __chunk_size)
+ {
+ std::__insertion_sort(__first, __first + __chunk_size);
+ __first += __chunk_size;
+ }
+ std::__insertion_sort(__first, __last);
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance,
+ typename _Compare>
+ void
+ __chunk_insertion_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Distance __chunk_size, _Compare __comp)
+ {
+ while (__last - __first >= __chunk_size)
+ {
+ std::__insertion_sort(__first, __first + __chunk_size, __comp);
+ __first += __chunk_size;
+ }
+ std::__insertion_sort(__first, __last, __comp);
+ }
+
+ enum { _S_chunk_size = 7 };
+
+ template<typename _RandomAccessIterator, typename _Pointer>
+ void
+ __merge_sort_with_buffer(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Pointer __buffer)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _Distance;
+
+ const _Distance __len = __last - __first;
+ const _Pointer __buffer_last = __buffer + __len;
+
+ _Distance __step_size = _S_chunk_size;
+ std::__chunk_insertion_sort(__first, __last, __step_size);
+
+ while (__step_size < __len)
+ {
+ std::__merge_sort_loop(__first, __last, __buffer, __step_size);
+ __step_size *= 2;
+ std::__merge_sort_loop(__buffer, __buffer_last, __first, __step_size);
+ __step_size *= 2;
+ }
+ }
+
+ template<typename _RandomAccessIterator, typename _Pointer, typename _Compare>
+ void
+ __merge_sort_with_buffer(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Pointer __buffer, _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _Distance;
+
+ const _Distance __len = __last - __first;
+ const _Pointer __buffer_last = __buffer + __len;
+
+ _Distance __step_size = _S_chunk_size;
+ std::__chunk_insertion_sort(__first, __last, __step_size, __comp);
+
+ while (__step_size < __len)
+ {
+ std::__merge_sort_loop(__first, __last, __buffer,
+ __step_size, __comp);
+ __step_size *= 2;
+ std::__merge_sort_loop(__buffer, __buffer_last, __first,
+ __step_size, __comp);
+ __step_size *= 2;
+ }
+ }
+
+ template<typename _RandomAccessIterator, typename _Pointer,
+ typename _Distance>
+ void
+ __stable_sort_adaptive(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Pointer __buffer, _Distance __buffer_size)
+ {
+ const _Distance __len = (__last - __first + 1) / 2;
+ const _RandomAccessIterator __middle = __first + __len;
+ if (__len > __buffer_size)
+ {
+ std::__stable_sort_adaptive(__first, __middle,
+ __buffer, __buffer_size);
+ std::__stable_sort_adaptive(__middle, __last,
+ __buffer, __buffer_size);
+ }
+ else
+ {
+ std::__merge_sort_with_buffer(__first, __middle, __buffer);
+ std::__merge_sort_with_buffer(__middle, __last, __buffer);
+ }
+ std::__merge_adaptive(__first, __middle, __last,
+ _Distance(__middle - __first),
+ _Distance(__last - __middle),
+ __buffer, __buffer_size);
+ }
+
+ template<typename _RandomAccessIterator, typename _Pointer,
+ typename _Distance, typename _Compare>
+ void
+ __stable_sort_adaptive(_RandomAccessIterator __first,
+ _RandomAccessIterator __last,
+ _Pointer __buffer, _Distance __buffer_size,
+ _Compare __comp)
+ {
+ const _Distance __len = (__last - __first + 1) / 2;
+ const _RandomAccessIterator __middle = __first + __len;
+ if (__len > __buffer_size)
+ {
+ std::__stable_sort_adaptive(__first, __middle, __buffer,
+ __buffer_size, __comp);
+ std::__stable_sort_adaptive(__middle, __last, __buffer,
+ __buffer_size, __comp);
+ }
+ else
+ {
+ std::__merge_sort_with_buffer(__first, __middle, __buffer, __comp);
+ std::__merge_sort_with_buffer(__middle, __last, __buffer, __comp);
+ }
+ std::__merge_adaptive(__first, __middle, __last,
+ _Distance(__middle - __first),
+ _Distance(__last - __middle),
+ __buffer, __buffer_size,
+ __comp);
+ }
+
+ /// This is a helper function for the stable sorting routines.
+ template<typename _RandomAccessIterator>
+ void
+ __inplace_stable_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last)
+ {
+ if (__last - __first < 15)
+ {
+ std::__insertion_sort(__first, __last);
+ return;
+ }
+ _RandomAccessIterator __middle = __first + (__last - __first) / 2;
+ std::__inplace_stable_sort(__first, __middle);
+ std::__inplace_stable_sort(__middle, __last);
+ std::__merge_without_buffer(__first, __middle, __last,
+ __middle - __first,
+ __last - __middle);
+ }
+
+ /// This is a helper function for the stable sorting routines.
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ __inplace_stable_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ if (__last - __first < 15)
+ {
+ std::__insertion_sort(__first, __last, __comp);
+ return;
+ }
+ _RandomAccessIterator __middle = __first + (__last - __first) / 2;
+ std::__inplace_stable_sort(__first, __middle, __comp);
+ std::__inplace_stable_sort(__middle, __last, __comp);
+ std::__merge_without_buffer(__first, __middle, __last,
+ __middle - __first,
+ __last - __middle,
+ __comp);
+ }
+
+ // stable_sort
+
+ // Set algorithms: includes, set_union, set_intersection, set_difference,
+ // set_symmetric_difference. All of these algorithms have the precondition
+ // that their input ranges are sorted and the postcondition that their output
+ // ranges are sorted.
+
+ /**
+ * @brief Determines whether all elements of a sequence exists in a range.
+ * @param first1 Start of search range.
+ * @param last1 End of search range.
+ * @param first2 Start of sequence
+ * @param last2 End of sequence.
+ * @return True if each element in [first2,last2) is contained in order
+ * within [first1,last1). False otherwise.
+ * @ingroup set_algorithms
+ *
+ * This operation expects both [first1,last1) and [first2,last2) to be
+ * sorted. Searches for the presence of each element in [first2,last2)
+ * within [first1,last1). The iterators over each range only move forward,
+ * so this is a linear algorithm. If an element in [first2,last2) is not
+ * found before the search iterator reaches @a last2, false is returned.
+ */
+ template<typename _InputIterator1, typename _InputIterator2>
+ bool
+ includes(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set(__first1, __last1, __first2);
+ __glibcxx_requires_sorted_set(__first2, __last2, __first1);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first2 < *__first1)
+ return false;
+ else if(*__first1 < *__first2)
+ ++__first1;
+ else
+ ++__first1, ++__first2;
+
+ return __first2 == __last2;
+ }
+
+ /**
+ * @brief Determines whether all elements of a sequence exists in a range
+ * using comparison.
+ * @ingroup set_algorithms
+ * @param first1 Start of search range.
+ * @param last1 End of search range.
+ * @param first2 Start of sequence
+ * @param last2 End of sequence.
+ * @param comp Comparison function to use.
+ * @return True if each element in [first2,last2) is contained in order
+ * within [first1,last1) according to comp. False otherwise.
+ * @ingroup set_algorithms
+ *
+ * This operation expects both [first1,last1) and [first2,last2) to be
+ * sorted. Searches for the presence of each element in [first2,last2)
+ * within [first1,last1), using comp to decide. The iterators over each
+ * range only move forward, so this is a linear algorithm. If an element
+ * in [first2,last2) is not found before the search iterator reaches @a
+ * last2, false is returned.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _Compare>
+ bool
+ includes(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
+ __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__CheckedCompare(__comp)(*__first2, *__first1))
+ return false;
+ else if(__CheckedCompare(__comp)(*__first1, *__first2))
+ ++__first1;
+ else
+ ++__first1, ++__first2;
+
+ return __first2 == __last2;
+ }
+
+ // nth_element
+ // merge
+ // set_difference
+ // set_intersection
+ // set_union
+ // stable_sort
+ // set_symmetric_difference
+ // min_element
+ // max_element
+
+ /**
+ * @brief Permute range into the next "dictionary" ordering.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @return False if wrapped to first permutation, true otherwise.
+ *
+ * Treats all permutations of the range as a set of "dictionary" sorted
+ * sequences. Permutes the current sequence into the next one of this set.
+ * Returns true if there are more sequences to generate. If the sequence
+ * is the largest of the set, the smallest is generated and false returned.
+ */
+ template<typename _BidirectionalIterator>
+ bool
+ next_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return false;
+ _BidirectionalIterator __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;)
+ {
+ _BidirectionalIterator __ii = __i;
+ --__i;
+ if (*__i < *__ii)
+ {
+ _BidirectionalIterator __j = __last;
+ while (!(*__i < *--__j))
+ {}
+ std::iter_swap(__i, __j);
+ std::reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first)
+ {
+ std::reverse(__first, __last);
+ return false;
+ }
+ }
+ }
+
+ /**
+ * @brief Permute range into the next "dictionary" ordering using
+ * comparison functor.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp A comparison functor.
+ * @return False if wrapped to first permutation, true otherwise.
+ *
+ * Treats all permutations of the range [first,last) as a set of
+ * "dictionary" sorted sequences ordered by @a comp. Permutes the current
+ * sequence into the next one of this set. Returns true if there are more
+ * sequences to generate. If the sequence is the largest of the set, the
+ * smallest is generated and false returned.
+ */
+ template<typename _BidirectionalIterator, typename _Compare>
+ bool
+ next_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last, _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_BidirectionalIterator>::value_type,
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return false;
+ _BidirectionalIterator __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;)
+ {
+ _BidirectionalIterator __ii = __i;
+ --__i;
+ if (__CheckedCompare(__comp)(*__i, *__ii))
+ {
+ _BidirectionalIterator __j = __last;
+ while (!bool(__CheckedCompare(__comp)(*__i, *--__j)))
+ {}
+ std::iter_swap(__i, __j);
+ std::reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first)
+ {
+ std::reverse(__first, __last);
+ return false;
+ }
+ }
+ }
+
+ /**
+ * @brief Permute range into the previous "dictionary" ordering.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @return False if wrapped to last permutation, true otherwise.
+ *
+ * Treats all permutations of the range as a set of "dictionary" sorted
+ * sequences. Permutes the current sequence into the previous one of this
+ * set. Returns true if there are more sequences to generate. If the
+ * sequence is the smallest of the set, the largest is generated and false
+ * returned.
+ */
+ template<typename _BidirectionalIterator>
+ bool
+ prev_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return false;
+ _BidirectionalIterator __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;)
+ {
+ _BidirectionalIterator __ii = __i;
+ --__i;
+ if (*__ii < *__i)
+ {
+ _BidirectionalIterator __j = __last;
+ while (!(*--__j < *__i))
+ {}
+ std::iter_swap(__i, __j);
+ std::reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first)
+ {
+ std::reverse(__first, __last);
+ return false;
+ }
+ }
+ }
+
+ /**
+ * @brief Permute range into the previous "dictionary" ordering using
+ * comparison functor.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp A comparison functor.
+ * @return False if wrapped to last permutation, true otherwise.
+ *
+ * Treats all permutations of the range [first,last) as a set of
+ * "dictionary" sorted sequences ordered by @a comp. Permutes the current
+ * sequence into the previous one of this set. Returns true if there are
+ * more sequences to generate. If the sequence is the smallest of the set,
+ * the largest is generated and false returned.
+ */
+ template<typename _BidirectionalIterator, typename _Compare>
+ bool
+ prev_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last, _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_BidirectionalIterator>::value_type,
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return false;
+ _BidirectionalIterator __i = __first;
+ ++__i;
+ if (__i == __last)
+ return false;
+ __i = __last;
+ --__i;
+
+ for(;;)
+ {
+ _BidirectionalIterator __ii = __i;
+ --__i;
+ if (__CheckedCompare(__comp)(*__ii, *__i))
+ {
+ _BidirectionalIterator __j = __last;
+ while (!bool(__CheckedCompare(__comp)(*--__j, *__i)))
+ {}
+ std::iter_swap(__i, __j);
+ std::reverse(__ii, __last);
+ return true;
+ }
+ if (__i == __first)
+ {
+ std::reverse(__first, __last);
+ return false;
+ }
+ }
+ }
+
+ // replace
+ // replace_if
+
+ /**
+ * @brief Copy a sequence, replacing each element of one value with another
+ * value.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param old_value The value to be replaced.
+ * @param new_value The replacement value.
+ * @return The end of the output sequence, @p result+(last-first).
+ *
+ * Copies each element in the input range @p [first,last) to the
+ * output range @p [result,result+(last-first)) replacing elements
+ * equal to @p old_value with @p new_value.
+ */
+ template<typename _InputIterator, typename _OutputIterator, typename _Tp>
+ _OutputIterator
+ replace_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ const _Tp& __old_value, const _Tp& __new_value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first, ++__result)
+ if (*__first == __old_value)
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
+ }
+
+ /**
+ * @brief Copy a sequence, replacing each value for which a predicate
+ * returns true with another value.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param pred A predicate.
+ * @param new_value The replacement value.
+ * @return The end of the output sequence, @p result+(last-first).
+ *
+ * Copies each element in the range @p [first,last) to the range
+ * @p [result,result+(last-first)) replacing elements for which
+ * @p pred returns true with @p new_value.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _Predicate, typename _Tp>
+ _OutputIterator
+ replace_copy_if(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ _Predicate __pred, const _Tp& __new_value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first, ++__result)
+ if (__pred(*__first))
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Determines whether the elements of a sequence are sorted.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @return True if the elements are sorted, false otherwise.
+ */
+ template<typename _ForwardIterator>
+ inline bool
+ is_sorted(_ForwardIterator __first, _ForwardIterator __last)
+ { return std::is_sorted_until(__first, __last) == __last; }
+
+ /**
+ * @brief Determines whether the elements of a sequence are sorted
+ * according to a comparison functor.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param comp A comparison functor.
+ * @return True if the elements are sorted, false otherwise.
+ */
+ template<typename _ForwardIterator, typename _Compare>
+ inline bool
+ is_sorted(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ { return std::is_sorted_until(__first, __last, __comp) == __last; }
+
+ /**
+ * @brief Determines the end of a sorted sequence.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @return An iterator pointing to the last iterator i in [first, last)
+ * for which the range [first, i) is sorted.
+ */
+ template<typename _ForwardIterator>
+ _ForwardIterator
+ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __last;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (*__next < *__first)
+ return __next;
+ return __next;
+ }
+
+ /**
+ * @brief Determines the end of a sorted sequence using comparison functor.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param comp A comparison functor.
+ * @return An iterator pointing to the last iterator i in [first, last)
+ * for which the range [first, i) is sorted.
+ */
+ template<typename _ForwardIterator, typename _Compare>
+ _ForwardIterator
+ is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __last;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (__CheckedCompare(__comp)(*__next, *__first))
+ return __next;
+ return __next;
+ }
+
+ /**
+ * @brief Determines min and max at once as an ordered pair.
+ * @ingroup sorting_algorithms
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @return A pair(b, a) if b is smaller than a, pair(a, b) otherwise.
+ */
+ template<typename _Tp>
+ inline pair<const _Tp&, const _Tp&>
+ minmax(const _Tp& __a, const _Tp& __b)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
+
+ return __b < __a ? pair<const _Tp&, const _Tp&>(__b, __a)
+ : pair<const _Tp&, const _Tp&>(__a, __b);
+ }
+
+ /**
+ * @brief Determines min and max at once as an ordered pair.
+ * @ingroup sorting_algorithms
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @param comp A @link comparison_functor comparison functor@endlink.
+ * @return A pair(b, a) if b is smaller than a, pair(a, b) otherwise.
+ */
+ template<typename _Tp, typename _Compare>
+ inline pair<const _Tp&, const _Tp&>
+ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
+ {
+ return __CheckedCompare(__comp)(__b, __a)
+ ? pair<const _Tp&, const _Tp&>(__b, __a)
+ : pair<const _Tp&, const _Tp&>(__a, __b);
+ }
+
+ /**
+ * @brief Return a pair of iterators pointing to the minimum and maximum
+ * elements in a range.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @return make_pair(m, M), where m is the first iterator i in
+ * [first, last) such that no other element in the range is
+ * smaller, and where M is the last iterator i in [first, last)
+ * such that no other element in the range is larger.
+ */
+ template<typename _ForwardIterator>
+ pair<_ForwardIterator, _ForwardIterator>
+ minmax_element(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ _ForwardIterator __next = __first;
+ if (__first == __last
+ || ++__next == __last)
+ return std::make_pair(__first, __first);
+
+ _ForwardIterator __min, __max;
+ if (*__next < *__first)
+ {
+ __min = __next;
+ __max = __first;
+ }
+ else
+ {
+ __min = __first;
+ __max = __next;
+ }
+
+ __first = __next;
+ ++__first;
+
+ while (__first != __last)
+ {
+ __next = __first;
+ if (++__next == __last)
+ {
+ if (*__first < *__min)
+ __min = __first;
+ else if (!(*__first < *__max))
+ __max = __first;
+ break;
+ }
+
+ if (*__next < *__first)
+ {
+ if (*__next < *__min)
+ __min = __next;
+ if (!(*__first < *__max))
+ __max = __first;
+ }
+ else
+ {
+ if (*__first < *__min)
+ __min = __first;
+ if (!(*__next < *__max))
+ __max = __next;
+ }
+
+ __first = __next;
+ ++__first;
+ }
+
+ return std::make_pair(__min, __max);
+ }
+
+ /**
+ * @brief Return a pair of iterators pointing to the minimum and maximum
+ * elements in a range.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp Comparison functor.
+ * @return make_pair(m, M), where m is the first iterator i in
+ * [first, last) such that no other element in the range is
+ * smaller, and where M is the last iterator i in [first, last)
+ * such that no other element in the range is larger.
+ */
+ template<typename _ForwardIterator, typename _Compare>
+ pair<_ForwardIterator, _ForwardIterator>
+ minmax_element(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ _ForwardIterator __next = __first;
+ if (__first == __last
+ || ++__next == __last)
+ return std::make_pair(__first, __first);
+
+ _ForwardIterator __min, __max;
+ if (__CheckedCompare(__comp)(*__next, *__first))
+ {
+ __min = __next;
+ __max = __first;
+ }
+ else
+ {
+ __min = __first;
+ __max = __next;
+ }
+
+ __first = __next;
+ ++__first;
+
+ while (__first != __last)
+ {
+ __next = __first;
+ if (++__next == __last)
+ {
+ if (__CheckedCompare(__comp)(*__first, *__min))
+ __min = __first;
+ else if (!__CheckedCompare(__comp)(*__first, *__max))
+ __max = __first;
+ break;
+ }
+
+ if (__CheckedCompare(__comp)(*__next, *__first))
+ {
+ if (__CheckedCompare(__comp)(*__next, *__min))
+ __min = __next;
+ if (!__CheckedCompare(__comp)(*__first, *__max))
+ __max = __first;
+ }
+ else
+ {
+ if (__CheckedCompare(__comp)(*__first, *__min))
+ __min = __first;
+ if (!__CheckedCompare(__comp)(*__next, *__max))
+ __max = __next;
+ }
+
+ __first = __next;
+ ++__first;
+ }
+
+ return std::make_pair(__min, __max);
+ }
+
+ // N2722 + fixes.
+ template<typename _Tp>
+ inline _Tp
+ min(initializer_list<_Tp> __l)
+ { return *std::min_element(__l.begin(), __l.end()); }
+
+ template<typename _Tp, typename _Compare>
+ inline _Tp
+ min(initializer_list<_Tp> __l, _Compare __comp)
+ { return *std::min_element(__l.begin(), __l.end(), __comp); }
+
+ template<typename _Tp>
+ inline _Tp
+ max(initializer_list<_Tp> __l)
+ { return *std::max_element(__l.begin(), __l.end()); }
+
+ template<typename _Tp, typename _Compare>
+ inline _Tp
+ max(initializer_list<_Tp> __l, _Compare __comp)
+ { return *std::max_element(__l.begin(), __l.end(), __comp); }
+
+ template<typename _Tp>
+ inline pair<_Tp, _Tp>
+ minmax(initializer_list<_Tp> __l)
+ {
+ pair<const _Tp*, const _Tp*> __p =
+ std::minmax_element(__l.begin(), __l.end());
+ return std::make_pair(*__p.first, *__p.second);
+ }
+
+ template<typename _Tp, typename _Compare>
+ inline pair<_Tp, _Tp>
+ minmax(initializer_list<_Tp> __l, _Compare __comp)
+ {
+ pair<const _Tp*, const _Tp*> __p =
+ std::minmax_element(__l.begin(), __l.end(), __comp);
+ return std::make_pair(*__p.first, *__p.second);
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
+
+ /**
+ * @brief Apply a function to every element of a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param f A unary function object.
+ * @return @p f.
+ *
+ * Applies the function object @p f to each element in the range
+ * @p [first,last). @p f must not modify the order of the sequence.
+ * If @p f has a return value it is ignored.
+ */
+ template<typename _InputIterator, typename _Function>
+ _Function
+ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ for (; __first != __last; ++__first)
+ __f(*__first);
+ return __f;
+ }
+
+ /**
+ * @brief Find the first occurrence of a value in a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param val The value to find.
+ * @return The first iterator @c i in the range @p [first,last)
+ * such that @c *i == @p val, or @p last if no such iterator exists.
+ */
+ template<typename _InputIterator, typename _Tp>
+ inline _InputIterator
+ find(_InputIterator __first, _InputIterator __last,
+ const _Tp& __val)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+ return std::__find(__first, __last, __val,
+ std::__iterator_category(__first));
+ }
+
+ /**
+ * @brief Find the first element in a sequence for which a
+ * predicate is true.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return The first iterator @c i in the range @p [first,last)
+ * such that @p pred(*i) is true, or @p last if no such iterator exists.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ inline _InputIterator
+ find_if(_InputIterator __first, _InputIterator __last,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+ return std::__find_if(__first, __last, __pred,
+ std::__iterator_category(__first));
+ }
+
+ /**
+ * @brief Find element from a set in a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first1 Start of range to search.
+ * @param last1 End of range to search.
+ * @param first2 Start of match candidates.
+ * @param last2 End of match candidates.
+ * @return The first iterator @c i in the range
+ * @p [first1,last1) such that @c *i == @p *(i2) such that i2 is an
+ * iterator in [first2,last2), or @p last1 if no such iterator exists.
+ *
+ * Searches the range @p [first1,last1) for an element that is equal to
+ * some element in the range [first2,last2). If found, returns an iterator
+ * in the range [first1,last1), otherwise returns @p last1.
+ */
+ template<typename _InputIterator, typename _ForwardIterator>
+ _InputIterator
+ find_first_of(_InputIterator __first1, _InputIterator __last1,
+ _ForwardIterator __first2, _ForwardIterator __last2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ for (; __first1 != __last1; ++__first1)
+ for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter)
+ if (*__first1 == *__iter)
+ return __first1;
+ return __last1;
+ }
+
+ /**
+ * @brief Find element from a set in a sequence using a predicate.
+ * @ingroup non_mutating_algorithms
+ * @param first1 Start of range to search.
+ * @param last1 End of range to search.
+ * @param first2 Start of match candidates.
+ * @param last2 End of match candidates.
+ * @param comp Predicate to use.
+ * @return The first iterator @c i in the range
+ * @p [first1,last1) such that @c comp(*i, @p *(i2)) is true and i2 is an
+ * iterator in [first2,last2), or @p last1 if no such iterator exists.
+ *
+
+ * Searches the range @p [first1,last1) for an element that is
+ * equal to some element in the range [first2,last2). If found,
+ * returns an iterator in the range [first1,last1), otherwise
+ * returns @p last1.
+ */
+ template<typename _InputIterator, typename _ForwardIterator,
+ typename _BinaryPredicate>
+ _InputIterator
+ find_first_of(_InputIterator __first1, _InputIterator __last1,
+ _ForwardIterator __first2, _ForwardIterator __last2,
+ _BinaryPredicate __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_InputIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ for (; __first1 != __last1; ++__first1)
+ for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter)
+ if (__comp(*__first1, *__iter))
+ return __first1;
+ return __last1;
+ }
+
+ /**
+ * @brief Find two adjacent values in a sequence that are equal.
+ * @ingroup non_mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @return The first iterator @c i such that @c i and @c i+1 are both
+ * valid iterators in @p [first,last) and such that @c *i == @c *(i+1),
+ * or @p last if no such iterator exists.
+ */
+ template<typename _ForwardIterator>
+ _ForwardIterator
+ adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_EqualityComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+ if (__first == __last)
+ return __last;
+ _ForwardIterator __next = __first;
+ while(++__next != __last)
+ {
+ if (*__first == *__next)
+ return __first;
+ __first = __next;
+ }
+ return __last;
+ }
+
+ /**
+ * @brief Find two adjacent values in a sequence using a predicate.
+ * @ingroup non_mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param binary_pred A binary predicate.
+ * @return The first iterator @c i such that @c i and @c i+1 are both
+ * valid iterators in @p [first,last) and such that
+ * @p binary_pred(*i,*(i+1)) is true, or @p last if no such iterator
+ * exists.
+ */
+ template<typename _ForwardIterator, typename _BinaryPredicate>
+ _ForwardIterator
+ adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
+ _BinaryPredicate __binary_pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+ if (__first == __last)
+ return __last;
+ _ForwardIterator __next = __first;
+ while(++__next != __last)
+ {
+ if (__binary_pred(*__first, *__next))
+ return __first;
+ __first = __next;
+ }
+ return __last;
+ }
+
+ /**
+ * @brief Count the number of copies of a value in a sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param value The value to be counted.
+ * @return The number of iterators @c i in the range @p [first,last)
+ * for which @c *i == @p value
+ */
+ template<typename _InputIterator, typename _Tp>
+ typename iterator_traits<_InputIterator>::difference_type
+ count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+ typename iterator_traits<_InputIterator>::difference_type __n = 0;
+ for (; __first != __last; ++__first)
+ if (*__first == __value)
+ ++__n;
+ return __n;
+ }
+
+ /**
+ * @brief Count the elements of a sequence for which a predicate is true.
+ * @ingroup non_mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param pred A predicate.
+ * @return The number of iterators @c i in the range @p [first,last)
+ * for which @p pred(*i) is true.
+ */
+ template<typename _InputIterator, typename _Predicate>
+ typename iterator_traits<_InputIterator>::difference_type
+ count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+ typename iterator_traits<_InputIterator>::difference_type __n = 0;
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ ++__n;
+ return __n;
+ }
+
+ /**
+ * @brief Search a sequence for a matching sub-sequence.
+ * @ingroup non_mutating_algorithms
+ * @param first1 A forward iterator.
+ * @param last1 A forward iterator.
+ * @param first2 A forward iterator.
+ * @param last2 A forward iterator.
+ * @return The first iterator @c i in the range
+ * @p [first1,last1-(last2-first2)) such that @c *(i+N) == @p *(first2+N)
+ * for each @c N in the range @p [0,last2-first2), or @p last1 if no
+ * such iterator exists.
+ *
+ * Searches the range @p [first1,last1) for a sub-sequence that compares
+ * equal value-by-value with the sequence given by @p [first2,last2) and
+ * returns an iterator to the first element of the sub-sequence, or
+ * @p last1 if the sub-sequence is not found.
+ *
+ * Because the sub-sequence must lie completely within the range
+ * @p [first1,last1) it must start at a position less than
+ * @p last1-(last2-first2) where @p last2-first2 is the length of the
+ * sub-sequence.
+ * This means that the returned iterator @c i will be in the range
+ * @p [first1,last1-(last2-first2))
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _ForwardIterator1
+ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_ForwardIterator1>::value_type,
+ typename iterator_traits<_ForwardIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIterator2 __p1(__first2);
+ if (++__p1 == __last2)
+ return _GLIBCXX_STD_P::find(__first1, __last1, *__first2);
+
+ // General case.
+ _ForwardIterator2 __p;
+ _ForwardIterator1 __current = __first1;
+
+ for (;;)
+ {
+ __first1 = _GLIBCXX_STD_P::find(__first1, __last1, *__first2);
+ if (__first1 == __last1)
+ return __last1;
+
+ __p = __p1;
+ __current = __first1;
+ if (++__current == __last1)
+ return __last1;
+
+ while (*__current == *__p)
+ {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+ ++__first1;
+ }
+ return __first1;
+ }
+
+ /**
+ * @brief Search a sequence for a matching sub-sequence using a predicate.
+ * @ingroup non_mutating_algorithms
+ * @param first1 A forward iterator.
+ * @param last1 A forward iterator.
+ * @param first2 A forward iterator.
+ * @param last2 A forward iterator.
+ * @param predicate A binary predicate.
+ * @return The first iterator @c i in the range
+ * @p [first1,last1-(last2-first2)) such that
+ * @p predicate(*(i+N),*(first2+N)) is true for each @c N in the range
+ * @p [0,last2-first2), or @p last1 if no such iterator exists.
+ *
+ * Searches the range @p [first1,last1) for a sub-sequence that compares
+ * equal value-by-value with the sequence given by @p [first2,last2),
+ * using @p predicate to determine equality, and returns an iterator
+ * to the first element of the sub-sequence, or @p last1 if no such
+ * iterator exists.
+ *
+ * @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2)
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2,
+ typename _BinaryPredicate>
+ _ForwardIterator1
+ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate __predicate)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator1>::value_type,
+ typename iterator_traits<_ForwardIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
+
+ // Test for a pattern of length 1.
+ _ForwardIterator2 __p1(__first2);
+ if (++__p1 == __last2)
+ {
+ while (__first1 != __last1
+ && !bool(__predicate(*__first1, *__first2)))
+ ++__first1;
+ return __first1;
+ }
+
+ // General case.
+ _ForwardIterator2 __p;
+ _ForwardIterator1 __current = __first1;
+
+ for (;;)
+ {
+ while (__first1 != __last1
+ && !bool(__predicate(*__first1, *__first2)))
+ ++__first1;
+ if (__first1 == __last1)
+ return __last1;
+
+ __p = __p1;
+ __current = __first1;
+ if (++__current == __last1)
+ return __last1;
+
+ while (__predicate(*__current, *__p))
+ {
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
+ }
+ ++__first1;
+ }
+ return __first1;
+ }
+
+
+ /**
+ * @brief Search a sequence for a number of consecutive values.
+ * @ingroup non_mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param count The number of consecutive values.
+ * @param val The value to find.
+ * @return The first iterator @c i in the range @p [first,last-count)
+ * such that @c *(i+N) == @p val for each @c N in the range @p [0,count),
+ * or @p last if no such iterator exists.
+ *
+ * Searches the range @p [first,last) for @p count consecutive elements
+ * equal to @p val.
+ */
+ template<typename _ForwardIterator, typename _Integer, typename _Tp>
+ _ForwardIterator
+ search_n(_ForwardIterator __first, _ForwardIterator __last,
+ _Integer __count, const _Tp& __val)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__count <= 0)
+ return __first;
+ if (__count == 1)
+ return _GLIBCXX_STD_P::find(__first, __last, __val);
+ return std::__search_n(__first, __last, __count, __val,
+ std::__iterator_category(__first));
+ }
+
+
+ /**
+ * @brief Search a sequence for a number of consecutive values using a
+ * predicate.
+ * @ingroup non_mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param count The number of consecutive values.
+ * @param val The value to find.
+ * @param binary_pred A binary predicate.
+ * @return The first iterator @c i in the range @p [first,last-count)
+ * such that @p binary_pred(*(i+N),val) is true for each @c N in the
+ * range @p [0,count), or @p last if no such iterator exists.
+ *
+ * Searches the range @p [first,last) for @p count consecutive elements
+ * for which the predicate returns true.
+ */
+ template<typename _ForwardIterator, typename _Integer, typename _Tp,
+ typename _BinaryPredicate>
+ _ForwardIterator
+ search_n(_ForwardIterator __first, _ForwardIterator __last,
+ _Integer __count, const _Tp& __val,
+ _BinaryPredicate __binary_pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__count <= 0)
+ return __first;
+ if (__count == 1)
+ {
+ while (__first != __last && !bool(__binary_pred(*__first, __val)))
+ ++__first;
+ return __first;
+ }
+ return std::__search_n(__first, __last, __count, __val, __binary_pred,
+ std::__iterator_category(__first));
+ }
+
+
+ /**
+ * @brief Perform an operation on a sequence.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param unary_op A unary operator.
+ * @return An output iterator equal to @p result+(last-first).
+ *
+ * Applies the operator to each element in the input range and assigns
+ * the results to successive elements of the output sequence.
+ * Evaluates @p *(result+N)=unary_op(*(first+N)) for each @c N in the
+ * range @p [0,last-first).
+ *
+ * @p unary_op must not alter its argument.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _UnaryOperation>
+ _OutputIterator
+ transform(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _UnaryOperation __unary_op)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ // "the type returned by a _UnaryOperation"
+ __typeof__(__unary_op(*__first))>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first, ++__result)
+ *__result = __unary_op(*__first);
+ return __result;
+ }
+
+ /**
+ * @brief Perform an operation on corresponding elements of two sequences.
+ * @ingroup mutating_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @param result An output iterator.
+ * @param binary_op A binary operator.
+ * @return An output iterator equal to @p result+(last-first).
+ *
+ * Applies the operator to the corresponding elements in the two
+ * input ranges and assigns the results to successive elements of the
+ * output sequence.
+ * Evaluates @p *(result+N)=binary_op(*(first1+N),*(first2+N)) for each
+ * @c N in the range @p [0,last1-first1).
+ *
+ * @p binary_op must not alter either of its arguments.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _BinaryOperation>
+ _OutputIterator
+ transform(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _OutputIterator __result,
+ _BinaryOperation __binary_op)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ // "the type returned by a _BinaryOperation"
+ __typeof__(__binary_op(*__first1,*__first2))>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ for (; __first1 != __last1; ++__first1, ++__first2, ++__result)
+ *__result = __binary_op(*__first1, *__first2);
+ return __result;
+ }
+
+ /**
+ * @brief Replace each occurrence of one value in a sequence with another
+ * value.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param old_value The value to be replaced.
+ * @param new_value The replacement value.
+ * @return replace() returns no value.
+ *
+ * For each iterator @c i in the range @p [first,last) if @c *i ==
+ * @p old_value then the assignment @c *i = @p new_value is performed.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ void
+ replace(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __old_value, const _Tp& __new_value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (*__first == __old_value)
+ *__first = __new_value;
+ }
+
+ /**
+ * @brief Replace each value in a sequence for which a predicate returns
+ * true with another value.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param pred A predicate.
+ * @param new_value The replacement value.
+ * @return replace_if() returns no value.
+ *
+ * For each iterator @c i in the range @p [first,last) if @p pred(*i)
+ * is true then the assignment @c *i = @p new_value is performed.
+ */
+ template<typename _ForwardIterator, typename _Predicate, typename _Tp>
+ void
+ replace_if(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred, const _Tp& __new_value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ if (__pred(*__first))
+ *__first = __new_value;
+ }
+
+ /**
+ * @brief Assign the result of a function object to each value in a
+ * sequence.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param gen A function object taking no arguments and returning
+ * std::iterator_traits<_ForwardIterator>::value_type
+ * @return generate() returns no value.
+ *
+ * Performs the assignment @c *i = @p gen() for each @c i in the range
+ * @p [first,last).
+ */
+ template<typename _ForwardIterator, typename _Generator>
+ void
+ generate(_ForwardIterator __first, _ForwardIterator __last,
+ _Generator __gen)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_GeneratorConcept<_Generator,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ *__first = __gen();
+ }
+
+ /**
+ * @brief Assign the result of a function object to each value in a
+ * sequence.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param n The length of the sequence.
+ * @param gen A function object taking no arguments and returning
+ * std::iterator_traits<_ForwardIterator>::value_type
+ * @return The end of the sequence, @p first+n
+ *
+ * Performs the assignment @c *i = @p gen() for each @c i in the range
+ * @p [first,first+n).
+ */
+ template<typename _OutputIterator, typename _Size, typename _Generator>
+ _OutputIterator
+ generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ // "the type returned by a _Generator"
+ __typeof__(__gen())>)
+
+ for (; __n > 0; --__n, ++__first)
+ *__first = __gen();
+ return __first;
+ }
+
+
+ /**
+ * @brief Copy a sequence, removing consecutive duplicate values.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies each element in the range @p [first,last) to the range
+ * beginning at @p result, except that only the first element is copied
+ * from groups of consecutive elements that compare equal.
+ * unique_copy() is stable, so the relative order of elements that are
+ * copied is unchanged.
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS
+ * DR 241. Does unique_copy() require CopyConstructible and Assignable?
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS
+ * DR 538. 241 again: Does unique_copy() require CopyConstructible and
+ * Assignable?
+ */
+ template<typename _InputIterator, typename _OutputIterator>
+ inline _OutputIterator
+ unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_function_requires(_EqualityComparableConcept<
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __result;
+ return std::__unique_copy(__first, __last, __result,
+ std::__iterator_category(__first),
+ std::__iterator_category(__result));
+ }
+
+ /**
+ * @brief Copy a sequence, removing consecutive values using a predicate.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @param binary_pred A binary predicate.
+ * @return An iterator designating the end of the resulting sequence.
+ *
+ * Copies each element in the range @p [first,last) to the range
+ * beginning at @p result, except that only the first element is copied
+ * from groups of consecutive elements for which @p binary_pred returns
+ * true.
+ * unique_copy() is stable, so the relative order of elements that are
+ * copied is unchanged.
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS
+ * DR 241. Does unique_copy() require CopyConstructible and Assignable?
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _BinaryPredicate>
+ inline _OutputIterator
+ unique_copy(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ _BinaryPredicate __binary_pred)
+ {
+ // concept requirements -- predicates checked later
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __result;
+ return std::__unique_copy(__first, __last, __result, __binary_pred,
+ std::__iterator_category(__first),
+ std::__iterator_category(__result));
+ }
+
+
+ /**
+ * @brief Randomly shuffle the elements of a sequence.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @return Nothing.
+ *
+ * Reorder the elements in the range @p [first,last) using a random
+ * distribution, so that every possible ordering of the sequence is
+ * equally likely.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first != __last)
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ std::iter_swap(__i, __first + (std::rand() % ((__i - __first) + 1)));
+ }
+
+ /**
+ * @brief Shuffle the elements of a sequence using a random number
+ * generator.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param rand The RNG functor or function.
+ * @return Nothing.
+ *
+ * Reorders the elements in the range @p [first,last) using @p rand to
+ * provide a random distribution. Calling @p rand(N) for a positive
+ * integer @p N should return a randomly chosen integer from the
+ * range [0,N).
+ */
+ template<typename _RandomAccessIterator, typename _RandomNumberGenerator>
+ void
+ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomNumberGenerator& __rand)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return;
+ for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
+ std::iter_swap(__i, __first + __rand((__i - __first) + 1));
+ }
+
+
+ /**
+ * @brief Move elements for which a predicate is true to the beginning
+ * of a sequence.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param pred A predicate functor.
+ * @return An iterator @p middle such that @p pred(i) is true for each
+ * iterator @p i in the range @p [first,middle) and false for each @p i
+ * in the range @p [middle,last).
+ *
+ * @p pred must not modify its operand. @p partition() does not preserve
+ * the relative ordering of elements in each group, use
+ * @p stable_partition() if this is needed.
+ */
+ template<typename _ForwardIterator, typename _Predicate>
+ inline _ForwardIterator
+ partition(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return std::__partition(__first, __last, __pred,
+ std::__iterator_category(__first));
+ }
+
+
+
+ /**
+ * @brief Sort the smallest elements of a sequence.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param middle Another iterator.
+ * @param last Another iterator.
+ * @return Nothing.
+ *
+ * Sorts the smallest @p (middle-first) elements in the range
+ * @p [first,last) and moves them to the range @p [first,middle). The
+ * order of the remaining elements in the range @p [middle,last) is
+ * undefined.
+ * After the sort if @p i and @j are iterators in the range
+ * @p [first,middle) such that @i precedes @j and @k is an iterator in
+ * the range @p [middle,last) then @p *j<*i and @p *k<*i are both false.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ partial_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __middle);
+ __glibcxx_requires_valid_range(__middle, __last);
+
+ std::__heap_select(__first, __middle, __last);
+ std::sort_heap(__first, __middle);
+ }
+
+ /**
+ * @brief Sort the smallest elements of a sequence using a predicate
+ * for comparison.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param middle Another iterator.
+ * @param last Another iterator.
+ * @param comp A comparison functor.
+ * @return Nothing.
+ *
+ * Sorts the smallest @p (middle-first) elements in the range
+ * @p [first,last) and moves them to the range @p [first,middle). The
+ * order of the remaining elements in the range @p [middle,last) is
+ * undefined.
+ * After the sort if @p i and @j are iterators in the range
+ * @p [first,middle) such that @i precedes @j and @k is an iterator in
+ * the range @p [middle,last) then @p *comp(j,*i) and @p comp(*k,*i)
+ * are both false.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ partial_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType, _ValueType>)
+ __glibcxx_requires_valid_range(__first, __middle);
+ __glibcxx_requires_valid_range(__middle, __last);
+
+ std::__heap_select(__first, __middle, __last, __CheckedCompare(__comp));
+ std::sort_heap(__first, __middle, __CheckedCompare(__comp));
+ }
+
+ /**
+ * @brief Sort a sequence just enough to find a particular position.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param nth Another iterator.
+ * @param last Another iterator.
+ * @return Nothing.
+ *
+ * Rearranges the elements in the range @p [first,last) so that @p *nth
+ * is the same element that would have been in that position had the
+ * whole sequence been sorted.
+ * whole sequence been sorted. The elements either side of @p *nth are
+ * not completely sorted, but for any iterator @i in the range
+ * @p [first,nth) and any iterator @j in the range @p [nth,last) it
+ * holds that @p *j<*i is false.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,
+ _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __nth);
+ __glibcxx_requires_valid_range(__nth, __last);
+
+ if (__first == __last || __nth == __last)
+ return;
+
+ std::__introselect(__first, __nth, __last,
+ std::__lg(__last - __first) * 2);
+ }
+
+ /**
+ * @brief Sort a sequence just enough to find a particular position
+ * using a predicate for comparison.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param nth Another iterator.
+ * @param last Another iterator.
+ * @param comp A comparison functor.
+ * @return Nothing.
+ *
+ * Rearranges the elements in the range @p [first,last) so that @p *nth
+ * is the same element that would have been in that position had the
+ * whole sequence been sorted. The elements either side of @p *nth are
+ * not completely sorted, but for any iterator @i in the range
+ * @p [first,nth) and any iterator @j in the range @p [nth,last) it
+ * holds that @p comp(*j,*i) is false.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType, _ValueType>)
+ __glibcxx_requires_valid_range(__first, __nth);
+ __glibcxx_requires_valid_range(__nth, __last);
+
+ if (__first == __last || __nth == __last)
+ return;
+
+ std::__introselect(__first, __nth, __last,
+ std::__lg(__last - __first) * 2,
+ __CheckedCompare(__comp));
+ }
+
+
+ /**
+ * @brief Sort the elements of a sequence.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @return Nothing.
+ *
+ * Sorts the elements in the range @p [first,last) in ascending order,
+ * such that @p *(i+1)<*i is false for each iterator @p i in the range
+ * @p [first,last-1).
+ *
+ * The relative ordering of equivalent elements is not preserved, use
+ * @p stable_sort() if this is needed.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first != __last)
+ {
+ std::__introsort_loop(__first, __last,
+ std::__lg(__last - __first) * 2);
+ std::__final_insertion_sort(__first, __last);
+ }
+ }
+
+ /**
+ * @brief Sort the elements of a sequence using a predicate for comparison.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param comp A comparison functor.
+ * @return Nothing.
+ *
+ * Sorts the elements in the range @p [first,last) in ascending order,
+ * such that @p comp(*(i+1),*i) is false for every iterator @p i in the
+ * range @p [first,last-1).
+ *
+ * The relative ordering of equivalent elements is not preserved, use
+ * @p stable_sort() if this is needed.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType,
+ _ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first != __last)
+ {
+ std::__introsort_loop(__first, __last,
+ std::__lg(__last - __first) * 2,
+ __CheckedCompare(__comp));
+ std::__final_insertion_sort(__first, __last,
+ __CheckedCompare(__comp));
+ }
+ }
+
+ /**
+ * @brief Merges two sorted ranges.
+ * @ingroup sorting_algorithms
+ * @param first1 An iterator.
+ * @param first2 Another iterator.
+ * @param last1 Another iterator.
+ * @param last2 Another iterator.
+ * @param result An iterator pointing to the end of the merged range.
+ * @return An iterator pointing to the first element "not less
+ * than" @a val.
+ *
+ * Merges the ranges [first1,last1) and [first2,last2) into the sorted range
+ * [result, result + (last1-first1) + (last2-first2)). Both input ranges
+ * must be sorted, and the output range must not overlap with either of
+ * the input ranges. The sort is @e stable, that is, for equivalent
+ * elements in the two ranges, elements from the first range will always
+ * come before elements from the second.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator>
+ _OutputIterator
+ merge(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set(__first1, __last1, __first2);
+ __glibcxx_requires_sorted_set(__first2, __last2, __first1);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (*__first2 < *__first1)
+ {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return std::copy(__first2, __last2, std::copy(__first1, __last1,
+ __result));
+ }
+
+ /**
+ * @brief Merges two sorted ranges.
+ * @ingroup sorting_algorithms
+ * @param first1 An iterator.
+ * @param first2 Another iterator.
+ * @param last1 Another iterator.
+ * @param last2 Another iterator.
+ * @param result An iterator pointing to the end of the merged range.
+ * @param comp A functor to use for comparisons.
+ * @return An iterator pointing to the first element "not less
+ * than" @a val.
+ *
+ * Merges the ranges [first1,last1) and [first2,last2) into the sorted range
+ * [result, result + (last1-first1) + (last2-first2)). Both input ranges
+ * must be sorted, and the output range must not overlap with either of
+ * the input ranges. The sort is @e stable, that is, for equivalent
+ * elements in the two ranges, elements from the first range will always
+ * come before elements from the second.
+ *
+ * The comparison function should have the same effects on ordering as
+ * the function used for the initial sort.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _Compare>
+ _OutputIterator
+ merge(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
+ __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (__CheckedCompare(__comp)(*__first2, *__first1))
+ {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
+ }
+ return std::copy(__first2, __last2, std::copy(__first1, __last1,
+ __result));
+ }
+
+
+ /**
+ * @brief Sort the elements of a sequence, preserving the relative order
+ * of equivalent elements.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @return Nothing.
+ *
+ * Sorts the elements in the range @p [first,last) in ascending order,
+ * such that @p *(i+1)<*i is false for each iterator @p i in the range
+ * @p [first,last-1).
+ *
+ * The relative ordering of equivalent elements is preserved, so any two
+ * elements @p x and @p y in the range @p [first,last) such that
+ * @p x<y is false and @p y<x is false will have the same relative
+ * ordering after calling @p stable_sort().
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first,
+ __last);
+ if (__buf.begin() == 0)
+ std::__inplace_stable_sort(__first, __last);
+ else
+ std::__stable_sort_adaptive(__first, __last, __buf.begin(),
+ _DistanceType(__buf.size()));
+ }
+
+ /**
+ * @brief Sort the elements of a sequence using a predicate for comparison,
+ * preserving the relative order of equivalent elements.
+ * @ingroup sorting_algorithms
+ * @param first An iterator.
+ * @param last Another iterator.
+ * @param comp A comparison functor.
+ * @return Nothing.
+ *
+ * Sorts the elements in the range @p [first,last) in ascending order,
+ * such that @p comp(*(i+1),*i) is false for each iterator @p i in the
+ * range @p [first,last-1).
+ *
+ * The relative ordering of equivalent elements is preserved, so any two
+ * elements @p x and @p y in the range @p [first,last) such that
+ * @p comp(x,y) is false and @p comp(y,x) is false will have the same
+ * relative ordering after calling @p stable_sort().
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType,
+ _ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first,
+ __last);
+ if (__buf.begin() == 0)
+ std::__inplace_stable_sort(__first, __last, __CheckedCompare(__comp));
+ else
+ std::__stable_sort_adaptive(__first, __last, __buf.begin(),
+ _DistanceType(__buf.size()),
+ __CheckedCompare(__comp));
+ }
+
+
+ /**
+ * @brief Return the union of two sorted ranges.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * each range in order to the output range. Iterators increment for each
+ * range. When the current element of one range is less than the other,
+ * that element is copied and the iterator advanced. If an element is
+ * contained in both ranges, the element from the first range is copied and
+ * both ranges advance. The output range may not overlap either input
+ * range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator>
+ _OutputIterator
+ set_union(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set(__first1, __last1, __first2);
+ __glibcxx_requires_sorted_set(__first2, __last2, __first1);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (*__first1 < *__first2)
+ {
+ *__result = *__first1;
+ ++__first1;
+ }
+ else if (*__first2 < *__first1)
+ {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ }
+ ++__result;
+ }
+ return std::copy(__first2, __last2, std::copy(__first1, __last1,
+ __result));
+ }
+
+ /**
+ * @brief Return the union of two sorted ranges using a comparison functor.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @param comp The comparison functor.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * each range in order to the output range. Iterators increment for each
+ * range. When the current element of one range is less than the other
+ * according to @a comp, that element is copied and the iterator advanced.
+ * If an equivalent element according to @a comp is contained in both
+ * ranges, the element from the first range is copied and both ranges
+ * advance. The output range may not overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _Compare>
+ _OutputIterator
+ set_union(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
+ __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (__CheckedCompare(__comp)(*__first1, *__first2))
+ {
+ *__result = *__first1;
+ ++__first1;
+ }
+ else if (__CheckedCompare(__comp)(*__first2, *__first1))
+ {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ }
+ ++__result;
+ }
+ return std::copy(__first2, __last2, std::copy(__first1, __last1,
+ __result));
+ }
+
+ /**
+ * @brief Return the intersection of two sorted ranges.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * both ranges in order to the output range. Iterators increment for each
+ * range. When the current element of one range is less than the other,
+ * that iterator advances. If an element is contained in both ranges, the
+ * element from the first range is copied and both ranges advance. The
+ * output range may not overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator>
+ _OutputIterator
+ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set(__first1, __last1, __first2);
+ __glibcxx_requires_sorted_set(__first2, __last2, __first1);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first1 < *__first2)
+ ++__first1;
+ else if (*__first2 < *__first1)
+ ++__first2;
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ ++__result;
+ }
+ return __result;
+ }
+
+ /**
+ * @brief Return the intersection of two sorted ranges using comparison
+ * functor.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @param comp The comparison functor.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * both ranges in order to the output range. Iterators increment for each
+ * range. When the current element of one range is less than the other
+ * according to @a comp, that iterator advances. If an element is
+ * contained in both ranges according to @a comp, the element from the
+ * first range is copied and both ranges advance. The output range may not
+ * overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _Compare>
+ _OutputIterator
+ set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
+ __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__CheckedCompare(__comp)(*__first1, *__first2))
+ ++__first1;
+ else if (__CheckedCompare(__comp)(*__first2, *__first1))
+ ++__first2;
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ ++__result;
+ }
+ return __result;
+ }
+
+ /**
+ * @brief Return the difference of two sorted ranges.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * the first range but not the second in order to the output range.
+ * Iterators increment for each range. When the current element of the
+ * first range is less than the second, that element is copied and the
+ * iterator advances. If the current element of the second range is less,
+ * the iterator advances, but no element is copied. If an element is
+ * contained in both ranges, no elements are copied and both ranges
+ * advance. The output range may not overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator>
+ _OutputIterator
+ set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set(__first1, __last1, __first2);
+ __glibcxx_requires_sorted_set(__first2, __last2, __first1);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first1 < *__first2)
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (*__first2 < *__first1)
+ ++__first2;
+ else
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return std::copy(__first1, __last1, __result);
+ }
+
+ /**
+ * @brief Return the difference of two sorted ranges using comparison
+ * functor.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @param comp The comparison functor.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * the first range but not the second in order to the output range.
+ * Iterators increment for each range. When the current element of the
+ * first range is less than the second according to @a comp, that element
+ * is copied and the iterator advances. If the current element of the
+ * second range is less, no element is copied and the iterator advances.
+ * If an element is contained in both ranges according to @a comp, no
+ * elements are copied and both ranges advance. The output range may not
+ * overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _Compare>
+ _OutputIterator
+ set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
+ __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__CheckedCompare(__comp)(*__first1, *__first2))
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__CheckedCompare(__comp)(*__first2, *__first1))
+ ++__first2;
+ else
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return std::copy(__first1, __last1, __result);
+ }
+
+ /**
+ * @brief Return the symmetric difference of two sorted ranges.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * one range but not the other in order to the output range. Iterators
+ * increment for each range. When the current element of one range is less
+ * than the other, that element is copied and the iterator advances. If an
+ * element is contained in both ranges, no elements are copied and both
+ * ranges advance. The output range may not overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator>
+ _OutputIterator
+ set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set(__first1, __last1, __first2);
+ __glibcxx_requires_sorted_set(__first2, __last2, __first1);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (*__first1 < *__first2)
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (*__first2 < *__first1)
+ {
+ *__result = *__first2;
+ ++__first2;
+ ++__result;
+ }
+ else
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return std::copy(__first2, __last2, std::copy(__first1,
+ __last1, __result));
+ }
+
+ /**
+ * @brief Return the symmetric difference of two sorted ranges using
+ * comparison functor.
+ * @ingroup set_algorithms
+ * @param first1 Start of first range.
+ * @param last1 End of first range.
+ * @param first2 Start of second range.
+ * @param last2 End of second range.
+ * @param comp The comparison functor.
+ * @return End of the output range.
+ * @ingroup set_algorithms
+ *
+ * This operation iterates over both ranges, copying elements present in
+ * one range but not the other in order to the output range. Iterators
+ * increment for each range. When the current element of one range is less
+ * than the other according to @a comp, that element is copied and the
+ * iterator advances. If an element is contained in both ranges according
+ * to @a comp, no elements are copied and both ranges advance. The output
+ * range may not overlap either input range.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _Compare>
+ _OutputIterator
+ set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType1>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ _ValueType2, _ValueType1>)
+ __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
+ __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__CheckedCompare(__comp)(*__first1, *__first2))
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__CheckedCompare(__comp)(*__first2, *__first1))
+ {
+ *__result = *__first2;
+ ++__first2;
+ ++__result;
+ }
+ else
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return std::copy(__first2, __last2,
+ std::copy(__first1, __last1, __result));
+ }
+
+
+ /**
+ * @brief Return the minimum element in a range.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @return Iterator referencing the first instance of the smallest value.
+ */
+ template<typename _ForwardIterator>
+ _ForwardIterator
+ min_element(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ while (++__first != __last)
+ if (*__first < *__result)
+ __result = __first;
+ return __result;
+ }
+
+ /**
+ * @brief Return the minimum element in a range using comparison functor.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp Comparison functor.
+ * @return Iterator referencing the first instance of the smallest value
+ * according to comp.
+ */
+ template<typename _ForwardIterator, typename _Compare>
+ _ForwardIterator
+ min_element(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ while (++__first != __last)
+ if (__CheckedCompare(__comp)(*__first, *__result))
+ __result = __first;
+ return __result;
+ }
+
+ /**
+ * @brief Return the maximum element in a range.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @return Iterator referencing the first instance of the largest value.
+ */
+ template<typename _ForwardIterator>
+ _ForwardIterator
+ max_element(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ while (++__first != __last)
+ if (*__result < *__first)
+ __result = __first;
+ return __result;
+ }
+
+ /**
+ * @brief Return the maximum element in a range using comparison functor.
+ * @ingroup sorting_algorithms
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp Comparison functor.
+ * @return Iterator referencing the first instance of the largest value
+ * according to comp.
+ */
+ template<typename _ForwardIterator, typename _Compare>
+ _ForwardIterator
+ max_element(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last) return __first;
+ _ForwardIterator __result = __first;
+ while (++__first != __last)
+ if (__CheckedCompare(__comp)(*__result, *__first))
+ __result = __first;
+ return __result;
+ }
+
+#undef __CheckedCompare
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_ALGO_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_algobase.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_algobase.h
new file mode 100644
index 000000000..2cef9237d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_algobase.h
@@ -0,0 +1,1153 @@
+// Core algorithmic facilities -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_algobase.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_ALGOBASE_H
+#define _STL_ALGOBASE_H 1
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <bits/functexcept.h>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+#include <ext/numeric_traits.h>
+#include <bits/stl_pair.h>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/stl_iterator.h>
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+#include <bits/move.h> // For std::swap and _GLIBCXX_MOVE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a
+ // nutshell, we are partially implementing the resolution of DR 187,
+ // when it's safe, i.e., the value_types are equal.
+ template<bool _BoolType>
+ struct __iter_swap
+ {
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ static void
+ iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
+ {
+ typedef typename iterator_traits<_ForwardIterator1>::value_type
+ _ValueType1;
+ _ValueType1 __tmp = _GLIBCXX_MOVE(*__a);
+ *__a = _GLIBCXX_MOVE(*__b);
+ *__b = _GLIBCXX_MOVE(__tmp);
+ }
+ };
+
+ template<>
+ struct __iter_swap<true>
+ {
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ static void
+ iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
+ {
+ swap(*__a, *__b);
+ }
+ };
+
+ /**
+ * @brief Swaps the contents of two iterators.
+ * @ingroup mutating_algorithms
+ * @param a An iterator.
+ * @param b Another iterator.
+ * @return Nothing.
+ *
+ * This function swaps the values pointed to by two iterators, not the
+ * iterators themselves.
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ inline void
+ iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
+ {
+ typedef typename iterator_traits<_ForwardIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_ForwardIterator2>::value_type
+ _ValueType2;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator1>)
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator2>)
+ __glibcxx_function_requires(_ConvertibleConcept<_ValueType1,
+ _ValueType2>)
+ __glibcxx_function_requires(_ConvertibleConcept<_ValueType2,
+ _ValueType1>)
+
+ typedef typename iterator_traits<_ForwardIterator1>::reference
+ _ReferenceType1;
+ typedef typename iterator_traits<_ForwardIterator2>::reference
+ _ReferenceType2;
+ std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value
+ && __are_same<_ValueType1&, _ReferenceType1>::__value
+ && __are_same<_ValueType2&, _ReferenceType2>::__value>::
+ iter_swap(__a, __b);
+ }
+
+ /**
+ * @brief Swap the elements of two sequences.
+ * @ingroup mutating_algorithms
+ * @param first1 A forward iterator.
+ * @param last1 A forward iterator.
+ * @param first2 A forward iterator.
+ * @return An iterator equal to @p first2+(last1-first1).
+ *
+ * Swaps each element in the range @p [first1,last1) with the
+ * corresponding element in the range @p [first2,(last1-first1)).
+ * The ranges must not overlap.
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ _ForwardIterator2
+ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator1>)
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator2>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ for (; __first1 != __last1; ++__first1, ++__first2)
+ std::iter_swap(__first1, __first2);
+ return __first2;
+ }
+
+ /**
+ * @brief This does what you think it does.
+ * @ingroup sorting_algorithms
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @return The lesser of the parameters.
+ *
+ * This is the simple classic generic implementation. It will work on
+ * temporary expressions, since they are only evaluated once, unlike a
+ * preprocessor macro.
+ */
+ template<typename _Tp>
+ inline const _Tp&
+ min(const _Tp& __a, const _Tp& __b)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
+ //return __b < __a ? __b : __a;
+ if (__b < __a)
+ return __b;
+ return __a;
+ }
+
+ /**
+ * @brief This does what you think it does.
+ * @ingroup sorting_algorithms
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @return The greater of the parameters.
+ *
+ * This is the simple classic generic implementation. It will work on
+ * temporary expressions, since they are only evaluated once, unlike a
+ * preprocessor macro.
+ */
+ template<typename _Tp>
+ inline const _Tp&
+ max(const _Tp& __a, const _Tp& __b)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
+ //return __a < __b ? __b : __a;
+ if (__a < __b)
+ return __b;
+ return __a;
+ }
+
+ /**
+ * @brief This does what you think it does.
+ * @ingroup sorting_algorithms
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @param comp A @link comparison_functors comparison functor@endlink.
+ * @return The lesser of the parameters.
+ *
+ * This will work on temporary expressions, since they are only evaluated
+ * once, unlike a preprocessor macro.
+ */
+ template<typename _Tp, typename _Compare>
+ inline const _Tp&
+ min(const _Tp& __a, const _Tp& __b, _Compare __comp)
+ {
+ //return __comp(__b, __a) ? __b : __a;
+ if (__comp(__b, __a))
+ return __b;
+ return __a;
+ }
+
+ /**
+ * @brief This does what you think it does.
+ * @ingroup sorting_algorithms
+ * @param a A thing of arbitrary type.
+ * @param b Another thing of arbitrary type.
+ * @param comp A @link comparison_functors comparison functor@endlink.
+ * @return The greater of the parameters.
+ *
+ * This will work on temporary expressions, since they are only evaluated
+ * once, unlike a preprocessor macro.
+ */
+ template<typename _Tp, typename _Compare>
+ inline const _Tp&
+ max(const _Tp& __a, const _Tp& __b, _Compare __comp)
+ {
+ //return __comp(__a, __b) ? __b : __a;
+ if (__comp(__a, __b))
+ return __b;
+ return __a;
+ }
+
+
+ // If _Iterator is a __normal_iterator return its base (a plain pointer,
+ // normally) otherwise return it untouched. See copy, fill, ...
+ template<typename _Iterator,
+ bool _IsNormal = __is_normal_iterator<_Iterator>::__value>
+ struct __niter_base
+ {
+ static _Iterator
+ __b(_Iterator __it)
+ { return __it; }
+ };
+
+ template<typename _Iterator>
+ struct __niter_base<_Iterator, true>
+ {
+ static typename _Iterator::iterator_type
+ __b(_Iterator __it)
+ { return __it.base(); }
+ };
+
+ // Likewise, for move_iterator.
+ template<typename _Iterator,
+ bool _IsMove = __is_move_iterator<_Iterator>::__value>
+ struct __miter_base
+ {
+ static _Iterator
+ __b(_Iterator __it)
+ { return __it; }
+ };
+
+ template<typename _Iterator>
+ struct __miter_base<_Iterator, true>
+ {
+ static typename _Iterator::iterator_type
+ __b(_Iterator __it)
+ { return __it.base(); }
+ };
+
+ // All of these auxiliary structs serve two purposes. (1) Replace
+ // calls to copy with memmove whenever possible. (Memmove, not memcpy,
+ // because the input and output ranges are permitted to overlap.)
+ // (2) If we're using random access iterators, then write the loop as
+ // a for loop with an explicit count.
+
+ template<bool, bool, typename>
+ struct __copy_move
+ {
+ template<typename _II, typename _OI>
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
+ for (; __first != __last; ++__result, ++__first)
+ *__result = *__first;
+ return __result;
+ }
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Category>
+ struct __copy_move<true, false, _Category>
+ {
+ template<typename _II, typename _OI>
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
+ for (; __first != __last; ++__result, ++__first)
+ *__result = std::move(*__first);
+ return __result;
+ }
+ };
+#endif
+
+ template<>
+ struct __copy_move<false, false, random_access_iterator_tag>
+ {
+ template<typename _II, typename _OI>
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
+ typedef typename iterator_traits<_II>::difference_type _Distance;
+ for(_Distance __n = __last - __first; __n > 0; --__n)
+ {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return __result;
+ }
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<>
+ struct __copy_move<true, false, random_access_iterator_tag>
+ {
+ template<typename _II, typename _OI>
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
+ typedef typename iterator_traits<_II>::difference_type _Distance;
+ for(_Distance __n = __last - __first; __n > 0; --__n)
+ {
+ *__result = std::move(*__first);
+ ++__first;
+ ++__result;
+ }
+ return __result;
+ }
+ };
+#endif
+
+ template<bool _IsMove>
+ struct __copy_move<_IsMove, true, random_access_iterator_tag>
+ {
+ template<typename _Tp>
+ static _Tp*
+ __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
+ {
+ __builtin_memmove(__result, __first,
+ sizeof(_Tp) * (__last - __first));
+ return __result + (__last - __first);
+ }
+ };
+
+ template<bool _IsMove, typename _II, typename _OI>
+ inline _OI
+ __copy_move_a(_II __first, _II __last, _OI __result)
+ {
+ typedef typename iterator_traits<_II>::value_type _ValueTypeI;
+ typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
+ typedef typename iterator_traits<_II>::iterator_category _Category;
+ const bool __simple = (__is_pod(_ValueTypeI)
+ && __is_pointer<_II>::__value
+ && __is_pointer<_OI>::__value
+ && __are_same<_ValueTypeI, _ValueTypeO>::__value);
+
+ return std::__copy_move<_IsMove, __simple,
+ _Category>::__copy_m(__first, __last, __result);
+ }
+
+ // Helpers for streambuf iterators (either istream or ostream).
+ // NB: avoid including <iosfwd>, relatively large.
+ template<typename _CharT>
+ struct char_traits;
+
+ template<typename _CharT, typename _Traits>
+ class istreambuf_iterator;
+
+ template<typename _CharT, typename _Traits>
+ class ostreambuf_iterator;
+
+ template<bool _IsMove, typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
+ __copy_move_a2(_CharT*, _CharT*,
+ ostreambuf_iterator<_CharT, char_traits<_CharT> >);
+
+ template<bool _IsMove, typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
+ __copy_move_a2(const _CharT*, const _CharT*,
+ ostreambuf_iterator<_CharT, char_traits<_CharT> >);
+
+ template<bool _IsMove, typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ _CharT*>::__type
+ __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >,
+ istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*);
+
+ template<bool _IsMove, typename _II, typename _OI>
+ inline _OI
+ __copy_move_a2(_II __first, _II __last, _OI __result)
+ {
+ return _OI(std::__copy_move_a<_IsMove>
+ (std::__niter_base<_II>::__b(__first),
+ std::__niter_base<_II>::__b(__last),
+ std::__niter_base<_OI>::__b(__result)));
+ }
+
+ /**
+ * @brief Copies the range [first,last) into result.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @return result + (first - last)
+ *
+ * This inline function will boil down to a call to @c memmove whenever
+ * possible. Failing that, if random access iterators are passed, then the
+ * loop count will be known (and therefore a candidate for compiler
+ * optimizations such as unrolling). Result may not be contained within
+ * [first,last); the copy_backward function should be used instead.
+ *
+ * Note that the end of the output range is permitted to be contained
+ * within [first,last).
+ */
+ template<typename _II, typename _OI>
+ inline _OI
+ copy(_II __first, _II __last, _OI __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_II>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OI,
+ typename iterator_traits<_II>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
+ (std::__miter_base<_II>::__b(__first),
+ std::__miter_base<_II>::__b(__last), __result));
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Moves the range [first,last) into result.
+ * @ingroup mutating_algorithms
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @return result + (first - last)
+ *
+ * This inline function will boil down to a call to @c memmove whenever
+ * possible. Failing that, if random access iterators are passed, then the
+ * loop count will be known (and therefore a candidate for compiler
+ * optimizations such as unrolling). Result may not be contained within
+ * [first,last); the move_backward function should be used instead.
+ *
+ * Note that the end of the output range is permitted to be contained
+ * within [first,last).
+ */
+ template<typename _II, typename _OI>
+ inline _OI
+ move(_II __first, _II __last, _OI __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_II>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OI,
+ typename iterator_traits<_II>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return (std::__copy_move_a2<true>
+ (std::__miter_base<_II>::__b(__first),
+ std::__miter_base<_II>::__b(__last), __result));
+ }
+
+#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp)
+#else
+#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp)
+#endif
+
+ template<bool, bool, typename>
+ struct __copy_move_backward
+ {
+ template<typename _BI1, typename _BI2>
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ while (__first != __last)
+ *--__result = *--__last;
+ return __result;
+ }
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Category>
+ struct __copy_move_backward<true, false, _Category>
+ {
+ template<typename _BI1, typename _BI2>
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ while (__first != __last)
+ *--__result = std::move(*--__last);
+ return __result;
+ }
+ };
+#endif
+
+ template<>
+ struct __copy_move_backward<false, false, random_access_iterator_tag>
+ {
+ template<typename _BI1, typename _BI2>
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ typename iterator_traits<_BI1>::difference_type __n;
+ for (__n = __last - __first; __n > 0; --__n)
+ *--__result = *--__last;
+ return __result;
+ }
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<>
+ struct __copy_move_backward<true, false, random_access_iterator_tag>
+ {
+ template<typename _BI1, typename _BI2>
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ typename iterator_traits<_BI1>::difference_type __n;
+ for (__n = __last - __first; __n > 0; --__n)
+ *--__result = std::move(*--__last);
+ return __result;
+ }
+ };
+#endif
+
+ template<bool _IsMove>
+ struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
+ {
+ template<typename _Tp>
+ static _Tp*
+ __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
+ {
+ const ptrdiff_t _Num = __last - __first;
+ __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
+ return __result - _Num;
+ }
+ };
+
+ template<bool _IsMove, typename _BI1, typename _BI2>
+ inline _BI2
+ __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ typedef typename iterator_traits<_BI1>::value_type _ValueType1;
+ typedef typename iterator_traits<_BI2>::value_type _ValueType2;
+ typedef typename iterator_traits<_BI1>::iterator_category _Category;
+ const bool __simple = (__is_pod(_ValueType1)
+ && __is_pointer<_BI1>::__value
+ && __is_pointer<_BI2>::__value
+ && __are_same<_ValueType1, _ValueType2>::__value);
+
+ return std::__copy_move_backward<_IsMove, __simple,
+ _Category>::__copy_move_b(__first,
+ __last,
+ __result);
+ }
+
+ template<bool _IsMove, typename _BI1, typename _BI2>
+ inline _BI2
+ __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ return _BI2(std::__copy_move_backward_a<_IsMove>
+ (std::__niter_base<_BI1>::__b(__first),
+ std::__niter_base<_BI1>::__b(__last),
+ std::__niter_base<_BI2>::__b(__result)));
+ }
+
+ /**
+ * @brief Copies the range [first,last) into result.
+ * @ingroup mutating_algorithms
+ * @param first A bidirectional iterator.
+ * @param last A bidirectional iterator.
+ * @param result A bidirectional iterator.
+ * @return result - (first - last)
+ *
+ * The function has the same effect as copy, but starts at the end of the
+ * range and works its way to the start, returning the start of the result.
+ * This inline function will boil down to a call to @c memmove whenever
+ * possible. Failing that, if random access iterators are passed, then the
+ * loop count will be known (and therefore a candidate for compiler
+ * optimizations such as unrolling).
+ *
+ * Result may not be in the range [first,last). Use copy instead. Note
+ * that the start of the output range may overlap [first,last).
+ */
+ template<typename _BI1, typename _BI2>
+ inline _BI2
+ copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
+ __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
+ __glibcxx_function_requires(_ConvertibleConcept<
+ typename iterator_traits<_BI1>::value_type,
+ typename iterator_traits<_BI2>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value>
+ (std::__miter_base<_BI1>::__b(__first),
+ std::__miter_base<_BI1>::__b(__last), __result));
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Moves the range [first,last) into result.
+ * @ingroup mutating_algorithms
+ * @param first A bidirectional iterator.
+ * @param last A bidirectional iterator.
+ * @param result A bidirectional iterator.
+ * @return result - (first - last)
+ *
+ * The function has the same effect as move, but starts at the end of the
+ * range and works its way to the start, returning the start of the result.
+ * This inline function will boil down to a call to @c memmove whenever
+ * possible. Failing that, if random access iterators are passed, then the
+ * loop count will be known (and therefore a candidate for compiler
+ * optimizations such as unrolling).
+ *
+ * Result may not be in the range [first,last). Use move instead. Note
+ * that the start of the output range may overlap [first,last).
+ */
+ template<typename _BI1, typename _BI2>
+ inline _BI2
+ move_backward(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)
+ __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)
+ __glibcxx_function_requires(_ConvertibleConcept<
+ typename iterator_traits<_BI1>::value_type,
+ typename iterator_traits<_BI2>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return (std::__copy_move_backward_a2<true>
+ (std::__miter_base<_BI1>::__b(__first),
+ std::__miter_base<_BI1>::__b(__last), __result));
+ }
+
+#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp)
+#else
+#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp)
+#endif
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline typename
+ __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, void>::__type
+ __fill_a(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __value)
+ {
+ for (; __first != __last; ++__first)
+ *__first = __value;
+ }
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline typename
+ __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type
+ __fill_a(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __value)
+ {
+ const _Tp __tmp = __value;
+ for (; __first != __last; ++__first)
+ *__first = __tmp;
+ }
+
+ // Specialization: for char types we can use memset.
+ template<typename _Tp>
+ inline typename
+ __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type
+ __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c)
+ {
+ const _Tp __tmp = __c;
+ __builtin_memset(__first, static_cast<unsigned char>(__tmp),
+ __last - __first);
+ }
+
+ /**
+ * @brief Fills the range [first,last) with copies of value.
+ * @ingroup mutating_algorithms
+ * @param first A forward iterator.
+ * @param last A forward iterator.
+ * @param value A reference-to-const of arbitrary type.
+ * @return Nothing.
+ *
+ * This function fills a range with copies of the same value. For char
+ * types filling contiguous areas of memory, this becomes an inline call
+ * to @c memset or @c wmemset.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ std::__fill_a(std::__niter_base<_ForwardIterator>::__b(__first),
+ std::__niter_base<_ForwardIterator>::__b(__last), __value);
+ }
+
+ template<typename _OutputIterator, typename _Size, typename _Tp>
+ inline typename
+ __gnu_cxx::__enable_if<!__is_scalar<_Tp>::__value, _OutputIterator>::__type
+ __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
+ {
+ for (; __n > 0; --__n, ++__first)
+ *__first = __value;
+ return __first;
+ }
+
+ template<typename _OutputIterator, typename _Size, typename _Tp>
+ inline typename
+ __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type
+ __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value)
+ {
+ const _Tp __tmp = __value;
+ for (; __n > 0; --__n, ++__first)
+ *__first = __tmp;
+ return __first;
+ }
+
+ template<typename _Size, typename _Tp>
+ inline typename
+ __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type
+ __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c)
+ {
+ std::__fill_a(__first, __first + __n, __c);
+ return __first + __n;
+ }
+
+ /**
+ * @brief Fills the range [first,first+n) with copies of value.
+ * @ingroup mutating_algorithms
+ * @param first An output iterator.
+ * @param n The count of copies to perform.
+ * @param value A reference-to-const of arbitrary type.
+ * @return The iterator at first+n.
+ *
+ * This function fills a range with copies of the same value. For char
+ * types filling contiguous areas of memory, this becomes an inline call
+ * to @c memset or @ wmemset.
+ */
+ template<typename _OI, typename _Size, typename _Tp>
+ inline _OI
+ fill_n(_OI __first, _Size __n, const _Tp& __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>)
+
+ return _OI(std::__fill_n_a(std::__niter_base<_OI>::__b(__first),
+ __n, __value));
+ }
+
+ template<bool _BoolType>
+ struct __equal
+ {
+ template<typename _II1, typename _II2>
+ static bool
+ equal(_II1 __first1, _II1 __last1, _II2 __first2)
+ {
+ for (; __first1 != __last1; ++__first1, ++__first2)
+ if (!(*__first1 == *__first2))
+ return false;
+ return true;
+ }
+ };
+
+ template<>
+ struct __equal<true>
+ {
+ template<typename _Tp>
+ static bool
+ equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
+ {
+ return !__builtin_memcmp(__first1, __first2, sizeof(_Tp)
+ * (__last1 - __first1));
+ }
+ };
+
+ template<typename _II1, typename _II2>
+ inline bool
+ __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2)
+ {
+ typedef typename iterator_traits<_II1>::value_type _ValueType1;
+ typedef typename iterator_traits<_II2>::value_type _ValueType2;
+ const bool __simple = (__is_integer<_ValueType1>::__value
+ && __is_pointer<_II1>::__value
+ && __is_pointer<_II2>::__value
+ && __are_same<_ValueType1, _ValueType2>::__value);
+
+ return std::__equal<__simple>::equal(__first1, __last1, __first2);
+ }
+
+
+ template<typename, typename>
+ struct __lc_rai
+ {
+ template<typename _II1, typename _II2>
+ static _II1
+ __newlast1(_II1, _II1 __last1, _II2, _II2)
+ { return __last1; }
+
+ template<typename _II>
+ static bool
+ __cnd2(_II __first, _II __last)
+ { return __first != __last; }
+ };
+
+ template<>
+ struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
+ {
+ template<typename _RAI1, typename _RAI2>
+ static _RAI1
+ __newlast1(_RAI1 __first1, _RAI1 __last1,
+ _RAI2 __first2, _RAI2 __last2)
+ {
+ const typename iterator_traits<_RAI1>::difference_type
+ __diff1 = __last1 - __first1;
+ const typename iterator_traits<_RAI2>::difference_type
+ __diff2 = __last2 - __first2;
+ return __diff2 < __diff1 ? __first1 + __diff2 : __last1;
+ }
+
+ template<typename _RAI>
+ static bool
+ __cnd2(_RAI, _RAI)
+ { return true; }
+ };
+
+ template<bool _BoolType>
+ struct __lexicographical_compare
+ {
+ template<typename _II1, typename _II2>
+ static bool __lc(_II1, _II1, _II2, _II2);
+ };
+
+ template<bool _BoolType>
+ template<typename _II1, typename _II2>
+ bool
+ __lexicographical_compare<_BoolType>::
+ __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
+ {
+ typedef typename iterator_traits<_II1>::iterator_category _Category1;
+ typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef std::__lc_rai<_Category1, _Category2> __rai_type;
+
+ __last1 = __rai_type::__newlast1(__first1, __last1,
+ __first2, __last2);
+ for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
+ ++__first1, ++__first2)
+ {
+ if (*__first1 < *__first2)
+ return true;
+ if (*__first2 < *__first1)
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+ }
+
+ template<>
+ struct __lexicographical_compare<true>
+ {
+ template<typename _Tp, typename _Up>
+ static bool
+ __lc(const _Tp* __first1, const _Tp* __last1,
+ const _Up* __first2, const _Up* __last2)
+ {
+ const size_t __len1 = __last1 - __first1;
+ const size_t __len2 = __last2 - __first2;
+ const int __result = __builtin_memcmp(__first1, __first2,
+ std::min(__len1, __len2));
+ return __result != 0 ? __result < 0 : __len1 < __len2;
+ }
+ };
+
+ template<typename _II1, typename _II2>
+ inline bool
+ __lexicographical_compare_aux(_II1 __first1, _II1 __last1,
+ _II2 __first2, _II2 __last2)
+ {
+ typedef typename iterator_traits<_II1>::value_type _ValueType1;
+ typedef typename iterator_traits<_II2>::value_type _ValueType2;
+ const bool __simple =
+ (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value
+ && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed
+ && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed
+ && __is_pointer<_II1>::__value
+ && __is_pointer<_II2>::__value);
+
+ return std::__lexicographical_compare<__simple>::__lc(__first1, __last1,
+ __first2, __last2);
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
+
+ /**
+ * @brief Tests a range for element-wise equality.
+ * @ingroup non_mutating_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @return A boolean true or false.
+ *
+ * This compares the elements of two ranges using @c == and returns true or
+ * false depending on whether all of the corresponding elements of the
+ * ranges are equal.
+ */
+ template<typename _II1, typename _II2>
+ inline bool
+ equal(_II1 __first1, _II1 __last1, _II2 __first2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_II1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_II2>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_II1>::value_type,
+ typename iterator_traits<_II2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ return std::__equal_aux(std::__niter_base<_II1>::__b(__first1),
+ std::__niter_base<_II1>::__b(__last1),
+ std::__niter_base<_II2>::__b(__first2));
+ }
+
+ /**
+ * @brief Tests a range for element-wise equality.
+ * @ingroup non_mutating_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @param binary_pred A binary predicate @link functors
+ * functor@endlink.
+ * @return A boolean true or false.
+ *
+ * This compares the elements of two ranges using the binary_pred
+ * parameter, and returns true or
+ * false depending on whether all of the corresponding elements of the
+ * ranges are equal.
+ */
+ template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ inline bool
+ equal(_IIter1 __first1, _IIter1 __last1,
+ _IIter2 __first2, _BinaryPredicate __binary_pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_IIter1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_IIter2>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ for (; __first1 != __last1; ++__first1, ++__first2)
+ if (!bool(__binary_pred(*__first1, *__first2)))
+ return false;
+ return true;
+ }
+
+ /**
+ * @brief Performs "dictionary" comparison on ranges.
+ * @ingroup sorting_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @param last2 An input iterator.
+ * @return A boolean true or false.
+ *
+ * "Returns true if the sequence of elements defined by the range
+ * [first1,last1) is lexicographically less than the sequence of elements
+ * defined by the range [first2,last2). Returns false otherwise."
+ * (Quoted from [25.3.8]/1.) If the iterators are all character pointers,
+ * then this is an inline call to @c memcmp.
+ */
+ template<typename _II1, typename _II2>
+ inline bool
+ lexicographical_compare(_II1 __first1, _II1 __last1,
+ _II2 __first2, _II2 __last2)
+ {
+ // concept requirements
+ typedef typename iterator_traits<_II1>::value_type _ValueType1;
+ typedef typename iterator_traits<_II2>::value_type _ValueType2;
+ __glibcxx_function_requires(_InputIteratorConcept<_II1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_II2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
+ __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ return std::__lexicographical_compare_aux
+ (std::__niter_base<_II1>::__b(__first1),
+ std::__niter_base<_II1>::__b(__last1),
+ std::__niter_base<_II2>::__b(__first2),
+ std::__niter_base<_II2>::__b(__last2));
+ }
+
+ /**
+ * @brief Performs "dictionary" comparison on ranges.
+ * @ingroup sorting_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @param last2 An input iterator.
+ * @param comp A @link comparison_functors comparison functor@endlink.
+ * @return A boolean true or false.
+ *
+ * The same as the four-parameter @c lexicographical_compare, but uses the
+ * comp parameter instead of @c <.
+ */
+ template<typename _II1, typename _II2, typename _Compare>
+ bool
+ lexicographical_compare(_II1 __first1, _II1 __last1,
+ _II2 __first2, _II2 __last2, _Compare __comp)
+ {
+ typedef typename iterator_traits<_II1>::iterator_category _Category1;
+ typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef std::__lc_rai<_Category1, _Category2> __rai_type;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_II1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_II2>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
+ for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
+ ++__first1, ++__first2)
+ {
+ if (__comp(*__first1, *__first2))
+ return true;
+ if (__comp(*__first2, *__first1))
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+ }
+
+ /**
+ * @brief Finds the places in ranges which don't match.
+ * @ingroup non_mutating_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @return A pair of iterators pointing to the first mismatch.
+ *
+ * This compares the elements of two ranges using @c == and returns a pair
+ * of iterators. The first iterator points into the first range, the
+ * second iterator points into the second range, and the elements pointed
+ * to by the iterators are not equal.
+ */
+ template<typename _InputIterator1, typename _InputIterator2>
+ pair<_InputIterator1, _InputIterator2>
+ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ while (__first1 != __last1 && *__first1 == *__first2)
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+ }
+
+ /**
+ * @brief Finds the places in ranges which don't match.
+ * @ingroup non_mutating_algorithms
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @param binary_pred A binary predicate @link functors
+ * functor@endlink.
+ * @return A pair of iterators pointing to the first mismatch.
+ *
+ * This compares the elements of two ranges using the binary_pred
+ * parameter, and returns a pair
+ * of iterators. The first iterator points into the first range, the
+ * second iterator points into the second range, and the elements pointed
+ * to by the iterators are not equal.
+ */
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _BinaryPredicate>
+ pair<_InputIterator1, _InputIterator2>
+ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _BinaryPredicate __binary_pred)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ while (__first1 != __last1 && bool(__binary_pred(*__first1, *__first2)))
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+ }
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+// NB: This file is included within many other C++ includes, as a way
+// of getting the base algorithms. So, make sure that parallel bits
+// come in too if requested.
+#ifdef _GLIBCXX_PARALLEL
+# include <parallel/algobase.h>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_bvector.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_bvector.h
new file mode 100644
index 000000000..0e60b7f1b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_bvector.h
@@ -0,0 +1,1024 @@
+// vector<bool> specialization -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_bvector.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_BVECTOR_H
+#define _STL_BVECTOR_H 1
+
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ typedef unsigned long _Bit_type;
+ enum { _S_word_bit = int(__CHAR_BIT__ * sizeof(_Bit_type)) };
+
+ struct _Bit_reference
+ {
+ _Bit_type * _M_p;
+ _Bit_type _M_mask;
+
+ _Bit_reference(_Bit_type * __x, _Bit_type __y)
+ : _M_p(__x), _M_mask(__y) { }
+
+ _Bit_reference() : _M_p(0), _M_mask(0) { }
+
+ operator bool() const
+ { return !!(*_M_p & _M_mask); }
+
+ _Bit_reference&
+ operator=(bool __x)
+ {
+ if (__x)
+ *_M_p |= _M_mask;
+ else
+ *_M_p &= ~_M_mask;
+ return *this;
+ }
+
+ _Bit_reference&
+ operator=(const _Bit_reference& __x)
+ { return *this = bool(__x); }
+
+ bool
+ operator==(const _Bit_reference& __x) const
+ { return bool(*this) == bool(__x); }
+
+ bool
+ operator<(const _Bit_reference& __x) const
+ { return !bool(*this) && bool(__x); }
+
+ void
+ flip()
+ { *_M_p ^= _M_mask; }
+ };
+
+ struct _Bit_iterator_base
+ : public std::iterator<std::random_access_iterator_tag, bool>
+ {
+ _Bit_type * _M_p;
+ unsigned int _M_offset;
+
+ _Bit_iterator_base(_Bit_type * __x, unsigned int __y)
+ : _M_p(__x), _M_offset(__y) { }
+
+ void
+ _M_bump_up()
+ {
+ if (_M_offset++ == int(_S_word_bit) - 1)
+ {
+ _M_offset = 0;
+ ++_M_p;
+ }
+ }
+
+ void
+ _M_bump_down()
+ {
+ if (_M_offset-- == 0)
+ {
+ _M_offset = int(_S_word_bit) - 1;
+ --_M_p;
+ }
+ }
+
+ void
+ _M_incr(ptrdiff_t __i)
+ {
+ difference_type __n = __i + _M_offset;
+ _M_p += __n / int(_S_word_bit);
+ __n = __n % int(_S_word_bit);
+ if (__n < 0)
+ {
+ __n += int(_S_word_bit);
+ --_M_p;
+ }
+ _M_offset = static_cast<unsigned int>(__n);
+ }
+
+ bool
+ operator==(const _Bit_iterator_base& __i) const
+ { return _M_p == __i._M_p && _M_offset == __i._M_offset; }
+
+ bool
+ operator<(const _Bit_iterator_base& __i) const
+ {
+ return _M_p < __i._M_p
+ || (_M_p == __i._M_p && _M_offset < __i._M_offset);
+ }
+
+ bool
+ operator!=(const _Bit_iterator_base& __i) const
+ { return !(*this == __i); }
+
+ bool
+ operator>(const _Bit_iterator_base& __i) const
+ { return __i < *this; }
+
+ bool
+ operator<=(const _Bit_iterator_base& __i) const
+ { return !(__i < *this); }
+
+ bool
+ operator>=(const _Bit_iterator_base& __i) const
+ { return !(*this < __i); }
+ };
+
+ inline ptrdiff_t
+ operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y)
+ {
+ return (int(_S_word_bit) * (__x._M_p - __y._M_p)
+ + __x._M_offset - __y._M_offset);
+ }
+
+ struct _Bit_iterator : public _Bit_iterator_base
+ {
+ typedef _Bit_reference reference;
+ typedef _Bit_reference* pointer;
+ typedef _Bit_iterator iterator;
+
+ _Bit_iterator() : _Bit_iterator_base(0, 0) { }
+
+ _Bit_iterator(_Bit_type * __x, unsigned int __y)
+ : _Bit_iterator_base(__x, __y) { }
+
+ reference
+ operator*() const
+ { return reference(_M_p, 1UL << _M_offset); }
+
+ iterator&
+ operator++()
+ {
+ _M_bump_up();
+ return *this;
+ }
+
+ iterator
+ operator++(int)
+ {
+ iterator __tmp = *this;
+ _M_bump_up();
+ return __tmp;
+ }
+
+ iterator&
+ operator--()
+ {
+ _M_bump_down();
+ return *this;
+ }
+
+ iterator
+ operator--(int)
+ {
+ iterator __tmp = *this;
+ _M_bump_down();
+ return __tmp;
+ }
+
+ iterator&
+ operator+=(difference_type __i)
+ {
+ _M_incr(__i);
+ return *this;
+ }
+
+ iterator&
+ operator-=(difference_type __i)
+ {
+ *this += -__i;
+ return *this;
+ }
+
+ iterator
+ operator+(difference_type __i) const
+ {
+ iterator __tmp = *this;
+ return __tmp += __i;
+ }
+
+ iterator
+ operator-(difference_type __i) const
+ {
+ iterator __tmp = *this;
+ return __tmp -= __i;
+ }
+
+ reference
+ operator[](difference_type __i) const
+ { return *(*this + __i); }
+ };
+
+ inline _Bit_iterator
+ operator+(ptrdiff_t __n, const _Bit_iterator& __x)
+ { return __x + __n; }
+
+ struct _Bit_const_iterator : public _Bit_iterator_base
+ {
+ typedef bool reference;
+ typedef bool const_reference;
+ typedef const bool* pointer;
+ typedef _Bit_const_iterator const_iterator;
+
+ _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
+
+ _Bit_const_iterator(_Bit_type * __x, unsigned int __y)
+ : _Bit_iterator_base(__x, __y) { }
+
+ _Bit_const_iterator(const _Bit_iterator& __x)
+ : _Bit_iterator_base(__x._M_p, __x._M_offset) { }
+
+ const_reference
+ operator*() const
+ { return _Bit_reference(_M_p, 1UL << _M_offset); }
+
+ const_iterator&
+ operator++()
+ {
+ _M_bump_up();
+ return *this;
+ }
+
+ const_iterator
+ operator++(int)
+ {
+ const_iterator __tmp = *this;
+ _M_bump_up();
+ return __tmp;
+ }
+
+ const_iterator&
+ operator--()
+ {
+ _M_bump_down();
+ return *this;
+ }
+
+ const_iterator
+ operator--(int)
+ {
+ const_iterator __tmp = *this;
+ _M_bump_down();
+ return __tmp;
+ }
+
+ const_iterator&
+ operator+=(difference_type __i)
+ {
+ _M_incr(__i);
+ return *this;
+ }
+
+ const_iterator&
+ operator-=(difference_type __i)
+ {
+ *this += -__i;
+ return *this;
+ }
+
+ const_iterator
+ operator+(difference_type __i) const
+ {
+ const_iterator __tmp = *this;
+ return __tmp += __i;
+ }
+
+ const_iterator
+ operator-(difference_type __i) const
+ {
+ const_iterator __tmp = *this;
+ return __tmp -= __i;
+ }
+
+ const_reference
+ operator[](difference_type __i) const
+ { return *(*this + __i); }
+ };
+
+ inline _Bit_const_iterator
+ operator+(ptrdiff_t __n, const _Bit_const_iterator& __x)
+ { return __x + __n; }
+
+ inline void
+ __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x)
+ {
+ for (; __first != __last; ++__first)
+ *__first = __x;
+ }
+
+ inline void
+ fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x)
+ {
+ if (__first._M_p != __last._M_p)
+ {
+ std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0);
+ __fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x);
+ __fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x);
+ }
+ else
+ __fill_bvector(__first, __last, __x);
+ }
+
+ template<typename _Alloc>
+ struct _Bvector_base
+ {
+ typedef typename _Alloc::template rebind<_Bit_type>::other
+ _Bit_alloc_type;
+
+ struct _Bvector_impl
+ : public _Bit_alloc_type
+ {
+ _Bit_iterator _M_start;
+ _Bit_iterator _M_finish;
+ _Bit_type* _M_end_of_storage;
+
+ _Bvector_impl()
+ : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0)
+ { }
+
+ _Bvector_impl(const _Bit_alloc_type& __a)
+ : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)
+ { }
+ };
+
+ public:
+ typedef _Alloc allocator_type;
+
+ _Bit_alloc_type&
+ _M_get_Bit_allocator()
+ { return *static_cast<_Bit_alloc_type*>(&this->_M_impl); }
+
+ const _Bit_alloc_type&
+ _M_get_Bit_allocator() const
+ { return *static_cast<const _Bit_alloc_type*>(&this->_M_impl); }
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_get_Bit_allocator()); }
+
+ _Bvector_base()
+ : _M_impl() { }
+
+ _Bvector_base(const allocator_type& __a)
+ : _M_impl(__a) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _Bvector_base(_Bvector_base&& __x)
+ : _M_impl(__x._M_get_Bit_allocator())
+ {
+ this->_M_impl._M_start = __x._M_impl._M_start;
+ this->_M_impl._M_finish = __x._M_impl._M_finish;
+ this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage;
+ __x._M_impl._M_start = _Bit_iterator();
+ __x._M_impl._M_finish = _Bit_iterator();
+ __x._M_impl._M_end_of_storage = 0;
+ }
+#endif
+
+ ~_Bvector_base()
+ { this->_M_deallocate(); }
+
+ protected:
+ _Bvector_impl _M_impl;
+
+ _Bit_type*
+ _M_allocate(size_t __n)
+ { return _M_impl.allocate((__n + int(_S_word_bit) - 1)
+ / int(_S_word_bit)); }
+
+ void
+ _M_deallocate()
+ {
+ if (_M_impl._M_start._M_p)
+ _M_impl.deallocate(_M_impl._M_start._M_p,
+ _M_impl._M_end_of_storage - _M_impl._M_start._M_p);
+ }
+ };
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+// Declare a partial specialization of vector<T, Alloc>.
+#include <bits/stl_vector.h>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * @brief A specialization of vector for booleans which offers fixed time
+ * access to individual elements in any order.
+ *
+ * Note that vector<bool> does not actually meet the requirements for being
+ * a container. This is because the reference and pointer types are not
+ * really references and pointers to bool. See DR96 for details. @see
+ * vector for function documentation.
+ *
+ * @ingroup sequences
+ *
+ * In some terminology a %vector can be described as a dynamic
+ * C-style array, it offers fast and efficient access to individual
+ * elements in any order and saves the user from worrying about
+ * memory and size allocation. Subscripting ( @c [] ) access is
+ * also provided as with C-style arrays.
+ */
+template<typename _Alloc>
+ class vector<bool, _Alloc> : protected _Bvector_base<_Alloc>
+ {
+ typedef _Bvector_base<_Alloc> _Base;
+
+ public:
+ typedef bool value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Bit_reference reference;
+ typedef bool const_reference;
+ typedef _Bit_reference* pointer;
+ typedef const bool* const_pointer;
+ typedef _Bit_iterator iterator;
+ typedef _Bit_const_iterator const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef _Alloc allocator_type;
+
+ allocator_type get_allocator() const
+ { return _Base::get_allocator(); }
+
+ protected:
+ using _Base::_M_allocate;
+ using _Base::_M_deallocate;
+ using _Base::_M_get_Bit_allocator;
+
+ public:
+ vector()
+ : _Base() { }
+
+ explicit
+ vector(const allocator_type& __a)
+ : _Base(__a) { }
+
+ explicit
+ vector(size_type __n, const bool& __value = bool(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_initialize(__n);
+ std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage,
+ __value ? ~0 : 0);
+ }
+
+ vector(const vector& __x)
+ : _Base(__x._M_get_Bit_allocator())
+ {
+ _M_initialize(__x.size());
+ _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector(vector&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ vector(initializer_list<bool> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_initialize_range(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
+#endif
+
+ template<typename _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+ ~vector() { }
+
+ vector&
+ operator=(const vector& __x)
+ {
+ if (&__x == this)
+ return *this;
+ if (__x.size() > capacity())
+ {
+ this->_M_deallocate();
+ _M_initialize(__x.size());
+ }
+ this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(),
+ begin());
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector&
+ operator=(vector&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ vector&
+ operator=(initializer_list<bool> __l)
+ {
+ this->assign (__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+ void
+ assign(size_type __n, const bool& __x)
+ { _M_fill_assign(__n, __x); }
+
+ template<typename _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ assign(initializer_list<bool> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
+ iterator
+ begin()
+ { return this->_M_impl._M_start; }
+
+ const_iterator
+ begin() const
+ { return this->_M_impl._M_start; }
+
+ iterator
+ end()
+ { return this->_M_impl._M_finish; }
+
+ const_iterator
+ end() const
+ { return this->_M_impl._M_finish; }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return this->_M_impl._M_start; }
+
+ const_iterator
+ cend() const
+ { return this->_M_impl._M_finish; }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ size_type
+ size() const
+ { return size_type(end() - begin()); }
+
+ size_type
+ max_size() const
+ {
+ const size_type __isize =
+ __gnu_cxx::__numeric_traits<difference_type>::__max
+ - int(_S_word_bit) + 1;
+ const size_type __asize = _M_get_Bit_allocator().max_size();
+ return (__asize <= __isize / int(_S_word_bit)
+ ? __asize * int(_S_word_bit) : __isize);
+ }
+
+ size_type
+ capacity() const
+ { return size_type(const_iterator(this->_M_impl._M_end_of_storage, 0)
+ - begin()); }
+
+ bool
+ empty() const
+ { return begin() == end(); }
+
+ reference
+ operator[](size_type __n)
+ {
+ return *iterator(this->_M_impl._M_start._M_p
+ + __n / int(_S_word_bit), __n % int(_S_word_bit));
+ }
+
+ const_reference
+ operator[](size_type __n) const
+ {
+ return *const_iterator(this->_M_impl._M_start._M_p
+ + __n / int(_S_word_bit), __n % int(_S_word_bit));
+ }
+
+ protected:
+ void
+ _M_range_check(size_type __n) const
+ {
+ if (__n >= this->size())
+ __throw_out_of_range(__N("vector<bool>::_M_range_check"));
+ }
+
+ public:
+ reference
+ at(size_type __n)
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ const_reference
+ at(size_type __n) const
+ { _M_range_check(__n); return (*this)[__n]; }
+
+ void
+ reserve(size_type __n);
+
+ reference
+ front()
+ { return *begin(); }
+
+ const_reference
+ front() const
+ { return *begin(); }
+
+ reference
+ back()
+ { return *(end() - 1); }
+
+ const_reference
+ back() const
+ { return *(end() - 1); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 464. Suggestion for new member functions in standard containers.
+ // N.B. DR 464 says nothing about vector<bool> but we need something
+ // here due to the way we are implementing DR 464 in the debug-mode
+ // vector class.
+ void
+ data() { }
+
+ void
+ push_back(bool __x)
+ {
+ if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
+ *this->_M_impl._M_finish++ = __x;
+ else
+ _M_insert_aux(end(), __x);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(vector&& __x)
+#else
+ swap(vector& __x)
+#endif
+ {
+ std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
+ std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
+ std::swap(this->_M_impl._M_end_of_storage,
+ __x._M_impl._M_end_of_storage);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<typename _Base::_Bit_alloc_type>::
+ _S_do_it(_M_get_Bit_allocator(), __x._M_get_Bit_allocator());
+ }
+
+ // [23.2.5]/1, third-to-last entry in synopsis listing
+ static void
+ swap(reference __x, reference __y)
+ {
+ bool __tmp = __x;
+ __x = __y;
+ __y = __tmp;
+ }
+
+ iterator
+ insert(iterator __position, const bool& __x = bool())
+ {
+ const difference_type __n = __position - begin();
+ if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage
+ && __position == end())
+ *this->_M_impl._M_finish++ = __x;
+ else
+ _M_insert_aux(__position, __x);
+ return begin() + __n;
+ }
+
+ template<typename _InputIterator>
+ void
+ insert(iterator __position,
+ _InputIterator __first, _InputIterator __last)
+ {
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+
+ void
+ insert(iterator __position, size_type __n, const bool& __x)
+ { _M_fill_insert(__position, __n, __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void insert(iterator __p, initializer_list<bool> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif
+
+ void
+ pop_back()
+ { --this->_M_impl._M_finish; }
+
+ iterator
+ erase(iterator __position)
+ {
+ if (__position + 1 != end())
+ std::copy(__position + 1, end(), __position);
+ --this->_M_impl._M_finish;
+ return __position;
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ _M_erase_at_end(std::copy(__last, end(), __first));
+ return __first;
+ }
+
+ void
+ resize(size_type __new_size, bool __x = bool())
+ {
+ if (__new_size < size())
+ _M_erase_at_end(begin() + difference_type(__new_size));
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+
+ void
+ flip()
+ {
+ for (_Bit_type * __p = this->_M_impl._M_start._M_p;
+ __p != this->_M_impl._M_end_of_storage; ++__p)
+ *__p = ~*__p;
+ }
+
+ void
+ clear()
+ { _M_erase_at_end(begin()); }
+
+
+ protected:
+ // Precondition: __first._M_offset == 0 && __result._M_offset == 0.
+ iterator
+ _M_copy_aligned(const_iterator __first, const_iterator __last,
+ iterator __result)
+ {
+ _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);
+ return std::copy(const_iterator(__last._M_p, 0), __last,
+ iterator(__q, 0));
+ }
+
+ void
+ _M_initialize(size_type __n)
+ {
+ _Bit_type* __q = this->_M_allocate(__n);
+ this->_M_impl._M_end_of_storage = (__q
+ + ((__n + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
+ {
+ _M_initialize(static_cast<size_type>(__n));
+ std::fill(this->_M_impl._M_start._M_p,
+ this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
+ }
+
+ template<typename _InputIterator>
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ { _M_initialize_range(__first, __last,
+ std::__iterator_category(__first)); }
+
+ template<typename _InputIterator>
+ void
+ _M_initialize_range(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
+ {
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ template<typename _ForwardIterator>
+ void
+ _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ const size_type __n = std::distance(__first, __last);
+ _M_initialize(__n);
+ std::copy(__first, __last, this->_M_impl._M_start);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign(__n, __val); }
+
+ template<class _InputIterator>
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ { _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
+
+ void
+ _M_fill_assign(size_t __n, bool __x)
+ {
+ if (__n > size())
+ {
+ std::fill(this->_M_impl._M_start._M_p,
+ this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
+ insert(end(), __n - size(), __x);
+ }
+ else
+ {
+ _M_erase_at_end(begin() + __n);
+ std::fill(this->_M_impl._M_start._M_p,
+ this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
+ }
+ }
+
+ template<typename _InputIterator>
+ void
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
+ {
+ iterator __cur = begin();
+ for (; __first != __last && __cur != end(); ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ _M_erase_at_end(__cur);
+ else
+ insert(end(), __first, __last);
+ }
+
+ template<typename _ForwardIterator>
+ void
+ _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ const size_type __len = std::distance(__first, __last);
+ if (__len < size())
+ _M_erase_at_end(std::copy(__first, __last, begin()));
+ else
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, size());
+ std::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
+ __true_type)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ template<typename _InputIterator>
+ void
+ _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ __false_type)
+ { _M_insert_range(__pos, __first, __last,
+ std::__iterator_category(__first)); }
+
+ void
+ _M_fill_insert(iterator __position, size_type __n, bool __x);
+
+ template<typename _InputIterator>
+ void
+ _M_insert_range(iterator __pos, _InputIterator __first,
+ _InputIterator __last, std::input_iterator_tag)
+ {
+ for (; __first != __last; ++__first)
+ {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template<typename _ForwardIterator>
+ void
+ _M_insert_range(iterator __position, _ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag);
+
+ void
+ _M_insert_aux(iterator __position, bool __x);
+
+ size_type
+ _M_check_len(size_type __n, const char* __s) const
+ {
+ if (max_size() - size() < __n)
+ __throw_length_error(__N(__s));
+
+ const size_type __len = size() + std::max(size(), __n);
+ return (__len < size() || __len > max_size()) ? max_size() : __len;
+ }
+
+ void
+ _M_erase_at_end(iterator __pos)
+ { this->_M_impl._M_finish = __pos; }
+ };
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_construct.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_construct.h
new file mode 100644
index 000000000..265c3ab19
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_construct.h
@@ -0,0 +1,129 @@
+// nonstandard construct and destroy functions -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_construct.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_CONSTRUCT_H
+#define _STL_CONSTRUCT_H 1
+
+#include <new>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * Constructs an object in existing memory by invoking an allocated
+ * object's constructor with an initializer.
+ */
+ template<typename _T1, typename _T2>
+ inline void
+ _Construct(_T1* __p, const _T2& __value)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 402. wrong new expression in [some_]allocator::construct
+ ::new(static_cast<void*>(__p)) _T1(__value);
+ }
+
+ /**
+ * Destroy the object pointed to by a pointer type.
+ */
+ template<typename _Tp>
+ inline void
+ _Destroy(_Tp* __pointer)
+ { __pointer->~_Tp(); }
+
+ /**
+ * Destroy a range of objects. If the value_type of the object has
+ * a trivial destructor, the compiler should optimize all of this
+ * away, otherwise the objects' destructors must be invoked.
+ */
+ template<typename _ForwardIterator>
+ inline void
+ _Destroy(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _Value_type;
+ if (!__has_trivial_destructor(_Value_type))
+ for (; __first != __last; ++__first)
+ std::_Destroy(&*__first);
+ }
+
+ /**
+ * Destroy a range of objects using the supplied allocator. For
+ * nondefault allocators we do not optimize away invocation of
+ * destroy() even if _Tp has a trivial destructor.
+ */
+
+ template <typename _Tp> class allocator;
+
+ template<typename _ForwardIterator, typename _Allocator>
+ void
+ _Destroy(_ForwardIterator __first, _ForwardIterator __last,
+ _Allocator& __alloc)
+ {
+ for (; __first != __last; ++__first)
+ __alloc.destroy(&*__first);
+ }
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ _Destroy(_ForwardIterator __first, _ForwardIterator __last,
+ allocator<_Tp>&)
+ {
+ _Destroy(__first, __last);
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_CONSTRUCT_H */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_deque.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_deque.h
new file mode 100644
index 000000000..1c20e275f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_deque.h
@@ -0,0 +1,1819 @@
+// Deque implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_deque.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_DEQUE_H
+#define _STL_DEQUE_H 1
+
+#include <bits/concept_check.h>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * @brief This function controls the size of memory nodes.
+ * @param size The size of an element.
+ * @return The number (not byte size) of elements per node.
+ *
+ * This function started off as a compiler kludge from SGI, but seems to
+ * be a useful wrapper around a repeated constant expression. The '512' is
+ * tunable (and no other code needs to change), but no investigation has
+ * been done since inheriting the SGI code.
+ */
+ inline size_t
+ __deque_buf_size(size_t __size)
+ { return __size < 512 ? size_t(512 / __size) : size_t(1); }
+
+
+ /**
+ * @brief A deque::iterator.
+ *
+ * Quite a bit of intelligence here. Much of the functionality of
+ * deque is actually passed off to this class. A deque holds two
+ * of these internally, marking its valid range. Access to
+ * elements is done as offsets of either of those two, relying on
+ * operator overloading in this class.
+ *
+ * All the functions are op overloads except for _M_set_node.
+ */
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ struct _Deque_iterator
+ {
+ typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
+ typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
+
+ static size_t _S_buffer_size()
+ { return __deque_buf_size(sizeof(_Tp)); }
+
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Ptr pointer;
+ typedef _Ref reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp** _Map_pointer;
+ typedef _Deque_iterator _Self;
+
+ _Tp* _M_cur;
+ _Tp* _M_first;
+ _Tp* _M_last;
+ _Map_pointer _M_node;
+
+ _Deque_iterator(_Tp* __x, _Map_pointer __y)
+ : _M_cur(__x), _M_first(*__y),
+ _M_last(*__y + _S_buffer_size()), _M_node(__y) { }
+
+ _Deque_iterator()
+ : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) { }
+
+ _Deque_iterator(const iterator& __x)
+ : _M_cur(__x._M_cur), _M_first(__x._M_first),
+ _M_last(__x._M_last), _M_node(__x._M_node) { }
+
+ reference
+ operator*() const
+ { return *_M_cur; }
+
+ pointer
+ operator->() const
+ { return _M_cur; }
+
+ _Self&
+ operator++()
+ {
+ ++_M_cur;
+ if (_M_cur == _M_last)
+ {
+ _M_set_node(_M_node + 1);
+ _M_cur = _M_first;
+ }
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _Self&
+ operator--()
+ {
+ if (_M_cur == _M_first)
+ {
+ _M_set_node(_M_node - 1);
+ _M_cur = _M_last;
+ }
+ --_M_cur;
+ return *this;
+ }
+
+ _Self
+ operator--(int)
+ {
+ _Self __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _Self&
+ operator+=(difference_type __n)
+ {
+ const difference_type __offset = __n + (_M_cur - _M_first);
+ if (__offset >= 0 && __offset < difference_type(_S_buffer_size()))
+ _M_cur += __n;
+ else
+ {
+ const difference_type __node_offset =
+ __offset > 0 ? __offset / difference_type(_S_buffer_size())
+ : -difference_type((-__offset - 1)
+ / _S_buffer_size()) - 1;
+ _M_set_node(_M_node + __node_offset);
+ _M_cur = _M_first + (__offset - __node_offset
+ * difference_type(_S_buffer_size()));
+ }
+ return *this;
+ }
+
+ _Self
+ operator+(difference_type __n) const
+ {
+ _Self __tmp = *this;
+ return __tmp += __n;
+ }
+
+ _Self&
+ operator-=(difference_type __n)
+ { return *this += -__n; }
+
+ _Self
+ operator-(difference_type __n) const
+ {
+ _Self __tmp = *this;
+ return __tmp -= __n;
+ }
+
+ reference
+ operator[](difference_type __n) const
+ { return *(*this + __n); }
+
+ /**
+ * Prepares to traverse new_node. Sets everything except
+ * _M_cur, which should therefore be set by the caller
+ * immediately afterwards, based on _M_first and _M_last.
+ */
+ void
+ _M_set_node(_Map_pointer __new_node)
+ {
+ _M_node = __new_node;
+ _M_first = *__new_node;
+ _M_last = _M_first + difference_type(_S_buffer_size());
+ }
+ };
+
+ // Note: we also provide overloads whose operands are of the same type in
+ // order to avoid ambiguous overload resolution when std::rel_ops operators
+ // are in scope (for additional details, see libstdc++/3628)
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline bool
+ operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ { return __x._M_cur == __y._M_cur; }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline bool
+ operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ { return __x._M_cur == __y._M_cur; }
+
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline bool
+ operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ { return !(__x == __y); }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline bool
+ operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ { return !(__x == __y); }
+
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline bool
+ operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
+ : (__x._M_node < __y._M_node); }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline bool
+ operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
+ : (__x._M_node < __y._M_node); }
+
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline bool
+ operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ { return __y < __x; }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline bool
+ operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ { return __y < __x; }
+
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline bool
+ operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ { return !(__y < __x); }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline bool
+ operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ { return !(__y < __x); }
+
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline bool
+ operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ { return !(__x < __y); }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline bool
+ operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ { return !(__x < __y); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR179 not only the various comparison
+ // operators but also operator- must accept mixed iterator/const_iterator
+ // parameters.
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type
+ operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ {
+ return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type
+ (_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size())
+ * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first)
+ + (__y._M_last - __y._M_cur);
+ }
+
+ template<typename _Tp, typename _RefL, typename _PtrL,
+ typename _RefR, typename _PtrR>
+ inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
+ operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ {
+ return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
+ (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size())
+ * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first)
+ + (__y._M_last - __y._M_cur);
+ }
+
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ inline _Deque_iterator<_Tp, _Ref, _Ptr>
+ operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
+ { return __x + __n; }
+
+ template<typename _Tp>
+ void
+ fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first,
+ const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value);
+
+ /**
+ * Deque base class. This class provides the unified face for %deque's
+ * allocation. This class's constructor and destructor allocate and
+ * deallocate (but do not initialize) storage. This makes %exception
+ * safety easier.
+ *
+ * Nothing in this class ever constructs or destroys an actual Tp element.
+ * (Deque handles that itself.) Only/All memory management is performed
+ * here.
+ */
+ template<typename _Tp, typename _Alloc>
+ class _Deque_base
+ {
+ public:
+ typedef _Alloc allocator_type;
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_get_Tp_allocator()); }
+
+ typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
+ typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
+
+ _Deque_base()
+ : _M_impl()
+ { _M_initialize_map(0); }
+
+ _Deque_base(const allocator_type& __a, size_t __num_elements)
+ : _M_impl(__a)
+ { _M_initialize_map(__num_elements); }
+
+ _Deque_base(const allocator_type& __a)
+ : _M_impl(__a)
+ { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _Deque_base(_Deque_base&& __x)
+ : _M_impl(__x._M_get_Tp_allocator())
+ {
+ _M_initialize_map(0);
+ if (__x._M_impl._M_map)
+ {
+ std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
+ std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
+ std::swap(this->_M_impl._M_map, __x._M_impl._M_map);
+ std::swap(this->_M_impl._M_map_size, __x._M_impl._M_map_size);
+ }
+ }
+#endif
+
+ ~_Deque_base();
+
+ protected:
+ //This struct encapsulates the implementation of the std::deque
+ //standard container and at the same time makes use of the EBO
+ //for empty allocators.
+ typedef typename _Alloc::template rebind<_Tp*>::other _Map_alloc_type;
+
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+
+ struct _Deque_impl
+ : public _Tp_alloc_type
+ {
+ _Tp** _M_map;
+ size_t _M_map_size;
+ iterator _M_start;
+ iterator _M_finish;
+
+ _Deque_impl()
+ : _Tp_alloc_type(), _M_map(0), _M_map_size(0),
+ _M_start(), _M_finish()
+ { }
+
+ _Deque_impl(const _Tp_alloc_type& __a)
+ : _Tp_alloc_type(__a), _M_map(0), _M_map_size(0),
+ _M_start(), _M_finish()
+ { }
+ };
+
+ _Tp_alloc_type&
+ _M_get_Tp_allocator()
+ { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); }
+
+ const _Tp_alloc_type&
+ _M_get_Tp_allocator() const
+ { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); }
+
+ _Map_alloc_type
+ _M_get_map_allocator() const
+ { return _Map_alloc_type(_M_get_Tp_allocator()); }
+
+ _Tp*
+ _M_allocate_node()
+ {
+ return _M_impl._Tp_alloc_type::allocate(__deque_buf_size(sizeof(_Tp)));
+ }
+
+ void
+ _M_deallocate_node(_Tp* __p)
+ {
+ _M_impl._Tp_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp)));
+ }
+
+ _Tp**
+ _M_allocate_map(size_t __n)
+ { return _M_get_map_allocator().allocate(__n); }
+
+ void
+ _M_deallocate_map(_Tp** __p, size_t __n)
+ { _M_get_map_allocator().deallocate(__p, __n); }
+
+ protected:
+ void _M_initialize_map(size_t);
+ void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
+ void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
+ enum { _S_initial_map_size = 8 };
+
+ _Deque_impl _M_impl;
+ };
+
+ template<typename _Tp, typename _Alloc>
+ _Deque_base<_Tp, _Alloc>::
+ ~_Deque_base()
+ {
+ if (this->_M_impl._M_map)
+ {
+ _M_destroy_nodes(this->_M_impl._M_start._M_node,
+ this->_M_impl._M_finish._M_node + 1);
+ _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);
+ }
+ }
+
+ /**
+ * @brief Layout storage.
+ * @param num_elements The count of T's for which to allocate space
+ * at first.
+ * @return Nothing.
+ *
+ * The initial underlying memory layout is a bit complicated...
+ */
+ template<typename _Tp, typename _Alloc>
+ void
+ _Deque_base<_Tp, _Alloc>::
+ _M_initialize_map(size_t __num_elements)
+ {
+ const size_t __num_nodes = (__num_elements/ __deque_buf_size(sizeof(_Tp))
+ + 1);
+
+ this->_M_impl._M_map_size = std::max((size_t) _S_initial_map_size,
+ size_t(__num_nodes + 2));
+ this->_M_impl._M_map = _M_allocate_map(this->_M_impl._M_map_size);
+
+ // For "small" maps (needing less than _M_map_size nodes), allocation
+ // starts in the middle elements and grows outwards. So nstart may be
+ // the beginning of _M_map, but for small maps it may be as far in as
+ // _M_map+3.
+
+ _Tp** __nstart = (this->_M_impl._M_map
+ + (this->_M_impl._M_map_size - __num_nodes) / 2);
+ _Tp** __nfinish = __nstart + __num_nodes;
+
+ __try
+ { _M_create_nodes(__nstart, __nfinish); }
+ __catch(...)
+ {
+ _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);
+ this->_M_impl._M_map = 0;
+ this->_M_impl._M_map_size = 0;
+ __throw_exception_again;
+ }
+
+ this->_M_impl._M_start._M_set_node(__nstart);
+ this->_M_impl._M_finish._M_set_node(__nfinish - 1);
+ this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first;
+ this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first
+ + __num_elements
+ % __deque_buf_size(sizeof(_Tp)));
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ _Deque_base<_Tp, _Alloc>::
+ _M_create_nodes(_Tp** __nstart, _Tp** __nfinish)
+ {
+ _Tp** __cur;
+ __try
+ {
+ for (__cur = __nstart; __cur < __nfinish; ++__cur)
+ *__cur = this->_M_allocate_node();
+ }
+ __catch(...)
+ {
+ _M_destroy_nodes(__nstart, __cur);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ _Deque_base<_Tp, _Alloc>::
+ _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
+ {
+ for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
+ _M_deallocate_node(*__n);
+ }
+
+ /**
+ * @brief A standard container using fixed-size memory allocation and
+ * constant-time manipulation of elements at either end.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>, including the
+ * <a href="tables.html#68">optional sequence requirements</a>.
+ *
+ * In previous HP/SGI versions of deque, there was an extra template
+ * parameter so users could control the node size. This extension turned
+ * out to violate the C++ standard (it can be detected using template
+ * template parameters), and it was removed.
+ *
+ * Here's how a deque<Tp> manages memory. Each deque has 4 members:
+ *
+ * - Tp** _M_map
+ * - size_t _M_map_size
+ * - iterator _M_start, _M_finish
+ *
+ * map_size is at least 8. %map is an array of map_size
+ * pointers-to-"nodes". (The name %map has nothing to do with the
+ * std::map class, and "nodes" should not be confused with
+ * std::list's usage of "node".)
+ *
+ * A "node" has no specific type name as such, but it is referred
+ * to as "node" in this file. It is a simple array-of-Tp. If Tp
+ * is very large, there will be one Tp element per node (i.e., an
+ * "array" of one). For non-huge Tp's, node size is inversely
+ * related to Tp size: the larger the Tp, the fewer Tp's will fit
+ * in a node. The goal here is to keep the total size of a node
+ * relatively small and constant over different Tp's, to improve
+ * allocator efficiency.
+ *
+ * Not every pointer in the %map array will point to a node. If
+ * the initial number of elements in the deque is small, the
+ * /middle/ %map pointers will be valid, and the ones at the edges
+ * will be unused. This same situation will arise as the %map
+ * grows: available %map pointers, if any, will be on the ends. As
+ * new nodes are created, only a subset of the %map's pointers need
+ * to be copied "outward".
+ *
+ * Class invariants:
+ * - For any nonsingular iterator i:
+ * - i.node points to a member of the %map array. (Yes, you read that
+ * correctly: i.node does not actually point to a node.) The member of
+ * the %map array is what actually points to the node.
+ * - i.first == *(i.node) (This points to the node (first Tp element).)
+ * - i.last == i.first + node_size
+ * - i.cur is a pointer in the range [i.first, i.last). NOTE:
+ * the implication of this is that i.cur is always a dereferenceable
+ * pointer, even if i is a past-the-end iterator.
+ * - Start and Finish are always nonsingular iterators. NOTE: this
+ * means that an empty deque must have one node, a deque with <N
+ * elements (where N is the node buffer size) must have one node, a
+ * deque with N through (2N-1) elements must have two nodes, etc.
+ * - For every node other than start.node and finish.node, every
+ * element in the node is an initialized object. If start.node ==
+ * finish.node, then [start.cur, finish.cur) are initialized
+ * objects, and the elements outside that range are uninitialized
+ * storage. Otherwise, [start.cur, start.last) and [finish.first,
+ * finish.cur) are initialized objects, and [start.first, start.cur)
+ * and [finish.cur, finish.last) are uninitialized storage.
+ * - [%map, %map + map_size) is a valid, non-empty range.
+ * - [start.node, finish.node] is a valid range contained within
+ * [%map, %map + map_size).
+ * - A pointer in the range [%map, %map + map_size) points to an allocated
+ * node if and only if the pointer is in the range
+ * [start.node, finish.node].
+ *
+ * Here's the magic: nothing in deque is "aware" of the discontiguous
+ * storage!
+ *
+ * The memory setup and layout occurs in the parent, _Base, and the iterator
+ * class is entirely responsible for "leaping" from one node to the next.
+ * All the implementation routines for deque itself work only through the
+ * start and finish iterators. This keeps the routines simple and sane,
+ * and we can use other standard algorithms as well.
+ */
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ class deque : protected _Deque_base<_Tp, _Alloc>
+ {
+ // concept requirements
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
+
+ typedef _Deque_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+
+ public:
+ typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef typename _Tp_alloc_type::const_pointer const_pointer;
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+
+ protected:
+ typedef pointer* _Map_pointer;
+
+ static size_t _S_buffer_size()
+ { return __deque_buf_size(sizeof(_Tp)); }
+
+ // Functions controlling memory layout, and nothing else.
+ using _Base::_M_initialize_map;
+ using _Base::_M_create_nodes;
+ using _Base::_M_destroy_nodes;
+ using _Base::_M_allocate_node;
+ using _Base::_M_deallocate_node;
+ using _Base::_M_allocate_map;
+ using _Base::_M_deallocate_map;
+ using _Base::_M_get_Tp_allocator;
+
+ /**
+ * A total of four data members accumulated down the hierarchy.
+ * May be accessed via _M_impl.*
+ */
+ using _Base::_M_impl;
+
+ public:
+ // [23.2.1.1] construct/copy/destroy
+ // (assign() and get_allocator() are also listed in this section)
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ deque()
+ : _Base() { }
+
+ /**
+ * @brief Creates a %deque with no elements.
+ * @param a An allocator object.
+ */
+ explicit
+ deque(const allocator_type& __a)
+ : _Base(__a, 0) { }
+
+ /**
+ * @brief Creates a %deque with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param a An allocator.
+ *
+ * This constructor fills the %deque with @a n copies of @a value.
+ */
+ explicit
+ deque(size_type __n, const value_type& __value = value_type(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__a, __n)
+ { _M_fill_initialize(__value); }
+
+ /**
+ * @brief %Deque copy constructor.
+ * @param x A %deque of identical element and allocator types.
+ *
+ * The newly-created %deque uses a copy of the allocation object used
+ * by @a x.
+ */
+ deque(const deque& __x)
+ : _Base(__x._M_get_Tp_allocator(), __x.size())
+ { std::__uninitialized_copy_a(__x.begin(), __x.end(),
+ this->_M_impl._M_start,
+ _M_get_Tp_allocator()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Deque move constructor.
+ * @param x A %deque of identical element and allocator types.
+ *
+ * The newly-created %deque contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %deque.
+ */
+ deque(deque&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ /**
+ * @brief Builds a %deque from an initializer list.
+ * @param l An initializer_list.
+ * @param a An allocator object.
+ *
+ * Create a %deque consisting of copies of the elements in the
+ * initializer_list @a l.
+ *
+ * This will call the element type's copy constructor N times
+ * (where N is l.size()) and do no memory reallocation.
+ */
+ deque(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_range_initialize(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
+#endif
+
+ /**
+ * @brief Builds a %deque from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param a An allocator object.
+ *
+ * Create a %deque consisting of copies of the elements from [first,
+ * last).
+ *
+ * If the iterators are forward, bidirectional, or random-access, then
+ * this will call the elements' copy constructor N times (where N is
+ * distance(first,last)) and do no memory reallocation. But if only
+ * input iterators are used, then this will do at most 2N calls to the
+ * copy constructor, and logN memory reallocations.
+ */
+ template<typename _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+ /**
+ * The dtor only erases the elements, and note that if the elements
+ * themselves are pointers, the pointed-to memory is not touched in any
+ * way. Managing the pointer is the user's responsibility.
+ */
+ ~deque()
+ { _M_destroy_data(begin(), end(), _M_get_Tp_allocator()); }
+
+ /**
+ * @brief %Deque assignment operator.
+ * @param x A %deque of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but unlike the copy constructor,
+ * the allocator object is not copied.
+ */
+ deque&
+ operator=(const deque& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Deque move assignment operator.
+ * @param x A %deque of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this deque (without copying).
+ * @a x is a valid, but unspecified %deque.
+ */
+ deque&
+ operator=(deque&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns an initializer list to a %deque.
+ * @param l An initializer_list.
+ *
+ * This function fills a %deque with copies of the elements in the
+ * initializer_list @a l.
+ *
+ * Note that the assignment completely changes the %deque and that the
+ * resulting %deque's size is the same as the number of elements
+ * assigned. Old data may be lost.
+ */
+ deque&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ /**
+ * @brief Assigns a given value to a %deque.
+ * @param n Number of elements to be assigned.
+ * @param val Value to be assigned.
+ *
+ * This function fills a %deque with @a n copies of the given
+ * value. Note that the assignment completely changes the
+ * %deque and that the resulting %deque's size is the same as
+ * the number of elements assigned. Old data may be lost.
+ */
+ void
+ assign(size_type __n, const value_type& __val)
+ { _M_fill_assign(__n, __val); }
+
+ /**
+ * @brief Assigns a range to a %deque.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function fills a %deque with copies of the elements in the
+ * range [first,last).
+ *
+ * Note that the assignment completely changes the %deque and that the
+ * resulting %deque's size is the same as the number of elements
+ * assigned. Old data may be lost.
+ */
+ template<typename _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assigns an initializer list to a %deque.
+ * @param l An initializer_list.
+ *
+ * This function fills a %deque with copies of the elements in the
+ * initializer_list @a l.
+ *
+ * Note that the assignment completely changes the %deque and that the
+ * resulting %deque's size is the same as the number of elements
+ * assigned. Old data may be lost.
+ */
+ void
+ assign(initializer_list<value_type> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
+ /// Get a copy of the memory allocation object.
+ allocator_type
+ get_allocator() const
+ { return _Base::get_allocator(); }
+
+ // iterators
+ /**
+ * Returns a read/write iterator that points to the first element in the
+ * %deque. Iteration is done in ordinary element order.
+ */
+ iterator
+ begin()
+ { return this->_M_impl._M_start; }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %deque. Iteration is done in ordinary element order.
+ */
+ const_iterator
+ begin() const
+ { return this->_M_impl._M_start; }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * element in the %deque. Iteration is done in ordinary
+ * element order.
+ */
+ iterator
+ end()
+ { return this->_M_impl._M_finish; }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %deque. Iteration is done in
+ * ordinary element order.
+ */
+ const_iterator
+ end() const
+ { return this->_M_impl._M_finish; }
+
+ /**
+ * Returns a read/write reverse iterator that points to the
+ * last element in the %deque. Iteration is done in reverse
+ * element order.
+ */
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(this->_M_impl._M_finish); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last element in the %deque. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(this->_M_impl._M_finish); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one
+ * before the first element in the %deque. Iteration is done
+ * in reverse element order.
+ */
+ reverse_iterator
+ rend()
+ { return reverse_iterator(this->_M_impl._M_start); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first element in the %deque. Iteration is
+ * done in reverse element order.
+ */
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(this->_M_impl._M_start); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %deque. Iteration is done in ordinary element order.
+ */
+ const_iterator
+ cbegin() const
+ { return this->_M_impl._M_start; }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %deque. Iteration is done in
+ * ordinary element order.
+ */
+ const_iterator
+ cend() const
+ { return this->_M_impl._M_finish; }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last element in the %deque. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(this->_M_impl._M_finish); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first element in the %deque. Iteration is
+ * done in reverse element order.
+ */
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(this->_M_impl._M_start); }
+#endif
+
+ // [23.2.1.2] capacity
+ /** Returns the number of elements in the %deque. */
+ size_type
+ size() const
+ { return this->_M_impl._M_finish - this->_M_impl._M_start; }
+
+ /** Returns the size() of the largest possible %deque. */
+ size_type
+ max_size() const
+ { return _M_get_Tp_allocator().max_size(); }
+
+ /**
+ * @brief Resizes the %deque to the specified number of elements.
+ * @param new_size Number of elements the %deque should contain.
+ * @param x Data with which new elements should be populated.
+ *
+ * This function will %resize the %deque to the specified
+ * number of elements. If the number is smaller than the
+ * %deque's current size the %deque is truncated, otherwise the
+ * %deque is extended and new elements are populated with given
+ * data.
+ */
+ void
+ resize(size_type __new_size, value_type __x = value_type())
+ {
+ const size_type __len = size();
+ if (__new_size < __len)
+ _M_erase_at_end(this->_M_impl._M_start + difference_type(__new_size));
+ else
+ insert(this->_M_impl._M_finish, __new_size - __len, __x);
+ }
+
+ /**
+ * Returns true if the %deque is empty. (Thus begin() would
+ * equal end().)
+ */
+ bool
+ empty() const
+ { return this->_M_impl._M_finish == this->_M_impl._M_start; }
+
+ // element access
+ /**
+ * @brief Subscript access to the data contained in the %deque.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read/write reference to data.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().)
+ */
+ reference
+ operator[](size_type __n)
+ { return this->_M_impl._M_start[difference_type(__n)]; }
+
+ /**
+ * @brief Subscript access to the data contained in the %deque.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read-only (constant) reference to data.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().)
+ */
+ const_reference
+ operator[](size_type __n) const
+ { return this->_M_impl._M_start[difference_type(__n)]; }
+
+ protected:
+ /// Safety check used only from at().
+ void
+ _M_range_check(size_type __n) const
+ {
+ if (__n >= this->size())
+ __throw_out_of_range(__N("deque::_M_range_check"));
+ }
+
+ public:
+ /**
+ * @brief Provides access to the data contained in the %deque.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read/write reference to data.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter
+ * is first checked that it is in the range of the deque. The
+ * function throws out_of_range if the check fails.
+ */
+ reference
+ at(size_type __n)
+ {
+ _M_range_check(__n);
+ return (*this)[__n];
+ }
+
+ /**
+ * @brief Provides access to the data contained in the %deque.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read-only (constant) reference to data.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter is first
+ * checked that it is in the range of the deque. The function throws
+ * out_of_range if the check fails.
+ */
+ const_reference
+ at(size_type __n) const
+ {
+ _M_range_check(__n);
+ return (*this)[__n];
+ }
+
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %deque.
+ */
+ reference
+ front()
+ { return *begin(); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %deque.
+ */
+ const_reference
+ front() const
+ { return *begin(); }
+
+ /**
+ * Returns a read/write reference to the data at the last element of the
+ * %deque.
+ */
+ reference
+ back()
+ {
+ iterator __tmp = end();
+ --__tmp;
+ return *__tmp;
+ }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the last
+ * element of the %deque.
+ */
+ const_reference
+ back() const
+ {
+ const_iterator __tmp = end();
+ --__tmp;
+ return *__tmp;
+ }
+
+ // [23.2.1.2] modifiers
+ /**
+ * @brief Add data to the front of the %deque.
+ * @param x Data to be added.
+ *
+ * This is a typical stack operation. The function creates an
+ * element at the front of the %deque and assigns the given
+ * data to it. Due to the nature of a %deque this operation
+ * can be done in constant time.
+ */
+ void
+ push_front(const value_type& __x)
+ {
+ if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
+ {
+ this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1, __x);
+ --this->_M_impl._M_start._M_cur;
+ }
+ else
+ _M_push_front_aux(__x);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_front(value_type&& __x)
+ { emplace_front(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_front(_Args&&... __args);
+#endif
+
+ /**
+ * @brief Add data to the end of the %deque.
+ * @param x Data to be added.
+ *
+ * This is a typical stack operation. The function creates an
+ * element at the end of the %deque and assigns the given data
+ * to it. Due to the nature of a %deque this operation can be
+ * done in constant time.
+ */
+ void
+ push_back(const value_type& __x)
+ {
+ if (this->_M_impl._M_finish._M_cur
+ != this->_M_impl._M_finish._M_last - 1)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __x);
+ ++this->_M_impl._M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux(__x);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(value_type&& __x)
+ { emplace_back(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_back(_Args&&... __args);
+#endif
+
+ /**
+ * @brief Removes first element.
+ *
+ * This is a typical stack operation. It shrinks the %deque by one.
+ *
+ * Note that no data is returned, and if the first element's data is
+ * needed, it should be retrieved before pop_front() is called.
+ */
+ void
+ pop_front()
+ {
+ if (this->_M_impl._M_start._M_cur
+ != this->_M_impl._M_start._M_last - 1)
+ {
+ this->_M_impl.destroy(this->_M_impl._M_start._M_cur);
+ ++this->_M_impl._M_start._M_cur;
+ }
+ else
+ _M_pop_front_aux();
+ }
+
+ /**
+ * @brief Removes last element.
+ *
+ * This is a typical stack operation. It shrinks the %deque by one.
+ *
+ * Note that no data is returned, and if the last element's data is
+ * needed, it should be retrieved before pop_back() is called.
+ */
+ void
+ pop_back()
+ {
+ if (this->_M_impl._M_finish._M_cur
+ != this->_M_impl._M_finish._M_first)
+ {
+ --this->_M_impl._M_finish._M_cur;
+ this->_M_impl.destroy(this->_M_impl._M_finish._M_cur);
+ }
+ else
+ _M_pop_back_aux();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Inserts an object in %deque before specified iterator.
+ * @param position An iterator into the %deque.
+ * @param args Arguments.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert an object of type T constructed
+ * with T(std::forward<Args>(args)...) before the specified location.
+ */
+ template<typename... _Args>
+ iterator
+ emplace(iterator __position, _Args&&... __args);
+#endif
+
+ /**
+ * @brief Inserts given value into %deque before specified iterator.
+ * @param position An iterator into the %deque.
+ * @param x Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given value before the
+ * specified location.
+ */
+ iterator
+ insert(iterator __position, const value_type& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Inserts given rvalue into %deque before specified iterator.
+ * @param position An iterator into the %deque.
+ * @param x Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given rvalue before the
+ * specified location.
+ */
+ iterator
+ insert(iterator __position, value_type&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ /**
+ * @brief Inserts an initializer list into the %deque.
+ * @param p An iterator into the %deque.
+ * @param l An initializer_list.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a l into the %deque before the location
+ * specified by @a p. This is known as "list insert."
+ */
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Inserts a number of copies of given data into the %deque.
+ * @param position An iterator into the %deque.
+ * @param n Number of elements to be inserted.
+ * @param x Data to be inserted.
+ *
+ * This function will insert a specified number of copies of the given
+ * data before the location specified by @a position.
+ */
+ void
+ insert(iterator __position, size_type __n, const value_type& __x)
+ { _M_fill_insert(__position, __n, __x); }
+
+ /**
+ * @brief Inserts a range into the %deque.
+ * @param position An iterator into the %deque.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function will insert copies of the data in the range
+ * [first,last) into the %deque before the location specified
+ * by @a pos. This is known as "range insert."
+ */
+ template<typename _InputIterator>
+ void
+ insert(iterator __position, _InputIterator __first,
+ _InputIterator __last)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+
+ /**
+ * @brief Remove element at given position.
+ * @param position Iterator pointing to element to be erased.
+ * @return An iterator pointing to the next element (or end()).
+ *
+ * This function will erase the element at the given position and thus
+ * shorten the %deque by one.
+ *
+ * The user is cautioned that
+ * this function only erases the element, and that if the element is
+ * itself a pointer, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __position);
+
+ /**
+ * @brief Remove a range of elements.
+ * @param first Iterator pointing to the first element to be erased.
+ * @param last Iterator pointing to one past the last element to be
+ * erased.
+ * @return An iterator pointing to the element pointed to by @a last
+ * prior to erasing (or end()).
+ *
+ * This function will erase the elements in the range [first,last) and
+ * shorten the %deque accordingly.
+ *
+ * The user is cautioned that
+ * this function only erases the elements, and that if the elements
+ * themselves are pointers, the pointed-to memory is not touched in any
+ * way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last);
+
+ /**
+ * @brief Swaps data with another %deque.
+ * @param x A %deque of the same element and allocator types.
+ *
+ * This exchanges the elements between two deques in constant time.
+ * (Four pointers, so it should be quite fast.)
+ * Note that the global std::swap() function is specialized such that
+ * std::swap(d1,d2) will feed to this function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(deque&& __x)
+#else
+ swap(deque& __x)
+#endif
+ {
+ std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
+ std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
+ std::swap(this->_M_impl._M_map, __x._M_impl._M_map);
+ std::swap(this->_M_impl._M_map_size, __x._M_impl._M_map_size);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(),
+ __x._M_get_Tp_allocator());
+ }
+
+ /**
+ * Erases all the elements. Note that this function only erases the
+ * elements, and that if the elements themselves are pointers, the
+ * pointed-to memory is not touched in any way. Managing the pointer is
+ * the user's responsibility.
+ */
+ void
+ clear()
+ { _M_erase_at_end(begin()); }
+
+ protected:
+ // Internal constructor functions follow.
+
+ // called by the range constructor to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
+ {
+ _M_initialize_map(static_cast<size_type>(__n));
+ _M_fill_initialize(__x);
+ }
+
+ // called by the range constructor to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::
+ iterator_category _IterCategory;
+ _M_range_initialize(__first, __last, _IterCategory());
+ }
+
+ // called by the second initialize_dispatch above
+ //@{
+ /**
+ * @brief Fills the deque with whatever is in [first,last).
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @return Nothing.
+ *
+ * If the iterators are actually forward iterators (or better), then the
+ * memory layout can be done all at once. Else we move forward using
+ * push_back on each value from the iterator.
+ */
+ template<typename _InputIterator>
+ void
+ _M_range_initialize(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag);
+
+ // called by the second initialize_dispatch above
+ template<typename _ForwardIterator>
+ void
+ _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag);
+ //@}
+
+ /**
+ * @brief Fills the %deque with copies of value.
+ * @param value Initial value.
+ * @return Nothing.
+ * @pre _M_start and _M_finish have already been initialized,
+ * but none of the %deque's elements have yet been constructed.
+ *
+ * This function is called only when the user provides an explicit size
+ * (with or without an explicit exemplar value).
+ */
+ void
+ _M_fill_initialize(const value_type& __value);
+
+ // Internal assign functions follow. The *_aux functions do the actual
+ // assignment work for the range versions.
+
+ // called by the range assign to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign(__n, __val); }
+
+ // called by the range assign to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::
+ iterator_category _IterCategory;
+ _M_assign_aux(__first, __last, _IterCategory());
+ }
+
+ // called by the second assign_dispatch above
+ template<typename _InputIterator>
+ void
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag);
+
+ // called by the second assign_dispatch above
+ template<typename _ForwardIterator>
+ void
+ _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ const size_type __len = std::distance(__first, __last);
+ if (__len > size())
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, size());
+ std::copy(__first, __mid, begin());
+ insert(end(), __mid, __last);
+ }
+ else
+ _M_erase_at_end(std::copy(__first, __last, begin()));
+ }
+
+ // Called by assign(n,t), and the range assign when it turns out
+ // to be the same thing.
+ void
+ _M_fill_assign(size_type __n, const value_type& __val)
+ {
+ if (__n > size())
+ {
+ std::fill(begin(), end(), __val);
+ insert(end(), __n - size(), __val);
+ }
+ else
+ {
+ _M_erase_at_end(begin() + difference_type(__n));
+ std::fill(begin(), end(), __val);
+ }
+ }
+
+ //@{
+ /// Helper functions for push_* and pop_*.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ void _M_push_back_aux(const value_type&);
+
+ void _M_push_front_aux(const value_type&);
+#else
+ template<typename... _Args>
+ void _M_push_back_aux(_Args&&... __args);
+
+ template<typename... _Args>
+ void _M_push_front_aux(_Args&&... __args);
+#endif
+
+ void _M_pop_back_aux();
+
+ void _M_pop_front_aux();
+ //@}
+
+ // Internal insert functions follow. The *_aux functions do the actual
+ // insertion work when all shortcuts fail.
+
+ // called by the range insert to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_insert_dispatch(iterator __pos,
+ _Integer __n, _Integer __x, __true_type)
+ { _M_fill_insert(__pos, __n, __x); }
+
+ // called by the range insert to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_insert_dispatch(iterator __pos,
+ _InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::
+ iterator_category _IterCategory;
+ _M_range_insert_aux(__pos, __first, __last, _IterCategory());
+ }
+
+ // called by the second insert_dispatch above
+ template<typename _InputIterator>
+ void
+ _M_range_insert_aux(iterator __pos, _InputIterator __first,
+ _InputIterator __last, std::input_iterator_tag);
+
+ // called by the second insert_dispatch above
+ template<typename _ForwardIterator>
+ void
+ _M_range_insert_aux(iterator __pos, _ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag);
+
+ // Called by insert(p,n,x), and the range insert when it turns out to be
+ // the same thing. Can use fill functions in optimal situations,
+ // otherwise passes off to insert_aux(p,n,x).
+ void
+ _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
+
+ // called by insert(p,x)
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ iterator
+ _M_insert_aux(iterator __pos, const value_type& __x);
+#else
+ template<typename... _Args>
+ iterator
+ _M_insert_aux(iterator __pos, _Args&&... __args);
+#endif
+
+ // called by insert(p,n,x) via fill_insert
+ void
+ _M_insert_aux(iterator __pos, size_type __n, const value_type& __x);
+
+ // called by range_insert_aux for forward iterators
+ template<typename _ForwardIterator>
+ void
+ _M_insert_aux(iterator __pos,
+ _ForwardIterator __first, _ForwardIterator __last,
+ size_type __n);
+
+
+ // Internal erase functions follow.
+
+ void
+ _M_destroy_data_aux(iterator __first, iterator __last);
+
+ // Called by ~deque().
+ // NB: Doesn't deallocate the nodes.
+ template<typename _Alloc1>
+ void
+ _M_destroy_data(iterator __first, iterator __last, const _Alloc1&)
+ { _M_destroy_data_aux(__first, __last); }
+
+ void
+ _M_destroy_data(iterator __first, iterator __last,
+ const std::allocator<_Tp>&)
+ {
+ if (!__has_trivial_destructor(value_type))
+ _M_destroy_data_aux(__first, __last);
+ }
+
+ // Called by erase(q1, q2).
+ void
+ _M_erase_at_begin(iterator __pos)
+ {
+ _M_destroy_data(begin(), __pos, _M_get_Tp_allocator());
+ _M_destroy_nodes(this->_M_impl._M_start._M_node, __pos._M_node);
+ this->_M_impl._M_start = __pos;
+ }
+
+ // Called by erase(q1, q2), resize(), clear(), _M_assign_aux,
+ // _M_fill_assign, operator=.
+ void
+ _M_erase_at_end(iterator __pos)
+ {
+ _M_destroy_data(__pos, end(), _M_get_Tp_allocator());
+ _M_destroy_nodes(__pos._M_node + 1,
+ this->_M_impl._M_finish._M_node + 1);
+ this->_M_impl._M_finish = __pos;
+ }
+
+ //@{
+ /// Memory-handling helpers for the previous internal insert functions.
+ iterator
+ _M_reserve_elements_at_front(size_type __n)
+ {
+ const size_type __vacancies = this->_M_impl._M_start._M_cur
+ - this->_M_impl._M_start._M_first;
+ if (__n > __vacancies)
+ _M_new_elements_at_front(__n - __vacancies);
+ return this->_M_impl._M_start - difference_type(__n);
+ }
+
+ iterator
+ _M_reserve_elements_at_back(size_type __n)
+ {
+ const size_type __vacancies = (this->_M_impl._M_finish._M_last
+ - this->_M_impl._M_finish._M_cur) - 1;
+ if (__n > __vacancies)
+ _M_new_elements_at_back(__n - __vacancies);
+ return this->_M_impl._M_finish + difference_type(__n);
+ }
+
+ void
+ _M_new_elements_at_front(size_type __new_elements);
+
+ void
+ _M_new_elements_at_back(size_type __new_elements);
+ //@}
+
+
+ //@{
+ /**
+ * @brief Memory-handling helpers for the major %map.
+ *
+ * Makes sure the _M_map has space for new nodes. Does not
+ * actually add the nodes. Can invalidate _M_map pointers.
+ * (And consequently, %deque iterators.)
+ */
+ void
+ _M_reserve_map_at_back(size_type __nodes_to_add = 1)
+ {
+ if (__nodes_to_add + 1 > this->_M_impl._M_map_size
+ - (this->_M_impl._M_finish._M_node - this->_M_impl._M_map))
+ _M_reallocate_map(__nodes_to_add, false);
+ }
+
+ void
+ _M_reserve_map_at_front(size_type __nodes_to_add = 1)
+ {
+ if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node
+ - this->_M_impl._M_map))
+ _M_reallocate_map(__nodes_to_add, true);
+ }
+
+ void
+ _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
+ //@}
+ };
+
+
+ /**
+ * @brief Deque equality comparison.
+ * @param x A %deque.
+ * @param y A %deque of the same type as @a x.
+ * @return True iff the size and elements of the deques are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the
+ * deques. Deques are considered equivalent if their sizes are equal,
+ * and if corresponding elements compare equal.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const deque<_Tp, _Alloc>& __x,
+ const deque<_Tp, _Alloc>& __y)
+ { return __x.size() == __y.size()
+ && std::equal(__x.begin(), __x.end(), __y.begin()); }
+
+ /**
+ * @brief Deque ordering relation.
+ * @param x A %deque.
+ * @param y A %deque of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * deques. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const deque<_Tp, _Alloc>& __x,
+ const deque<_Tp, _Alloc>& __y)
+ { return std::lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()); }
+
+ /// Based on operator==
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const deque<_Tp, _Alloc>& __x,
+ const deque<_Tp, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const deque<_Tp, _Alloc>& __x,
+ const deque<_Tp, _Alloc>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const deque<_Tp, _Alloc>& __x,
+ const deque<_Tp, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const deque<_Tp, _Alloc>& __x,
+ const deque<_Tp, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::deque::swap().
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp,_Alloc>&& __x, deque<_Tp,_Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_DEQUE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_function.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_function.h
new file mode 100644
index 000000000..b2569d517
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_function.h
@@ -0,0 +1,715 @@
+// Functor implementations -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_function.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_FUNCTION_H
+#define _STL_FUNCTION_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 20.3.1 base classes
+ /** @defgroup functors Function Objects
+ * @ingroup utilities
+ *
+ * Function objects, or @e functors, are objects with an @c operator()
+ * defined and accessible. They can be passed as arguments to algorithm
+ * templates and used in place of a function pointer. Not only is the
+ * resulting expressiveness of the library increased, but the generated
+ * code can be more efficient than what you might write by hand. When we
+ * refer to "functors," then, generally we include function pointers in
+ * the description as well.
+ *
+ * Often, functors are only created as temporaries passed to algorithm
+ * calls, rather than being created as named variables.
+ *
+ * Two examples taken from the standard itself follow. To perform a
+ * by-element addition of two vectors @c a and @c b containing @c double,
+ * and put the result in @c a, use
+ * \code
+ * transform (a.begin(), a.end(), b.begin(), a.begin(), plus<double>());
+ * \endcode
+ * To negate every element in @c a, use
+ * \code
+ * transform(a.begin(), a.end(), a.begin(), negate<double>());
+ * \endcode
+ * The addition and negation functions will be inlined directly.
+ *
+ * The standard functors are derived from structs named @c unary_function
+ * and @c binary_function. These two classes contain nothing but typedefs,
+ * to aid in generic (template) programming. If you write your own
+ * functors, you might consider doing the same.
+ *
+ * @{
+ */
+ /**
+ * This is one of the @link functors functor base classes@endlink.
+ */
+ template<typename _Arg, typename _Result>
+ struct unary_function
+ {
+ typedef _Arg argument_type; ///< @c argument_type is the type of the
+ /// argument (no surprises here)
+
+ typedef _Result result_type; ///< @c result_type is the return type
+ };
+
+ /**
+ * This is one of the @link functors functor base classes@endlink.
+ */
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ struct binary_function
+ {
+ typedef _Arg1 first_argument_type; ///< the type of the first argument
+ /// (no surprises here)
+
+ typedef _Arg2 second_argument_type; ///< the type of the second argument
+ typedef _Result result_type; ///< type of the return type
+ };
+ /** @} */
+
+ // 20.3.2 arithmetic
+ /** @defgroup arithmetic_functors Arithmetic Classes
+ * @ingroup functors
+ *
+ * Because basic math often needs to be done during an algorithm,
+ * the library provides functors for those operations. See the
+ * documentation for @link functors the base classes@endlink
+ * for examples of their use.
+ *
+ * @{
+ */
+ /// One of the @link arithmetic_functors math functors@endlink.
+ template<typename _Tp>
+ struct plus : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x + __y; }
+ };
+
+ /// One of the @link arithmetic_functors math functors@endlink.
+ template<typename _Tp>
+ struct minus : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x - __y; }
+ };
+
+ /// One of the @link arithmetic_functors math functors@endlink.
+ template<typename _Tp>
+ struct multiplies : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x * __y; }
+ };
+
+ /// One of the @link arithmetic_functors math functors@endlink.
+ template<typename _Tp>
+ struct divides : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x / __y; }
+ };
+
+ /// One of the @link arithmetic_functors math functors@endlink.
+ template<typename _Tp>
+ struct modulus : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x % __y; }
+ };
+
+ /// One of the @link arithmetic_functors math functors@endlink.
+ template<typename _Tp>
+ struct negate : public unary_function<_Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x) const
+ { return -__x; }
+ };
+ /** @} */
+
+ // 20.3.3 comparisons
+ /** @defgroup comparison_functors Comparison Classes
+ * @ingroup functors
+ *
+ * The library provides six wrapper functors for all the basic comparisons
+ * in C++, like @c <.
+ *
+ * @{
+ */
+ /// One of the @link comparison_functors comparison functors@endlink.
+ template<typename _Tp>
+ struct equal_to : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x == __y; }
+ };
+
+ /// One of the @link comparison_functors comparison functors@endlink.
+ template<typename _Tp>
+ struct not_equal_to : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x != __y; }
+ };
+
+ /// One of the @link comparison_functors comparison functors@endlink.
+ template<typename _Tp>
+ struct greater : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x > __y; }
+ };
+
+ /// One of the @link comparison_functors comparison functors@endlink.
+ template<typename _Tp>
+ struct less : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x < __y; }
+ };
+
+ /// One of the @link comparison_functors comparison functors@endlink.
+ template<typename _Tp>
+ struct greater_equal : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x >= __y; }
+ };
+
+ /// One of the @link comparison_functors comparison functors@endlink.
+ template<typename _Tp>
+ struct less_equal : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x <= __y; }
+ };
+ /** @} */
+
+ // 20.3.4 logical operations
+ /** @defgroup logical_functors Boolean Operations Classes
+ * @ingroup functors
+ *
+ * Here are wrapper functors for Boolean operations: @c &&, @c ||,
+ * and @c !.
+ *
+ * @{
+ */
+ /// One of the @link logical_functors Boolean operations functors@endlink.
+ template<typename _Tp>
+ struct logical_and : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x && __y; }
+ };
+
+ /// One of the @link logical_functors Boolean operations functors@endlink.
+ template<typename _Tp>
+ struct logical_or : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x || __y; }
+ };
+
+ /// One of the @link logical_functors Boolean operations functors@endlink.
+ template<typename _Tp>
+ struct logical_not : public unary_function<_Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x) const
+ { return !__x; }
+ };
+ /** @} */
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 660. Missing Bitwise Operations.
+ template<typename _Tp>
+ struct bit_and : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x & __y; }
+ };
+
+ template<typename _Tp>
+ struct bit_or : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x | __y; }
+ };
+
+ template<typename _Tp>
+ struct bit_xor : public binary_function<_Tp, _Tp, _Tp>
+ {
+ _Tp
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x ^ __y; }
+ };
+
+ // 20.3.5 negators
+ /** @defgroup negators Negators
+ * @ingroup functors
+ *
+ * The functions @c not1 and @c not2 each take a predicate functor
+ * and return an instance of @c unary_negate or
+ * @c binary_negate, respectively. These classes are functors whose
+ * @c operator() performs the stored predicate function and then returns
+ * the negation of the result.
+ *
+ * For example, given a vector of integers and a trivial predicate,
+ * \code
+ * struct IntGreaterThanThree
+ * : public std::unary_function<int, bool>
+ * {
+ * bool operator() (int x) { return x > 3; }
+ * };
+ *
+ * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree()));
+ * \endcode
+ * The call to @c find_if will locate the first index (i) of @c v for which
+ * "!(v[i] > 3)" is true.
+ *
+ * The not1/unary_negate combination works on predicates taking a single
+ * argument. The not2/binary_negate combination works on predicates which
+ * take two arguments.
+ *
+ * @{
+ */
+ /// One of the @link negators negation functors@endlink.
+ template<typename _Predicate>
+ class unary_negate
+ : public unary_function<typename _Predicate::argument_type, bool>
+ {
+ protected:
+ _Predicate _M_pred;
+
+ public:
+ explicit
+ unary_negate(const _Predicate& __x) : _M_pred(__x) { }
+
+ bool
+ operator()(const typename _Predicate::argument_type& __x) const
+ { return !_M_pred(__x); }
+ };
+
+ /// One of the @link negators negation functors@endlink.
+ template<typename _Predicate>
+ inline unary_negate<_Predicate>
+ not1(const _Predicate& __pred)
+ { return unary_negate<_Predicate>(__pred); }
+
+ /// One of the @link negators negation functors@endlink.
+ template<typename _Predicate>
+ class binary_negate
+ : public binary_function<typename _Predicate::first_argument_type,
+ typename _Predicate::second_argument_type, bool>
+ {
+ protected:
+ _Predicate _M_pred;
+
+ public:
+ explicit
+ binary_negate(const _Predicate& __x) : _M_pred(__x) { }
+
+ bool
+ operator()(const typename _Predicate::first_argument_type& __x,
+ const typename _Predicate::second_argument_type& __y) const
+ { return !_M_pred(__x, __y); }
+ };
+
+ /// One of the @link negators negation functors@endlink.
+ template<typename _Predicate>
+ inline binary_negate<_Predicate>
+ not2(const _Predicate& __pred)
+ { return binary_negate<_Predicate>(__pred); }
+ /** @} */
+
+ // 20.3.7 adaptors pointers functions
+ /** @defgroup pointer_adaptors Adaptors for pointers to functions
+ * @ingroup functors
+ *
+ * The advantage of function objects over pointers to functions is that
+ * the objects in the standard library declare nested typedefs describing
+ * their argument and result types with uniform names (e.g., @c result_type
+ * from the base classes @c unary_function and @c binary_function).
+ * Sometimes those typedefs are required, not just optional.
+ *
+ * Adaptors are provided to turn pointers to unary (single-argument) and
+ * binary (double-argument) functions into function objects. The
+ * long-winded functor @c pointer_to_unary_function is constructed with a
+ * function pointer @c f, and its @c operator() called with argument @c x
+ * returns @c f(x). The functor @c pointer_to_binary_function does the same
+ * thing, but with a double-argument @c f and @c operator().
+ *
+ * The function @c ptr_fun takes a pointer-to-function @c f and constructs
+ * an instance of the appropriate functor.
+ *
+ * @{
+ */
+ /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
+ template<typename _Arg, typename _Result>
+ class pointer_to_unary_function : public unary_function<_Arg, _Result>
+ {
+ protected:
+ _Result (*_M_ptr)(_Arg);
+
+ public:
+ pointer_to_unary_function() { }
+
+ explicit
+ pointer_to_unary_function(_Result (*__x)(_Arg))
+ : _M_ptr(__x) { }
+
+ _Result
+ operator()(_Arg __x) const
+ { return _M_ptr(__x); }
+ };
+
+ /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
+ template<typename _Arg, typename _Result>
+ inline pointer_to_unary_function<_Arg, _Result>
+ ptr_fun(_Result (*__x)(_Arg))
+ { return pointer_to_unary_function<_Arg, _Result>(__x); }
+
+ /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ class pointer_to_binary_function
+ : public binary_function<_Arg1, _Arg2, _Result>
+ {
+ protected:
+ _Result (*_M_ptr)(_Arg1, _Arg2);
+
+ public:
+ pointer_to_binary_function() { }
+
+ explicit
+ pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
+ : _M_ptr(__x) { }
+
+ _Result
+ operator()(_Arg1 __x, _Arg2 __y) const
+ { return _M_ptr(__x, __y); }
+ };
+
+ /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ inline pointer_to_binary_function<_Arg1, _Arg2, _Result>
+ ptr_fun(_Result (*__x)(_Arg1, _Arg2))
+ { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); }
+ /** @} */
+
+ template<typename _Tp>
+ struct _Identity : public unary_function<_Tp,_Tp>
+ {
+ _Tp&
+ operator()(_Tp& __x) const
+ { return __x; }
+
+ const _Tp&
+ operator()(const _Tp& __x) const
+ { return __x; }
+ };
+
+ template<typename _Pair>
+ struct _Select1st : public unary_function<_Pair,
+ typename _Pair::first_type>
+ {
+ typename _Pair::first_type&
+ operator()(_Pair& __x) const
+ { return __x.first; }
+
+ const typename _Pair::first_type&
+ operator()(const _Pair& __x) const
+ { return __x.first; }
+ };
+
+ template<typename _Pair>
+ struct _Select2nd : public unary_function<_Pair,
+ typename _Pair::second_type>
+ {
+ typename _Pair::second_type&
+ operator()(_Pair& __x) const
+ { return __x.second; }
+
+ const typename _Pair::second_type&
+ operator()(const _Pair& __x) const
+ { return __x.second; }
+ };
+
+ // 20.3.8 adaptors pointers members
+ /** @defgroup memory_adaptors Adaptors for pointers to members
+ * @ingroup functors
+ *
+ * There are a total of 8 = 2^3 function objects in this family.
+ * (1) Member functions taking no arguments vs member functions taking
+ * one argument.
+ * (2) Call through pointer vs call through reference.
+ * (3) Const vs non-const member function.
+ *
+ * All of this complexity is in the function objects themselves. You can
+ * ignore it by using the helper function mem_fun and mem_fun_ref,
+ * which create whichever type of adaptor is appropriate.
+ *
+ * @{
+ */
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp>
+ class mem_fun_t : public unary_function<_Tp*, _Ret>
+ {
+ public:
+ explicit
+ mem_fun_t(_Ret (_Tp::*__pf)())
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(_Tp* __p) const
+ { return (__p->*_M_f)(); }
+
+ private:
+ _Ret (_Tp::*_M_f)();
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp>
+ class const_mem_fun_t : public unary_function<const _Tp*, _Ret>
+ {
+ public:
+ explicit
+ const_mem_fun_t(_Ret (_Tp::*__pf)() const)
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(const _Tp* __p) const
+ { return (__p->*_M_f)(); }
+
+ private:
+ _Ret (_Tp::*_M_f)() const;
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp>
+ class mem_fun_ref_t : public unary_function<_Tp, _Ret>
+ {
+ public:
+ explicit
+ mem_fun_ref_t(_Ret (_Tp::*__pf)())
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(_Tp& __r) const
+ { return (__r.*_M_f)(); }
+
+ private:
+ _Ret (_Tp::*_M_f)();
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp>
+ class const_mem_fun_ref_t : public unary_function<_Tp, _Ret>
+ {
+ public:
+ explicit
+ const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(const _Tp& __r) const
+ { return (__r.*_M_f)(); }
+
+ private:
+ _Ret (_Tp::*_M_f)() const;
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp, typename _Arg>
+ class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret>
+ {
+ public:
+ explicit
+ mem_fun1_t(_Ret (_Tp::*__pf)(_Arg))
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(_Tp* __p, _Arg __x) const
+ { return (__p->*_M_f)(__x); }
+
+ private:
+ _Ret (_Tp::*_M_f)(_Arg);
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp, typename _Arg>
+ class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret>
+ {
+ public:
+ explicit
+ const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(const _Tp* __p, _Arg __x) const
+ { return (__p->*_M_f)(__x); }
+
+ private:
+ _Ret (_Tp::*_M_f)(_Arg) const;
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp, typename _Arg>
+ class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>
+ {
+ public:
+ explicit
+ mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg))
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(_Tp& __r, _Arg __x) const
+ { return (__r.*_M_f)(__x); }
+
+ private:
+ _Ret (_Tp::*_M_f)(_Arg);
+ };
+
+ /// One of the @link memory_adaptors adaptors for member
+ /// pointers@endlink.
+ template<typename _Ret, typename _Tp, typename _Arg>
+ class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>
+ {
+ public:
+ explicit
+ const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)
+ : _M_f(__pf) { }
+
+ _Ret
+ operator()(const _Tp& __r, _Arg __x) const
+ { return (__r.*_M_f)(__x); }
+
+ private:
+ _Ret (_Tp::*_M_f)(_Arg) const;
+ };
+
+ // Mem_fun adaptor helper functions. There are only two:
+ // mem_fun and mem_fun_ref.
+ template<typename _Ret, typename _Tp>
+ inline mem_fun_t<_Ret, _Tp>
+ mem_fun(_Ret (_Tp::*__f)())
+ { return mem_fun_t<_Ret, _Tp>(__f); }
+
+ template<typename _Ret, typename _Tp>
+ inline const_mem_fun_t<_Ret, _Tp>
+ mem_fun(_Ret (_Tp::*__f)() const)
+ { return const_mem_fun_t<_Ret, _Tp>(__f); }
+
+ template<typename _Ret, typename _Tp>
+ inline mem_fun_ref_t<_Ret, _Tp>
+ mem_fun_ref(_Ret (_Tp::*__f)())
+ { return mem_fun_ref_t<_Ret, _Tp>(__f); }
+
+ template<typename _Ret, typename _Tp>
+ inline const_mem_fun_ref_t<_Ret, _Tp>
+ mem_fun_ref(_Ret (_Tp::*__f)() const)
+ { return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
+
+ template<typename _Ret, typename _Tp, typename _Arg>
+ inline mem_fun1_t<_Ret, _Tp, _Arg>
+ mem_fun(_Ret (_Tp::*__f)(_Arg))
+ { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+ template<typename _Ret, typename _Tp, typename _Arg>
+ inline const_mem_fun1_t<_Ret, _Tp, _Arg>
+ mem_fun(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+ template<typename _Ret, typename _Tp, typename _Arg>
+ inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
+ { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+ template<typename _Ret, typename _Tp, typename _Arg>
+ inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+ /** @} */
+
+_GLIBCXX_END_NAMESPACE
+
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
+# include <backward/binders.h>
+#endif
+
+#endif /* _STL_FUNCTION_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_heap.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_heap.h
new file mode 100644
index 000000000..9348fe970
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_heap.h
@@ -0,0 +1,578 @@
+// Heap implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_heap.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_HEAP_H
+#define _STL_HEAP_H 1
+
+#include <debug/debug.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @defgroup heap_algorithms Heap Algorithms
+ * @ingroup sorting_algorithms
+ */
+
+ template<typename _RandomAccessIterator, typename _Distance>
+ _Distance
+ __is_heap_until(_RandomAccessIterator __first, _Distance __n)
+ {
+ _Distance __parent = 0;
+ for (_Distance __child = 1; __child < __n; ++__child)
+ {
+ if (__first[__parent] < __first[__child])
+ return __child;
+ if ((__child & 1) == 0)
+ ++__parent;
+ }
+ return __n;
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance,
+ typename _Compare>
+ _Distance
+ __is_heap_until(_RandomAccessIterator __first, _Distance __n,
+ _Compare __comp)
+ {
+ _Distance __parent = 0;
+ for (_Distance __child = 1; __child < __n; ++__child)
+ {
+ if (__comp(__first[__parent], __first[__child]))
+ return __child;
+ if ((__child & 1) == 0)
+ ++__parent;
+ }
+ return __n;
+ }
+
+ // __is_heap, a predicate testing whether or not a range is a heap.
+ // This function is an extension, not part of the C++ standard.
+ template<typename _RandomAccessIterator, typename _Distance>
+ inline bool
+ __is_heap(_RandomAccessIterator __first, _Distance __n)
+ { return std::__is_heap_until(__first, __n) == __n; }
+
+ template<typename _RandomAccessIterator, typename _Compare,
+ typename _Distance>
+ inline bool
+ __is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n)
+ { return std::__is_heap_until(__first, __n, __comp) == __n; }
+
+ template<typename _RandomAccessIterator>
+ inline bool
+ __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ { return std::__is_heap(__first, std::distance(__first, __last)); }
+
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline bool
+ __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ { return std::__is_heap(__first, __comp, std::distance(__first, __last)); }
+
+ // Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap,
+ // + is_heap and is_heap_until in C++0x.
+
+ template<typename _RandomAccessIterator, typename _Distance, typename _Tp>
+ void
+ __push_heap(_RandomAccessIterator __first,
+ _Distance __holeIndex, _Distance __topIndex, _Tp __value)
+ {
+ _Distance __parent = (__holeIndex - 1) / 2;
+ while (__holeIndex > __topIndex && *(__first + __parent) < __value)
+ {
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
+ __holeIndex = __parent;
+ __parent = (__holeIndex - 1) / 2;
+ }
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(__value);
+ }
+
+ /**
+ * @brief Push an element onto a heap.
+ * @param first Start of heap.
+ * @param last End of heap + element.
+ * @ingroup heap_algorithms
+ *
+ * This operation pushes the element at last-1 onto the valid heap over the
+ * range [first,last-1). After completion, [first,last) is a valid heap.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_heap(__first, __last - 1);
+
+ _ValueType __value = _GLIBCXX_MOVE(*(__last - 1));
+ std::__push_heap(__first, _DistanceType((__last - __first) - 1),
+ _DistanceType(0), _GLIBCXX_MOVE(__value));
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance, typename _Tp,
+ typename _Compare>
+ void
+ __push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __topIndex, _Tp __value, _Compare __comp)
+ {
+ _Distance __parent = (__holeIndex - 1) / 2;
+ while (__holeIndex > __topIndex
+ && __comp(*(__first + __parent), __value))
+ {
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
+ __holeIndex = __parent;
+ __parent = (__holeIndex - 1) / 2;
+ }
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(__value);
+ }
+
+ /**
+ * @brief Push an element onto a heap using comparison functor.
+ * @param first Start of heap.
+ * @param last End of heap + element.
+ * @param comp Comparison functor.
+ * @ingroup heap_algorithms
+ *
+ * This operation pushes the element at last-1 onto the valid heap over the
+ * range [first,last-1). After completion, [first,last) is a valid heap.
+ * Compare operations are performed using comp.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_heap_pred(__first, __last - 1, __comp);
+
+ _ValueType __value = _GLIBCXX_MOVE(*(__last - 1));
+ std::__push_heap(__first, _DistanceType((__last - __first) - 1),
+ _DistanceType(0), _GLIBCXX_MOVE(__value), __comp);
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance, typename _Tp>
+ void
+ __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __value)
+ {
+ const _Distance __topIndex = __holeIndex;
+ _Distance __secondChild = __holeIndex;
+ while (__secondChild < (__len - 1) / 2)
+ {
+ __secondChild = 2 * (__secondChild + 1);
+ if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
+ __secondChild--;
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));
+ __holeIndex = __secondChild;
+ }
+ if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2)
+ {
+ __secondChild = 2 * (__secondChild + 1);
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first
+ + (__secondChild - 1)));
+ __holeIndex = __secondChild - 1;
+ }
+ std::__push_heap(__first, __holeIndex, __topIndex,
+ _GLIBCXX_MOVE(__value));
+ }
+
+ template<typename _RandomAccessIterator>
+ inline void
+ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomAccessIterator __result)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ _ValueType __value = _GLIBCXX_MOVE(*__result);
+ *__result = _GLIBCXX_MOVE(*__first);
+ std::__adjust_heap(__first, _DistanceType(0),
+ _DistanceType(__last - __first),
+ _GLIBCXX_MOVE(__value));
+ }
+
+ /**
+ * @brief Pop an element off a heap.
+ * @param first Start of heap.
+ * @param last End of heap.
+ * @ingroup heap_algorithms
+ *
+ * This operation pops the top of the heap. The elements first and last-1
+ * are swapped and [first,last-1) is made into a heap.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_heap(__first, __last);
+
+ --__last;
+ std::__pop_heap(__first, __last, __last);
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance,
+ typename _Tp, typename _Compare>
+ void
+ __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
+ _Distance __len, _Tp __value, _Compare __comp)
+ {
+ const _Distance __topIndex = __holeIndex;
+ _Distance __secondChild = __holeIndex;
+ while (__secondChild < (__len - 1) / 2)
+ {
+ __secondChild = 2 * (__secondChild + 1);
+ if (__comp(*(__first + __secondChild),
+ *(__first + (__secondChild - 1))))
+ __secondChild--;
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));
+ __holeIndex = __secondChild;
+ }
+ if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2)
+ {
+ __secondChild = 2 * (__secondChild + 1);
+ *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first
+ + (__secondChild - 1)));
+ __holeIndex = __secondChild - 1;
+ }
+ std::__push_heap(__first, __holeIndex, __topIndex,
+ _GLIBCXX_MOVE(__value), __comp);
+ }
+
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _RandomAccessIterator __result, _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ _ValueType __value = _GLIBCXX_MOVE(*__result);
+ *__result = _GLIBCXX_MOVE(*__first);
+ std::__adjust_heap(__first, _DistanceType(0),
+ _DistanceType(__last - __first),
+ _GLIBCXX_MOVE(__value), __comp);
+ }
+
+ /**
+ * @brief Pop an element off a heap using comparison functor.
+ * @param first Start of heap.
+ * @param last End of heap.
+ * @param comp Comparison functor to use.
+ * @ingroup heap_algorithms
+ *
+ * This operation pops the top of the heap. The elements first and last-1
+ * are swapped and [first,last-1) is made into a heap. Comparisons are
+ * made using comp.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ pop_heap(_RandomAccessIterator __first,
+ _RandomAccessIterator __last, _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_heap_pred(__first, __last, __comp);
+
+ --__last;
+ std::__pop_heap(__first, __last, __last, __comp);
+ }
+
+ /**
+ * @brief Construct a heap over a range.
+ * @param first Start of heap.
+ * @param last End of heap.
+ * @ingroup heap_algorithms
+ *
+ * This operation makes the elements in [first,last) into a heap.
+ */
+ template<typename _RandomAccessIterator>
+ void
+ make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__last - __first < 2)
+ return;
+
+ const _DistanceType __len = __last - __first;
+ _DistanceType __parent = (__len - 2) / 2;
+ while (true)
+ {
+ _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
+ std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value));
+ if (__parent == 0)
+ return;
+ __parent--;
+ }
+ }
+
+ /**
+ * @brief Construct a heap over a range using comparison functor.
+ * @param first Start of heap.
+ * @param last End of heap.
+ * @param comp Comparison functor to use.
+ * @ingroup heap_algorithms
+ *
+ * This operation makes the elements in [first,last) into a heap.
+ * Comparisons are made using comp.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__last - __first < 2)
+ return;
+
+ const _DistanceType __len = __last - __first;
+ _DistanceType __parent = (__len - 2) / 2;
+ while (true)
+ {
+ _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
+ std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
+ __comp);
+ if (__parent == 0)
+ return;
+ __parent--;
+ }
+ }
+
+ /**
+ * @brief Sort a heap.
+ * @param first Start of heap.
+ * @param last End of heap.
+ * @ingroup heap_algorithms
+ *
+ * This operation sorts the valid heap in the range [first,last).
+ */
+ template<typename _RandomAccessIterator>
+ void
+ sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_heap(__first, __last);
+
+ while (__last - __first > 1)
+ {
+ --__last;
+ std::__pop_heap(__first, __last, __last);
+ }
+ }
+
+ /**
+ * @brief Sort a heap using comparison functor.
+ * @param first Start of heap.
+ * @param last End of heap.
+ * @param comp Comparison functor to use.
+ * @ingroup heap_algorithms
+ *
+ * This operation sorts the valid heap in the range [first,last).
+ * Comparisons are made using comp.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_heap_pred(__first, __last, __comp);
+
+ while (__last - __first > 1)
+ {
+ --__last;
+ std::__pop_heap(__first, __last, __last, __comp);
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Search the end of a heap.
+ * @param first Start of range.
+ * @param last End of range.
+ * @return An iterator pointing to the first element not in the heap.
+ * @ingroup heap_algorithms
+ *
+ * This operation returns the last iterator i in [first, last) for which
+ * the range [first, i) is a heap.
+ */
+ template<typename _RandomAccessIterator>
+ inline _RandomAccessIterator
+ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return __first + std::__is_heap_until(__first, std::distance(__first,
+ __last));
+ }
+
+ /**
+ * @brief Search the end of a heap using comparison functor.
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp Comparison functor to use.
+ * @return An iterator pointing to the first element not in the heap.
+ * @ingroup heap_algorithms
+ *
+ * This operation returns the last iterator i in [first, last) for which
+ * the range [first, i) is a heap. Comparisons are made using comp.
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline _RandomAccessIterator
+ is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return __first + std::__is_heap_until(__first, std::distance(__first,
+ __last),
+ __comp);
+ }
+
+ /**
+ * @brief Determines whether a range is a heap.
+ * @param first Start of range.
+ * @param last End of range.
+ * @return True if range is a heap, false otherwise.
+ * @ingroup heap_algorithms
+ */
+ template<typename _RandomAccessIterator>
+ inline bool
+ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ { return std::is_heap_until(__first, __last) == __last; }
+
+ /**
+ * @brief Determines whether a range is a heap using comparison functor.
+ * @param first Start of range.
+ * @param last End of range.
+ * @param comp Comparison functor to use.
+ * @return True if range is a heap, false otherwise.
+ * @ingroup heap_algorithms
+ */
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline bool
+ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ { return std::is_heap_until(__first, __last, __comp) == __last; }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_HEAP_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator.h
new file mode 100644
index 000000000..129552f37
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator.h
@@ -0,0 +1,1041 @@
+// Iterators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_iterator.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ *
+ * This file implements reverse_iterator, back_insert_iterator,
+ * front_insert_iterator, insert_iterator, __normal_iterator, and their
+ * supporting functions and overloaded operators.
+ */
+
+#ifndef _STL_ITERATOR_H
+#define _STL_ITERATOR_H 1
+
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 24.4.1 Reverse iterators
+ /**
+ * "Bidirectional and random access iterators have corresponding reverse
+ * %iterator adaptors that iterate through the data structure in the
+ * opposite direction. They have the same signatures as the corresponding
+ * iterators. The fundamental relation between a reverse %iterator and its
+ * corresponding %iterator @c i is established by the identity:
+ * @code
+ * &*(reverse_iterator(i)) == &*(i - 1)
+ * @endcode
+ *
+ * This mapping is dictated by the fact that while there is always a
+ * pointer past the end of an array, there might not be a valid pointer
+ * before the beginning of an array." [24.4.1]/1,2
+ *
+ * Reverse iterators can be tricky and surprising at first. Their
+ * semantics make sense, however, and the trickiness is a side effect of
+ * the requirement that the iterators must be safe.
+ */
+ template<typename _Iterator>
+ class reverse_iterator
+ : public iterator<typename iterator_traits<_Iterator>::iterator_category,
+ typename iterator_traits<_Iterator>::value_type,
+ typename iterator_traits<_Iterator>::difference_type,
+ typename iterator_traits<_Iterator>::pointer,
+ typename iterator_traits<_Iterator>::reference>
+ {
+ protected:
+ _Iterator current;
+
+ public:
+ typedef _Iterator iterator_type;
+ typedef typename iterator_traits<_Iterator>::difference_type
+ difference_type;
+ typedef typename iterator_traits<_Iterator>::reference reference;
+ typedef typename iterator_traits<_Iterator>::pointer pointer;
+
+ public:
+ /**
+ * The default constructor default-initializes member @p current.
+ * If it is a pointer, that means it is zero-initialized.
+ */
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 235 No specification of default ctor for reverse_iterator
+ reverse_iterator() : current() { }
+
+ /**
+ * This %iterator will move in the opposite direction that @p x does.
+ */
+ explicit
+ reverse_iterator(iterator_type __x) : current(__x) { }
+
+ /**
+ * The copy constructor is normal.
+ */
+ reverse_iterator(const reverse_iterator& __x)
+ : current(__x.current) { }
+
+ /**
+ * A reverse_iterator across other types can be copied in the normal
+ * fashion.
+ */
+ template<typename _Iter>
+ reverse_iterator(const reverse_iterator<_Iter>& __x)
+ : current(__x.base()) { }
+
+ /**
+ * @return @c current, the %iterator used for underlying work.
+ */
+ iterator_type
+ base() const
+ { return current; }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reference
+ operator*() const
+ {
+ _Iterator __tmp = current;
+ return *--__tmp;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ pointer
+ operator->() const
+ { return &(operator*()); }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator&
+ operator++()
+ {
+ --current;
+ return *this;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator
+ operator++(int)
+ {
+ reverse_iterator __tmp = *this;
+ --current;
+ return __tmp;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator&
+ operator--()
+ {
+ ++current;
+ return *this;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator
+ operator--(int)
+ {
+ reverse_iterator __tmp = *this;
+ ++current;
+ return __tmp;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator
+ operator+(difference_type __n) const
+ { return reverse_iterator(current - __n); }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator&
+ operator+=(difference_type __n)
+ {
+ current -= __n;
+ return *this;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator
+ operator-(difference_type __n) const
+ { return reverse_iterator(current + __n); }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reverse_iterator&
+ operator-=(difference_type __n)
+ {
+ current += __n;
+ return *this;
+ }
+
+ /**
+ * @return TODO
+ *
+ * @doctodo
+ */
+ reference
+ operator[](difference_type __n) const
+ { return *(*this + __n); }
+ };
+
+ //@{
+ /**
+ * @param x A %reverse_iterator.
+ * @param y A %reverse_iterator.
+ * @return A simple bool.
+ *
+ * Reverse iterators forward many operations to their underlying base()
+ * iterators. Others are implemented in terms of one another.
+ *
+ */
+ template<typename _Iterator>
+ inline bool
+ operator==(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return __x.base() == __y.base(); }
+
+ template<typename _Iterator>
+ inline bool
+ operator<(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return __y.base() < __x.base(); }
+
+ template<typename _Iterator>
+ inline bool
+ operator!=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return !(__x == __y); }
+
+ template<typename _Iterator>
+ inline bool
+ operator>(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return __y < __x; }
+
+ template<typename _Iterator>
+ inline bool
+ operator<=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return !(__y < __x); }
+
+ template<typename _Iterator>
+ inline bool
+ operator>=(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return !(__x < __y); }
+
+ template<typename _Iterator>
+ inline typename reverse_iterator<_Iterator>::difference_type
+ operator-(const reverse_iterator<_Iterator>& __x,
+ const reverse_iterator<_Iterator>& __y)
+ { return __y.base() - __x.base(); }
+
+ template<typename _Iterator>
+ inline reverse_iterator<_Iterator>
+ operator+(typename reverse_iterator<_Iterator>::difference_type __n,
+ const reverse_iterator<_Iterator>& __x)
+ { return reverse_iterator<_Iterator>(__x.base() - __n); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 280. Comparison of reverse_iterator to const reverse_iterator.
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator==(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ { return __x.base() == __y.base(); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator<(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ { return __y.base() < __x.base(); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator!=(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ { return !(__x == __y); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator>(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ { return __y < __x; }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator<=(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ { return !(__y < __x); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator>=(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ { return !(__x < __y); }
+
+ template<typename _IteratorL, typename _IteratorR>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // DR 685.
+ inline auto
+ operator-(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+ -> decltype(__y.base() - __x.base())
+#else
+ inline typename reverse_iterator<_IteratorL>::difference_type
+ operator-(const reverse_iterator<_IteratorL>& __x,
+ const reverse_iterator<_IteratorR>& __y)
+#endif
+ { return __y.base() - __x.base(); }
+ //@}
+
+ // 24.4.2.2.1 back_insert_iterator
+ /**
+ * @brief Turns assignment into insertion.
+ *
+ * These are output iterators, constructed from a container-of-T.
+ * Assigning a T to the iterator appends it to the container using
+ * push_back.
+ *
+ * Tip: Using the back_inserter function to create these iterators can
+ * save typing.
+ */
+ template<typename _Container>
+ class back_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void>
+ {
+ protected:
+ _Container* container;
+
+ public:
+ /// A nested typedef for the type of whatever container you used.
+ typedef _Container container_type;
+
+ /// The only way to create this %iterator is with a container.
+ explicit
+ back_insert_iterator(_Container& __x) : container(&__x) { }
+
+ /**
+ * @param value An instance of whatever type
+ * container_type::const_reference is; presumably a
+ * reference-to-const T for container<T>.
+ * @return This %iterator, for chained operations.
+ *
+ * This kind of %iterator doesn't really have a "position" in the
+ * container (you can think of the position as being permanently at
+ * the end, if you like). Assigning a value to the %iterator will
+ * always append the value to the end of the container.
+ */
+ back_insert_iterator&
+ operator=(typename _Container::const_reference __value)
+ {
+ container->push_back(__value);
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ back_insert_iterator&
+ operator=(typename _Container::value_type&& __value)
+ {
+ container->push_back(std::move(__value));
+ return *this;
+ }
+#endif
+
+ /// Simply returns *this.
+ back_insert_iterator&
+ operator*()
+ { return *this; }
+
+ /// Simply returns *this. (This %iterator does not "move".)
+ back_insert_iterator&
+ operator++()
+ { return *this; }
+
+ /// Simply returns *this. (This %iterator does not "move".)
+ back_insert_iterator
+ operator++(int)
+ { return *this; }
+ };
+
+ /**
+ * @param x A container of arbitrary type.
+ * @return An instance of back_insert_iterator working on @p x.
+ *
+ * This wrapper function helps in creating back_insert_iterator instances.
+ * Typing the name of the %iterator requires knowing the precise full
+ * type of the container, which can be tedious and impedes generic
+ * programming. Using this function lets you take advantage of automatic
+ * template parameter deduction, making the compiler match the correct
+ * types for you.
+ */
+ template<typename _Container>
+ inline back_insert_iterator<_Container>
+ back_inserter(_Container& __x)
+ { return back_insert_iterator<_Container>(__x); }
+
+ /**
+ * @brief Turns assignment into insertion.
+ *
+ * These are output iterators, constructed from a container-of-T.
+ * Assigning a T to the iterator prepends it to the container using
+ * push_front.
+ *
+ * Tip: Using the front_inserter function to create these iterators can
+ * save typing.
+ */
+ template<typename _Container>
+ class front_insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void>
+ {
+ protected:
+ _Container* container;
+
+ public:
+ /// A nested typedef for the type of whatever container you used.
+ typedef _Container container_type;
+
+ /// The only way to create this %iterator is with a container.
+ explicit front_insert_iterator(_Container& __x) : container(&__x) { }
+
+ /**
+ * @param value An instance of whatever type
+ * container_type::const_reference is; presumably a
+ * reference-to-const T for container<T>.
+ * @return This %iterator, for chained operations.
+ *
+ * This kind of %iterator doesn't really have a "position" in the
+ * container (you can think of the position as being permanently at
+ * the front, if you like). Assigning a value to the %iterator will
+ * always prepend the value to the front of the container.
+ */
+ front_insert_iterator&
+ operator=(typename _Container::const_reference __value)
+ {
+ container->push_front(__value);
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ front_insert_iterator&
+ operator=(typename _Container::value_type&& __value)
+ {
+ container->push_front(std::move(__value));
+ return *this;
+ }
+#endif
+
+ /// Simply returns *this.
+ front_insert_iterator&
+ operator*()
+ { return *this; }
+
+ /// Simply returns *this. (This %iterator does not "move".)
+ front_insert_iterator&
+ operator++()
+ { return *this; }
+
+ /// Simply returns *this. (This %iterator does not "move".)
+ front_insert_iterator
+ operator++(int)
+ { return *this; }
+ };
+
+ /**
+ * @param x A container of arbitrary type.
+ * @return An instance of front_insert_iterator working on @p x.
+ *
+ * This wrapper function helps in creating front_insert_iterator instances.
+ * Typing the name of the %iterator requires knowing the precise full
+ * type of the container, which can be tedious and impedes generic
+ * programming. Using this function lets you take advantage of automatic
+ * template parameter deduction, making the compiler match the correct
+ * types for you.
+ */
+ template<typename _Container>
+ inline front_insert_iterator<_Container>
+ front_inserter(_Container& __x)
+ { return front_insert_iterator<_Container>(__x); }
+
+ /**
+ * @brief Turns assignment into insertion.
+ *
+ * These are output iterators, constructed from a container-of-T.
+ * Assigning a T to the iterator inserts it in the container at the
+ * %iterator's position, rather than overwriting the value at that
+ * position.
+ *
+ * (Sequences will actually insert a @e copy of the value before the
+ * %iterator's position.)
+ *
+ * Tip: Using the inserter function to create these iterators can
+ * save typing.
+ */
+ template<typename _Container>
+ class insert_iterator
+ : public iterator<output_iterator_tag, void, void, void, void>
+ {
+ protected:
+ _Container* container;
+ typename _Container::iterator iter;
+
+ public:
+ /// A nested typedef for the type of whatever container you used.
+ typedef _Container container_type;
+
+ /**
+ * The only way to create this %iterator is with a container and an
+ * initial position (a normal %iterator into the container).
+ */
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : container(&__x), iter(__i) {}
+
+ /**
+ * @param value An instance of whatever type
+ * container_type::const_reference is; presumably a
+ * reference-to-const T for container<T>.
+ * @return This %iterator, for chained operations.
+ *
+ * This kind of %iterator maintains its own position in the
+ * container. Assigning a value to the %iterator will insert the
+ * value into the container at the place before the %iterator.
+ *
+ * The position is maintained such that subsequent assignments will
+ * insert values immediately after one another. For example,
+ * @code
+ * // vector v contains A and Z
+ *
+ * insert_iterator i (v, ++v.begin());
+ * i = 1;
+ * i = 2;
+ * i = 3;
+ *
+ * // vector v contains A, 1, 2, 3, and Z
+ * @endcode
+ */
+ insert_iterator&
+ operator=(typename _Container::const_reference __value)
+ {
+ iter = container->insert(iter, __value);
+ ++iter;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert_iterator&
+ operator=(typename _Container::value_type&& __value)
+ {
+ iter = container->insert(iter, std::move(__value));
+ ++iter;
+ return *this;
+ }
+#endif
+
+ /// Simply returns *this.
+ insert_iterator&
+ operator*()
+ { return *this; }
+
+ /// Simply returns *this. (This %iterator does not "move".)
+ insert_iterator&
+ operator++()
+ { return *this; }
+
+ /// Simply returns *this. (This %iterator does not "move".)
+ insert_iterator&
+ operator++(int)
+ { return *this; }
+ };
+
+ /**
+ * @param x A container of arbitrary type.
+ * @return An instance of insert_iterator working on @p x.
+ *
+ * This wrapper function helps in creating insert_iterator instances.
+ * Typing the name of the %iterator requires knowing the precise full
+ * type of the container, which can be tedious and impedes generic
+ * programming. Using this function lets you take advantage of automatic
+ * template parameter deduction, making the compiler match the correct
+ * types for you.
+ */
+ template<typename _Container, typename _Iterator>
+ inline insert_iterator<_Container>
+ inserter(_Container& __x, _Iterator __i)
+ {
+ return insert_iterator<_Container>(__x,
+ typename _Container::iterator(__i));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // This iterator adapter is 'normal' in the sense that it does not
+ // change the semantics of any of the operators of its iterator
+ // parameter. Its primary purpose is to convert an iterator that is
+ // not a class, e.g. a pointer, into an iterator that is a class.
+ // The _Container parameter exists solely so that different containers
+ // using this template can instantiate different types, even if the
+ // _Iterator parameter is the same.
+ using std::iterator_traits;
+ using std::iterator;
+ template<typename _Iterator, typename _Container>
+ class __normal_iterator
+ {
+ protected:
+ _Iterator _M_current;
+
+ public:
+ typedef _Iterator iterator_type;
+ typedef typename iterator_traits<_Iterator>::iterator_category
+ iterator_category;
+ typedef typename iterator_traits<_Iterator>::value_type value_type;
+ typedef typename iterator_traits<_Iterator>::difference_type
+ difference_type;
+ typedef typename iterator_traits<_Iterator>::reference reference;
+ typedef typename iterator_traits<_Iterator>::pointer pointer;
+
+ __normal_iterator() : _M_current(_Iterator()) { }
+
+ explicit
+ __normal_iterator(const _Iterator& __i) : _M_current(__i) { }
+
+ // Allow iterator to const_iterator conversion
+ template<typename _Iter>
+ __normal_iterator(const __normal_iterator<_Iter,
+ typename __enable_if<
+ (std::__are_same<_Iter, typename _Container::pointer>::__value),
+ _Container>::__type>& __i)
+ : _M_current(__i.base()) { }
+
+ // Forward iterator requirements
+ reference
+ operator*() const
+ { return *_M_current; }
+
+ pointer
+ operator->() const
+ { return _M_current; }
+
+ __normal_iterator&
+ operator++()
+ {
+ ++_M_current;
+ return *this;
+ }
+
+ __normal_iterator
+ operator++(int)
+ { return __normal_iterator(_M_current++); }
+
+ // Bidirectional iterator requirements
+ __normal_iterator&
+ operator--()
+ {
+ --_M_current;
+ return *this;
+ }
+
+ __normal_iterator
+ operator--(int)
+ { return __normal_iterator(_M_current--); }
+
+ // Random access iterator requirements
+ reference
+ operator[](const difference_type& __n) const
+ { return _M_current[__n]; }
+
+ __normal_iterator&
+ operator+=(const difference_type& __n)
+ { _M_current += __n; return *this; }
+
+ __normal_iterator
+ operator+(const difference_type& __n) const
+ { return __normal_iterator(_M_current + __n); }
+
+ __normal_iterator&
+ operator-=(const difference_type& __n)
+ { _M_current -= __n; return *this; }
+
+ __normal_iterator
+ operator-(const difference_type& __n) const
+ { return __normal_iterator(_M_current - __n); }
+
+ const _Iterator&
+ base() const
+ { return _M_current; }
+ };
+
+ // Note: In what follows, the left- and right-hand-side iterators are
+ // allowed to vary in types (conceptually in cv-qualification) so that
+ // comparison between cv-qualified and non-cv-qualified iterators be
+ // valid. However, the greedy and unfriendly operators in std::rel_ops
+ // will make overload resolution ambiguous (when in scope) if we don't
+ // provide overloads whose operands are of the same type. Can someone
+ // remind me what generic programming is about? -- Gaby
+
+ // Forward iterator requirements
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline bool
+ operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() == __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline bool
+ operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() == __rhs.base(); }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline bool
+ operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() != __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline bool
+ operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() != __rhs.base(); }
+
+ // Random access iterator requirements
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline bool
+ operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() < __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline bool
+ operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() < __rhs.base(); }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline bool
+ operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() > __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline bool
+ operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() > __rhs.base(); }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline bool
+ operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() <= __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline bool
+ operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() <= __rhs.base(); }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+ inline bool
+ operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ { return __lhs.base() >= __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline bool
+ operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() >= __rhs.base(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR179 not only the various comparison
+ // operators but also operator- must accept mixed iterator/const_iterator
+ // parameters.
+ template<typename _IteratorL, typename _IteratorR, typename _Container>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // DR 685.
+ inline auto
+ operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+ -> decltype(__lhs.base() - __rhs.base())
+#else
+ inline typename __normal_iterator<_IteratorL, _Container>::difference_type
+ operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ const __normal_iterator<_IteratorR, _Container>& __rhs)
+#endif
+ { return __lhs.base() - __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline typename __normal_iterator<_Iterator, _Container>::difference_type
+ operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
+ const __normal_iterator<_Iterator, _Container>& __rhs)
+ { return __lhs.base() - __rhs.base(); }
+
+ template<typename _Iterator, typename _Container>
+ inline __normal_iterator<_Iterator, _Container>
+ operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
+ __n, const __normal_iterator<_Iterator, _Container>& __i)
+ { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }
+
+_GLIBCXX_END_NAMESPACE
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 24.4.3 Move iterators
+ /**
+ * Class template move_iterator is an iterator adapter with the same
+ * behavior as the underlying iterator except that its dereference
+ * operator implicitly converts the value returned by the underlying
+ * iterator's dereference operator to an rvalue reference. Some
+ * generic algorithms can be called with move iterators to replace
+ * copying with moving.
+ */
+ template<typename _Iterator>
+ class move_iterator
+ {
+ protected:
+ _Iterator _M_current;
+
+ public:
+ typedef _Iterator iterator_type;
+ typedef typename iterator_traits<_Iterator>::difference_type
+ difference_type;
+ // NB: DR 680.
+ typedef _Iterator pointer;
+ typedef typename iterator_traits<_Iterator>::value_type value_type;
+ typedef typename iterator_traits<_Iterator>::iterator_category
+ iterator_category;
+ typedef value_type&& reference;
+
+ public:
+ move_iterator()
+ : _M_current() { }
+
+ explicit
+ move_iterator(iterator_type __i)
+ : _M_current(__i) { }
+
+ template<typename _Iter>
+ move_iterator(const move_iterator<_Iter>& __i)
+ : _M_current(__i.base()) { }
+
+ iterator_type
+ base() const
+ { return _M_current; }
+
+ reference
+ operator*() const
+ { return *_M_current; }
+
+ pointer
+ operator->() const
+ { return _M_current; }
+
+ move_iterator&
+ operator++()
+ {
+ ++_M_current;
+ return *this;
+ }
+
+ move_iterator
+ operator++(int)
+ {
+ move_iterator __tmp = *this;
+ ++_M_current;
+ return __tmp;
+ }
+
+ move_iterator&
+ operator--()
+ {
+ --_M_current;
+ return *this;
+ }
+
+ move_iterator
+ operator--(int)
+ {
+ move_iterator __tmp = *this;
+ --_M_current;
+ return __tmp;
+ }
+
+ move_iterator
+ operator+(difference_type __n) const
+ { return move_iterator(_M_current + __n); }
+
+ move_iterator&
+ operator+=(difference_type __n)
+ {
+ _M_current += __n;
+ return *this;
+ }
+
+ move_iterator
+ operator-(difference_type __n) const
+ { return move_iterator(_M_current - __n); }
+
+ move_iterator&
+ operator-=(difference_type __n)
+ {
+ _M_current -= __n;
+ return *this;
+ }
+
+ reference
+ operator[](difference_type __n) const
+ { return _M_current[__n]; }
+ };
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator==(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ { return __x.base() == __y.base(); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator!=(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ { return !(__x == __y); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator<(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ { return __x.base() < __y.base(); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator<=(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ { return !(__y < __x); }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator>(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ { return __y < __x; }
+
+ template<typename _IteratorL, typename _IteratorR>
+ inline bool
+ operator>=(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ { return !(__x < __y); }
+
+ // DR 685.
+ template<typename _IteratorL, typename _IteratorR>
+ inline auto
+ operator-(const move_iterator<_IteratorL>& __x,
+ const move_iterator<_IteratorR>& __y)
+ -> decltype(__x.base() - __y.base())
+ { return __x.base() - __y.base(); }
+
+ template<typename _Iterator>
+ inline move_iterator<_Iterator>
+ operator+(typename move_iterator<_Iterator>::difference_type __n,
+ const move_iterator<_Iterator>& __x)
+ { return __x + __n; }
+
+ template<typename _Iterator>
+ inline move_iterator<_Iterator>
+ make_move_iterator(const _Iterator& __i)
+ { return move_iterator<_Iterator>(__i); }
+
+_GLIBCXX_END_NAMESPACE
+
+#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter)
+#else
+#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) (_Iter)
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_funcs.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
new file mode 100644
index 000000000..0a854faa1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
@@ -0,0 +1,197 @@
+// Functions used by iterators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_iterator_base_funcs.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ *
+ * This file contains all of the general iterator-related utility
+ * functions, such as distance() and advance().
+ */
+
+#ifndef _STL_ITERATOR_BASE_FUNCS_H
+#define _STL_ITERATOR_BASE_FUNCS_H 1
+
+#pragma GCC system_header
+#include <bits/concept_check.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _InputIterator>
+ inline typename iterator_traits<_InputIterator>::difference_type
+ __distance(_InputIterator __first, _InputIterator __last,
+ input_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+
+ typename iterator_traits<_InputIterator>::difference_type __n = 0;
+ while (__first != __last)
+ {
+ ++__first;
+ ++__n;
+ }
+ return __n;
+ }
+
+ template<typename _RandomAccessIterator>
+ inline typename iterator_traits<_RandomAccessIterator>::difference_type
+ __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ random_access_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ return __last - __first;
+ }
+
+ /**
+ * @brief A generalization of pointer arithmetic.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @return The distance between them.
+ *
+ * Returns @c n such that first + n == last. This requires that @p last
+ * must be reachable from @p first. Note that @c n may be negative.
+ *
+ * For random access iterators, this uses their @c + and @c - operations
+ * and are constant time. For other %iterator classes they are linear time.
+ */
+ template<typename _InputIterator>
+ inline typename iterator_traits<_InputIterator>::difference_type
+ distance(_InputIterator __first, _InputIterator __last)
+ {
+ // concept requirements -- taken care of in __distance
+ return std::__distance(__first, __last,
+ std::__iterator_category(__first));
+ }
+
+ template<typename _InputIterator, typename _Distance>
+ inline void
+ __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ while (__n--)
+ ++__i;
+ }
+
+ template<typename _BidirectionalIterator, typename _Distance>
+ inline void
+ __advance(_BidirectionalIterator& __i, _Distance __n,
+ bidirectional_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ if (__n > 0)
+ while (__n--)
+ ++__i;
+ else
+ while (__n++)
+ --__i;
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance>
+ inline void
+ __advance(_RandomAccessIterator& __i, _Distance __n,
+ random_access_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __i += __n;
+ }
+
+ /**
+ * @brief A generalization of pointer arithmetic.
+ * @param i An input iterator.
+ * @param n The "delta" by which to change @p i.
+ * @return Nothing.
+ *
+ * This increments @p i by @p n. For bidirectional and random access
+ * iterators, @p n may be negative, in which case @p i is decremented.
+ *
+ * For random access iterators, this uses their @c + and @c - operations
+ * and are constant time. For other %iterator classes they are linear time.
+ */
+ template<typename _InputIterator, typename _Distance>
+ inline void
+ advance(_InputIterator& __i, _Distance __n)
+ {
+ // concept requirements -- taken care of in __advance
+ typename iterator_traits<_InputIterator>::difference_type __d = __n;
+ std::__advance(__i, __d, std::__iterator_category(__i));
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _InputIterator>
+ inline _InputIterator
+ next(_InputIterator __x, typename
+ iterator_traits<_InputIterator>::difference_type __n = 1)
+ {
+ std::advance(__x, __n);
+ return __x;
+ }
+
+ template<typename _BidirectionalIterator>
+ inline _BidirectionalIterator
+ prev(_BidirectionalIterator __x, typename
+ iterator_traits<_BidirectionalIterator>::difference_type __n = 1)
+ {
+ std::advance(__x, -__n);
+ return __x;
+ }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_ITERATOR_BASE_FUNCS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_types.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_types.h
new file mode 100644
index 000000000..6dc0d7838
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_iterator_base_types.h
@@ -0,0 +1,168 @@
+// Types used in iterator implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_iterator_base_types.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ *
+ * This file contains all of the general iterator-related utility types,
+ * such as iterator_traits and struct iterator.
+ */
+
+#ifndef _STL_ITERATOR_BASE_TYPES_H
+#define _STL_ITERATOR_BASE_TYPES_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @defgroup iterators Iterators
+ * These are empty types, used to distinguish different iterators. The
+ * distinction is not made by what they contain, but simply by what they
+ * are. Different underlying algorithms can then be used based on the
+ * different operations supported by different iterator types.
+ */
+ //@{
+ /// Marking input iterators.
+ struct input_iterator_tag { };
+ /// Marking output iterators.
+ struct output_iterator_tag { };
+ /// Forward iterators support a superset of input iterator operations.
+ struct forward_iterator_tag : public input_iterator_tag { };
+ /// Bidirectional iterators support a superset of forward iterator
+ /// operations.
+ struct bidirectional_iterator_tag : public forward_iterator_tag { };
+ /// Random-access iterators support a superset of bidirectional iterator
+ /// operations.
+ struct random_access_iterator_tag : public bidirectional_iterator_tag { };
+
+
+ /**
+ * @brief Common %iterator class.
+ *
+ * This class does nothing but define nested typedefs. %Iterator classes
+ * can inherit from this class to save some work. The typedefs are then
+ * used in specializations and overloading.
+ *
+ * In particular, there are no default implementations of requirements
+ * such as @c operator++ and the like. (How could there be?)
+ */
+ template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
+ typename _Pointer = _Tp*, typename _Reference = _Tp&>
+ struct iterator
+ {
+ /// One of the @link iterator_tags tag types@endlink.
+ typedef _Category iterator_category;
+ /// The type "pointed to" by the iterator.
+ typedef _Tp value_type;
+ /// Distance between iterators is represented as this type.
+ typedef _Distance difference_type;
+ /// This type represents a pointer-to-value_type.
+ typedef _Pointer pointer;
+ /// This type represents a reference-to-value_type.
+ typedef _Reference reference;
+ };
+
+ /**
+ * This class does nothing but define nested typedefs. The general
+ * version simply "forwards" the nested typedefs from the Iterator
+ * argument. Specialized versions for pointers and pointers-to-const
+ * provide tighter, more correct semantics.
+ */
+ template<typename _Iterator>
+ struct iterator_traits
+ {
+ typedef typename _Iterator::iterator_category iterator_category;
+ typedef typename _Iterator::value_type value_type;
+ typedef typename _Iterator::difference_type difference_type;
+ typedef typename _Iterator::pointer pointer;
+ typedef typename _Iterator::reference reference;
+ };
+
+ template<typename _Tp>
+ struct iterator_traits<_Tp*>
+ {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ };
+
+ template<typename _Tp>
+ struct iterator_traits<const _Tp*>
+ {
+ typedef random_access_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+ };
+
+ /**
+ * This function is not a part of the C++ standard but is syntactic
+ * sugar for internal library use only.
+ */
+ template<typename _Iter>
+ inline typename iterator_traits<_Iter>::iterator_category
+ __iterator_category(const _Iter&)
+ { return typename iterator_traits<_Iter>::iterator_category(); }
+
+ //@}
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_ITERATOR_BASE_TYPES_H */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_list.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_list.h
new file mode 100644
index 000000000..66a50b81e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_list.h
@@ -0,0 +1,1533 @@
+// List implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_list.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_LIST_H
+#define _STL_LIST_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ // Supporting structures are split into common and templated types; the
+ // latter publicly inherits from the former in an effort to reduce code
+ // duplication. This results in some "needless" static_cast'ing later on,
+ // but it's all safe downcasting.
+
+ /// Common part of a node in the %list.
+ struct _List_node_base
+ {
+ _List_node_base* _M_next;
+ _List_node_base* _M_prev;
+
+ static void
+ swap(_List_node_base& __x, _List_node_base& __y);
+
+ void
+ transfer(_List_node_base * const __first,
+ _List_node_base * const __last);
+
+ void
+ reverse();
+
+ void
+ hook(_List_node_base * const __position);
+
+ void
+ unhook();
+ };
+
+ /// An actual node in the %list.
+ template<typename _Tp>
+ struct _List_node : public _List_node_base
+ {
+ ///< User's data.
+ _Tp _M_data;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ _List_node(_Args&&... __args)
+ : _List_node_base(), _M_data(std::forward<_Args>(__args)...) { }
+#endif
+ };
+
+ /**
+ * @brief A list::iterator.
+ *
+ * All the functions are op overloads.
+ */
+ template<typename _Tp>
+ struct _List_iterator
+ {
+ typedef _List_iterator<_Tp> _Self;
+ typedef _List_node<_Tp> _Node;
+
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+
+ _List_iterator()
+ : _M_node() { }
+
+ explicit
+ _List_iterator(_List_node_base* __x)
+ : _M_node(__x) { }
+
+ // Must downcast from List_node_base to _List_node to get to _M_data.
+ reference
+ operator*() const
+ { return static_cast<_Node*>(_M_node)->_M_data; }
+
+ pointer
+ operator->() const
+ { return &static_cast<_Node*>(_M_node)->_M_data; }
+
+ _Self&
+ operator++()
+ {
+ _M_node = _M_node->_M_next;
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_next;
+ return __tmp;
+ }
+
+ _Self&
+ operator--()
+ {
+ _M_node = _M_node->_M_prev;
+ return *this;
+ }
+
+ _Self
+ operator--(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_prev;
+ return __tmp;
+ }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ // The only member points to the %list element.
+ _List_node_base* _M_node;
+ };
+
+ /**
+ * @brief A list::const_iterator.
+ *
+ * All the functions are op overloads.
+ */
+ template<typename _Tp>
+ struct _List_const_iterator
+ {
+ typedef _List_const_iterator<_Tp> _Self;
+ typedef const _List_node<_Tp> _Node;
+ typedef _List_iterator<_Tp> iterator;
+
+ typedef ptrdiff_t difference_type;
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef _Tp value_type;
+ typedef const _Tp* pointer;
+ typedef const _Tp& reference;
+
+ _List_const_iterator()
+ : _M_node() { }
+
+ explicit
+ _List_const_iterator(const _List_node_base* __x)
+ : _M_node(__x) { }
+
+ _List_const_iterator(const iterator& __x)
+ : _M_node(__x._M_node) { }
+
+ // Must downcast from List_node_base to _List_node to get to
+ // _M_data.
+ reference
+ operator*() const
+ { return static_cast<_Node*>(_M_node)->_M_data; }
+
+ pointer
+ operator->() const
+ { return &static_cast<_Node*>(_M_node)->_M_data; }
+
+ _Self&
+ operator++()
+ {
+ _M_node = _M_node->_M_next;
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_next;
+ return __tmp;
+ }
+
+ _Self&
+ operator--()
+ {
+ _M_node = _M_node->_M_prev;
+ return *this;
+ }
+
+ _Self
+ operator--(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _M_node->_M_prev;
+ return __tmp;
+ }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ // The only member points to the %list element.
+ const _List_node_base* _M_node;
+ };
+
+ template<typename _Val>
+ inline bool
+ operator==(const _List_iterator<_Val>& __x,
+ const _List_const_iterator<_Val>& __y)
+ { return __x._M_node == __y._M_node; }
+
+ template<typename _Val>
+ inline bool
+ operator!=(const _List_iterator<_Val>& __x,
+ const _List_const_iterator<_Val>& __y)
+ { return __x._M_node != __y._M_node; }
+
+
+ /// See bits/stl_deque.h's _Deque_base for an explanation.
+ template<typename _Tp, typename _Alloc>
+ class _List_base
+ {
+ protected:
+ // NOTA BENE
+ // The stored instance is not actually of "allocator_type"'s
+ // type. Instead we rebind the type to
+ // Allocator<List_node<Tp>>, which according to [20.1.5]/4
+ // should probably be the same. List_node<Tp> is not the same
+ // size as Tp (it's two pointers larger), and specializations on
+ // Tp may go unused because List_node<Tp> is being bound
+ // instead.
+ //
+ // We put this to the test in the constructors and in
+ // get_allocator, where we use conversions between
+ // allocator_type and _Node_alloc_type. The conversion is
+ // required by table 32 in [20.1.5].
+ typedef typename _Alloc::template rebind<_List_node<_Tp> >::other
+ _Node_alloc_type;
+
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+
+ struct _List_impl
+ : public _Node_alloc_type
+ {
+ _List_node_base _M_node;
+
+ _List_impl()
+ : _Node_alloc_type(), _M_node()
+ { }
+
+ _List_impl(const _Node_alloc_type& __a)
+ : _Node_alloc_type(__a), _M_node()
+ { }
+ };
+
+ _List_impl _M_impl;
+
+ _List_node<_Tp>*
+ _M_get_node()
+ { return _M_impl._Node_alloc_type::allocate(1); }
+
+ void
+ _M_put_node(_List_node<_Tp>* __p)
+ { _M_impl._Node_alloc_type::deallocate(__p, 1); }
+
+ public:
+ typedef _Alloc allocator_type;
+
+ _Node_alloc_type&
+ _M_get_Node_allocator()
+ { return *static_cast<_Node_alloc_type*>(&this->_M_impl); }
+
+ const _Node_alloc_type&
+ _M_get_Node_allocator() const
+ { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); }
+
+ _Tp_alloc_type
+ _M_get_Tp_allocator() const
+ { return _Tp_alloc_type(_M_get_Node_allocator()); }
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_get_Node_allocator()); }
+
+ _List_base()
+ : _M_impl()
+ { _M_init(); }
+
+ _List_base(const allocator_type& __a)
+ : _M_impl(__a)
+ { _M_init(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _List_base(_List_base&& __x)
+ : _M_impl(__x._M_get_Node_allocator())
+ {
+ _M_init();
+ _List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);
+ }
+#endif
+
+ // This is what actually destroys the list.
+ ~_List_base()
+ { _M_clear(); }
+
+ void
+ _M_clear();
+
+ void
+ _M_init()
+ {
+ this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
+ this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
+ }
+ };
+
+ /**
+ * @brief A standard container with linear time access to elements,
+ * and fixed time insertion/deletion at any point in the sequence.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>, including the
+ * <a href="tables.html#68">optional sequence requirements</a> with the
+ * %exception of @c at and @c operator[].
+ *
+ * This is a @e doubly @e linked %list. Traversal up and down the
+ * %list requires linear time, but adding and removing elements (or
+ * @e nodes) is done in constant time, regardless of where the
+ * change takes place. Unlike std::vector and std::deque,
+ * random-access iterators are not provided, so subscripting ( @c
+ * [] ) access is not allowed. For algorithms which only need
+ * sequential access, this lack makes no difference.
+ *
+ * Also unlike the other standard containers, std::list provides
+ * specialized algorithms %unique to linked lists, such as
+ * splicing, sorting, and in-place reversal.
+ *
+ * A couple points on memory allocation for list<Tp>:
+ *
+ * First, we never actually allocate a Tp, we allocate
+ * List_node<Tp>'s and trust [20.1.5]/4 to DTRT. This is to ensure
+ * that after elements from %list<X,Alloc1> are spliced into
+ * %list<X,Alloc2>, destroying the memory of the second %list is a
+ * valid operation, i.e., Alloc1 giveth and Alloc2 taketh away.
+ *
+ * Second, a %list conceptually represented as
+ * @code
+ * A <---> B <---> C <---> D
+ * @endcode
+ * is actually circular; a link exists between A and D. The %list
+ * class holds (as its only data member) a private list::iterator
+ * pointing to @e D, not to @e A! To get to the head of the %list,
+ * we start at the tail and move forward by one. When this member
+ * iterator's next/previous pointers refer to itself, the %list is
+ * %empty.
+ */
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ class list : protected _List_base<_Tp, _Alloc>
+ {
+ // concept requirements
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
+
+ typedef _List_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+
+ public:
+ typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef typename _Tp_alloc_type::const_pointer const_pointer;
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef _List_iterator<_Tp> iterator;
+ typedef _List_const_iterator<_Tp> const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+
+ protected:
+ // Note that pointers-to-_Node's can be ctor-converted to
+ // iterator types.
+ typedef _List_node<_Tp> _Node;
+
+ using _Base::_M_impl;
+ using _Base::_M_put_node;
+ using _Base::_M_get_node;
+ using _Base::_M_get_Tp_allocator;
+ using _Base::_M_get_Node_allocator;
+
+ /**
+ * @param x An instance of user data.
+ *
+ * Allocates space for a new node and constructs a copy of @a x in it.
+ */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ _Node*
+ _M_create_node(const value_type& __x)
+ {
+ _Node* __p = this->_M_get_node();
+ __try
+ {
+ _M_get_Tp_allocator().construct(&__p->_M_data, __x);
+ }
+ __catch(...)
+ {
+ _M_put_node(__p);
+ __throw_exception_again;
+ }
+ return __p;
+ }
+#else
+ template<typename... _Args>
+ _Node*
+ _M_create_node(_Args&&... __args)
+ {
+ _Node* __p = this->_M_get_node();
+ __try
+ {
+ _M_get_Node_allocator().construct(__p,
+ std::forward<_Args>(__args)...);
+ }
+ __catch(...)
+ {
+ _M_put_node(__p);
+ __throw_exception_again;
+ }
+ return __p;
+ }
+#endif
+
+ public:
+ // [23.2.2.1] construct/copy/destroy
+ // (assign() and get_allocator() are also listed in this section)
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ list()
+ : _Base() { }
+
+ /**
+ * @brief Creates a %list with no elements.
+ * @param a An allocator object.
+ */
+ explicit
+ list(const allocator_type& __a)
+ : _Base(__a) { }
+
+ /**
+ * @brief Creates a %list with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param a An allocator object.
+ *
+ * This constructor fills the %list with @a n copies of @a value.
+ */
+ explicit
+ list(size_type __n, const value_type& __value = value_type(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ { _M_fill_initialize(__n, __value); }
+
+ /**
+ * @brief %List copy constructor.
+ * @param x A %list of identical element and allocator types.
+ *
+ * The newly-created %list uses a copy of the allocation object used
+ * by @a x.
+ */
+ list(const list& __x)
+ : _Base(__x._M_get_Node_allocator())
+ { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %List move constructor.
+ * @param x A %list of identical element and allocator types.
+ *
+ * The newly-created %list contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %list.
+ */
+ list(list&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ /**
+ * @brief Builds a %list from an initializer_list
+ * @param l An initializer_list of value_type.
+ * @param a An allocator object.
+ *
+ * Create a %list consisting of copies of the elements in the
+ * initializer_list @a l. This is linear in l.size().
+ */
+ list(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
+#endif
+
+ /**
+ * @brief Builds a %list from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param a An allocator object.
+ *
+ * Create a %list consisting of copies of the elements from
+ * [@a first,@a last). This is linear in N (where N is
+ * distance(@a first,@a last)).
+ */
+ template<typename _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+ /**
+ * No explicit dtor needed as the _Base dtor takes care of
+ * things. The _Base dtor only erases the elements, and note
+ * that if the elements themselves are pointers, the pointed-to
+ * memory is not touched in any way. Managing the pointer is
+ * the user's responsibility.
+ */
+
+ /**
+ * @brief %List assignment operator.
+ * @param x A %list of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but unlike the copy
+ * constructor, the allocator object is not copied.
+ */
+ list&
+ operator=(const list& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %List move assignment operator.
+ * @param x A %list of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this %list (without copying).
+ * @a x is a valid, but unspecified %list
+ */
+ list&
+ operator=(list&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief %List initializer list assignment operator.
+ * @param l An initializer_list of value_type.
+ *
+ * Replace the contents of the %list with copies of the elements
+ * in the initializer_list @a l. This is linear in l.size().
+ */
+ list&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ /**
+ * @brief Assigns a given value to a %list.
+ * @param n Number of elements to be assigned.
+ * @param val Value to be assigned.
+ *
+ * This function fills a %list with @a n copies of the given
+ * value. Note that the assignment completely changes the %list
+ * and that the resulting %list's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ void
+ assign(size_type __n, const value_type& __val)
+ { _M_fill_assign(__n, __val); }
+
+ /**
+ * @brief Assigns a range to a %list.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function fills a %list with copies of the elements in the
+ * range [@a first,@a last).
+ *
+ * Note that the assignment completely changes the %list and
+ * that the resulting %list's size is the same as the number of
+ * elements assigned. Old data may be lost.
+ */
+ template<typename _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assigns an initializer_list to a %list.
+ * @param l An initializer_list of value_type.
+ *
+ * Replace the contents of the %list with copies of the elements
+ * in the initializer_list @a l. This is linear in l.size().
+ */
+ void
+ assign(initializer_list<value_type> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
+ /// Get a copy of the memory allocation object.
+ allocator_type
+ get_allocator() const
+ { return _Base::get_allocator(); }
+
+ // iterators
+ /**
+ * Returns a read/write iterator that points to the first element in the
+ * %list. Iteration is done in ordinary element order.
+ */
+ iterator
+ begin()
+ { return iterator(this->_M_impl._M_node._M_next); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the
+ * first element in the %list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ begin() const
+ { return const_iterator(this->_M_impl._M_node._M_next); }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * element in the %list. Iteration is done in ordinary element
+ * order.
+ */
+ iterator
+ end()
+ { return iterator(&this->_M_impl._M_node); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ end() const
+ { return const_iterator(&this->_M_impl._M_node); }
+
+ /**
+ * Returns a read/write reverse iterator that points to the last
+ * element in the %list. Iteration is done in reverse element
+ * order.
+ */
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to
+ * the last element in the %list. Iteration is done in reverse
+ * element order.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one
+ * before the first element in the %list. Iteration is done in
+ * reverse element order.
+ */
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to one
+ * before the first element in the %list. Iteration is done in reverse
+ * element order.
+ */
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the
+ * first element in the %list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ cbegin() const
+ { return const_iterator(this->_M_impl._M_node._M_next); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %list. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ cend() const
+ { return const_iterator(&this->_M_impl._M_node); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to
+ * the last element in the %list. Iteration is done in reverse
+ * element order.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to one
+ * before the first element in the %list. Iteration is done in reverse
+ * element order.
+ */
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // [23.2.2.2] capacity
+ /**
+ * Returns true if the %list is empty. (Thus begin() would equal
+ * end().)
+ */
+ bool
+ empty() const
+ { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }
+
+ /** Returns the number of elements in the %list. */
+ size_type
+ size() const
+ { return std::distance(begin(), end()); }
+
+ /** Returns the size() of the largest possible %list. */
+ size_type
+ max_size() const
+ { return _M_get_Node_allocator().max_size(); }
+
+ /**
+ * @brief Resizes the %list to the specified number of elements.
+ * @param new_size Number of elements the %list should contain.
+ * @param x Data with which new elements should be populated.
+ *
+ * This function will %resize the %list to the specified number
+ * of elements. If the number is smaller than the %list's
+ * current size the %list is truncated, otherwise the %list is
+ * extended and new elements are populated with given data.
+ */
+ void
+ resize(size_type __new_size, value_type __x = value_type());
+
+ // element access
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %list.
+ */
+ reference
+ front()
+ { return *begin(); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %list.
+ */
+ const_reference
+ front() const
+ { return *begin(); }
+
+ /**
+ * Returns a read/write reference to the data at the last element
+ * of the %list.
+ */
+ reference
+ back()
+ {
+ iterator __tmp = end();
+ --__tmp;
+ return *__tmp;
+ }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the last
+ * element of the %list.
+ */
+ const_reference
+ back() const
+ {
+ const_iterator __tmp = end();
+ --__tmp;
+ return *__tmp;
+ }
+
+ // [23.2.2.3] modifiers
+ /**
+ * @brief Add data to the front of the %list.
+ * @param x Data to be added.
+ *
+ * This is a typical stack operation. The function creates an
+ * element at the front of the %list and assigns the given data
+ * to it. Due to the nature of a %list this operation can be
+ * done in constant time, and does not invalidate iterators and
+ * references.
+ */
+ void
+ push_front(const value_type& __x)
+ { this->_M_insert(begin(), __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_front(value_type&& __x)
+ { this->_M_insert(begin(), std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_front(_Args&&... __args)
+ { this->_M_insert(begin(), std::forward<_Args>(__args)...); }
+#endif
+
+ /**
+ * @brief Removes first element.
+ *
+ * This is a typical stack operation. It shrinks the %list by
+ * one. Due to the nature of a %list this operation can be done
+ * in constant time, and only invalidates iterators/references to
+ * the element being removed.
+ *
+ * Note that no data is returned, and if the first element's data
+ * is needed, it should be retrieved before pop_front() is
+ * called.
+ */
+ void
+ pop_front()
+ { this->_M_erase(begin()); }
+
+ /**
+ * @brief Add data to the end of the %list.
+ * @param x Data to be added.
+ *
+ * This is a typical stack operation. The function creates an
+ * element at the end of the %list and assigns the given data to
+ * it. Due to the nature of a %list this operation can be done
+ * in constant time, and does not invalidate iterators and
+ * references.
+ */
+ void
+ push_back(const value_type& __x)
+ { this->_M_insert(end(), __x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(value_type&& __x)
+ { this->_M_insert(end(), std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_back(_Args&&... __args)
+ { this->_M_insert(end(), std::forward<_Args>(__args)...); }
+#endif
+
+ /**
+ * @brief Removes last element.
+ *
+ * This is a typical stack operation. It shrinks the %list by
+ * one. Due to the nature of a %list this operation can be done
+ * in constant time, and only invalidates iterators/references to
+ * the element being removed.
+ *
+ * Note that no data is returned, and if the last element's data
+ * is needed, it should be retrieved before pop_back() is called.
+ */
+ void
+ pop_back()
+ { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Constructs object in %list before specified iterator.
+ * @param position A const_iterator into the %list.
+ * @param args Arguments.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert an object of type T constructed
+ * with T(std::forward<Args>(args)...) before the specified
+ * location. Due to the nature of a %list this operation can
+ * be done in constant time, and does not invalidate iterators
+ * and references.
+ */
+ template<typename... _Args>
+ iterator
+ emplace(iterator __position, _Args&&... __args);
+#endif
+
+ /**
+ * @brief Inserts given value into %list before specified iterator.
+ * @param position An iterator into the %list.
+ * @param x Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given value before
+ * the specified location. Due to the nature of a %list this
+ * operation can be done in constant time, and does not
+ * invalidate iterators and references.
+ */
+ iterator
+ insert(iterator __position, const value_type& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Inserts given rvalue into %list before specified iterator.
+ * @param position An iterator into the %list.
+ * @param x Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given rvalue before
+ * the specified location. Due to the nature of a %list this
+ * operation can be done in constant time, and does not
+ * invalidate iterators and references.
+ */
+ iterator
+ insert(iterator __position, value_type&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ /**
+ * @brief Inserts the contents of an initializer_list into %list
+ * before specified iterator.
+ * @param p An iterator into the %list.
+ * @param l An initializer_list of value_type.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a l into the %list before the location
+ * specified by @a p.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Inserts a number of copies of given data into the %list.
+ * @param position An iterator into the %list.
+ * @param n Number of elements to be inserted.
+ * @param x Data to be inserted.
+ *
+ * This function will insert a specified number of copies of the
+ * given data before the location specified by @a position.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ void
+ insert(iterator __position, size_type __n, const value_type& __x)
+ {
+ list __tmp(__n, __x, _M_get_Node_allocator());
+ splice(__position, __tmp);
+ }
+
+ /**
+ * @brief Inserts a range into the %list.
+ * @param position An iterator into the %list.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function will insert copies of the data in the range [@a
+ * first,@a last) into the %list before the location specified by
+ * @a position.
+ *
+ * This operation is linear in the number of elements inserted and
+ * does not invalidate iterators and references.
+ */
+ template<typename _InputIterator>
+ void
+ insert(iterator __position, _InputIterator __first,
+ _InputIterator __last)
+ {
+ list __tmp(__first, __last, _M_get_Node_allocator());
+ splice(__position, __tmp);
+ }
+
+ /**
+ * @brief Remove element at given position.
+ * @param position Iterator pointing to element to be erased.
+ * @return An iterator pointing to the next element (or end()).
+ *
+ * This function will erase the element at the given position and thus
+ * shorten the %list by one.
+ *
+ * Due to the nature of a %list this operation can be done in
+ * constant time, and only invalidates iterators/references to
+ * the element being removed. The user is also cautioned that
+ * this function only erases the element, and that if the element
+ * is itself a pointer, the pointed-to memory is not touched in
+ * any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __position);
+
+ /**
+ * @brief Remove a range of elements.
+ * @param first Iterator pointing to the first element to be erased.
+ * @param last Iterator pointing to one past the last element to be
+ * erased.
+ * @return An iterator pointing to the element pointed to by @a last
+ * prior to erasing (or end()).
+ *
+ * This function will erase the elements in the range @a
+ * [first,last) and shorten the %list accordingly.
+ *
+ * This operation is linear time in the size of the range and only
+ * invalidates iterators/references to the element being removed.
+ * The user is also cautioned that this function only erases the
+ * elements, and that if the elements themselves are pointers, the
+ * pointed-to memory is not touched in any way. Managing the pointer
+ * is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ while (__first != __last)
+ __first = erase(__first);
+ return __last;
+ }
+
+ /**
+ * @brief Swaps data with another %list.
+ * @param x A %list of the same element and allocator types.
+ *
+ * This exchanges the elements between two lists in constant
+ * time. Note that the global std::swap() function is
+ * specialized such that std::swap(l1,l2) will feed to this
+ * function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(list&& __x)
+#else
+ swap(list& __x)
+#endif
+ {
+ _List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<typename _Base::_Node_alloc_type>::
+ _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator());
+ }
+
+ /**
+ * Erases all the elements. Note that this function only erases
+ * the elements, and that if the elements themselves are
+ * pointers, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ void
+ clear()
+ {
+ _Base::_M_clear();
+ _Base::_M_init();
+ }
+
+ // [23.2.2.4] list operations
+ /**
+ * @brief Insert contents of another %list.
+ * @param position Iterator referencing the element to insert before.
+ * @param x Source list.
+ *
+ * The elements of @a x are inserted in constant time in front of
+ * the element referenced by @a position. @a x becomes an empty
+ * list.
+ *
+ * Requires this != @a x.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(iterator __position, list&& __x)
+#else
+ splice(iterator __position, list& __x)
+#endif
+ {
+ if (!__x.empty())
+ {
+ _M_check_equal_allocators(__x);
+
+ this->_M_transfer(__position, __x.begin(), __x.end());
+ }
+ }
+
+ /**
+ * @brief Insert element from another %list.
+ * @param position Iterator referencing the element to insert before.
+ * @param x Source list.
+ * @param i Iterator referencing the element to move.
+ *
+ * Removes the element in list @a x referenced by @a i and
+ * inserts it into the current list before @a position.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(iterator __position, list&& __x, iterator __i)
+#else
+ splice(iterator __position, list& __x, iterator __i)
+#endif
+ {
+ iterator __j = __i;
+ ++__j;
+ if (__position == __i || __position == __j)
+ return;
+
+ if (this != &__x)
+ _M_check_equal_allocators(__x);
+
+ this->_M_transfer(__position, __i, __j);
+ }
+
+ /**
+ * @brief Insert range from another %list.
+ * @param position Iterator referencing the element to insert before.
+ * @param x Source list.
+ * @param first Iterator referencing the start of range in x.
+ * @param last Iterator referencing the end of range in x.
+ *
+ * Removes elements in the range [first,last) and inserts them
+ * before @a position in constant time.
+ *
+ * Undefined if @a position is in [first,last).
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(iterator __position, list&& __x, iterator __first,
+ iterator __last)
+#else
+ splice(iterator __position, list& __x, iterator __first,
+ iterator __last)
+#endif
+ {
+ if (__first != __last)
+ {
+ if (this != &__x)
+ _M_check_equal_allocators(__x);
+
+ this->_M_transfer(__position, __first, __last);
+ }
+ }
+
+ /**
+ * @brief Remove all elements equal to value.
+ * @param value The value to remove.
+ *
+ * Removes every element in the list equal to @a value.
+ * Remaining elements stay in list order. Note that this
+ * function only erases the elements, and that if the elements
+ * themselves are pointers, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ void
+ remove(const _Tp& __value);
+
+ /**
+ * @brief Remove all elements satisfying a predicate.
+ * @param Predicate Unary predicate function or object.
+ *
+ * Removes every element in the list for which the predicate
+ * returns true. Remaining elements stay in list order. Note
+ * that this function only erases the elements, and that if the
+ * elements themselves are pointers, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ template<typename _Predicate>
+ void
+ remove_if(_Predicate);
+
+ /**
+ * @brief Remove consecutive duplicate elements.
+ *
+ * For each consecutive set of elements with the same value,
+ * remove all but the first one. Remaining elements stay in
+ * list order. Note that this function only erases the
+ * elements, and that if the elements themselves are pointers,
+ * the pointed-to memory is not touched in any way. Managing
+ * the pointer is the user's responsibility.
+ */
+ void
+ unique();
+
+ /**
+ * @brief Remove consecutive elements satisfying a predicate.
+ * @param BinaryPredicate Binary predicate function or object.
+ *
+ * For each consecutive set of elements [first,last) that
+ * satisfy predicate(first,i) where i is an iterator in
+ * [first,last), remove all but the first one. Remaining
+ * elements stay in list order. Note that this function only
+ * erases the elements, and that if the elements themselves are
+ * pointers, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ template<typename _BinaryPredicate>
+ void
+ unique(_BinaryPredicate);
+
+ /**
+ * @brief Merge sorted lists.
+ * @param x Sorted list to merge.
+ *
+ * Assumes that both @a x and this list are sorted according to
+ * operator<(). Merges elements of @a x into this list in
+ * sorted order, leaving @a x empty when complete. Elements in
+ * this list precede elements in @a x that are equal.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ merge(list&& __x);
+#else
+ merge(list& __x);
+#endif
+
+ /**
+ * @brief Merge sorted lists according to comparison function.
+ * @param x Sorted list to merge.
+ * @param StrictWeakOrdering Comparison function defining
+ * sort order.
+ *
+ * Assumes that both @a x and this list are sorted according to
+ * StrictWeakOrdering. Merges elements of @a x into this list
+ * in sorted order, leaving @a x empty when complete. Elements
+ * in this list precede elements in @a x that are equivalent
+ * according to StrictWeakOrdering().
+ */
+ template<typename _StrictWeakOrdering>
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ merge(list&&, _StrictWeakOrdering);
+#else
+ merge(list&, _StrictWeakOrdering);
+#endif
+
+ /**
+ * @brief Reverse the elements in list.
+ *
+ * Reverse the order of elements in the list in linear time.
+ */
+ void
+ reverse()
+ { this->_M_impl._M_node.reverse(); }
+
+ /**
+ * @brief Sort the elements.
+ *
+ * Sorts the elements of this list in NlogN time. Equivalent
+ * elements remain in list order.
+ */
+ void
+ sort();
+
+ /**
+ * @brief Sort the elements according to comparison function.
+ *
+ * Sorts the elements of this list in NlogN time. Equivalent
+ * elements remain in list order.
+ */
+ template<typename _StrictWeakOrdering>
+ void
+ sort(_StrictWeakOrdering);
+
+ protected:
+ // Internal constructor functions follow.
+
+ // Called by the range constructor to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
+ { _M_fill_initialize(static_cast<size_type>(__n), __x); }
+
+ // Called by the range constructor to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ // Called by list(n,v,a), and the range constructor when it turns out
+ // to be the same thing.
+ void
+ _M_fill_initialize(size_type __n, const value_type& __x)
+ {
+ for (; __n > 0; --__n)
+ push_back(__x);
+ }
+
+
+ // Internal assign functions follow.
+
+ // Called by the range assign to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign(__n, __val); }
+
+ // Called by the range assign to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type);
+
+ // Called by assign(n,t), and the range assign when it turns out
+ // to be the same thing.
+ void
+ _M_fill_assign(size_type __n, const value_type& __val);
+
+
+ // Moves the elements from [first,last) before position.
+ void
+ _M_transfer(iterator __position, iterator __first, iterator __last)
+ { __position._M_node->transfer(__first._M_node, __last._M_node); }
+
+ // Inserts new element at position given and with value given.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ _M_insert(iterator __position, const value_type& __x)
+ {
+ _Node* __tmp = _M_create_node(__x);
+ __tmp->hook(__position._M_node);
+ }
+#else
+ template<typename... _Args>
+ void
+ _M_insert(iterator __position, _Args&&... __args)
+ {
+ _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...);
+ __tmp->hook(__position._M_node);
+ }
+#endif
+
+ // Erases element at position given.
+ void
+ _M_erase(iterator __position)
+ {
+ __position._M_node->unhook();
+ _Node* __n = static_cast<_Node*>(__position._M_node);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _M_get_Node_allocator().destroy(__n);
+#else
+ _M_get_Tp_allocator().destroy(&__n->_M_data);
+#endif
+ _M_put_node(__n);
+ }
+
+ // To implement the splice (and merge) bits of N1599.
+ void
+ _M_check_equal_allocators(list& __x)
+ {
+ if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
+ _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
+ __throw_runtime_error(__N("list::_M_check_equal_allocators"));
+ }
+ };
+
+ /**
+ * @brief List equality comparison.
+ * @param x A %list.
+ * @param y A %list of the same type as @a x.
+ * @return True iff the size and elements of the lists are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of
+ * the lists. Lists are considered equivalent if their sizes are
+ * equal, and if corresponding elements compare equal.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+ {
+ typedef typename list<_Tp, _Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = __x.end();
+ const_iterator __end2 = __y.end();
+
+ const_iterator __i1 = __x.begin();
+ const_iterator __i2 = __y.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
+ {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+ }
+
+ /**
+ * @brief List ordering relation.
+ * @param x A %list.
+ * @param y A %list of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * lists. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+ { return std::lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()); }
+
+ /// Based on operator==
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::list::swap().
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>&& __x, list<_Tp, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_LIST_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_map.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_map.h
new file mode 100644
index 000000000..90e5239dd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_map.h
@@ -0,0 +1,871 @@
+// Map implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_map.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_MAP_H
+#define _STL_MAP_H 1
+
+#include <bits/functexcept.h>
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * @brief A standard container made up of (key,value) pairs, which can be
+ * retrieved based on a key, in logarithmic time.
+ *
+ * @ingroup associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and an
+ * <a href="tables.html#69">associative container</a> (using unique keys).
+ * For a @c map<Key,T> the key_type is Key, the mapped_type is T, and the
+ * value_type is std::pair<const Key,T>.
+ *
+ * Maps support bidirectional iterators.
+ *
+ * The private tree data is declared exactly the same way for map and
+ * multimap; the distinction is made entirely in how the tree functions are
+ * called (*_unique versus *_equal, same as the standard).
+ */
+ template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class map
+ {
+ public:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Alloc allocator_type;
+
+ private:
+ // concept requirements
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
+ _BinaryFunctionConcept)
+ __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
+
+ public:
+ class value_compare
+ : public std::binary_function<value_type, value_type, bool>
+ {
+ friend class map<_Key, _Tp, _Compare, _Alloc>;
+ protected:
+ _Compare comp;
+
+ value_compare(_Compare __c)
+ : comp(__c) { }
+
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+ private:
+ /// This turns a red-black tree into a [multi]map.
+ typedef typename _Alloc::template rebind<value_type>::other
+ _Pair_alloc_type;
+
+ typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
+ key_compare, _Pair_alloc_type> _Rep_type;
+
+ /// The actual tree structure.
+ _Rep_type _M_t;
+
+ public:
+ // many of these are specified differently in ISO, but the following are
+ // "functionally equivalent"
+ typedef typename _Pair_alloc_type::pointer pointer;
+ typedef typename _Pair_alloc_type::const_pointer const_pointer;
+ typedef typename _Pair_alloc_type::reference reference;
+ typedef typename _Pair_alloc_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+
+ // [23.3.1.1] construct/copy/destroy
+ // (get_allocator() is normally listed in this section, but seems to have
+ // been accidentally omitted in the printed standard)
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ map()
+ : _M_t() { }
+
+ /**
+ * @brief Creates a %map with no elements.
+ * @param comp A comparison object.
+ * @param a An allocator object.
+ */
+ explicit
+ map(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+ /**
+ * @brief %Map copy constructor.
+ * @param x A %map of identical element and allocator types.
+ *
+ * The newly-created %map uses a copy of the allocation object
+ * used by @a x.
+ */
+ map(const map& __x)
+ : _M_t(__x._M_t) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Map move constructor.
+ * @param x A %map of identical element and allocator types.
+ *
+ * The newly-created %map contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %map.
+ */
+ map(map&& __x)
+ : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %map from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison object.
+ * @param a An allocator object.
+ *
+ * Create a %map consisting of copies of the elements in the
+ * initializer_list @a l.
+ * This is linear in N if the range is already sorted, and NlogN
+ * otherwise (where N is @a l.size()).
+ */
+ map(initializer_list<value_type> __l,
+ const _Compare& __c = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__c, __a)
+ { _M_t._M_insert_unique(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Builds a %map from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * Create a %map consisting of copies of the elements from [first,last).
+ * This is linear in N if the range is already sorted, and NlogN
+ * otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ map(_InputIterator __first, _InputIterator __last)
+ : _M_t()
+ { _M_t._M_insert_unique(__first, __last); }
+
+ /**
+ * @brief Builds a %map from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %map consisting of copies of the elements from [first,last).
+ * This is linear in N if the range is already sorted, and NlogN
+ * otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ map(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_unique(__first, __last); }
+
+ // FIXME There is no dtor declared, but we should have something
+ // generated by Doxygen. I don't know what tags to add to this
+ // paragraph to make that happen:
+ /**
+ * The dtor only erases the elements, and note that if the elements
+ * themselves are pointers, the pointed-to memory is not touched in any
+ * way. Managing the pointer is the user's responsibility.
+ */
+
+ /**
+ * @brief %Map assignment operator.
+ * @param x A %map of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but unlike the copy constructor,
+ * the allocator object is not copied.
+ */
+ map&
+ operator=(const map& __x)
+ {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Map move assignment operator.
+ * @param x A %map of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this map (without copying).
+ * @a x is a valid, but unspecified %map.
+ */
+ map&
+ operator=(map&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief %Map list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %map with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %map and
+ * that the resulting %map's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ /// Get a copy of the memory allocation object.
+ allocator_type
+ get_allocator() const
+ { return _M_t.get_allocator(); }
+
+ // iterators
+ /**
+ * Returns a read/write iterator that points to the first pair in the
+ * %map.
+ * Iteration is done in ascending order according to the keys.
+ */
+ iterator
+ begin()
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first pair
+ * in the %map. Iteration is done in ascending order according to the
+ * keys.
+ */
+ const_iterator
+ begin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * pair in the %map. Iteration is done in ascending order
+ * according to the keys.
+ */
+ iterator
+ end()
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * pair in the %map. Iteration is done in ascending order according to
+ * the keys.
+ */
+ const_iterator
+ end() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read/write reverse iterator that points to the last pair in
+ * the %map. Iteration is done in descending order according to the
+ * keys.
+ */
+ reverse_iterator
+ rbegin()
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last pair in the %map. Iteration is done in descending order
+ * according to the keys.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one before the
+ * first pair in the %map. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ rend()
+ { return _M_t.rend(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to one
+ * before the first pair in the %map. Iteration is done in descending
+ * order according to the keys.
+ */
+ const_reverse_iterator
+ rend() const
+ { return _M_t.rend(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first pair
+ * in the %map. Iteration is done in ascending order according to the
+ * keys.
+ */
+ const_iterator
+ cbegin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * pair in the %map. Iteration is done in ascending order according to
+ * the keys.
+ */
+ const_iterator
+ cend() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last pair in the %map. Iteration is done in descending order
+ * according to the keys.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to one
+ * before the first pair in the %map. Iteration is done in descending
+ * order according to the keys.
+ */
+ const_reverse_iterator
+ crend() const
+ { return _M_t.rend(); }
+#endif
+
+ // capacity
+ /** Returns true if the %map is empty. (Thus begin() would equal
+ * end().)
+ */
+ bool
+ empty() const
+ { return _M_t.empty(); }
+
+ /** Returns the size of the %map. */
+ size_type
+ size() const
+ { return _M_t.size(); }
+
+ /** Returns the maximum size of the %map. */
+ size_type
+ max_size() const
+ { return _M_t.max_size(); }
+
+ // [23.3.1.2] element access
+ /**
+ * @brief Subscript ( @c [] ) access to %map data.
+ * @param k The key for which data should be retrieved.
+ * @return A reference to the data of the (key,data) %pair.
+ *
+ * Allows for easy lookup with the subscript ( @c [] )
+ * operator. Returns data associated with the key specified in
+ * subscript. If the key does not exist, a pair with that key
+ * is created using default values, which is then returned.
+ *
+ * Lookup requires logarithmic time.
+ */
+ mapped_type&
+ operator[](const key_type& __k)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
+
+ iterator __i = lower_bound(__k);
+ // __i->first is greater than or equivalent to __k.
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ __i = insert(__i, value_type(__k, mapped_type()));
+ return (*__i).second;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 464. Suggestion for new member functions in standard containers.
+ /**
+ * @brief Access to %map data.
+ * @param k The key for which data should be retrieved.
+ * @return A reference to the data whose key is equivalent to @a k, if
+ * such a data is present in the %map.
+ * @throw std::out_of_range If no such data is present.
+ */
+ mapped_type&
+ at(const key_type& __k)
+ {
+ iterator __i = lower_bound(__k);
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ __throw_out_of_range(__N("map::at"));
+ return (*__i).second;
+ }
+
+ const mapped_type&
+ at(const key_type& __k) const
+ {
+ const_iterator __i = lower_bound(__k);
+ if (__i == end() || key_comp()(__k, (*__i).first))
+ __throw_out_of_range(__N("map::at"));
+ return (*__i).second;
+ }
+
+ // modifiers
+ /**
+ * @brief Attempts to insert a std::pair into the %map.
+
+ * @param x Pair to be inserted (see std::make_pair for easy creation
+ * of pairs).
+
+ * @return A pair, of which the first element is an iterator that
+ * points to the possibly inserted pair, and the second is
+ * a bool that is true if the pair was actually inserted.
+ *
+ * This function attempts to insert a (key, value) %pair into the %map.
+ * A %map relies on unique keys and thus a %pair is only inserted if its
+ * first element (the key) is not already present in the %map.
+ *
+ * Insertion requires logarithmic time.
+ */
+ std::pair<iterator, bool>
+ insert(const value_type& __x)
+ { return _M_t._M_insert_unique(__x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of std::pairs into the %map.
+ * @param list A std::initializer_list<value_type> of pairs to be
+ * inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(std::initializer_list<value_type> __list)
+ { insert (__list.begin(), __list.end()); }
+#endif
+
+ /**
+ * @brief Attempts to insert a std::pair into the %map.
+ * @param position An iterator that serves as a hint as to where the
+ * pair should be inserted.
+ * @param x Pair to be inserted (see std::make_pair for easy creation
+ * of pairs).
+ * @return An iterator that points to the element with key of @a x (may
+ * or may not be the %pair passed in).
+ *
+
+ * This function is not concerned about whether the insertion
+ * took place, and thus does not return a boolean like the
+ * single-argument insert() does. Note that the first
+ * parameter is only a hint and can potentially improve the
+ * performance of the insertion process. A bad hint would
+ * cause no gains in efficiency.
+ *
+ * See
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+ * for more on "hinting".
+ *
+ * Insertion requires logarithmic time (if the hint is not taken).
+ */
+ iterator
+ insert(iterator __position, const value_type& __x)
+ { return _M_t._M_insert_unique_(__position, __x); }
+
+ /**
+ * @brief Template function that attempts to insert a range of elements.
+ * @param first Iterator pointing to the start of the range to be
+ * inserted.
+ * @param last Iterator pointing to the end of the range.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_unique(__first, __last); }
+
+ /**
+ * @brief Erases an element from a %map.
+ * @param position An iterator pointing to the element to be erased.
+ *
+ * This function erases an element, pointed to by the given
+ * iterator, from a %map. Note that this function only erases
+ * the element, and that if the element is itself a pointer,
+ * the pointed-to memory is not touched in any way. Managing
+ * the pointer is the user's responsibility.
+ */
+ void
+ erase(iterator __position)
+ { _M_t.erase(__position); }
+
+ /**
+ * @brief Erases elements according to the provided key.
+ * @param x Key of element to be erased.
+ * @return The number of elements erased.
+ *
+ * This function erases all the elements located by the given key from
+ * a %map.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ size_type
+ erase(const key_type& __x)
+ { return _M_t.erase(__x); }
+
+ /**
+ * @brief Erases a [first,last) range of elements from a %map.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ *
+ * This function erases a sequence of elements from a %map.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ void
+ erase(iterator __first, iterator __last)
+ { _M_t.erase(__first, __last); }
+
+ /**
+ * @brief Swaps data with another %map.
+ * @param x A %map of the same element and allocator types.
+ *
+ * This exchanges the elements between two maps in constant
+ * time. (It is only swapping a pointer, an integer, and an
+ * instance of the @c Compare type (which itself is often
+ * stateless and empty), so it should be quite fast.) Note
+ * that the global std::swap() function is specialized such
+ * that std::swap(m1,m2) will feed to this function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(map&& __x)
+#else
+ swap(map& __x)
+#endif
+ { _M_t.swap(__x._M_t); }
+
+ /**
+ * Erases all elements in a %map. Note that this function only
+ * erases the elements, and that if the elements themselves are
+ * pointers, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ void
+ clear()
+ { _M_t.clear(); }
+
+ // observers
+ /**
+ * Returns the key comparison object out of which the %map was
+ * constructed.
+ */
+ key_compare
+ key_comp() const
+ { return _M_t.key_comp(); }
+
+ /**
+ * Returns a value comparison object, built from the key comparison
+ * object out of which the %map was constructed.
+ */
+ value_compare
+ value_comp() const
+ { return value_compare(_M_t.key_comp()); }
+
+ // [23.3.1.3] map operations
+ /**
+ * @brief Tries to locate an element in a %map.
+ * @param x Key of (key, value) %pair to be located.
+ * @return Iterator pointing to sought-after element, or end() if not
+ * found.
+ *
+ * This function takes a key and tries to locate the element with which
+ * the key matches. If successful the function returns an iterator
+ * pointing to the sought after %pair. If unsuccessful it returns the
+ * past-the-end ( @c end() ) iterator.
+ */
+ iterator
+ find(const key_type& __x)
+ { return _M_t.find(__x); }
+
+ /**
+ * @brief Tries to locate an element in a %map.
+ * @param x Key of (key, value) %pair to be located.
+ * @return Read-only (constant) iterator pointing to sought-after
+ * element, or end() if not found.
+ *
+ * This function takes a key and tries to locate the element with which
+ * the key matches. If successful the function returns a constant
+ * iterator pointing to the sought after %pair. If unsuccessful it
+ * returns the past-the-end ( @c end() ) iterator.
+ */
+ const_iterator
+ find(const key_type& __x) const
+ { return _M_t.find(__x); }
+
+ /**
+ * @brief Finds the number of elements with given key.
+ * @param x Key of (key, value) pairs to be located.
+ * @return Number of elements with specified key.
+ *
+ * This function only makes sense for multimaps; for map the result will
+ * either be 0 (not present) or 1 (present).
+ */
+ size_type
+ count(const key_type& __x) const
+ { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
+
+ /**
+ * @brief Finds the beginning of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Iterator pointing to first element equal to or greater
+ * than key, or end().
+ *
+ * This function returns the first element of a subsequence of elements
+ * that matches the given key. If unsuccessful it returns an iterator
+ * pointing to the first element that has a greater value than given key
+ * or end() if no such element exists.
+ */
+ iterator
+ lower_bound(const key_type& __x)
+ { return _M_t.lower_bound(__x); }
+
+ /**
+ * @brief Finds the beginning of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Read-only (constant) iterator pointing to first element
+ * equal to or greater than key, or end().
+ *
+ * This function returns the first element of a subsequence of elements
+ * that matches the given key. If unsuccessful it returns an iterator
+ * pointing to the first element that has a greater value than given key
+ * or end() if no such element exists.
+ */
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return _M_t.lower_bound(__x); }
+
+ /**
+ * @brief Finds the end of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Iterator pointing to the first element
+ * greater than key, or end().
+ */
+ iterator
+ upper_bound(const key_type& __x)
+ { return _M_t.upper_bound(__x); }
+
+ /**
+ * @brief Finds the end of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Read-only (constant) iterator pointing to first iterator
+ * greater than key, or end().
+ */
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return _M_t.upper_bound(__x); }
+
+ /**
+ * @brief Finds a subsequence matching given key.
+ * @param x Key of (key, value) pairs to be located.
+ * @return Pair of iterators that possibly points to the subsequence
+ * matching given key.
+ *
+ * This function is equivalent to
+ * @code
+ * std::make_pair(c.lower_bound(val),
+ * c.upper_bound(val))
+ * @endcode
+ * (but is faster than making the calls separately).
+ *
+ * This function probably only makes sense for multimaps.
+ */
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __x)
+ { return _M_t.equal_range(__x); }
+
+ /**
+ * @brief Finds a subsequence matching given key.
+ * @param x Key of (key, value) pairs to be located.
+ * @return Pair of read-only (constant) iterators that possibly points
+ * to the subsequence matching given key.
+ *
+ * This function is equivalent to
+ * @code
+ * std::make_pair(c.lower_bound(val),
+ * c.upper_bound(val))
+ * @endcode
+ * (but is faster than making the calls separately).
+ *
+ * This function probably only makes sense for multimaps.
+ */
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __x) const
+ { return _M_t.equal_range(__x); }
+
+ template<typename _K1, typename _T1, typename _C1, typename _A1>
+ friend bool
+ operator==(const map<_K1, _T1, _C1, _A1>&,
+ const map<_K1, _T1, _C1, _A1>&);
+
+ template<typename _K1, typename _T1, typename _C1, typename _A1>
+ friend bool
+ operator<(const map<_K1, _T1, _C1, _A1>&,
+ const map<_K1, _T1, _C1, _A1>&);
+ };
+
+ /**
+ * @brief Map equality comparison.
+ * @param x A %map.
+ * @param y A %map of the same type as @a x.
+ * @return True iff the size and elements of the maps are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the
+ * maps. Maps are considered equivalent if their sizes are equal,
+ * and if corresponding elements compare equal.
+ */
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return __x._M_t == __y._M_t; }
+
+ /**
+ * @brief Map ordering relation.
+ * @param x A %map.
+ * @param y A %map of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * maps. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return __x._M_t < __y._M_t; }
+
+ /// Based on operator==
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::map::swap().
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
+ map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Alloc>&& __x,
+ map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
+ map<_Key, _Tp, _Compare, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_MAP_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_multimap.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_multimap.h
new file mode 100644
index 000000000..484537cf2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_multimap.h
@@ -0,0 +1,800 @@
+// Multimap implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_multimap.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_MULTIMAP_H
+#define _STL_MULTIMAP_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * @brief A standard container made up of (key,value) pairs, which can be
+ * retrieved based on a key, in logarithmic time.
+ *
+ * @ingroup associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and an
+ * <a href="tables.html#69">associative container</a> (using equivalent
+ * keys). For a @c multimap<Key,T> the key_type is Key, the mapped_type
+ * is T, and the value_type is std::pair<const Key,T>.
+ *
+ * Multimaps support bidirectional iterators.
+ *
+ * The private tree data is declared exactly the same way for map and
+ * multimap; the distinction is made entirely in how the tree functions are
+ * called (*_unique versus *_equal, same as the standard).
+ */
+ template <typename _Key, typename _Tp,
+ typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class multimap
+ {
+ public:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Alloc allocator_type;
+
+ private:
+ // concept requirements
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
+ _BinaryFunctionConcept)
+ __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
+
+ public:
+ class value_compare
+ : public std::binary_function<value_type, value_type, bool>
+ {
+ friend class multimap<_Key, _Tp, _Compare, _Alloc>;
+ protected:
+ _Compare comp;
+
+ value_compare(_Compare __c)
+ : comp(__c) { }
+
+ public:
+ bool operator()(const value_type& __x, const value_type& __y) const
+ { return comp(__x.first, __y.first); }
+ };
+
+ private:
+ /// This turns a red-black tree into a [multi]map.
+ typedef typename _Alloc::template rebind<value_type>::other
+ _Pair_alloc_type;
+
+ typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
+ key_compare, _Pair_alloc_type> _Rep_type;
+ /// The actual tree structure.
+ _Rep_type _M_t;
+
+ public:
+ // many of these are specified differently in ISO, but the following are
+ // "functionally equivalent"
+ typedef typename _Pair_alloc_type::pointer pointer;
+ typedef typename _Pair_alloc_type::const_pointer const_pointer;
+ typedef typename _Pair_alloc_type::reference reference;
+ typedef typename _Pair_alloc_type::const_reference const_reference;
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ typedef typename _Rep_type::reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+
+ // [23.3.2] construct/copy/destroy
+ // (get_allocator() is also listed in this section)
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ multimap()
+ : _M_t() { }
+
+ /**
+ * @brief Creates a %multimap with no elements.
+ * @param comp A comparison object.
+ * @param a An allocator object.
+ */
+ explicit
+ multimap(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+ /**
+ * @brief %Multimap copy constructor.
+ * @param x A %multimap of identical element and allocator types.
+ *
+ * The newly-created %multimap uses a copy of the allocation object
+ * used by @a x.
+ */
+ multimap(const multimap& __x)
+ : _M_t(__x._M_t) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Multimap move constructor.
+ * @param x A %multimap of identical element and allocator types.
+ *
+ * The newly-created %multimap contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %multimap.
+ */
+ multimap(multimap&& __x)
+ : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %multimap from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %multimap consisting of copies of the elements from
+ * the initializer_list. This is linear in N if the list is already
+ * sorted, and NlogN otherwise (where N is @a __l.size()).
+ */
+ multimap(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_equal(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Builds a %multimap from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * Create a %multimap consisting of copies of the elements from
+ * [first,last). This is linear in N if the range is already sorted,
+ * and NlogN otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last)
+ : _M_t()
+ { _M_t._M_insert_equal(__first, __last); }
+
+ /**
+ * @brief Builds a %multimap from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %multimap consisting of copies of the elements from
+ * [first,last). This is linear in N if the range is already sorted,
+ * and NlogN otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_equal(__first, __last); }
+
+ // FIXME There is no dtor declared, but we should have something generated
+ // by Doxygen. I don't know what tags to add to this paragraph to make
+ // that happen:
+ /**
+ * The dtor only erases the elements, and note that if the elements
+ * themselves are pointers, the pointed-to memory is not touched in any
+ * way. Managing the pointer is the user's responsibility.
+ */
+
+ /**
+ * @brief %Multimap assignment operator.
+ * @param x A %multimap of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but unlike the copy constructor,
+ * the allocator object is not copied.
+ */
+ multimap&
+ operator=(const multimap& __x)
+ {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Multimap move assignment operator.
+ * @param x A %multimap of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this multimap (without copying).
+ * @a x is a valid, but unspecified multimap.
+ */
+ multimap&
+ operator=(multimap&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief %Multimap list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %multimap with copies of the elements
+ * in the initializer list @a l.
+ *
+ * Note that the assignment completely changes the %multimap and
+ * that the resulting %multimap's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ /// Get a copy of the memory allocation object.
+ allocator_type
+ get_allocator() const
+ { return _M_t.get_allocator(); }
+
+ // iterators
+ /**
+ * Returns a read/write iterator that points to the first pair in the
+ * %multimap. Iteration is done in ascending order according to the
+ * keys.
+ */
+ iterator
+ begin()
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first pair
+ * in the %multimap. Iteration is done in ascending order according to
+ * the keys.
+ */
+ const_iterator
+ begin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read/write iterator that points one past the last pair in
+ * the %multimap. Iteration is done in ascending order according to the
+ * keys.
+ */
+ iterator
+ end()
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * pair in the %multimap. Iteration is done in ascending order according
+ * to the keys.
+ */
+ const_iterator
+ end() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read/write reverse iterator that points to the last pair in
+ * the %multimap. Iteration is done in descending order according to the
+ * keys.
+ */
+ reverse_iterator
+ rbegin()
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last pair in the %multimap. Iteration is done in descending order
+ * according to the keys.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one before the
+ * first pair in the %multimap. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ rend()
+ { return _M_t.rend(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to one
+ * before the first pair in the %multimap. Iteration is done in
+ * descending order according to the keys.
+ */
+ const_reverse_iterator
+ rend() const
+ { return _M_t.rend(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first pair
+ * in the %multimap. Iteration is done in ascending order according to
+ * the keys.
+ */
+ const_iterator
+ cbegin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * pair in the %multimap. Iteration is done in ascending order according
+ * to the keys.
+ */
+ const_iterator
+ cend() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last pair in the %multimap. Iteration is done in descending order
+ * according to the keys.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to one
+ * before the first pair in the %multimap. Iteration is done in
+ * descending order according to the keys.
+ */
+ const_reverse_iterator
+ crend() const
+ { return _M_t.rend(); }
+#endif
+
+ // capacity
+ /** Returns true if the %multimap is empty. */
+ bool
+ empty() const
+ { return _M_t.empty(); }
+
+ /** Returns the size of the %multimap. */
+ size_type
+ size() const
+ { return _M_t.size(); }
+
+ /** Returns the maximum size of the %multimap. */
+ size_type
+ max_size() const
+ { return _M_t.max_size(); }
+
+ // modifiers
+ /**
+ * @brief Inserts a std::pair into the %multimap.
+ * @param x Pair to be inserted (see std::make_pair for easy creation
+ * of pairs).
+ * @return An iterator that points to the inserted (key,value) pair.
+ *
+ * This function inserts a (key, value) pair into the %multimap.
+ * Contrary to a std::map the %multimap does not rely on unique keys and
+ * thus multiple pairs with the same key can be inserted.
+ *
+ * Insertion requires logarithmic time.
+ */
+ iterator
+ insert(const value_type& __x)
+ { return _M_t._M_insert_equal(__x); }
+
+ /**
+ * @brief Inserts a std::pair into the %multimap.
+ * @param position An iterator that serves as a hint as to where the
+ * pair should be inserted.
+ * @param x Pair to be inserted (see std::make_pair for easy creation
+ * of pairs).
+ * @return An iterator that points to the inserted (key,value) pair.
+ *
+ * This function inserts a (key, value) pair into the %multimap.
+ * Contrary to a std::map the %multimap does not rely on unique keys and
+ * thus multiple pairs with the same key can be inserted.
+ * Note that the first parameter is only a hint and can potentially
+ * improve the performance of the insertion process. A bad hint would
+ * cause no gains in efficiency.
+ *
+ * For more on "hinting," see:
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+ *
+ * Insertion requires logarithmic time (if the hint is not taken).
+ */
+ iterator
+ insert(iterator __position, const value_type& __x)
+ { return _M_t._M_insert_equal_(__position, __x); }
+
+ /**
+ * @brief A template function that attempts to insert a range
+ * of elements.
+ * @param first Iterator pointing to the start of the range to be
+ * inserted.
+ * @param last Iterator pointing to the end of the range.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_equal(__first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of std::pairs into the %multimap.
+ * @param list A std::initializer_list<value_type> of pairs to be
+ * inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Erases an element from a %multimap.
+ * @param position An iterator pointing to the element to be erased.
+ *
+ * This function erases an element, pointed to by the given iterator,
+ * from a %multimap. Note that this function only erases the element,
+ * and that if the element is itself a pointer, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ void
+ erase(iterator __position)
+ { _M_t.erase(__position); }
+
+ /**
+ * @brief Erases elements according to the provided key.
+ * @param x Key of element to be erased.
+ * @return The number of elements erased.
+ *
+ * This function erases all elements located by the given key from a
+ * %multimap.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ size_type
+ erase(const key_type& __x)
+ { return _M_t.erase(__x); }
+
+ /**
+ * @brief Erases a [first,last) range of elements from a %multimap.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ *
+ * This function erases a sequence of elements from a %multimap.
+ * Note that this function only erases the elements, and that if
+ * the elements themselves are pointers, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's responsibility.
+ */
+ void
+ erase(iterator __first, iterator __last)
+ { _M_t.erase(__first, __last); }
+
+ /**
+ * @brief Swaps data with another %multimap.
+ * @param x A %multimap of the same element and allocator types.
+ *
+ * This exchanges the elements between two multimaps in constant time.
+ * (It is only swapping a pointer, an integer, and an instance of
+ * the @c Compare type (which itself is often stateless and empty), so it
+ * should be quite fast.)
+ * Note that the global std::swap() function is specialized such that
+ * std::swap(m1,m2) will feed to this function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multimap&& __x)
+#else
+ swap(multimap& __x)
+#endif
+ { _M_t.swap(__x._M_t); }
+
+ /**
+ * Erases all elements in a %multimap. Note that this function only
+ * erases the elements, and that if the elements themselves are pointers,
+ * the pointed-to memory is not touched in any way. Managing the pointer
+ * is the user's responsibility.
+ */
+ void
+ clear()
+ { _M_t.clear(); }
+
+ // observers
+ /**
+ * Returns the key comparison object out of which the %multimap
+ * was constructed.
+ */
+ key_compare
+ key_comp() const
+ { return _M_t.key_comp(); }
+
+ /**
+ * Returns a value comparison object, built from the key comparison
+ * object out of which the %multimap was constructed.
+ */
+ value_compare
+ value_comp() const
+ { return value_compare(_M_t.key_comp()); }
+
+ // multimap operations
+ /**
+ * @brief Tries to locate an element in a %multimap.
+ * @param x Key of (key, value) pair to be located.
+ * @return Iterator pointing to sought-after element,
+ * or end() if not found.
+ *
+ * This function takes a key and tries to locate the element with which
+ * the key matches. If successful the function returns an iterator
+ * pointing to the sought after %pair. If unsuccessful it returns the
+ * past-the-end ( @c end() ) iterator.
+ */
+ iterator
+ find(const key_type& __x)
+ { return _M_t.find(__x); }
+
+ /**
+ * @brief Tries to locate an element in a %multimap.
+ * @param x Key of (key, value) pair to be located.
+ * @return Read-only (constant) iterator pointing to sought-after
+ * element, or end() if not found.
+ *
+ * This function takes a key and tries to locate the element with which
+ * the key matches. If successful the function returns a constant
+ * iterator pointing to the sought after %pair. If unsuccessful it
+ * returns the past-the-end ( @c end() ) iterator.
+ */
+ const_iterator
+ find(const key_type& __x) const
+ { return _M_t.find(__x); }
+
+ /**
+ * @brief Finds the number of elements with given key.
+ * @param x Key of (key, value) pairs to be located.
+ * @return Number of elements with specified key.
+ */
+ size_type
+ count(const key_type& __x) const
+ { return _M_t.count(__x); }
+
+ /**
+ * @brief Finds the beginning of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Iterator pointing to first element equal to or greater
+ * than key, or end().
+ *
+ * This function returns the first element of a subsequence of elements
+ * that matches the given key. If unsuccessful it returns an iterator
+ * pointing to the first element that has a greater value than given key
+ * or end() if no such element exists.
+ */
+ iterator
+ lower_bound(const key_type& __x)
+ { return _M_t.lower_bound(__x); }
+
+ /**
+ * @brief Finds the beginning of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Read-only (constant) iterator pointing to first element
+ * equal to or greater than key, or end().
+ *
+ * This function returns the first element of a subsequence of elements
+ * that matches the given key. If unsuccessful the iterator will point
+ * to the next greatest element or, if no such greater element exists, to
+ * end().
+ */
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return _M_t.lower_bound(__x); }
+
+ /**
+ * @brief Finds the end of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Iterator pointing to the first element
+ * greater than key, or end().
+ */
+ iterator
+ upper_bound(const key_type& __x)
+ { return _M_t.upper_bound(__x); }
+
+ /**
+ * @brief Finds the end of a subsequence matching given key.
+ * @param x Key of (key, value) pair to be located.
+ * @return Read-only (constant) iterator pointing to first iterator
+ * greater than key, or end().
+ */
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return _M_t.upper_bound(__x); }
+
+ /**
+ * @brief Finds a subsequence matching given key.
+ * @param x Key of (key, value) pairs to be located.
+ * @return Pair of iterators that possibly points to the subsequence
+ * matching given key.
+ *
+ * This function is equivalent to
+ * @code
+ * std::make_pair(c.lower_bound(val),
+ * c.upper_bound(val))
+ * @endcode
+ * (but is faster than making the calls separately).
+ */
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __x)
+ { return _M_t.equal_range(__x); }
+
+ /**
+ * @brief Finds a subsequence matching given key.
+ * @param x Key of (key, value) pairs to be located.
+ * @return Pair of read-only (constant) iterators that possibly points
+ * to the subsequence matching given key.
+ *
+ * This function is equivalent to
+ * @code
+ * std::make_pair(c.lower_bound(val),
+ * c.upper_bound(val))
+ * @endcode
+ * (but is faster than making the calls separately).
+ */
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __x) const
+ { return _M_t.equal_range(__x); }
+
+ template<typename _K1, typename _T1, typename _C1, typename _A1>
+ friend bool
+ operator==(const multimap<_K1, _T1, _C1, _A1>&,
+ const multimap<_K1, _T1, _C1, _A1>&);
+
+ template<typename _K1, typename _T1, typename _C1, typename _A1>
+ friend bool
+ operator<(const multimap<_K1, _T1, _C1, _A1>&,
+ const multimap<_K1, _T1, _C1, _A1>&);
+ };
+
+ /**
+ * @brief Multimap equality comparison.
+ * @param x A %multimap.
+ * @param y A %multimap of the same type as @a x.
+ * @return True iff the size and elements of the maps are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the
+ * multimaps. Multimaps are considered equivalent if their sizes are equal,
+ * and if corresponding elements compare equal.
+ */
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return __x._M_t == __y._M_t; }
+
+ /**
+ * @brief Multimap ordering relation.
+ * @param x A %multimap.
+ * @param y A %multimap of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * multimaps. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return __x._M_t < __y._M_t; }
+
+ /// Based on operator==
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline bool
+ operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ const multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::multimap::swap().
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Alloc>&& __x,
+ multimap<_Key, _Tp, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,
+ multimap<_Key, _Tp, _Compare, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_MULTIMAP_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_multiset.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_multiset.h
new file mode 100644
index 000000000..b5c710f31
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_multiset.h
@@ -0,0 +1,697 @@
+// Multiset implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_multiset.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_MULTISET_H
+#define _STL_MULTISET_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * @brief A standard container made up of elements, which can be retrieved
+ * in logarithmic time.
+ *
+ * @ingroup associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and an
+ * <a href="tables.html#69">associative container</a> (using equivalent
+ * keys). For a @c multiset<Key> the key_type and value_type are Key.
+ *
+ * Multisets support bidirectional iterators.
+ *
+ * The private tree data is declared exactly the same way for set and
+ * multiset; the distinction is made entirely in how the tree functions are
+ * called (*_unique versus *_equal, same as the standard).
+ */
+ template <typename _Key, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class multiset
+ {
+ // concept requirements
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Key, _SGIAssignableConcept)
+ __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
+ _BinaryFunctionConcept)
+ __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
+
+ public:
+ // typedefs:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+ typedef _Alloc allocator_type;
+
+ private:
+ /// This turns a red-black tree into a [multi]set.
+ typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
+
+ typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
+ key_compare, _Key_alloc_type> _Rep_type;
+ /// The actual tree structure.
+ _Rep_type _M_t;
+
+ public:
+ typedef typename _Key_alloc_type::pointer pointer;
+ typedef typename _Key_alloc_type::const_pointer const_pointer;
+ typedef typename _Key_alloc_type::reference reference;
+ typedef typename _Key_alloc_type::const_reference const_reference;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 103. set::iterator is required to be modifiable,
+ // but this allows modification of keys.
+ typedef typename _Rep_type::const_iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+
+ // allocation/deallocation
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ multiset()
+ : _M_t() { }
+
+ /**
+ * @brief Creates a %multiset with no elements.
+ * @param comp Comparator to use.
+ * @param a An allocator object.
+ */
+ explicit
+ multiset(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+ /**
+ * @brief Builds a %multiset from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * Create a %multiset consisting of copies of the elements from
+ * [first,last). This is linear in N if the range is already sorted,
+ * and NlogN otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last)
+ : _M_t()
+ { _M_t._M_insert_equal(__first, __last); }
+
+ /**
+ * @brief Builds a %multiset from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %multiset consisting of copies of the elements from
+ * [first,last). This is linear in N if the range is already sorted,
+ * and NlogN otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_equal(__first, __last); }
+
+ /**
+ * @brief %Multiset copy constructor.
+ * @param x A %multiset of identical element and allocator types.
+ *
+ * The newly-created %multiset uses a copy of the allocation object used
+ * by @a x.
+ */
+ multiset(const multiset& __x)
+ : _M_t(__x._M_t) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Multiset move constructor.
+ * @param x A %multiset of identical element and allocator types.
+ *
+ * The newly-created %multiset contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %multiset.
+ */
+ multiset(multiset&& __x)
+ : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %multiset from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %multiset consisting of copies of the elements from
+ * the list. This is linear in N if the list is already sorted,
+ * and NlogN otherwise (where N is @a l.size()).
+ */
+ multiset(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_equal(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief %Multiset assignment operator.
+ * @param x A %multiset of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but unlike the copy constructor,
+ * the allocator object is not copied.
+ */
+ multiset&
+ operator=(const multiset& __x)
+ {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Multiset move assignment operator.
+ * @param x A %multiset of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this %multiset (without copying).
+ * @a x is a valid, but unspecified %multiset.
+ */
+ multiset&
+ operator=(multiset&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief %Multiset list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %multiset with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %multiset and
+ * that the resulting %multiset's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ // accessors:
+
+ /// Returns the comparison object.
+ key_compare
+ key_comp() const
+ { return _M_t.key_comp(); }
+ /// Returns the comparison object.
+ value_compare
+ value_comp() const
+ { return _M_t.key_comp(); }
+ /// Returns the memory allocation object.
+ allocator_type
+ get_allocator() const
+ { return _M_t.get_allocator(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %multiset. Iteration is done in ascending order
+ * according to the keys.
+ */
+ iterator
+ begin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * element in the %multiset. Iteration is done in ascending order
+ * according to the keys.
+ */
+ iterator
+ end() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last element in the %multiset. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ rbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last element in the %multiset. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ rend() const
+ { return _M_t.rend(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %multiset. Iteration is done in ascending order
+ * according to the keys.
+ */
+ iterator
+ cbegin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * element in the %multiset. Iteration is done in ascending order
+ * according to the keys.
+ */
+ iterator
+ cend() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last element in the %multiset. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ crbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last element in the %multiset. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ crend() const
+ { return _M_t.rend(); }
+#endif
+
+ /// Returns true if the %set is empty.
+ bool
+ empty() const
+ { return _M_t.empty(); }
+
+ /// Returns the size of the %set.
+ size_type
+ size() const
+ { return _M_t.size(); }
+
+ /// Returns the maximum size of the %set.
+ size_type
+ max_size() const
+ { return _M_t.max_size(); }
+
+ /**
+ * @brief Swaps data with another %multiset.
+ * @param x A %multiset of the same element and allocator types.
+ *
+ * This exchanges the elements between two multisets in constant time.
+ * (It is only swapping a pointer, an integer, and an instance of the @c
+ * Compare type (which itself is often stateless and empty), so it should
+ * be quite fast.)
+ * Note that the global std::swap() function is specialized such that
+ * std::swap(s1,s2) will feed to this function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multiset&& __x)
+#else
+ swap(multiset& __x)
+#endif
+ { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ /**
+ * @brief Inserts an element into the %multiset.
+ * @param x Element to be inserted.
+ * @return An iterator that points to the inserted element.
+ *
+ * This function inserts an element into the %multiset. Contrary
+ * to a std::set the %multiset does not rely on unique keys and thus
+ * multiple copies of the same element can be inserted.
+ *
+ * Insertion requires logarithmic time.
+ */
+ iterator
+ insert(const value_type& __x)
+ { return _M_t._M_insert_equal(__x); }
+
+ /**
+ * @brief Inserts an element into the %multiset.
+ * @param position An iterator that serves as a hint as to where the
+ * element should be inserted.
+ * @param x Element to be inserted.
+ * @return An iterator that points to the inserted element.
+ *
+ * This function inserts an element into the %multiset. Contrary
+ * to a std::set the %multiset does not rely on unique keys and thus
+ * multiple copies of the same element can be inserted.
+ *
+ * Note that the first parameter is only a hint and can potentially
+ * improve the performance of the insertion process. A bad hint would
+ * cause no gains in efficiency.
+ *
+ * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+ * for more on "hinting".
+ *
+ * Insertion requires logarithmic time (if the hint is not taken).
+ */
+ iterator
+ insert(iterator __position, const value_type& __x)
+ { return _M_t._M_insert_equal_(__position, __x); }
+
+ /**
+ * @brief A template function that attempts to insert a range of elements.
+ * @param first Iterator pointing to the start of the range to be
+ * inserted.
+ * @param last Iterator pointing to the end of the range.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_equal(__first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of elements into the %multiset.
+ * @param list A std::initializer_list<value_type> of elements
+ * to be inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Erases an element from a %multiset.
+ * @param position An iterator pointing to the element to be erased.
+ *
+ * This function erases an element, pointed to by the given iterator,
+ * from a %multiset. Note that this function only erases the element,
+ * and that if the element is itself a pointer, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ void
+ erase(iterator __position)
+ { _M_t.erase(__position); }
+
+ /**
+ * @brief Erases elements according to the provided key.
+ * @param x Key of element to be erased.
+ * @return The number of elements erased.
+ *
+ * This function erases all elements located by the given key from a
+ * %multiset.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ size_type
+ erase(const key_type& __x)
+ { return _M_t.erase(__x); }
+
+ /**
+ * @brief Erases a [first,last) range of elements from a %multiset.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ *
+ * This function erases a sequence of elements from a %multiset.
+ * Note that this function only erases the elements, and that if
+ * the elements themselves are pointers, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's responsibility.
+ */
+ void
+ erase(iterator __first, iterator __last)
+ { _M_t.erase(__first, __last); }
+
+ /**
+ * Erases all elements in a %multiset. Note that this function only
+ * erases the elements, and that if the elements themselves are pointers,
+ * the pointed-to memory is not touched in any way. Managing the pointer
+ * is the user's responsibility.
+ */
+ void
+ clear()
+ { _M_t.clear(); }
+
+ // multiset operations:
+
+ /**
+ * @brief Finds the number of elements with given key.
+ * @param x Key of elements to be located.
+ * @return Number of elements with specified key.
+ */
+ size_type
+ count(const key_type& __x) const
+ { return _M_t.count(__x); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ //@{
+ /**
+ * @brief Tries to locate an element in a %set.
+ * @param x Element to be located.
+ * @return Iterator pointing to sought-after element, or end() if not
+ * found.
+ *
+ * This function takes a key and tries to locate the element with which
+ * the key matches. If successful the function returns an iterator
+ * pointing to the sought after element. If unsuccessful it returns the
+ * past-the-end ( @c end() ) iterator.
+ */
+ iterator
+ find(const key_type& __x)
+ { return _M_t.find(__x); }
+
+ const_iterator
+ find(const key_type& __x) const
+ { return _M_t.find(__x); }
+ //@}
+
+ //@{
+ /**
+ * @brief Finds the beginning of a subsequence matching given key.
+ * @param x Key to be located.
+ * @return Iterator pointing to first element equal to or greater
+ * than key, or end().
+ *
+ * This function returns the first element of a subsequence of elements
+ * that matches the given key. If unsuccessful it returns an iterator
+ * pointing to the first element that has a greater value than given key
+ * or end() if no such element exists.
+ */
+ iterator
+ lower_bound(const key_type& __x)
+ { return _M_t.lower_bound(__x); }
+
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return _M_t.lower_bound(__x); }
+ //@}
+
+ //@{
+ /**
+ * @brief Finds the end of a subsequence matching given key.
+ * @param x Key to be located.
+ * @return Iterator pointing to the first element
+ * greater than key, or end().
+ */
+ iterator
+ upper_bound(const key_type& __x)
+ { return _M_t.upper_bound(__x); }
+
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return _M_t.upper_bound(__x); }
+ //@}
+
+ //@{
+ /**
+ * @brief Finds a subsequence matching given key.
+ * @param x Key to be located.
+ * @return Pair of iterators that possibly points to the subsequence
+ * matching given key.
+ *
+ * This function is equivalent to
+ * @code
+ * std::make_pair(c.lower_bound(val),
+ * c.upper_bound(val))
+ * @endcode
+ * (but is faster than making the calls separately).
+ *
+ * This function probably only makes sense for multisets.
+ */
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __x)
+ { return _M_t.equal_range(__x); }
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __x) const
+ { return _M_t.equal_range(__x); }
+
+ template<typename _K1, typename _C1, typename _A1>
+ friend bool
+ operator==(const multiset<_K1, _C1, _A1>&,
+ const multiset<_K1, _C1, _A1>&);
+
+ template<typename _K1, typename _C1, typename _A1>
+ friend bool
+ operator< (const multiset<_K1, _C1, _A1>&,
+ const multiset<_K1, _C1, _A1>&);
+ };
+
+ /**
+ * @brief Multiset equality comparison.
+ * @param x A %multiset.
+ * @param y A %multiset of the same type as @a x.
+ * @return True iff the size and elements of the multisets are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the
+ * multisets.
+ * Multisets are considered equivalent if their sizes are equal, and if
+ * corresponding elements compare equal.
+ */
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator==(const multiset<_Key, _Compare, _Alloc>& __x,
+ const multiset<_Key, _Compare, _Alloc>& __y)
+ { return __x._M_t == __y._M_t; }
+
+ /**
+ * @brief Multiset ordering relation.
+ * @param x A %multiset.
+ * @param y A %multiset of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * maps. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator<(const multiset<_Key, _Compare, _Alloc>& __x,
+ const multiset<_Key, _Compare, _Alloc>& __y)
+ { return __x._M_t < __y._M_t; }
+
+ /// Returns !(x == y).
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator!=(const multiset<_Key, _Compare, _Alloc>& __x,
+ const multiset<_Key, _Compare, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Returns y < x.
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator>(const multiset<_Key,_Compare,_Alloc>& __x,
+ const multiset<_Key,_Compare,_Alloc>& __y)
+ { return __y < __x; }
+
+ /// Returns !(y < x)
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
+ const multiset<_Key, _Compare, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Returns !(x < y)
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator>=(const multiset<_Key, _Compare, _Alloc>& __x,
+ const multiset<_Key, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::multiset::swap().
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(multiset<_Key, _Compare, _Alloc>& __x,
+ multiset<_Key, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(multiset<_Key, _Compare, _Alloc>&& __x,
+ multiset<_Key, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(multiset<_Key, _Compare, _Alloc>& __x,
+ multiset<_Key, _Compare, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_MULTISET_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_numeric.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_numeric.h
new file mode 100644
index 000000000..5edf2bc5d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_numeric.h
@@ -0,0 +1,373 @@
+// Numeric functions implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_numeric.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_NUMERIC_H
+#define _STL_NUMERIC_H 1
+
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Create a range of sequentially increasing values.
+ *
+ * For each element in the range @p [first,last) assigns @p value and
+ * increments @p value as if by @p ++value.
+ *
+ * @param first Start of range.
+ * @param last End of range.
+ * @param value Starting value.
+ * @return Nothing.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ void
+ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
+ _ForwardIterator>)
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ {
+ *__first = __value;
+ ++__value;
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
+
+ /**
+ * @brief Accumulate values in a range.
+ *
+ * Accumulates the values in the range [first,last) using operator+(). The
+ * initial value is @a init. The values are processed in order.
+ *
+ * @param first Start of range.
+ * @param last End of range.
+ * @param init Starting value to add other values to.
+ * @return The final sum.
+ */
+ template<typename _InputIterator, typename _Tp>
+ inline _Tp
+ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ __init = __init + *__first;
+ return __init;
+ }
+
+ /**
+ * @brief Accumulate values in a range with operation.
+ *
+ * Accumulates the values in the range [first,last) using the function
+ * object @a binary_op. The initial value is @a init. The values are
+ * processed in order.
+ *
+ * @param first Start of range.
+ * @param last End of range.
+ * @param init Starting value to add other values to.
+ * @param binary_op Function object to accumulate with.
+ * @return The final sum.
+ */
+ template<typename _InputIterator, typename _Tp, typename _BinaryOperation>
+ inline _Tp
+ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
+ _BinaryOperation __binary_op)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for (; __first != __last; ++__first)
+ __init = __binary_op(__init, *__first);
+ return __init;
+ }
+
+ /**
+ * @brief Compute inner product of two ranges.
+ *
+ * Starting with an initial value of @a init, multiplies successive
+ * elements from the two ranges and adds each product into the accumulated
+ * value using operator+(). The values in the ranges are processed in
+ * order.
+ *
+ * @param first1 Start of range 1.
+ * @param last1 End of range 1.
+ * @param first2 Start of range 2.
+ * @param init Starting value to add other values to.
+ * @return The final inner product.
+ */
+ template<typename _InputIterator1, typename _InputIterator2, typename _Tp>
+ inline _Tp
+ inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp __init)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ for (; __first1 != __last1; ++__first1, ++__first2)
+ __init = __init + (*__first1 * *__first2);
+ return __init;
+ }
+
+ /**
+ * @brief Compute inner product of two ranges.
+ *
+ * Starting with an initial value of @a init, applies @a binary_op2 to
+ * successive elements from the two ranges and accumulates each result into
+ * the accumulated value using @a binary_op1. The values in the ranges are
+ * processed in order.
+ *
+ * @param first1 Start of range 1.
+ * @param last1 End of range 1.
+ * @param first2 Start of range 2.
+ * @param init Starting value to add other values to.
+ * @param binary_op1 Function object to accumulate with.
+ * @param binary_op2 Function object to apply to pairs of input values.
+ * @return The final inner product.
+ */
+ template<typename _InputIterator1, typename _InputIterator2, typename _Tp,
+ typename _BinaryOperation1, typename _BinaryOperation2>
+ inline _Tp
+ inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp __init,
+ _BinaryOperation1 __binary_op1,
+ _BinaryOperation2 __binary_op2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ for (; __first1 != __last1; ++__first1, ++__first2)
+ __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
+ return __init;
+ }
+
+ /**
+ * @brief Return list of partial sums
+ *
+ * Accumulates the values in the range [first,last) using operator+().
+ * As each successive input value is added into the total, that partial sum
+ * is written to @a result. Therefore, the first value in result is the
+ * first value of the input, the second value in result is the sum of the
+ * first and second input values, and so on.
+ *
+ * @param first Start of input range.
+ * @param last End of input range.
+ * @param result Output to write sums to.
+ * @return Iterator pointing just beyond the values written to result.
+ */
+ template<typename _InputIterator, typename _OutputIterator>
+ _OutputIterator
+ partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __result;
+ _ValueType __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ {
+ __value = __value + *__first;
+ *++__result = __value;
+ }
+ return ++__result;
+ }
+
+ /**
+ * @brief Return list of partial sums
+ *
+ * Accumulates the values in the range [first,last) using operator+().
+ * As each successive input value is added into the total, that partial sum
+ * is written to @a result. Therefore, the first value in result is the
+ * first value of the input, the second value in result is the sum of the
+ * first and second input values, and so on.
+ *
+ * @param first Start of input range.
+ * @param last End of input range.
+ * @param result Output to write sums to.
+ * @return Iterator pointing just beyond the values written to result.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _BinaryOperation>
+ _OutputIterator
+ partial_sum(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOperation __binary_op)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __result;
+ _ValueType __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ {
+ __value = __binary_op(__value, *__first);
+ *++__result = __value;
+ }
+ return ++__result;
+ }
+
+ /**
+ * @brief Return differences between adjacent values.
+ *
+ * Computes the difference between adjacent values in the range
+ * [first,last) using operator-() and writes the result to @a result.
+ *
+ * @param first Start of input range.
+ * @param last End of input range.
+ * @param result Output to write sums to.
+ * @return Iterator pointing just beyond the values written to result.
+ */
+ template<typename _InputIterator, typename _OutputIterator>
+ _OutputIterator
+ adjacent_difference(_InputIterator __first,
+ _InputIterator __last, _OutputIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __result;
+ _ValueType __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ {
+ _ValueType __tmp = *__first;
+ *++__result = __tmp - __value;
+ __value = __tmp;
+ }
+ return ++__result;
+ }
+
+ /**
+ * @brief Return differences between adjacent values.
+ *
+ * Computes the difference between adjacent values in the range
+ * [first,last) using the function object @a binary_op and writes the
+ * result to @a result.
+ *
+ * @param first Start of input range.
+ * @param last End of input range.
+ * @param result Output to write sums to.
+ * @return Iterator pointing just beyond the values written to result.
+ */
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _BinaryOperation>
+ _OutputIterator
+ adjacent_difference(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOperation __binary_op)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type _ValueType;
+
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ _ValueType>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return __result;
+ _ValueType __value = *__first;
+ *__result = __value;
+ while (++__first != __last)
+ {
+ _ValueType __tmp = *__first;
+ *++__result = __binary_op(__tmp, __value);
+ __value = __tmp;
+ }
+ return ++__result;
+ }
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_NUMERIC_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_pair.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_pair.h
new file mode 100644
index 000000000..fd395adbd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_pair.h
@@ -0,0 +1,261 @@
+// Pair implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_pair.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_PAIR_H
+#define _STL_PAIR_H 1
+
+#include <bits/move.h> // for std::move / std::forward, std::decay, and
+ // std::swap
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /// pair holds two objects of arbitrary type.
+ template<class _T1, class _T2>
+ struct pair
+ {
+ typedef _T1 first_type; ///< @c first_type is the first bound type
+ typedef _T2 second_type; ///< @c second_type is the second bound type
+
+ _T1 first; ///< @c first is a copy of the first object
+ _T2 second; ///< @c second is a copy of the second object
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 265. std::pair::pair() effects overly restrictive
+ /** The default constructor creates @c first and @c second using their
+ * respective default constructors. */
+ pair()
+ : first(), second() { }
+
+ /** Two objects may be passed to a @c pair constructor to be copied. */
+ pair(const _T1& __a, const _T2& __b)
+ : first(__a), second(__b) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<class _U1, class _U2>
+ pair(_U1&& __x, _U2&& __y)
+ : first(std::forward<_U1>(__x)),
+ second(std::forward<_U2>(__y)) { }
+
+ pair(pair&& __p)
+ : first(std::move(__p.first)),
+ second(std::move(__p.second)) { }
+#endif
+
+ /** There is also a templated copy ctor for the @c pair class itself. */
+ template<class _U1, class _U2>
+ pair(const pair<_U1, _U2>& __p)
+ : first(__p.first),
+ second(__p.second) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<class _U1, class _U2>
+ pair(pair<_U1, _U2>&& __p)
+ : first(std::move(__p.first)),
+ second(std::move(__p.second)) { }
+
+ // http://gcc.gnu.org/ml/libstdc++/2007-08/msg00052.html
+ template<class _U1, class _Arg0, class... _Args>
+ pair(_U1&& __x, _Arg0&& __arg0, _Args&&... __args)
+ : first(std::forward<_U1>(__x)),
+ second(std::forward<_Arg0>(__arg0),
+ std::forward<_Args>(__args)...) { }
+
+ pair&
+ operator=(pair&& __p)
+ {
+ first = std::move(__p.first);
+ second = std::move(__p.second);
+ return *this;
+ }
+
+ template<class _U1, class _U2>
+ pair&
+ operator=(pair<_U1, _U2>&& __p)
+ {
+ first = std::move(__p.first);
+ second = std::move(__p.second);
+ return *this;
+ }
+
+ void
+ swap(pair&& __p)
+ {
+ using std::swap;
+ swap(first, __p.first);
+ swap(second, __p.second);
+ }
+#endif
+ };
+
+ /// Two pairs of the same type are equal iff their members are equal.
+ template<class _T1, class _T2>
+ inline bool
+ operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+ { return __x.first == __y.first && __x.second == __y.second; }
+
+ /// <http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html>
+ template<class _T1, class _T2>
+ inline bool
+ operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+ { return __x.first < __y.first
+ || (!(__y.first < __x.first) && __x.second < __y.second); }
+
+ /// Uses @c operator== to find the result.
+ template<class _T1, class _T2>
+ inline bool
+ operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+ { return !(__x == __y); }
+
+ /// Uses @c operator< to find the result.
+ template<class _T1, class _T2>
+ inline bool
+ operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+ { return __y < __x; }
+
+ /// Uses @c operator< to find the result.
+ template<class _T1, class _T2>
+ inline bool
+ operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+ { return !(__y < __x); }
+
+ /// Uses @c operator< to find the result.
+ template<class _T1, class _T2>
+ inline bool
+ operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
+ { return !(__x < __y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// See std::pair::swap().
+ // Note: no std::swap overloads in C++03 mode, this has performance
+ // implications, see, eg, libstdc++/38466.
+ template<class _T1, class _T2>
+ inline void
+ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
+ { __x.swap(__y); }
+
+ template<class _T1, class _T2>
+ inline void
+ swap(pair<_T1, _T2>&& __x, pair<_T1, _T2>& __y)
+ { __x.swap(__y); }
+
+ template<class _T1, class _T2>
+ inline void
+ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>&& __y)
+ { __x.swap(__y); }
+#endif
+
+ /**
+ * @brief A convenience wrapper for creating a pair from two objects.
+ * @param x The first object.
+ * @param y The second object.
+ * @return A newly-constructed pair<> object of the appropriate type.
+ *
+ * The standard requires that the objects be passed by reference-to-const,
+ * but LWG issue #181 says they should be passed by const value. We follow
+ * the LWG by default.
+ */
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 181. make_pair() unintended behavior
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ template<class _T1, class _T2>
+ inline pair<_T1, _T2>
+ make_pair(_T1 __x, _T2 __y)
+ { return pair<_T1, _T2>(__x, __y); }
+#else
+ template<typename _Tp>
+ class reference_wrapper;
+
+ // Helper which adds a reference to a type when given a reference_wrapper
+ template<typename _Tp>
+ struct __strip_reference_wrapper
+ {
+ typedef _Tp __type;
+ };
+
+ template<typename _Tp>
+ struct __strip_reference_wrapper<reference_wrapper<_Tp> >
+ {
+ typedef _Tp& __type;
+ };
+
+ template<typename _Tp>
+ struct __strip_reference_wrapper<const reference_wrapper<_Tp> >
+ {
+ typedef _Tp& __type;
+ };
+
+ template<typename _Tp>
+ struct __decay_and_strip
+ {
+ typedef typename __strip_reference_wrapper<
+ typename decay<_Tp>::type>::__type __type;
+ };
+
+ // NB: DR 706.
+ template<class _T1, class _T2>
+ inline pair<typename __decay_and_strip<_T1>::__type,
+ typename __decay_and_strip<_T2>::__type>
+ make_pair(_T1&& __x, _T2&& __y)
+ {
+ return pair<typename __decay_and_strip<_T1>::__type,
+ typename __decay_and_strip<_T2>::__type>
+ (std::forward<_T1>(__x), std::forward<_T2>(__y));
+ }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_PAIR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_queue.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_queue.h
new file mode 100644
index 000000000..7479469d1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_queue.h
@@ -0,0 +1,586 @@
+// Queue implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_queue.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_QUEUE_H
+#define _STL_QUEUE_H 1
+
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief A standard container giving FIFO behavior.
+ *
+ * @ingroup sequences
+ *
+ * Meets many of the requirements of a
+ * <a href="tables.html#65">container</a>,
+ * but does not define anything to do with iterators. Very few of the
+ * other standard container interfaces are defined.
+ *
+ * This is not a true container, but an @e adaptor. It holds another
+ * container, and provides a wrapper interface to that container. The
+ * wrapper is what enforces strict first-in-first-out %queue behavior.
+ *
+ * The second template parameter defines the type of the underlying
+ * sequence/container. It defaults to std::deque, but it can be any type
+ * that supports @c front, @c back, @c push_back, and @c pop_front,
+ * such as std::list or an appropriate user-defined type.
+ *
+ * Members not found in "normal" containers are @c container_type,
+ * which is a typedef for the second Sequence parameter, and @c push and
+ * @c pop, which are standard %queue/FIFO operations.
+ */
+ template<typename _Tp, typename _Sequence = deque<_Tp> >
+ class queue
+ {
+ // concept requirements
+ typedef typename _Sequence::value_type _Sequence_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
+ __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
+ __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
+
+ template<typename _Tp1, typename _Seq1>
+ friend bool
+ operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
+
+ template<typename _Tp1, typename _Seq1>
+ friend bool
+ operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
+
+ public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ protected:
+ /**
+ * 'c' is the underlying container. Maintainers wondering why
+ * this isn't uglified as per style guidelines should note that
+ * this name is specified in the standard, [23.2.3.1]. (Why?
+ * Presumably for the same reason that it's protected instead
+ * of private: to allow derivation. But none of the other
+ * containers allow for derivation. Odd.)
+ */
+ _Sequence c;
+
+ public:
+ /**
+ * @brief Default constructor creates no elements.
+ */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ queue(const _Sequence& __c = _Sequence())
+ : c(__c) { }
+#else
+ explicit
+ queue(const _Sequence& __c)
+ : c(__c) { }
+
+ explicit
+ queue(_Sequence&& __c = _Sequence())
+ : c(std::move(__c)) { }
+
+ queue(queue&& __q)
+ : c(std::move(__q.c)) { }
+
+ queue&
+ operator=(queue&& __q)
+ {
+ c = std::move(__q.c);
+ return *this;
+ }
+#endif
+
+ /**
+ * Returns true if the %queue is empty.
+ */
+ bool
+ empty() const
+ { return c.empty(); }
+
+ /** Returns the number of elements in the %queue. */
+ size_type
+ size() const
+ { return c.size(); }
+
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %queue.
+ */
+ reference
+ front()
+ {
+ __glibcxx_requires_nonempty();
+ return c.front();
+ }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %queue.
+ */
+ const_reference
+ front() const
+ {
+ __glibcxx_requires_nonempty();
+ return c.front();
+ }
+
+ /**
+ * Returns a read/write reference to the data at the last
+ * element of the %queue.
+ */
+ reference
+ back()
+ {
+ __glibcxx_requires_nonempty();
+ return c.back();
+ }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the last
+ * element of the %queue.
+ */
+ const_reference
+ back() const
+ {
+ __glibcxx_requires_nonempty();
+ return c.back();
+ }
+
+ /**
+ * @brief Add data to the end of the %queue.
+ * @param x Data to be added.
+ *
+ * This is a typical %queue operation. The function creates an
+ * element at the end of the %queue and assigns the given data
+ * to it. The time complexity of the operation depends on the
+ * underlying sequence.
+ */
+ void
+ push(const value_type& __x)
+ { c.push_back(__x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push(value_type&& __x)
+ { c.push_back(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace(_Args&&... __args)
+ { c.emplace_back(std::forward<_Args>(__args)...); }
+#endif
+
+ /**
+ * @brief Removes first element.
+ *
+ * This is a typical %queue operation. It shrinks the %queue by one.
+ * The time complexity of the operation depends on the underlying
+ * sequence.
+ *
+ * Note that no data is returned, and if the first element's
+ * data is needed, it should be retrieved before pop() is
+ * called.
+ */
+ void
+ pop()
+ {
+ __glibcxx_requires_nonempty();
+ c.pop_front();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ swap(queue&& __q)
+ { c.swap(__q.c); }
+#endif
+ };
+
+ /**
+ * @brief Queue equality comparison.
+ * @param x A %queue.
+ * @param y A %queue of the same type as @a x.
+ * @return True iff the size and elements of the queues are equal.
+ *
+ * This is an equivalence relation. Complexity and semantics depend on the
+ * underlying sequence type, but the expected rules are: this relation is
+ * linear in the size of the sequences, and queues are considered equivalent
+ * if their sequences compare equal.
+ */
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
+ { return __x.c == __y.c; }
+
+ /**
+ * @brief Queue ordering relation.
+ * @param x A %queue.
+ * @param y A %queue of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is an total ordering relation. Complexity and semantics
+ * depend on the underlying sequence type, but the expected rules
+ * are: this relation is linear in the size of the sequences, the
+ * elements must be comparable with @c <, and
+ * std::lexicographical_compare() is usually used to make the
+ * determination.
+ */
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
+ { return __x.c < __y.c; }
+
+ /// Based on operator==
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
+ { return !(__x < __y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Seq>
+ inline void
+ swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Seq>
+ inline void
+ swap(queue<_Tp, _Seq>&& __x, queue<_Tp, _Seq>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Seq>
+ inline void
+ swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>&& __y)
+ { __x.swap(__y); }
+#endif
+
+ /**
+ * @brief A standard container automatically sorting its contents.
+ *
+ * @ingroup sequences
+ *
+ * This is not a true container, but an @e adaptor. It holds
+ * another container, and provides a wrapper interface to that
+ * container. The wrapper is what enforces priority-based sorting
+ * and %queue behavior. Very few of the standard container/sequence
+ * interface requirements are met (e.g., iterators).
+ *
+ * The second template parameter defines the type of the underlying
+ * sequence/container. It defaults to std::vector, but it can be
+ * any type that supports @c front(), @c push_back, @c pop_back,
+ * and random-access iterators, such as std::deque or an
+ * appropriate user-defined type.
+ *
+ * The third template parameter supplies the means of making
+ * priority comparisons. It defaults to @c less<value_type> but
+ * can be anything defining a strict weak ordering.
+ *
+ * Members not found in "normal" containers are @c container_type,
+ * which is a typedef for the second Sequence parameter, and @c
+ * push, @c pop, and @c top, which are standard %queue operations.
+ *
+ * @note No equality/comparison operators are provided for
+ * %priority_queue.
+ *
+ * @note Sorting of the elements takes place as they are added to,
+ * and removed from, the %priority_queue using the
+ * %priority_queue's member functions. If you access the elements
+ * by other means, and change their data such that the sorting
+ * order would be different, the %priority_queue will not re-sort
+ * the elements for you. (How could it know to do so?)
+ */
+ template<typename _Tp, typename _Sequence = vector<_Tp>,
+ typename _Compare = less<typename _Sequence::value_type> >
+ class priority_queue
+ {
+ // concept requirements
+ typedef typename _Sequence::value_type _Sequence_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires(_Sequence, _SequenceConcept)
+ __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
+ __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
+ __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,
+ _BinaryFunctionConcept)
+
+ public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ protected:
+ // See queue::c for notes on these names.
+ _Sequence c;
+ _Compare comp;
+
+ public:
+ /**
+ * @brief Default constructor creates no elements.
+ */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ priority_queue(const _Compare& __x = _Compare(),
+ const _Sequence& __s = _Sequence())
+ : c(__s), comp(__x)
+ { std::make_heap(c.begin(), c.end(), comp); }
+#else
+ explicit
+ priority_queue(const _Compare& __x,
+ const _Sequence& __s)
+ : c(__s), comp(__x)
+ { std::make_heap(c.begin(), c.end(), comp); }
+
+ explicit
+ priority_queue(const _Compare& __x = _Compare(),
+ _Sequence&& __s = _Sequence())
+ : c(std::move(__s)), comp(__x)
+ { std::make_heap(c.begin(), c.end(), comp); }
+#endif
+
+ /**
+ * @brief Builds a %queue from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param x A comparison functor describing a strict weak ordering.
+ * @param s An initial sequence with which to start.
+ *
+ * Begins by copying @a s, inserting a copy of the elements
+ * from @a [first,last) into the copy of @a s, then ordering
+ * the copy according to @a x.
+ *
+ * For more information on function objects, see the
+ * documentation on @link functors functor base
+ * classes@endlink.
+ */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last,
+ const _Compare& __x = _Compare(),
+ const _Sequence& __s = _Sequence())
+ : c(__s), comp(__x)
+ {
+ __glibcxx_requires_valid_range(__first, __last);
+ c.insert(c.end(), __first, __last);
+ std::make_heap(c.begin(), c.end(), comp);
+ }
+#else
+ template<typename _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last,
+ const _Compare& __x,
+ const _Sequence& __s)
+ : c(__s), comp(__x)
+ {
+ __glibcxx_requires_valid_range(__first, __last);
+ c.insert(c.end(), __first, __last);
+ std::make_heap(c.begin(), c.end(), comp);
+ }
+
+ template<typename _InputIterator>
+ priority_queue(_InputIterator __first, _InputIterator __last,
+ const _Compare& __x = _Compare(),
+ _Sequence&& __s = _Sequence())
+ : c(std::move(__s)), comp(__x)
+ {
+ __glibcxx_requires_valid_range(__first, __last);
+ c.insert(c.end(), __first, __last);
+ std::make_heap(c.begin(), c.end(), comp);
+ }
+
+ priority_queue(priority_queue&& __pq)
+ : c(std::move(__pq.c)), comp(std::move(__pq.comp)) { }
+
+ priority_queue&
+ operator=(priority_queue&& __pq)
+ {
+ c = std::move(__pq.c);
+ comp = std::move(__pq.comp);
+ return *this;
+ }
+#endif
+
+ /**
+ * Returns true if the %queue is empty.
+ */
+ bool
+ empty() const
+ { return c.empty(); }
+
+ /** Returns the number of elements in the %queue. */
+ size_type
+ size() const
+ { return c.size(); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %queue.
+ */
+ const_reference
+ top() const
+ {
+ __glibcxx_requires_nonempty();
+ return c.front();
+ }
+
+ /**
+ * @brief Add data to the %queue.
+ * @param x Data to be added.
+ *
+ * This is a typical %queue operation.
+ * The time complexity of the operation depends on the underlying
+ * sequence.
+ */
+ void
+ push(const value_type& __x)
+ {
+ c.push_back(__x);
+ std::push_heap(c.begin(), c.end(), comp);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push(value_type&& __x)
+ {
+ c.push_back(std::move(__x));
+ std::push_heap(c.begin(), c.end(), comp);
+ }
+
+ template<typename... _Args>
+ void
+ emplace(_Args&&... __args)
+ {
+ c.emplace_back(std::forward<_Args>(__args)...);
+ std::push_heap(c.begin(), c.end(), comp);
+ }
+#endif
+
+ /**
+ * @brief Removes first element.
+ *
+ * This is a typical %queue operation. It shrinks the %queue
+ * by one. The time complexity of the operation depends on the
+ * underlying sequence.
+ *
+ * Note that no data is returned, and if the first element's
+ * data is needed, it should be retrieved before pop() is
+ * called.
+ */
+ void
+ pop()
+ {
+ __glibcxx_requires_nonempty();
+ std::pop_heap(c.begin(), c.end(), comp);
+ c.pop_back();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ swap(priority_queue&& __pq)
+ {
+ using std::swap;
+ c.swap(__pq.c);
+ swap(comp, __pq.comp);
+ }
+#endif
+ };
+
+ // No equality/comparison operators are provided for priority_queue.
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Sequence, typename _Compare>
+ inline void
+ swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
+ priority_queue<_Tp, _Sequence, _Compare>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Sequence, typename _Compare>
+ inline void
+ swap(priority_queue<_Tp, _Sequence, _Compare>&& __x,
+ priority_queue<_Tp, _Sequence, _Compare>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Sequence, typename _Compare>
+ inline void
+ swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
+ priority_queue<_Tp, _Sequence, _Compare>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_QUEUE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_raw_storage_iter.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_raw_storage_iter.h
new file mode 100644
index 000000000..de6cad970
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_raw_storage_iter.h
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_raw_storage_iter.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_RAW_STORAGE_ITERATOR_H
+#define _STL_RAW_STORAGE_ITERATOR_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * This iterator class lets algorithms store their results into
+ * uninitialized memory.
+ */
+ template <class _OutputIterator, class _Tp>
+ class raw_storage_iterator
+ : public iterator<output_iterator_tag, void, void, void, void>
+ {
+ protected:
+ _OutputIterator _M_iter;
+
+ public:
+ explicit
+ raw_storage_iterator(_OutputIterator __x)
+ : _M_iter(__x) {}
+
+ raw_storage_iterator&
+ operator*() { return *this; }
+
+ raw_storage_iterator&
+ operator=(const _Tp& __element)
+ {
+ std::_Construct(&*_M_iter, __element);
+ return *this;
+ }
+
+ raw_storage_iterator<_OutputIterator, _Tp>&
+ operator++()
+ {
+ ++_M_iter;
+ return *this;
+ }
+
+ raw_storage_iterator<_OutputIterator, _Tp>
+ operator++(int)
+ {
+ raw_storage_iterator<_OutputIterator, _Tp> __tmp = *this;
+ ++_M_iter;
+ return __tmp;
+ }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_relops.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_relops.h
new file mode 100644
index 000000000..4377c5fa5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_relops.h
@@ -0,0 +1,131 @@
+// std::rel_ops implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the, 2009 Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file stl_relops.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ *
+ * Inclusion of this file has been removed from
+ * all of the other STL headers for safety reasons, except std_utility.h.
+ * For more information, see the thread of about twenty messages starting
+ * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or
+ * http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads
+ *
+ * Short summary: the rel_ops operators should be avoided for the present.
+ */
+
+#ifndef _STL_RELOPS_H
+#define _STL_RELOPS_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ namespace rel_ops
+ {
+ /** @namespace std::rel_ops
+ * @brief The generated relational operators are sequestered here.
+ */
+
+ /**
+ * @brief Defines @c != for arbitrary types, in terms of @c ==.
+ * @param x A thing.
+ * @param y Another thing.
+ * @return x != y
+ *
+ * This function uses @c == to determine its result.
+ */
+ template <class _Tp>
+ inline bool
+ operator!=(const _Tp& __x, const _Tp& __y)
+ { return !(__x == __y); }
+
+ /**
+ * @brief Defines @c > for arbitrary types, in terms of @c <.
+ * @param x A thing.
+ * @param y Another thing.
+ * @return x > y
+ *
+ * This function uses @c < to determine its result.
+ */
+ template <class _Tp>
+ inline bool
+ operator>(const _Tp& __x, const _Tp& __y)
+ { return __y < __x; }
+
+ /**
+ * @brief Defines @c <= for arbitrary types, in terms of @c <.
+ * @param x A thing.
+ * @param y Another thing.
+ * @return x <= y
+ *
+ * This function uses @c < to determine its result.
+ */
+ template <class _Tp>
+ inline bool
+ operator<=(const _Tp& __x, const _Tp& __y)
+ { return !(__y < __x); }
+
+ /**
+ * @brief Defines @c >= for arbitrary types, in terms of @c <.
+ * @param x A thing.
+ * @param y Another thing.
+ * @return x >= y
+ *
+ * This function uses @c < to determine its result.
+ */
+ template <class _Tp>
+ inline bool
+ operator>=(const _Tp& __x, const _Tp& __y)
+ { return !(__x < __y); }
+
+ } // namespace rel_ops
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_RELOPS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_set.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_set.h
new file mode 100644
index 000000000..f06fe0336
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_set.h
@@ -0,0 +1,708 @@
+// Set implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_set.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_SET_H
+#define _STL_SET_H 1
+
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * @brief A standard container made up of unique keys, which can be
+ * retrieved in logarithmic time.
+ *
+ * @ingroup associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and an
+ * <a href="tables.html#69">associative container</a> (using unique keys).
+ *
+ * Sets support bidirectional iterators.
+ *
+ * @param Key Type of key objects.
+ * @param Compare Comparison function object type, defaults to less<Key>.
+ * @param Alloc Allocator type, defaults to allocator<Key>.
+ *
+ * The private tree data is declared exactly the same way for set and
+ * multiset; the distinction is made entirely in how the tree functions are
+ * called (*_unique versus *_equal, same as the standard).
+ */
+ template<typename _Key, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class set
+ {
+ // concept requirements
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Key, _SGIAssignableConcept)
+ __glibcxx_class_requires4(_Compare, bool, _Key, _Key,
+ _BinaryFunctionConcept)
+ __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
+
+ public:
+ // typedefs:
+ //@{
+ /// Public typedefs.
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+ typedef _Alloc allocator_type;
+ //@}
+
+ private:
+ typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
+
+ typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
+ key_compare, _Key_alloc_type> _Rep_type;
+ _Rep_type _M_t; // Red-black tree representing set.
+
+ public:
+ //@{
+ /// Iterator-related typedefs.
+ typedef typename _Key_alloc_type::pointer pointer;
+ typedef typename _Key_alloc_type::const_pointer const_pointer;
+ typedef typename _Key_alloc_type::reference reference;
+ typedef typename _Key_alloc_type::const_reference const_reference;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 103. set::iterator is required to be modifiable,
+ // but this allows modification of keys.
+ typedef typename _Rep_type::const_iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+ typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
+ typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename _Rep_type::size_type size_type;
+ typedef typename _Rep_type::difference_type difference_type;
+ //@}
+
+ // allocation/deallocation
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ set()
+ : _M_t() { }
+
+ /**
+ * @brief Creates a %set with no elements.
+ * @param comp Comparator to use.
+ * @param a An allocator object.
+ */
+ explicit
+ set(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a) { }
+
+ /**
+ * @brief Builds a %set from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * Create a %set consisting of copies of the elements from [first,last).
+ * This is linear in N if the range is already sorted, and NlogN
+ * otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ set(_InputIterator __first, _InputIterator __last)
+ : _M_t()
+ { _M_t._M_insert_unique(__first, __last); }
+
+ /**
+ * @brief Builds a %set from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %set consisting of copies of the elements from [first,last).
+ * This is linear in N if the range is already sorted, and NlogN
+ * otherwise (where N is distance(first,last)).
+ */
+ template<typename _InputIterator>
+ set(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_unique(__first, __last); }
+
+ /**
+ * @brief %Set copy constructor.
+ * @param x A %set of identical element and allocator types.
+ *
+ * The newly-created %set uses a copy of the allocation object used
+ * by @a x.
+ */
+ set(const set& __x)
+ : _M_t(__x._M_t) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Set move constructor
+ * @param x A %set of identical element and allocator types.
+ *
+ * The newly-created %set contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %set.
+ */
+ set(set&& __x)
+ : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
+
+ /**
+ * @brief Builds a %set from an initializer_list.
+ * @param l An initializer_list.
+ * @param comp A comparison functor.
+ * @param a An allocator object.
+ *
+ * Create a %set consisting of copies of the elements in the list.
+ * This is linear in N if the list is already sorted, and NlogN
+ * otherwise (where N is @a l.size()).
+ */
+ set(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _M_t(__comp, __a)
+ { _M_t._M_insert_unique(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief %Set assignment operator.
+ * @param x A %set of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but unlike the copy constructor,
+ * the allocator object is not copied.
+ */
+ set&
+ operator=(const set& __x)
+ {
+ _M_t = __x._M_t;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Set move assignment operator.
+ * @param x A %set of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this %set (without copying).
+ * @a x is a valid, but unspecified %set.
+ */
+ set&
+ operator=(set&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief %Set list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %set with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %set and
+ * that the resulting %set's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ // accessors:
+
+ /// Returns the comparison object with which the %set was constructed.
+ key_compare
+ key_comp() const
+ { return _M_t.key_comp(); }
+ /// Returns the comparison object with which the %set was constructed.
+ value_compare
+ value_comp() const
+ { return _M_t.key_comp(); }
+ /// Returns the allocator object with which the %set was constructed.
+ allocator_type
+ get_allocator() const
+ { return _M_t.get_allocator(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %set. Iteration is done in ascending order according
+ * to the keys.
+ */
+ iterator
+ begin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * element in the %set. Iteration is done in ascending order according
+ * to the keys.
+ */
+ iterator
+ end() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the last
+ * element in the %set. Iteration is done in descending order according
+ * to the keys.
+ */
+ reverse_iterator
+ rbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last pair in the %set. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ rend() const
+ { return _M_t.rend(); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * element in the %set. Iteration is done in ascending order according
+ * to the keys.
+ */
+ iterator
+ cbegin() const
+ { return _M_t.begin(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the last
+ * element in the %set. Iteration is done in ascending order according
+ * to the keys.
+ */
+ iterator
+ cend() const
+ { return _M_t.end(); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the last
+ * element in the %set. Iteration is done in descending order according
+ * to the keys.
+ */
+ reverse_iterator
+ crbegin() const
+ { return _M_t.rbegin(); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points to the
+ * last pair in the %set. Iteration is done in descending order
+ * according to the keys.
+ */
+ reverse_iterator
+ crend() const
+ { return _M_t.rend(); }
+#endif
+
+ /// Returns true if the %set is empty.
+ bool
+ empty() const
+ { return _M_t.empty(); }
+
+ /// Returns the size of the %set.
+ size_type
+ size() const
+ { return _M_t.size(); }
+
+ /// Returns the maximum size of the %set.
+ size_type
+ max_size() const
+ { return _M_t.max_size(); }
+
+ /**
+ * @brief Swaps data with another %set.
+ * @param x A %set of the same element and allocator types.
+ *
+ * This exchanges the elements between two sets in constant time.
+ * (It is only swapping a pointer, an integer, and an instance of
+ * the @c Compare type (which itself is often stateless and empty), so it
+ * should be quite fast.)
+ * Note that the global std::swap() function is specialized such that
+ * std::swap(s1,s2) will feed to this function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(set&& __x)
+#else
+ swap(set& __x)
+#endif
+ { _M_t.swap(__x._M_t); }
+
+ // insert/erase
+ /**
+ * @brief Attempts to insert an element into the %set.
+ * @param x Element to be inserted.
+ * @return A pair, of which the first element is an iterator that points
+ * to the possibly inserted element, and the second is a bool
+ * that is true if the element was actually inserted.
+ *
+ * This function attempts to insert an element into the %set. A %set
+ * relies on unique keys and thus an element is only inserted if it is
+ * not already present in the %set.
+ *
+ * Insertion requires logarithmic time.
+ */
+ std::pair<iterator, bool>
+ insert(const value_type& __x)
+ {
+ std::pair<typename _Rep_type::iterator, bool> __p =
+ _M_t._M_insert_unique(__x);
+ return std::pair<iterator, bool>(__p.first, __p.second);
+ }
+
+ /**
+ * @brief Attempts to insert an element into the %set.
+ * @param position An iterator that serves as a hint as to where the
+ * element should be inserted.
+ * @param x Element to be inserted.
+ * @return An iterator that points to the element with key of @a x (may
+ * or may not be the element passed in).
+ *
+ * This function is not concerned about whether the insertion took place,
+ * and thus does not return a boolean like the single-argument insert()
+ * does. Note that the first parameter is only a hint and can
+ * potentially improve the performance of the insertion process. A bad
+ * hint would cause no gains in efficiency.
+ *
+ * For more on "hinting", see:
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html
+ *
+ * Insertion requires logarithmic time (if the hint is not taken).
+ */
+ iterator
+ insert(iterator __position, const value_type& __x)
+ { return _M_t._M_insert_unique_(__position, __x); }
+
+ /**
+ * @brief A template function that attempts to insert a range
+ * of elements.
+ * @param first Iterator pointing to the start of the range to be
+ * inserted.
+ * @param last Iterator pointing to the end of the range.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _M_t._M_insert_unique(__first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Attempts to insert a list of elements into the %set.
+ * @param list A std::initializer_list<value_type> of elements
+ * to be inserted.
+ *
+ * Complexity similar to that of the range constructor.
+ */
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Erases an element from a %set.
+ * @param position An iterator pointing to the element to be erased.
+ *
+ * This function erases an element, pointed to by the given iterator,
+ * from a %set. Note that this function only erases the element, and
+ * that if the element is itself a pointer, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's responsibility.
+ */
+ void
+ erase(iterator __position)
+ { _M_t.erase(__position); }
+
+ /**
+ * @brief Erases elements according to the provided key.
+ * @param x Key of element to be erased.
+ * @return The number of elements erased.
+ *
+ * This function erases all the elements located by the given key from
+ * a %set.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ size_type
+ erase(const key_type& __x)
+ { return _M_t.erase(__x); }
+
+ /**
+ * @brief Erases a [first,last) range of elements from a %set.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ *
+ * This function erases a sequence of elements from a %set.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ void
+ erase(iterator __first, iterator __last)
+ { _M_t.erase(__first, __last); }
+
+ /**
+ * Erases all elements in a %set. Note that this function only erases
+ * the elements, and that if the elements themselves are pointers, the
+ * pointed-to memory is not touched in any way. Managing the pointer is
+ * the user's responsibility.
+ */
+ void
+ clear()
+ { _M_t.clear(); }
+
+ // set operations:
+
+ /**
+ * @brief Finds the number of elements.
+ * @param x Element to located.
+ * @return Number of elements with specified key.
+ *
+ * This function only makes sense for multisets; for set the result will
+ * either be 0 (not present) or 1 (present).
+ */
+ size_type
+ count(const key_type& __x) const
+ { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ //@{
+ /**
+ * @brief Tries to locate an element in a %set.
+ * @param x Element to be located.
+ * @return Iterator pointing to sought-after element, or end() if not
+ * found.
+ *
+ * This function takes a key and tries to locate the element with which
+ * the key matches. If successful the function returns an iterator
+ * pointing to the sought after element. If unsuccessful it returns the
+ * past-the-end ( @c end() ) iterator.
+ */
+ iterator
+ find(const key_type& __x)
+ { return _M_t.find(__x); }
+
+ const_iterator
+ find(const key_type& __x) const
+ { return _M_t.find(__x); }
+ //@}
+
+ //@{
+ /**
+ * @brief Finds the beginning of a subsequence matching given key.
+ * @param x Key to be located.
+ * @return Iterator pointing to first element equal to or greater
+ * than key, or end().
+ *
+ * This function returns the first element of a subsequence of elements
+ * that matches the given key. If unsuccessful it returns an iterator
+ * pointing to the first element that has a greater value than given key
+ * or end() if no such element exists.
+ */
+ iterator
+ lower_bound(const key_type& __x)
+ { return _M_t.lower_bound(__x); }
+
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return _M_t.lower_bound(__x); }
+ //@}
+
+ //@{
+ /**
+ * @brief Finds the end of a subsequence matching given key.
+ * @param x Key to be located.
+ * @return Iterator pointing to the first element
+ * greater than key, or end().
+ */
+ iterator
+ upper_bound(const key_type& __x)
+ { return _M_t.upper_bound(__x); }
+
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return _M_t.upper_bound(__x); }
+ //@}
+
+ //@{
+ /**
+ * @brief Finds a subsequence matching given key.
+ * @param x Key to be located.
+ * @return Pair of iterators that possibly points to the subsequence
+ * matching given key.
+ *
+ * This function is equivalent to
+ * @code
+ * std::make_pair(c.lower_bound(val),
+ * c.upper_bound(val))
+ * @endcode
+ * (but is faster than making the calls separately).
+ *
+ * This function probably only makes sense for multisets.
+ */
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __x)
+ { return _M_t.equal_range(__x); }
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __x) const
+ { return _M_t.equal_range(__x); }
+ //@}
+
+ template<typename _K1, typename _C1, typename _A1>
+ friend bool
+ operator==(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
+
+ template<typename _K1, typename _C1, typename _A1>
+ friend bool
+ operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
+ };
+
+
+ /**
+ * @brief Set equality comparison.
+ * @param x A %set.
+ * @param y A %set of the same type as @a x.
+ * @return True iff the size and elements of the sets are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the sets.
+ * Sets are considered equivalent if their sizes are equal, and if
+ * corresponding elements compare equal.
+ */
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator==(const set<_Key, _Compare, _Alloc>& __x,
+ const set<_Key, _Compare, _Alloc>& __y)
+ { return __x._M_t == __y._M_t; }
+
+ /**
+ * @brief Set ordering relation.
+ * @param x A %set.
+ * @param y A %set of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * maps. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator<(const set<_Key, _Compare, _Alloc>& __x,
+ const set<_Key, _Compare, _Alloc>& __y)
+ { return __x._M_t < __y._M_t; }
+
+ /// Returns !(x == y).
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator!=(const set<_Key, _Compare, _Alloc>& __x,
+ const set<_Key, _Compare, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Returns y < x.
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator>(const set<_Key, _Compare, _Alloc>& __x,
+ const set<_Key, _Compare, _Alloc>& __y)
+ { return __y < __x; }
+
+ /// Returns !(y < x)
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator<=(const set<_Key, _Compare, _Alloc>& __x,
+ const set<_Key, _Compare, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Returns !(x < y)
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline bool
+ operator>=(const set<_Key, _Compare, _Alloc>& __x,
+ const set<_Key, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::set::swap().
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(set<_Key, _Compare, _Alloc>&& __x, set<_Key, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Alloc>
+ inline void
+ swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_SET_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_stack.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_stack.h
new file mode 100644
index 000000000..da301d474
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_stack.h
@@ -0,0 +1,299 @@
+// Stack implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_stack.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_STACK_H
+#define _STL_STACK_H 1
+
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief A standard container giving FILO behavior.
+ *
+ * @ingroup sequences
+ *
+ * Meets many of the requirements of a
+ * <a href="tables.html#65">container</a>,
+ * but does not define anything to do with iterators. Very few of the
+ * other standard container interfaces are defined.
+ *
+ * This is not a true container, but an @e adaptor. It holds
+ * another container, and provides a wrapper interface to that
+ * container. The wrapper is what enforces strict
+ * first-in-last-out %stack behavior.
+ *
+ * The second template parameter defines the type of the underlying
+ * sequence/container. It defaults to std::deque, but it can be
+ * any type that supports @c back, @c push_back, and @c pop_front,
+ * such as std::list, std::vector, or an appropriate user-defined
+ * type.
+ *
+ * Members not found in "normal" containers are @c container_type,
+ * which is a typedef for the second Sequence parameter, and @c
+ * push, @c pop, and @c top, which are standard %stack/FILO
+ * operations.
+ */
+ template<typename _Tp, typename _Sequence = deque<_Tp> >
+ class stack
+ {
+ // concept requirements
+ typedef typename _Sequence::value_type _Sequence_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
+ __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
+
+ template<typename _Tp1, typename _Seq1>
+ friend bool
+ operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
+
+ template<typename _Tp1, typename _Seq1>
+ friend bool
+ operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
+
+ public:
+ typedef typename _Sequence::value_type value_type;
+ typedef typename _Sequence::reference reference;
+ typedef typename _Sequence::const_reference const_reference;
+ typedef typename _Sequence::size_type size_type;
+ typedef _Sequence container_type;
+
+ protected:
+ // See queue::c for notes on this name.
+ _Sequence c;
+
+ public:
+ // XXX removed old def ctor, added def arg to this one to match 14882
+ /**
+ * @brief Default constructor creates no elements.
+ */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+ stack(const _Sequence& __c = _Sequence())
+ : c(__c) { }
+#else
+ explicit
+ stack(const _Sequence& __c)
+ : c(__c) { }
+
+ explicit
+ stack(_Sequence&& __c = _Sequence())
+ : c(std::move(__c)) { }
+#endif
+
+ /**
+ * Returns true if the %stack is empty.
+ */
+ bool
+ empty() const
+ { return c.empty(); }
+
+ /** Returns the number of elements in the %stack. */
+ size_type
+ size() const
+ { return c.size(); }
+
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %stack.
+ */
+ reference
+ top()
+ {
+ __glibcxx_requires_nonempty();
+ return c.back();
+ }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %stack.
+ */
+ const_reference
+ top() const
+ {
+ __glibcxx_requires_nonempty();
+ return c.back();
+ }
+
+ /**
+ * @brief Add data to the top of the %stack.
+ * @param x Data to be added.
+ *
+ * This is a typical %stack operation. The function creates an
+ * element at the top of the %stack and assigns the given data
+ * to it. The time complexity of the operation depends on the
+ * underlying sequence.
+ */
+ void
+ push(const value_type& __x)
+ { c.push_back(__x); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push(value_type&& __x)
+ { c.push_back(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace(_Args&&... __args)
+ { c.emplace_back(std::forward<_Args>(__args)...); }
+#endif
+
+ /**
+ * @brief Removes first element.
+ *
+ * This is a typical %stack operation. It shrinks the %stack
+ * by one. The time complexity of the operation depends on the
+ * underlying sequence.
+ *
+ * Note that no data is returned, and if the first element's
+ * data is needed, it should be retrieved before pop() is
+ * called.
+ */
+ void
+ pop()
+ {
+ __glibcxx_requires_nonempty();
+ c.pop_back();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ swap(stack&& __s)
+ { c.swap(__s.c); }
+#endif
+ };
+
+ /**
+ * @brief Stack equality comparison.
+ * @param x A %stack.
+ * @param y A %stack of the same type as @a x.
+ * @return True iff the size and elements of the stacks are equal.
+ *
+ * This is an equivalence relation. Complexity and semantics
+ * depend on the underlying sequence type, but the expected rules
+ * are: this relation is linear in the size of the sequences, and
+ * stacks are considered equivalent if their sequences compare
+ * equal.
+ */
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
+ { return __x.c == __y.c; }
+
+ /**
+ * @brief Stack ordering relation.
+ * @param x A %stack.
+ * @param y A %stack of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is an total ordering relation. Complexity and semantics
+ * depend on the underlying sequence type, but the expected rules
+ * are: this relation is linear in the size of the sequences, the
+ * elements must be comparable with @c <, and
+ * std::lexicographical_compare() is usually used to make the
+ * determination.
+ */
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
+ { return __x.c < __y.c; }
+
+ /// Based on operator==
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator<=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Seq>
+ inline bool
+ operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
+ { return !(__x < __y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Seq>
+ inline void
+ swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Seq>
+ inline void
+ swap(stack<_Tp, _Seq>&& __x, stack<_Tp, _Seq>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Seq>
+ inline void
+ swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_STACK_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_tempbuf.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_tempbuf.h
new file mode 100644
index 000000000..a3b081007
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -0,0 +1,206 @@
+// Temporary buffer implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_tempbuf.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_TEMPBUF_H
+#define _STL_TEMPBUF_H 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Allocates a temporary buffer.
+ * @param len The number of objects of type Tp.
+ * @return See full description.
+ *
+ * Reinventing the wheel, but this time with prettier spokes!
+ *
+ * This function tries to obtain storage for @c len adjacent Tp
+ * objects. The objects themselves are not constructed, of course.
+ * A pair<> is returned containing "the buffer s address and
+ * capacity (in the units of sizeof(Tp)), or a pair of 0 values if
+ * no storage can be obtained." Note that the capacity obtained
+ * may be less than that requested if the memory is unavailable;
+ * you should compare len with the .second return value.
+ *
+ * Provides the nothrow exception guarantee.
+ */
+ template<typename _Tp>
+ pair<_Tp*, ptrdiff_t>
+ get_temporary_buffer(ptrdiff_t __len)
+ {
+ const ptrdiff_t __max =
+ __gnu_cxx::__numeric_traits<ptrdiff_t>::__max / sizeof(_Tp);
+ if (__len > __max)
+ __len = __max;
+
+ while (__len > 0)
+ {
+ _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp),
+ std::nothrow));
+ if (__tmp != 0)
+ return std::pair<_Tp*, ptrdiff_t>(__tmp, __len);
+ __len /= 2;
+ }
+ return std::pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0);
+ }
+
+ /**
+ * @brief The companion to get_temporary_buffer().
+ * @param p A buffer previously allocated by get_temporary_buffer.
+ * @return None.
+ *
+ * Frees the memory pointed to by p.
+ */
+ template<typename _Tp>
+ inline void
+ return_temporary_buffer(_Tp* __p)
+ { ::operator delete(__p, std::nothrow); }
+
+
+ /**
+ * This class is used in two places: stl_algo.h and ext/memory,
+ * where it is wrapped as the temporary_buffer class. See
+ * temporary_buffer docs for more notes.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ class _Temporary_buffer
+ {
+ // concept requirements
+ __glibcxx_class_requires(_ForwardIterator, _ForwardIteratorConcept)
+
+ public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef pointer iterator;
+ typedef ptrdiff_t size_type;
+
+ protected:
+ size_type _M_original_len;
+ size_type _M_len;
+ pointer _M_buffer;
+
+ public:
+ /// As per Table mumble.
+ size_type
+ size() const
+ { return _M_len; }
+
+ /// Returns the size requested by the constructor; may be >size().
+ size_type
+ requested_size() const
+ { return _M_original_len; }
+
+ /// As per Table mumble.
+ iterator
+ begin()
+ { return _M_buffer; }
+
+ /// As per Table mumble.
+ iterator
+ end()
+ { return _M_buffer + _M_len; }
+
+ /**
+ * Constructs a temporary buffer of a size somewhere between
+ * zero and the size of the given range.
+ */
+ _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last);
+
+ ~_Temporary_buffer()
+ {
+ std::_Destroy(_M_buffer, _M_buffer + _M_len);
+ std::return_temporary_buffer(_M_buffer);
+ }
+
+ private:
+ // Disable copy constructor and assignment operator.
+ _Temporary_buffer(const _Temporary_buffer&);
+
+ void
+ operator=(const _Temporary_buffer&);
+ };
+
+ template<typename _ForwardIterator, typename _Tp>
+ _Temporary_buffer<_ForwardIterator, _Tp>::
+ _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
+ : _M_original_len(std::distance(__first, __last)),
+ _M_len(0), _M_buffer(0)
+ {
+ __try
+ {
+ std::pair<pointer, size_type> __p(std::get_temporary_buffer<
+ value_type>(_M_original_len));
+ _M_buffer = __p.first;
+ _M_len = __p.second;
+ if (!__is_pod(_Tp) && _M_len > 0)
+ std::uninitialized_fill_n(_M_buffer, _M_len, *__first);
+ }
+ __catch(...)
+ {
+ std::return_temporary_buffer(_M_buffer);
+ _M_buffer = 0;
+ _M_len = 0;
+ __throw_exception_again;
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_TEMPBUF_H */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_tree.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_tree.h
new file mode 100644
index 000000000..4f0ad2d8d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_tree.h
@@ -0,0 +1,1523 @@
+// RB tree implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ */
+
+/** @file stl_tree.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_TREE_H
+#define _STL_TREE_H 1
+
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_function.h>
+#include <bits/cpp_type_traits.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Red-black tree class, designed for use in implementing STL
+ // associative containers (set, multiset, map, and multimap). The
+ // insertion and deletion algorithms are based on those in Cormen,
+ // Leiserson, and Rivest, Introduction to Algorithms (MIT Press,
+ // 1990), except that
+ //
+ // (1) the header cell is maintained with links not only to the root
+ // but also to the leftmost node of the tree, to enable constant
+ // time begin(), and to the rightmost node of the tree, to enable
+ // linear time performance when used with the generic set algorithms
+ // (set_union, etc.)
+ //
+ // (2) when a node being deleted has two children its successor node
+ // is relinked into its place, rather than copied, so that the only
+ // iterators invalidated are those referring to the deleted node.
+
+ enum _Rb_tree_color { _S_red = false, _S_black = true };
+
+ struct _Rb_tree_node_base
+ {
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef const _Rb_tree_node_base* _Const_Base_ptr;
+
+ _Rb_tree_color _M_color;
+ _Base_ptr _M_parent;
+ _Base_ptr _M_left;
+ _Base_ptr _M_right;
+
+ static _Base_ptr
+ _S_minimum(_Base_ptr __x)
+ {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Const_Base_ptr
+ _S_minimum(_Const_Base_ptr __x)
+ {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Base_ptr
+ _S_maximum(_Base_ptr __x)
+ {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+
+ static _Const_Base_ptr
+ _S_maximum(_Const_Base_ptr __x)
+ {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+ };
+
+ template<typename _Val>
+ struct _Rb_tree_node : public _Rb_tree_node_base
+ {
+ typedef _Rb_tree_node<_Val>* _Link_type;
+ _Val _M_value_field;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ _Rb_tree_node(_Args&&... __args)
+ : _Rb_tree_node_base(),
+ _M_value_field(std::forward<_Args>(__args)...) { }
+#endif
+ };
+
+ _Rb_tree_node_base*
+ _Rb_tree_increment(_Rb_tree_node_base* __x);
+
+ const _Rb_tree_node_base*
+ _Rb_tree_increment(const _Rb_tree_node_base* __x);
+
+ _Rb_tree_node_base*
+ _Rb_tree_decrement(_Rb_tree_node_base* __x);
+
+ const _Rb_tree_node_base*
+ _Rb_tree_decrement(const _Rb_tree_node_base* __x);
+
+ template<typename _Tp>
+ struct _Rb_tree_iterator
+ {
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Rb_tree_iterator<_Tp> _Self;
+ typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
+ typedef _Rb_tree_node<_Tp>* _Link_type;
+
+ _Rb_tree_iterator()
+ : _M_node() { }
+
+ explicit
+ _Rb_tree_iterator(_Link_type __x)
+ : _M_node(__x) { }
+
+ reference
+ operator*() const
+ { return static_cast<_Link_type>(_M_node)->_M_value_field; }
+
+ pointer
+ operator->() const
+ { return &static_cast<_Link_type>(_M_node)->_M_value_field; }
+
+ _Self&
+ operator++()
+ {
+ _M_node = _Rb_tree_increment(_M_node);
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _Rb_tree_increment(_M_node);
+ return __tmp;
+ }
+
+ _Self&
+ operator--()
+ {
+ _M_node = _Rb_tree_decrement(_M_node);
+ return *this;
+ }
+
+ _Self
+ operator--(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _Rb_tree_decrement(_M_node);
+ return __tmp;
+ }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ _Base_ptr _M_node;
+ };
+
+ template<typename _Tp>
+ struct _Rb_tree_const_iterator
+ {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+
+ typedef _Rb_tree_iterator<_Tp> iterator;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Rb_tree_const_iterator<_Tp> _Self;
+ typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
+ typedef const _Rb_tree_node<_Tp>* _Link_type;
+
+ _Rb_tree_const_iterator()
+ : _M_node() { }
+
+ explicit
+ _Rb_tree_const_iterator(_Link_type __x)
+ : _M_node(__x) { }
+
+ _Rb_tree_const_iterator(const iterator& __it)
+ : _M_node(__it._M_node) { }
+
+ reference
+ operator*() const
+ { return static_cast<_Link_type>(_M_node)->_M_value_field; }
+
+ pointer
+ operator->() const
+ { return &static_cast<_Link_type>(_M_node)->_M_value_field; }
+
+ _Self&
+ operator++()
+ {
+ _M_node = _Rb_tree_increment(_M_node);
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _Rb_tree_increment(_M_node);
+ return __tmp;
+ }
+
+ _Self&
+ operator--()
+ {
+ _M_node = _Rb_tree_decrement(_M_node);
+ return *this;
+ }
+
+ _Self
+ operator--(int)
+ {
+ _Self __tmp = *this;
+ _M_node = _Rb_tree_decrement(_M_node);
+ return __tmp;
+ }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ _Base_ptr _M_node;
+ };
+
+ template<typename _Val>
+ inline bool
+ operator==(const _Rb_tree_iterator<_Val>& __x,
+ const _Rb_tree_const_iterator<_Val>& __y)
+ { return __x._M_node == __y._M_node; }
+
+ template<typename _Val>
+ inline bool
+ operator!=(const _Rb_tree_iterator<_Val>& __x,
+ const _Rb_tree_const_iterator<_Val>& __y)
+ { return __x._M_node != __y._M_node; }
+
+ void
+ _Rb_tree_insert_and_rebalance(const bool __insert_left,
+ _Rb_tree_node_base* __x,
+ _Rb_tree_node_base* __p,
+ _Rb_tree_node_base& __header);
+
+ _Rb_tree_node_base*
+ _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
+ _Rb_tree_node_base& __header);
+
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc = allocator<_Val> >
+ class _Rb_tree
+ {
+ typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other
+ _Node_allocator;
+
+ protected:
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef const _Rb_tree_node_base* _Const_Base_ptr;
+
+ public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef _Rb_tree_node<_Val>* _Link_type;
+ typedef const _Rb_tree_node<_Val>* _Const_Link_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+
+ _Node_allocator&
+ _M_get_Node_allocator()
+ { return *static_cast<_Node_allocator*>(&this->_M_impl); }
+
+ const _Node_allocator&
+ _M_get_Node_allocator() const
+ { return *static_cast<const _Node_allocator*>(&this->_M_impl); }
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_get_Node_allocator()); }
+
+ protected:
+ _Link_type
+ _M_get_node()
+ { return _M_impl._Node_allocator::allocate(1); }
+
+ void
+ _M_put_node(_Link_type __p)
+ { _M_impl._Node_allocator::deallocate(__p, 1); }
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ _Link_type
+ _M_create_node(const value_type& __x)
+ {
+ _Link_type __tmp = _M_get_node();
+ __try
+ { get_allocator().construct(&__tmp->_M_value_field, __x); }
+ __catch(...)
+ {
+ _M_put_node(__tmp);
+ __throw_exception_again;
+ }
+ return __tmp;
+ }
+
+ void
+ _M_destroy_node(_Link_type __p)
+ {
+ get_allocator().destroy(&__p->_M_value_field);
+ _M_put_node(__p);
+ }
+#else
+ template<typename... _Args>
+ _Link_type
+ _M_create_node(_Args&&... __args)
+ {
+ _Link_type __tmp = _M_get_node();
+ __try
+ {
+ _M_get_Node_allocator().construct(__tmp,
+ std::forward<_Args>(__args)...);
+ }
+ __catch(...)
+ {
+ _M_put_node(__tmp);
+ __throw_exception_again;
+ }
+ return __tmp;
+ }
+
+ void
+ _M_destroy_node(_Link_type __p)
+ {
+ _M_get_Node_allocator().destroy(__p);
+ _M_put_node(__p);
+ }
+#endif
+
+ _Link_type
+ _M_clone_node(_Const_Link_type __x)
+ {
+ _Link_type __tmp = _M_create_node(__x->_M_value_field);
+ __tmp->_M_color = __x->_M_color;
+ __tmp->_M_left = 0;
+ __tmp->_M_right = 0;
+ return __tmp;
+ }
+
+ protected:
+ template<typename _Key_compare,
+ bool _Is_pod_comparator = __is_pod(_Key_compare)>
+ struct _Rb_tree_impl : public _Node_allocator
+ {
+ _Key_compare _M_key_compare;
+ _Rb_tree_node_base _M_header;
+ size_type _M_node_count; // Keeps track of size of tree.
+
+ _Rb_tree_impl()
+ : _Node_allocator(), _M_key_compare(), _M_header(),
+ _M_node_count(0)
+ { _M_initialize(); }
+
+ _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
+ : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
+ _M_node_count(0)
+ { _M_initialize(); }
+
+ private:
+ void
+ _M_initialize()
+ {
+ this->_M_header._M_color = _S_red;
+ this->_M_header._M_parent = 0;
+ this->_M_header._M_left = &this->_M_header;
+ this->_M_header._M_right = &this->_M_header;
+ }
+ };
+
+ // Local modification: if __google_stl_debug_rbtree is defined to
+ // non-zero value, check sort predicate for strict weak ordering.
+ // See http://b/1731200.
+#if __google_stl_debug_rbtree
+ template<typename _KeyCompare>
+ struct _CheckedCompare {
+ // Mutable because some clients use non-const operator().
+ mutable _KeyCompare _M_key_compare;
+
+ _CheckedCompare(): _M_key_compare() { }
+ _CheckedCompare(const _KeyCompare & __comp): _M_key_compare(__comp) { }
+
+ bool operator()(const _Key& __x, const _Key& __y) const {
+ if (_M_key_compare(__x, __x))
+ __throw_runtime_error("strict weak ordering: (__x LT __x) != false");
+ if (_M_key_compare(__y, __y))
+ __throw_runtime_error("strict weak ordering: (__y LT __y) != false");
+ bool lt = _M_key_compare(__x, __y);
+ if (lt && _M_key_compare(__y, __x))
+ __throw_runtime_error("strict weak ordering: ((__x LT __y) && (__y LT __x)) != false");
+ return lt;
+ }
+ operator _KeyCompare() const { return _M_key_compare; }
+ };
+
+ _Rb_tree_impl<_CheckedCompare<_Compare> > _M_impl;
+#else
+ _Rb_tree_impl<_Compare> _M_impl;
+#endif
+
+ protected:
+ _Base_ptr&
+ _M_root()
+ { return this->_M_impl._M_header._M_parent; }
+
+ _Const_Base_ptr
+ _M_root() const
+ { return this->_M_impl._M_header._M_parent; }
+
+ _Base_ptr&
+ _M_leftmost()
+ { return this->_M_impl._M_header._M_left; }
+
+ _Const_Base_ptr
+ _M_leftmost() const
+ { return this->_M_impl._M_header._M_left; }
+
+ _Base_ptr&
+ _M_rightmost()
+ { return this->_M_impl._M_header._M_right; }
+
+ _Const_Base_ptr
+ _M_rightmost() const
+ { return this->_M_impl._M_header._M_right; }
+
+ _Link_type
+ _M_begin()
+ { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); }
+
+ _Const_Link_type
+ _M_begin() const
+ {
+ return static_cast<_Const_Link_type>
+ (this->_M_impl._M_header._M_parent);
+ }
+
+ _Link_type
+ _M_end()
+ { return static_cast<_Link_type>(&this->_M_impl._M_header); }
+
+ _Const_Link_type
+ _M_end() const
+ { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
+
+ static const_reference
+ _S_value(_Const_Link_type __x)
+ { return __x->_M_value_field; }
+
+ static const _Key&
+ _S_key(_Const_Link_type __x)
+ { return _KeyOfValue()(_S_value(__x)); }
+
+ static _Link_type
+ _S_left(_Base_ptr __x)
+ { return static_cast<_Link_type>(__x->_M_left); }
+
+ static _Const_Link_type
+ _S_left(_Const_Base_ptr __x)
+ { return static_cast<_Const_Link_type>(__x->_M_left); }
+
+ static _Link_type
+ _S_right(_Base_ptr __x)
+ { return static_cast<_Link_type>(__x->_M_right); }
+
+ static _Const_Link_type
+ _S_right(_Const_Base_ptr __x)
+ { return static_cast<_Const_Link_type>(__x->_M_right); }
+
+ static const_reference
+ _S_value(_Const_Base_ptr __x)
+ { return static_cast<_Const_Link_type>(__x)->_M_value_field; }
+
+ static const _Key&
+ _S_key(_Const_Base_ptr __x)
+ { return _KeyOfValue()(_S_value(__x)); }
+
+ static _Base_ptr
+ _S_minimum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_minimum(__x); }
+
+ static _Const_Base_ptr
+ _S_minimum(_Const_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_minimum(__x); }
+
+ static _Base_ptr
+ _S_maximum(_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_maximum(__x); }
+
+ static _Const_Base_ptr
+ _S_maximum(_Const_Base_ptr __x)
+ { return _Rb_tree_node_base::_S_maximum(__x); }
+
+ public:
+ typedef _Rb_tree_iterator<value_type> iterator;
+ typedef _Rb_tree_const_iterator<value_type> const_iterator;
+
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ private:
+ iterator
+ _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __y,
+ const value_type& __v);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 233. Insertion hints in associative containers.
+ iterator
+ _M_insert_lower(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
+
+ iterator
+ _M_insert_equal_lower(const value_type& __x);
+
+ _Link_type
+ _M_copy(_Const_Link_type __x, _Link_type __p);
+
+ void
+ _M_erase(_Link_type __x);
+
+ iterator
+ _M_lower_bound(_Link_type __x, _Link_type __y,
+ const _Key& __k);
+
+ const_iterator
+ _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
+ const _Key& __k) const;
+
+ iterator
+ _M_upper_bound(_Link_type __x, _Link_type __y,
+ const _Key& __k);
+
+ const_iterator
+ _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
+ const _Key& __k) const;
+
+ public:
+ // allocation/deallocation
+ _Rb_tree() { }
+
+ _Rb_tree(const _Compare& __comp,
+ const allocator_type& __a = allocator_type())
+ : _M_impl(__comp, __a) { }
+
+ _Rb_tree(const _Rb_tree& __x)
+ : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
+ {
+ if (__x._M_root() != 0)
+ {
+ _M_root() = _M_copy(__x._M_begin(), _M_end());
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ _M_impl._M_node_count = __x._M_impl._M_node_count;
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _Rb_tree(_Rb_tree&& __x);
+#endif
+
+ ~_Rb_tree()
+ { _M_erase(_M_begin()); }
+
+ _Rb_tree&
+ operator=(const _Rb_tree& __x);
+
+ // Accessors.
+ _Compare
+ key_comp() const
+ { return _M_impl._M_key_compare; }
+
+ iterator
+ begin()
+ {
+ return iterator(static_cast<_Link_type>
+ (this->_M_impl._M_header._M_left));
+ }
+
+ const_iterator
+ begin() const
+ {
+ return const_iterator(static_cast<_Const_Link_type>
+ (this->_M_impl._M_header._M_left));
+ }
+
+ iterator
+ end()
+ { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }
+
+ const_iterator
+ end() const
+ {
+ return const_iterator(static_cast<_Const_Link_type>
+ (&this->_M_impl._M_header));
+ }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+ bool
+ empty() const
+ { return _M_impl._M_node_count == 0; }
+
+ size_type
+ size() const
+ { return _M_impl._M_node_count; }
+
+ size_type
+ max_size() const
+ { return _M_get_Node_allocator().max_size(); }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(_Rb_tree&& __t);
+#else
+ swap(_Rb_tree& __t);
+#endif
+
+ // Insert/erase.
+ pair<iterator, bool>
+ _M_insert_unique(const value_type& __x);
+
+ iterator
+ _M_insert_equal(const value_type& __x);
+
+ iterator
+ _M_insert_unique_(const_iterator __position, const value_type& __x);
+
+ iterator
+ _M_insert_equal_(const_iterator __position, const value_type& __x);
+
+ template<typename _InputIterator>
+ void
+ _M_insert_unique(_InputIterator __first, _InputIterator __last);
+
+ template<typename _InputIterator>
+ void
+ _M_insert_equal(_InputIterator __first, _InputIterator __last);
+
+ void
+ erase(iterator __position);
+
+ void
+ erase(const_iterator __position);
+
+ size_type
+ erase(const key_type& __x);
+
+ void
+ erase(iterator __first, iterator __last);
+
+ void
+ erase(const_iterator __first, const_iterator __last);
+
+ void
+ erase(const key_type* __first, const key_type* __last);
+
+ void
+ clear()
+ {
+ _M_erase(_M_begin());
+ _M_leftmost() = _M_end();
+ _M_root() = 0;
+ _M_rightmost() = _M_end();
+ _M_impl._M_node_count = 0;
+ }
+
+ // Set operations.
+ iterator
+ find(const key_type& __k);
+
+ const_iterator
+ find(const key_type& __k) const;
+
+ size_type
+ count(const key_type& __k) const;
+
+ iterator
+ lower_bound(const key_type& __k)
+ { return _M_lower_bound(_M_begin(), _M_end(), __k); }
+
+ const_iterator
+ lower_bound(const key_type& __k) const
+ { return _M_lower_bound(_M_begin(), _M_end(), __k); }
+
+ iterator
+ upper_bound(const key_type& __k)
+ { return _M_upper_bound(_M_begin(), _M_end(), __k); }
+
+ const_iterator
+ upper_bound(const key_type& __k) const
+ { return _M_upper_bound(_M_begin(), _M_end(), __k); }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __k);
+
+ pair<const_iterator, const_iterator>
+ equal_range(const key_type& __k) const;
+
+ // Debugging.
+ bool
+ __rb_verify() const;
+ };
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline bool
+ operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ {
+ return __x.size() == __y.size()
+ && std::equal(__x.begin(), __x.end(), __y.begin());
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline bool
+ operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ {
+ return std::lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end());
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline bool
+ operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline bool
+ operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ { return __y < __x; }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline bool
+ operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline bool
+ operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline void
+ swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _Rb_tree(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __x)
+ : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator())
+ {
+ if (__x._M_root() != 0)
+ {
+ _M_root() = __x._M_root();
+ _M_leftmost() = __x._M_leftmost();
+ _M_rightmost() = __x._M_rightmost();
+ _M_root()->_M_parent = _M_end();
+
+ __x._M_root() = 0;
+ __x._M_leftmost() = __x._M_end();
+ __x._M_rightmost() = __x._M_end();
+
+ this->_M_impl._M_node_count = __x._M_impl._M_node_count;
+ __x._M_impl._M_node_count = 0;
+ }
+ }
+#endif
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
+ {
+ if (this != &__x)
+ {
+ // Note that _Key may be a constant type.
+ clear();
+ _M_impl._M_key_compare = __x._M_impl._M_key_compare;
+ if (__x._M_root() != 0)
+ {
+ _M_root() = _M_copy(__x._M_begin(), _M_end());
+ _M_leftmost() = _S_minimum(_M_root());
+ _M_rightmost() = _S_maximum(_M_root());
+ _M_impl._M_node_count = __x._M_impl._M_node_count;
+ }
+ }
+ return *this;
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)
+ {
+ bool __insert_left = (__x != 0 || __p == _M_end()
+ || _M_impl._M_key_compare(_KeyOfValue()(__v),
+ _S_key(__p)));
+
+ _Link_type __z = _M_create_node(__v);
+
+ _Rb_tree_insert_and_rebalance(__insert_left, __z,
+ const_cast<_Base_ptr>(__p),
+ this->_M_impl._M_header);
+ ++_M_impl._M_node_count;
+ return iterator(__z);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_lower(_Base_ptr __x, _Base_ptr __p, const _Val& __v)
+ {
+ bool __insert_left = (__x != 0 || __p == _M_end()
+ || !_M_impl._M_key_compare(_S_key(__p),
+ _KeyOfValue()(__v)));
+
+ _Link_type __z = _M_create_node(__v);
+
+ _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
+ this->_M_impl._M_header);
+ ++_M_impl._M_node_count;
+ return iterator(__z);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_equal_lower(const _Val& __v)
+ {
+ _Link_type __x = _M_begin();
+ _Link_type __y = _M_end();
+ while (__x != 0)
+ {
+ __y = __x;
+ __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ?
+ _S_left(__x) : _S_right(__x);
+ }
+ return _M_insert_lower(__x, __y, __v);
+ }
+
+ template<typename _Key, typename _Val, typename _KoV,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
+ _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
+ _M_copy(_Const_Link_type __x, _Link_type __p)
+ {
+ // Structural copy. __x and __p must be non-null.
+ _Link_type __top = _M_clone_node(__x);
+ __top->_M_parent = __p;
+
+ __try
+ {
+ if (__x->_M_right)
+ __top->_M_right = _M_copy(_S_right(__x), __top);
+ __p = __top;
+ __x = _S_left(__x);
+
+ while (__x != 0)
+ {
+ _Link_type __y = _M_clone_node(__x);
+ __p->_M_left = __y;
+ __y->_M_parent = __p;
+ if (__x->_M_right)
+ __y->_M_right = _M_copy(_S_right(__x), __y);
+ __p = __y;
+ __x = _S_left(__x);
+ }
+ }
+ __catch(...)
+ {
+ _M_erase(__top);
+ __throw_exception_again;
+ }
+ return __top;
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_erase(_Link_type __x)
+ {
+ // Erase without rebalancing.
+ while (__x != 0)
+ {
+ _M_erase(_S_right(__x));
+ _Link_type __y = _S_left(__x);
+ _M_destroy_node(__x);
+ __x = __y;
+ }
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_lower_bound(_Link_type __x, _Link_type __y,
+ const _Key& __k)
+ {
+ while (__x != 0)
+ if (!_M_impl._M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+ return iterator(__y);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
+ const _Key& __k) const
+ {
+ while (__x != 0)
+ if (!_M_impl._M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+ return const_iterator(__y);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_upper_bound(_Link_type __x, _Link_type __y,
+ const _Key& __k)
+ {
+ while (__x != 0)
+ if (_M_impl._M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+ return iterator(__y);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
+ const _Key& __k) const
+ {
+ while (__x != 0)
+ if (_M_impl._M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+ return const_iterator(__y);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator,
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ equal_range(const _Key& __k)
+ {
+ _Link_type __x = _M_begin();
+ _Link_type __y = _M_end();
+ while (__x != 0)
+ {
+ if (_M_impl._M_key_compare(_S_key(__x), __k))
+ __x = _S_right(__x);
+ else if (_M_impl._M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ {
+ _Link_type __xu(__x), __yu(__y);
+ __y = __x, __x = _S_left(__x);
+ __xu = _S_right(__xu);
+ return pair<iterator,
+ iterator>(_M_lower_bound(__x, __y, __k),
+ _M_upper_bound(__xu, __yu, __k));
+ }
+ }
+ return pair<iterator, iterator>(iterator(__y),
+ iterator(__y));
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::const_iterator,
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::const_iterator>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ equal_range(const _Key& __k) const
+ {
+ _Const_Link_type __x = _M_begin();
+ _Const_Link_type __y = _M_end();
+ while (__x != 0)
+ {
+ if (_M_impl._M_key_compare(_S_key(__x), __k))
+ __x = _S_right(__x);
+ else if (_M_impl._M_key_compare(__k, _S_key(__x)))
+ __y = __x, __x = _S_left(__x);
+ else
+ {
+ _Const_Link_type __xu(__x), __yu(__y);
+ __y = __x, __x = _S_left(__x);
+ __xu = _S_right(__xu);
+ return pair<const_iterator,
+ const_iterator>(_M_lower_bound(__x, __y, __k),
+ _M_upper_bound(__xu, __yu, __k));
+ }
+ }
+ return pair<const_iterator, const_iterator>(const_iterator(__y),
+ const_iterator(__y));
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __t)
+#else
+ swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
+#endif
+ {
+ if (_M_root() == 0)
+ {
+ if (__t._M_root() != 0)
+ {
+ _M_root() = __t._M_root();
+ _M_leftmost() = __t._M_leftmost();
+ _M_rightmost() = __t._M_rightmost();
+ _M_root()->_M_parent = _M_end();
+
+ __t._M_root() = 0;
+ __t._M_leftmost() = __t._M_end();
+ __t._M_rightmost() = __t._M_end();
+ }
+ }
+ else if (__t._M_root() == 0)
+ {
+ __t._M_root() = _M_root();
+ __t._M_leftmost() = _M_leftmost();
+ __t._M_rightmost() = _M_rightmost();
+ __t._M_root()->_M_parent = __t._M_end();
+
+ _M_root() = 0;
+ _M_leftmost() = _M_end();
+ _M_rightmost() = _M_end();
+ }
+ else
+ {
+ std::swap(_M_root(),__t._M_root());
+ std::swap(_M_leftmost(),__t._M_leftmost());
+ std::swap(_M_rightmost(),__t._M_rightmost());
+
+ _M_root()->_M_parent = _M_end();
+ __t._M_root()->_M_parent = __t._M_end();
+ }
+ // No need to swap header's color as it does not change.
+ std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count);
+ std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<_Node_allocator>::
+ _S_do_it(_M_get_Node_allocator(), __t._M_get_Node_allocator());
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator, bool>
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_unique(const _Val& __v)
+ {
+ _Link_type __x = _M_begin();
+ _Link_type __y = _M_end();
+ bool __comp = true;
+ while (__x != 0)
+ {
+ __y = __x;
+ __comp = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x));
+ __x = __comp ? _S_left(__x) : _S_right(__x);
+ }
+ iterator __j = iterator(__y);
+ if (__comp)
+ {
+ if (__j == begin())
+ return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
+ else
+ --__j;
+ }
+ if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
+ return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
+ return pair<iterator, bool>(__j, false);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_equal(const _Val& __v)
+ {
+ _Link_type __x = _M_begin();
+ _Link_type __y = _M_end();
+ while (__x != 0)
+ {
+ __y = __x;
+ __x = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x)) ?
+ _S_left(__x) : _S_right(__x);
+ }
+ return _M_insert_(__x, __y, __v);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_unique_(const_iterator __position, const _Val& __v)
+ {
+ // end()
+ if (__position._M_node == _M_end())
+ {
+ if (size() > 0
+ && _M_impl._M_key_compare(_S_key(_M_rightmost()),
+ _KeyOfValue()(__v)))
+ return _M_insert_(0, _M_rightmost(), __v);
+ else
+ return _M_insert_unique(__v).first;
+ }
+ else if (_M_impl._M_key_compare(_KeyOfValue()(__v),
+ _S_key(__position._M_node)))
+ {
+ // First, try before...
+ const_iterator __before = __position;
+ if (__position._M_node == _M_leftmost()) // begin()
+ return _M_insert_(_M_leftmost(), _M_leftmost(), __v);
+ else if (_M_impl._M_key_compare(_S_key((--__before)._M_node),
+ _KeyOfValue()(__v)))
+ {
+ if (_S_right(__before._M_node) == 0)
+ return _M_insert_(0, __before._M_node, __v);
+ else
+ return _M_insert_(__position._M_node,
+ __position._M_node, __v);
+ }
+ else
+ return _M_insert_unique(__v).first;
+ }
+ else if (_M_impl._M_key_compare(_S_key(__position._M_node),
+ _KeyOfValue()(__v)))
+ {
+ // ... then try after.
+ const_iterator __after = __position;
+ if (__position._M_node == _M_rightmost())
+ return _M_insert_(0, _M_rightmost(), __v);
+ else if (_M_impl._M_key_compare(_KeyOfValue()(__v),
+ _S_key((++__after)._M_node)))
+ {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert_(0, __position._M_node, __v);
+ else
+ return _M_insert_(__after._M_node, __after._M_node, __v);
+ }
+ else
+ return _M_insert_unique(__v).first;
+ }
+ else
+ // Equivalent keys.
+ return iterator(static_cast<_Link_type>
+ (const_cast<_Base_ptr>(__position._M_node)));
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_insert_equal_(const_iterator __position, const _Val& __v)
+ {
+ // end()
+ if (__position._M_node == _M_end())
+ {
+ if (size() > 0
+ && !_M_impl._M_key_compare(_KeyOfValue()(__v),
+ _S_key(_M_rightmost())))
+ return _M_insert_(0, _M_rightmost(), __v);
+ else
+ return _M_insert_equal(__v);
+ }
+ else if (!_M_impl._M_key_compare(_S_key(__position._M_node),
+ _KeyOfValue()(__v)))
+ {
+ // First, try before...
+ const_iterator __before = __position;
+ if (__position._M_node == _M_leftmost()) // begin()
+ return _M_insert_(_M_leftmost(), _M_leftmost(), __v);
+ else if (!_M_impl._M_key_compare(_KeyOfValue()(__v),
+ _S_key((--__before)._M_node)))
+ {
+ if (_S_right(__before._M_node) == 0)
+ return _M_insert_(0, __before._M_node, __v);
+ else
+ return _M_insert_(__position._M_node,
+ __position._M_node, __v);
+ }
+ else
+ return _M_insert_equal(__v);
+ }
+ else
+ {
+ // ... then try after.
+ const_iterator __after = __position;
+ if (__position._M_node == _M_rightmost())
+ return _M_insert_(0, _M_rightmost(), __v);
+ else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node),
+ _KeyOfValue()(__v)))
+ {
+ if (_S_right(__position._M_node) == 0)
+ return _M_insert_(0, __position._M_node, __v);
+ else
+ return _M_insert_(__after._M_node, __after._M_node, __v);
+ }
+ else
+ return _M_insert_equal_lower(__v);
+ }
+ }
+
+ template<typename _Key, typename _Val, typename _KoV,
+ typename _Cmp, typename _Alloc>
+ template<class _II>
+ void
+ _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
+ _M_insert_unique(_II __first, _II __last)
+ {
+ for (; __first != __last; ++__first)
+ _M_insert_unique_(end(), *__first);
+ }
+
+ template<typename _Key, typename _Val, typename _KoV,
+ typename _Cmp, typename _Alloc>
+ template<class _II>
+ void
+ _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
+ _M_insert_equal(_II __first, _II __last)
+ {
+ for (; __first != __last; ++__first)
+ _M_insert_equal_(end(), *__first);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(iterator __position)
+ {
+ _Link_type __y =
+ static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
+ (__position._M_node,
+ this->_M_impl._M_header));
+ _M_destroy_node(__y);
+ --_M_impl._M_node_count;
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const_iterator __position)
+ {
+ _Link_type __y =
+ static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
+ (const_cast<_Base_ptr>(__position._M_node),
+ this->_M_impl._M_header));
+ _M_destroy_node(__y);
+ --_M_impl._M_node_count;
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const _Key& __x)
+ {
+ pair<iterator, iterator> __p = equal_range(__x);
+ const size_type __old_size = size();
+ erase(__p.first, __p.second);
+ return __old_size - size();
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(iterator __first, iterator __last)
+ {
+ if (__first == begin() && __last == end())
+ clear();
+ else
+ while (__first != __last)
+ erase(__first++);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const_iterator __first, const_iterator __last)
+ {
+ if (__first == begin() && __last == end())
+ clear();
+ else
+ while (__first != __last)
+ erase(__first++);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const _Key* __first, const _Key* __last)
+ {
+ while (__first != __last)
+ erase(*__first++);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ find(const _Key& __k)
+ {
+ iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
+ return (__j == end()
+ || _M_impl._M_key_compare(__k,
+ _S_key(__j._M_node))) ? end() : __j;
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ find(const _Key& __k) const
+ {
+ const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
+ return (__j == end()
+ || _M_impl._M_key_compare(__k,
+ _S_key(__j._M_node))) ? end() : __j;
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ count(const _Key& __k) const
+ {
+ pair<const_iterator, const_iterator> __p = equal_range(__k);
+ const size_type __n = std::distance(__p.first, __p.second);
+ return __n;
+ }
+
+ unsigned int
+ _Rb_tree_black_count(const _Rb_tree_node_base* __node,
+ const _Rb_tree_node_base* __root);
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ bool
+ _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const
+ {
+ if (_M_impl._M_node_count == 0 || begin() == end())
+ return _M_impl._M_node_count == 0 && begin() == end()
+ && this->_M_impl._M_header._M_left == _M_end()
+ && this->_M_impl._M_header._M_right == _M_end();
+
+ unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root());
+ for (const_iterator __it = begin(); __it != end(); ++__it)
+ {
+ _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node);
+ _Const_Link_type __L = _S_left(__x);
+ _Const_Link_type __R = _S_right(__x);
+
+ if (__x->_M_color == _S_red)
+ if ((__L && __L->_M_color == _S_red)
+ || (__R && __R->_M_color == _S_red))
+ return false;
+
+ if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L)))
+ return false;
+ if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x)))
+ return false;
+
+ if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len)
+ return false;
+ }
+
+ if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
+ return false;
+ if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
+ return false;
+ return true;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_uninitialized.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_uninitialized.h
new file mode 100644
index 000000000..11a66c7a5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_uninitialized.h
@@ -0,0 +1,478 @@
+// Raw memory manipulators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_uninitialized.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_UNINITIALIZED_H
+#define _STL_UNINITIALIZED_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<bool>
+ struct __uninitialized_copy
+ {
+ template<typename _InputIterator, typename _ForwardIterator>
+ static _ForwardIterator
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ {
+ _ForwardIterator __cur = __result;
+ __try
+ {
+ for (; __first != __last; ++__first, ++__cur)
+ ::new(static_cast<void*>(&*__cur)) typename
+ iterator_traits<_ForwardIterator>::value_type(*__first);
+ return __cur;
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_copy<true>
+ {
+ template<typename _InputIterator, typename _ForwardIterator>
+ static _ForwardIterator
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ { return std::copy(__first, __last, __result); }
+ };
+
+ /**
+ * @brief Copies the range [first,last) into result.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @return result + (first - last)
+ *
+ * Like copy(), but does not require an initialized output range.
+ */
+ template<typename _InputIterator, typename _ForwardIterator>
+ inline _ForwardIterator
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType2;
+
+ return std::__uninitialized_copy<(__is_pod(_ValueType1)
+ && __is_pod(_ValueType2))>::
+ uninitialized_copy(__first, __last, __result);
+ }
+
+
+ template<bool>
+ struct __uninitialized_fill
+ {
+ template<typename _ForwardIterator, typename _Tp>
+ static void
+ uninitialized_fill(_ForwardIterator __first,
+ _ForwardIterator __last, const _Tp& __x)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __cur != __last; ++__cur)
+ std::_Construct(&*__cur, __x);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_fill<true>
+ {
+ template<typename _ForwardIterator, typename _Tp>
+ static void
+ uninitialized_fill(_ForwardIterator __first,
+ _ForwardIterator __last, const _Tp& __x)
+ { std::fill(__first, __last, __x); }
+ };
+
+ /**
+ * @brief Copies the value x into the range [first,last).
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param x The source value.
+ * @return Nothing.
+ *
+ * Like fill(), but does not require an initialized output range.
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_fill<__is_pod(_ValueType)>::
+ uninitialized_fill(__first, __last, __x);
+ }
+
+
+ template<bool>
+ struct __uninitialized_fill_n
+ {
+ template<typename _ForwardIterator, typename _Size, typename _Tp>
+ static void
+ uninitialized_fill_n(_ForwardIterator __first, _Size __n,
+ const _Tp& __x)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __n > 0; --__n, ++__cur)
+ std::_Construct(&*__cur, __x);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_fill_n<true>
+ {
+ template<typename _ForwardIterator, typename _Size, typename _Tp>
+ static void
+ uninitialized_fill_n(_ForwardIterator __first, _Size __n,
+ const _Tp& __x)
+ { std::fill_n(__first, __n, __x); }
+ };
+
+ /**
+ * @brief Copies the value x into the range [first,first+n).
+ * @param first An input iterator.
+ * @param n The number of copies to make.
+ * @param x The source value.
+ * @return Nothing.
+ *
+ * Like fill_n(), but does not require an initialized output range.
+ */
+ template<typename _ForwardIterator, typename _Size, typename _Tp>
+ inline void
+ uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_fill_n<__is_pod(_ValueType)>::
+ uninitialized_fill_n(__first, __n, __x);
+ }
+
+ // Extensions: versions of uninitialized_copy, uninitialized_fill,
+ // and uninitialized_fill_n that take an allocator parameter.
+ // We dispatch back to the standard versions when we're given the
+ // default allocator. For nondefault allocators we do not use
+ // any of the POD optimizations.
+
+ template<typename _InputIterator, typename _ForwardIterator,
+ typename _Allocator>
+ _ForwardIterator
+ __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result, _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __result;
+ __try
+ {
+ for (; __first != __last; ++__first, ++__cur)
+ __alloc.construct(&*__cur, *__first);
+ return __cur;
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
+ inline _ForwardIterator
+ __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result, allocator<_Tp>&)
+ { return std::uninitialized_copy(__first, __last, __result); }
+
+ template<typename _InputIterator, typename _ForwardIterator,
+ typename _Allocator>
+ inline _ForwardIterator
+ __uninitialized_move_a(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result, _Allocator& __alloc)
+ {
+ return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
+ _GLIBCXX_MAKE_MOVE_ITERATOR(__last),
+ __result, __alloc);
+ }
+
+ template<typename _ForwardIterator, typename _Tp, typename _Allocator>
+ void
+ __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x, _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __cur != __last; ++__cur)
+ __alloc.construct(&*__cur, __x);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _ForwardIterator, typename _Tp, typename _Tp2>
+ inline void
+ __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x, allocator<_Tp2>&)
+ { std::uninitialized_fill(__first, __last, __x); }
+
+ template<typename _ForwardIterator, typename _Size, typename _Tp,
+ typename _Allocator>
+ void
+ __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
+ const _Tp& __x, _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __n > 0; --__n, ++__cur)
+ __alloc.construct(&*__cur, __x);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _ForwardIterator, typename _Size, typename _Tp,
+ typename _Tp2>
+ inline void
+ __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
+ const _Tp& __x, allocator<_Tp2>&)
+ { std::uninitialized_fill_n(__first, __n, __x); }
+
+
+ // Extensions: __uninitialized_copy_move, __uninitialized_move_copy,
+ // __uninitialized_fill_move, __uninitialized_move_fill.
+ // All of these algorithms take a user-supplied allocator, which is used
+ // for construction and destruction.
+
+ // __uninitialized_copy_move
+ // Copies [first1, last1) into [result, result + (last1 - first1)), and
+ // move [first2, last2) into
+ // [result, result + (last1 - first1) + (last2 - first2)).
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _ForwardIterator, typename _Allocator>
+ inline _ForwardIterator
+ __uninitialized_copy_move(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _ForwardIterator __result,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
+ __result,
+ __alloc);
+ __try
+ {
+ return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __mid, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ // __uninitialized_move_copy
+ // Moves [first1, last1) into [result, result + (last1 - first1)), and
+ // copies [first2, last2) into
+ // [result, result + (last1 - first1) + (last2 - first2)).
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _ForwardIterator, typename _Allocator>
+ inline _ForwardIterator
+ __uninitialized_move_copy(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _ForwardIterator __result,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
+ __result,
+ __alloc);
+ __try
+ {
+ return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __mid, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ // __uninitialized_fill_move
+ // Fills [result, mid) with x, and moves [first, last) into
+ // [mid, mid + (last - first)).
+ template<typename _ForwardIterator, typename _Tp, typename _InputIterator,
+ typename _Allocator>
+ inline _ForwardIterator
+ __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
+ const _Tp& __x, _InputIterator __first,
+ _InputIterator __last, _Allocator& __alloc)
+ {
+ std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
+ __try
+ {
+ return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __mid, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ // __uninitialized_move_fill
+ // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and
+ // fills [first2 + (last1 - first1), last2) with x.
+ template<typename _InputIterator, typename _ForwardIterator, typename _Tp,
+ typename _Allocator>
+ inline void
+ __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
+ _ForwardIterator __first2,
+ _ForwardIterator __last2, const _Tp& __x,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
+ __first2,
+ __alloc);
+ __try
+ {
+ std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first2, __mid2, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _InputIterator, typename _Size,
+ typename _ForwardIterator>
+ _ForwardIterator
+ __uninitialized_copy_n(_InputIterator __first, _Size __n,
+ _ForwardIterator __result, input_iterator_tag)
+ {
+ _ForwardIterator __cur = __result;
+ __try
+ {
+ for (; __n > 0; --__n, ++__first, ++__cur)
+ ::new(static_cast<void*>(&*__cur)) typename
+ iterator_traits<_ForwardIterator>::value_type(*__first);
+ return __cur;
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __cur);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _RandomAccessIterator, typename _Size,
+ typename _ForwardIterator>
+ inline _ForwardIterator
+ __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n,
+ _ForwardIterator __result,
+ random_access_iterator_tag)
+ { return std::uninitialized_copy(__first, __first + __n, __result); }
+
+ /**
+ * @brief Copies the range [first,first+n) into result.
+ * @param first An input iterator.
+ * @param n The number of elements to copy.
+ * @param result An output iterator.
+ * @return result + n
+ *
+ * Like copy_n(), but does not require an initialized output range.
+ */
+ template<typename _InputIterator, typename _Size, typename _ForwardIterator>
+ inline _ForwardIterator
+ uninitialized_copy_n(_InputIterator __first, _Size __n,
+ _ForwardIterator __result)
+ { return std::__uninitialized_copy_n(__first, __n, __result,
+ std::__iterator_category(__first)); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _STL_UNINITIALIZED_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stl_vector.h b/gcc-4.4.0/libstdc++-v3/include/bits/stl_vector.h
new file mode 100644
index 000000000..6871bb072
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stl_vector.h
@@ -0,0 +1,1249 @@
+// Vector implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file stl_vector.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STL_VECTOR_H
+#define _STL_VECTOR_H 1
+
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/functexcept.h>
+#include <bits/concept_check.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /// See bits/stl_deque.h's _Deque_base for an explanation.
+ template<typename _Tp, typename _Alloc>
+ struct _Vector_base
+ {
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+
+ struct _Vector_impl
+ : public _Tp_alloc_type
+ {
+ typename _Tp_alloc_type::pointer _M_start;
+ typename _Tp_alloc_type::pointer _M_finish;
+ typename _Tp_alloc_type::pointer _M_end_of_storage;
+
+ _Vector_impl()
+ : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
+ { }
+
+ _Vector_impl(_Tp_alloc_type const& __a)
+ : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
+ { }
+ };
+
+ public:
+ typedef _Alloc allocator_type;
+
+ _Tp_alloc_type&
+ _M_get_Tp_allocator()
+ { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); }
+
+ const _Tp_alloc_type&
+ _M_get_Tp_allocator() const
+ { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); }
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_get_Tp_allocator()); }
+
+ _Vector_base()
+ : _M_impl() { }
+
+ _Vector_base(const allocator_type& __a)
+ : _M_impl(__a) { }
+
+ _Vector_base(size_t __n, const allocator_type& __a)
+ : _M_impl(__a)
+ {
+ this->_M_impl._M_start = this->_M_allocate(__n);
+ this->_M_impl._M_finish = this->_M_impl._M_start;
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ _Vector_base(_Vector_base&& __x)
+ : _M_impl(__x._M_get_Tp_allocator())
+ {
+ this->_M_impl._M_start = __x._M_impl._M_start;
+ this->_M_impl._M_finish = __x._M_impl._M_finish;
+ this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage;
+ __x._M_impl._M_start = 0;
+ __x._M_impl._M_finish = 0;
+ __x._M_impl._M_end_of_storage = 0;
+ }
+#endif
+
+ ~_Vector_base()
+ { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start); }
+
+ public:
+ _Vector_impl _M_impl;
+
+ typename _Tp_alloc_type::pointer
+ _M_allocate(size_t __n)
+ { return __n != 0 ? _M_impl.allocate(__n) : 0; }
+
+ void
+ _M_deallocate(typename _Tp_alloc_type::pointer __p, size_t __n)
+ {
+ if (__p)
+ _M_impl.deallocate(__p, __n);
+ }
+ };
+
+
+ /**
+ * @brief A standard container which offers fixed time access to
+ * individual elements in any order.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>, including the
+ * <a href="tables.html#68">optional sequence requirements</a> with the
+ * %exception of @c push_front and @c pop_front.
+ *
+ * In some terminology a %vector can be described as a dynamic
+ * C-style array, it offers fast and efficient access to individual
+ * elements in any order and saves the user from worrying about
+ * memory and size allocation. Subscripting ( @c [] ) access is
+ * also provided as with C-style arrays.
+ */
+ template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ class vector : protected _Vector_base<_Tp, _Alloc>
+ {
+ // Concept requirements.
+ typedef typename _Alloc::value_type _Alloc_value_type;
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+ __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
+
+ typedef _Vector_base<_Tp, _Alloc> _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+
+ public:
+ typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef typename _Tp_alloc_type::const_pointer const_pointer;
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
+ typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
+ const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+
+ protected:
+ using _Base::_M_allocate;
+ using _Base::_M_deallocate;
+ using _Base::_M_impl;
+ using _Base::_M_get_Tp_allocator;
+
+ public:
+ // [23.2.4.1] construct/copy/destroy
+ // (assign() and get_allocator() are also listed in this section)
+ /**
+ * @brief Default constructor creates no elements.
+ */
+ vector()
+ : _Base() { }
+
+ /**
+ * @brief Creates a %vector with no elements.
+ * @param a An allocator object.
+ */
+ explicit
+ vector(const allocator_type& __a)
+ : _Base(__a) { }
+
+ /**
+ * @brief Creates a %vector with copies of an exemplar element.
+ * @param n The number of elements to initially create.
+ * @param value An element to copy.
+ * @param a An allocator.
+ *
+ * This constructor fills the %vector with @a n copies of @a value.
+ */
+ explicit
+ vector(size_type __n, const value_type& __value = value_type(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __a)
+ { _M_fill_initialize(__n, __value); }
+
+ /**
+ * @brief %Vector copy constructor.
+ * @param x A %vector of identical element and allocator types.
+ *
+ * The newly-created %vector uses a copy of the allocation
+ * object used by @a x. All the elements of @a x are copied,
+ * but any extra memory in
+ * @a x (for fast expansion) will not be copied.
+ */
+ vector(const vector& __x)
+ : _Base(__x.size(), __x._M_get_Tp_allocator())
+ { this->_M_impl._M_finish =
+ std::__uninitialized_copy_a(__x.begin(), __x.end(),
+ this->_M_impl._M_start,
+ _M_get_Tp_allocator());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Vector move constructor.
+ * @param x A %vector of identical element and allocator types.
+ *
+ * The newly-created %vector contains the exact contents of @a x.
+ * The contents of @a x are a valid, but unspecified %vector.
+ */
+ vector(vector&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ /**
+ * @brief Builds a %vector from an initializer list.
+ * @param l An initializer_list.
+ * @param a An allocator.
+ *
+ * Create a %vector consisting of copies of the elements in the
+ * initializer_list @a l.
+ *
+ * This will call the element type's copy constructor N times
+ * (where N is @a l.size()) and do no memory reallocation.
+ */
+ vector(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _M_range_initialize(__l.begin(), __l.end(),
+ random_access_iterator_tag());
+ }
+#endif
+
+ /**
+ * @brief Builds a %vector from a range.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param a An allocator.
+ *
+ * Create a %vector consisting of copies of the elements from
+ * [first,last).
+ *
+ * If the iterators are forward, bidirectional, or
+ * random-access, then this will call the elements' copy
+ * constructor N times (where N is distance(first,last)) and do
+ * no memory reallocation. But if only input iterators are
+ * used, then this will do at most 2N calls to the copy
+ * constructor, and logN memory reallocations.
+ */
+ template<typename _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_initialize_dispatch(__first, __last, _Integral());
+ }
+
+ /**
+ * The dtor only erases the elements, and note that if the
+ * elements themselves are pointers, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ ~vector()
+ { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator()); }
+
+ /**
+ * @brief %Vector assignment operator.
+ * @param x A %vector of identical element and allocator types.
+ *
+ * All the elements of @a x are copied, but any extra memory in
+ * @a x (for fast expansion) will not be copied. Unlike the
+ * copy constructor, the allocator object is not copied.
+ */
+ vector&
+ operator=(const vector& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief %Vector move assignment operator.
+ * @param x A %vector of identical element and allocator types.
+ *
+ * The contents of @a x are moved into this %vector (without copying).
+ * @a x is a valid, but unspecified %vector.
+ */
+ vector&
+ operator=(vector&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ /**
+ * @brief %Vector list assignment operator.
+ * @param l An initializer_list.
+ *
+ * This function fills a %vector with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %vector and
+ * that the resulting %vector's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ vector&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ /**
+ * @brief Assigns a given value to a %vector.
+ * @param n Number of elements to be assigned.
+ * @param val Value to be assigned.
+ *
+ * This function fills a %vector with @a n copies of the given
+ * value. Note that the assignment completely changes the
+ * %vector and that the resulting %vector's size is the same as
+ * the number of elements assigned. Old data may be lost.
+ */
+ void
+ assign(size_type __n, const value_type& __val)
+ { _M_fill_assign(__n, __val); }
+
+ /**
+ * @brief Assigns a range to a %vector.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function fills a %vector with copies of the elements in the
+ * range [first,last).
+ *
+ * Note that the assignment completely changes the %vector and
+ * that the resulting %vector's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ template<typename _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assigns an initializer list to a %vector.
+ * @param l An initializer_list.
+ *
+ * This function fills a %vector with copies of the elements in the
+ * initializer list @a l.
+ *
+ * Note that the assignment completely changes the %vector and
+ * that the resulting %vector's size is the same as the number
+ * of elements assigned. Old data may be lost.
+ */
+ void
+ assign(initializer_list<value_type> __l)
+ { this->assign(__l.begin(), __l.end()); }
+#endif
+
+ /// Get a copy of the memory allocation object.
+ using _Base::get_allocator;
+
+ // iterators
+ /**
+ * Returns a read/write iterator that points to the first
+ * element in the %vector. Iteration is done in ordinary
+ * element order.
+ */
+ iterator
+ begin()
+ { return iterator(this->_M_impl._M_start); }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the
+ * first element in the %vector. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ begin() const
+ { return const_iterator(this->_M_impl._M_start); }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * element in the %vector. Iteration is done in ordinary
+ * element order.
+ */
+ iterator
+ end()
+ { return iterator(this->_M_impl._M_finish); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %vector. Iteration is done in
+ * ordinary element order.
+ */
+ const_iterator
+ end() const
+ { return const_iterator(this->_M_impl._M_finish); }
+
+ /**
+ * Returns a read/write reverse iterator that points to the
+ * last element in the %vector. Iteration is done in reverse
+ * element order.
+ */
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last element in the %vector. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one
+ * before the first element in the %vector. Iteration is done
+ * in reverse element order.
+ */
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first element in the %vector. Iteration
+ * is done in reverse element order.
+ */
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the
+ * first element in the %vector. Iteration is done in ordinary
+ * element order.
+ */
+ const_iterator
+ cbegin() const
+ { return const_iterator(this->_M_impl._M_start); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past
+ * the last element in the %vector. Iteration is done in
+ * ordinary element order.
+ */
+ const_iterator
+ cend() const
+ { return const_iterator(this->_M_impl._M_finish); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last element in the %vector. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first element in the %vector. Iteration
+ * is done in reverse element order.
+ */
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // [23.2.4.2] capacity
+ /** Returns the number of elements in the %vector. */
+ size_type
+ size() const
+ { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
+
+ /** Returns the size() of the largest possible %vector. */
+ size_type
+ max_size() const
+ { return _M_get_Tp_allocator().max_size(); }
+
+ /**
+ * @brief Resizes the %vector to the specified number of elements.
+ * @param new_size Number of elements the %vector should contain.
+ * @param x Data with which new elements should be populated.
+ *
+ * This function will %resize the %vector to the specified
+ * number of elements. If the number is smaller than the
+ * %vector's current size the %vector is truncated, otherwise
+ * the %vector is extended and new elements are populated with
+ * given data.
+ */
+ void
+ resize(size_type __new_size, value_type __x = value_type())
+ {
+ if (__new_size < size())
+ _M_erase_at_end(this->_M_impl._M_start + __new_size);
+ else
+ insert(end(), __new_size - size(), __x);
+ }
+
+ /**
+ * Returns the total number of elements that the %vector can
+ * hold before needing to allocate more memory.
+ */
+ size_type
+ capacity() const
+ { return size_type(this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start); }
+
+ /**
+ * Returns true if the %vector is empty. (Thus begin() would
+ * equal end().)
+ */
+ bool
+ empty() const
+ { return begin() == end(); }
+
+ /**
+ * @brief Attempt to preallocate enough memory for specified number of
+ * elements.
+ * @param n Number of elements required.
+ * @throw std::length_error If @a n exceeds @c max_size().
+ *
+ * This function attempts to reserve enough memory for the
+ * %vector to hold the specified number of elements. If the
+ * number requested is more than max_size(), length_error is
+ * thrown.
+ *
+ * The advantage of this function is that if optimal code is a
+ * necessity and the user can determine the number of elements
+ * that will be required, the user can reserve the memory in
+ * %advance, and thus prevent a possible reallocation of memory
+ * and copying of %vector data.
+ */
+ void
+ reserve(size_type __n);
+
+ // element access
+ /**
+ * @brief Subscript access to the data contained in the %vector.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read/write reference to data.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().)
+ *
+ * Local modification: range checks are performed if
+ * __google_stl_debug_vector is defined to non-zero.
+ */
+ reference
+ operator[](size_type __n)
+ {
+#if __google_stl_debug_vector
+ _M_range_check(__n);
+#endif
+ return *(this->_M_impl._M_start + __n);
+ }
+
+ /**
+ * @brief Subscript access to the data contained in the %vector.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read-only (constant) reference to data.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().)
+ *
+ * Local modification: range checks are performed if
+ * __google_stl_debug_vector is defined to non-zero.
+ */
+ const_reference
+ operator[](size_type __n) const
+ {
+#if __google_stl_debug_vector
+ _M_range_check(__n);
+#endif
+ return *(this->_M_impl._M_start + __n);
+ }
+
+ protected:
+ /// Safety check used only from at().
+ void
+ _M_range_check(size_type __n) const
+ {
+ if (__n >= this->size())
+ __throw_out_of_range(__N("vector::_M_range_check"));
+ }
+
+ public:
+ /**
+ * @brief Provides access to the data contained in the %vector.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read/write reference to data.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter
+ * is first checked that it is in the range of the vector. The
+ * function throws out_of_range if the check fails.
+ */
+ reference
+ at(size_type __n)
+ {
+ _M_range_check(__n);
+ return (*this)[__n];
+ }
+
+ /**
+ * @brief Provides access to the data contained in the %vector.
+ * @param n The index of the element for which data should be
+ * accessed.
+ * @return Read-only (constant) reference to data.
+ * @throw std::out_of_range If @a n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter
+ * is first checked that it is in the range of the vector. The
+ * function throws out_of_range if the check fails.
+ */
+ const_reference
+ at(size_type __n) const
+ {
+ _M_range_check(__n);
+ return (*this)[__n];
+ }
+
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %vector.
+ */
+ reference
+ front()
+ { return *begin(); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %vector.
+ */
+ const_reference
+ front() const
+ { return *begin(); }
+
+ /**
+ * Returns a read/write reference to the data at the last
+ * element of the %vector.
+ */
+ reference
+ back()
+ { return *(end() - 1); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the
+ * last element of the %vector.
+ */
+ const_reference
+ back() const
+ { return *(end() - 1); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 464. Suggestion for new member functions in standard containers.
+ // data access
+ /**
+ * Returns a pointer such that [data(), data() + size()) is a valid
+ * range. For a non-empty %vector, data() == &front().
+ */
+ pointer
+ data()
+ { return pointer(this->_M_impl._M_start); }
+
+ const_pointer
+ data() const
+ { return const_pointer(this->_M_impl._M_start); }
+
+ // [23.2.4.3] modifiers
+ /**
+ * @brief Add data to the end of the %vector.
+ * @param x Data to be added.
+ *
+ * This is a typical stack operation. The function creates an
+ * element at the end of the %vector and assigns the given data
+ * to it. Due to the nature of a %vector this operation can be
+ * done in constant time if the %vector has preallocated space
+ * available.
+ */
+ void
+ push_back(const value_type& __x)
+ {
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish, __x);
+ ++this->_M_impl._M_finish;
+ }
+ else
+ _M_insert_aux(end(), __x);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(value_type&& __x)
+ { emplace_back(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_back(_Args&&... __args);
+#endif
+
+ /**
+ * @brief Removes last element.
+ *
+ * This is a typical stack operation. It shrinks the %vector by one.
+ *
+ * Note that no data is returned, and if the last element's
+ * data is needed, it should be retrieved before pop_back() is
+ * called.
+ */
+ void
+ pop_back()
+ {
+ --this->_M_impl._M_finish;
+ this->_M_impl.destroy(this->_M_impl._M_finish);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Inserts an object in %vector before specified iterator.
+ * @param position An iterator into the %vector.
+ * @param args Arguments.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert an object of type T constructed
+ * with T(std::forward<Args>(args)...) before the specified location.
+ * Note that this kind of operation could be expensive for a %vector
+ * and if it is frequently used the user should consider using
+ * std::list.
+ */
+ template<typename... _Args>
+ iterator
+ emplace(iterator __position, _Args&&... __args);
+#endif
+
+ /**
+ * @brief Inserts given value into %vector before specified iterator.
+ * @param position An iterator into the %vector.
+ * @param x Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given value before
+ * the specified location. Note that this kind of operation
+ * could be expensive for a %vector and if it is frequently
+ * used the user should consider using std::list.
+ */
+ iterator
+ insert(iterator __position, const value_type& __x);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Inserts given rvalue into %vector before specified iterator.
+ * @param position An iterator into the %vector.
+ * @param x Data to be inserted.
+ * @return An iterator that points to the inserted data.
+ *
+ * This function will insert a copy of the given rvalue before
+ * the specified location. Note that this kind of operation
+ * could be expensive for a %vector and if it is frequently
+ * used the user should consider using std::list.
+ */
+ iterator
+ insert(iterator __position, value_type&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ /**
+ * @brief Inserts an initializer_list into the %vector.
+ * @param position An iterator into the %vector.
+ * @param l An initializer_list.
+ *
+ * This function will insert copies of the data in the
+ * initializer_list @a l into the %vector before the location
+ * specified by @a position.
+ *
+ * Note that this kind of operation could be expensive for a
+ * %vector and if it is frequently used the user should
+ * consider using std::list.
+ */
+ void
+ insert(iterator __position, initializer_list<value_type> __l)
+ { this->insert(__position, __l.begin(), __l.end()); }
+#endif
+
+ /**
+ * @brief Inserts a number of copies of given data into the %vector.
+ * @param position An iterator into the %vector.
+ * @param n Number of elements to be inserted.
+ * @param x Data to be inserted.
+ *
+ * This function will insert a specified number of copies of
+ * the given data before the location specified by @a position.
+ *
+ * Note that this kind of operation could be expensive for a
+ * %vector and if it is frequently used the user should
+ * consider using std::list.
+ */
+ void
+ insert(iterator __position, size_type __n, const value_type& __x)
+ { _M_fill_insert(__position, __n, __x); }
+
+ /**
+ * @brief Inserts a range into the %vector.
+ * @param position An iterator into the %vector.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ *
+ * This function will insert copies of the data in the range
+ * [first,last) into the %vector before the location specified
+ * by @a pos.
+ *
+ * Note that this kind of operation could be expensive for a
+ * %vector and if it is frequently used the user should
+ * consider using std::list.
+ */
+ template<typename _InputIterator>
+ void
+ insert(iterator __position, _InputIterator __first,
+ _InputIterator __last)
+ {
+ // Check whether it's an integral type. If so, it's not an iterator.
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_insert_dispatch(__position, __first, __last, _Integral());
+ }
+
+ /**
+ * @brief Remove element at given position.
+ * @param position Iterator pointing to element to be erased.
+ * @return An iterator pointing to the next element (or end()).
+ *
+ * This function will erase the element at the given position and thus
+ * shorten the %vector by one.
+ *
+ * Note This operation could be expensive and if it is
+ * frequently used the user should consider using std::list.
+ * The user is also cautioned that this function only erases
+ * the element, and that if the element is itself a pointer,
+ * the pointed-to memory is not touched in any way. Managing
+ * the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __position);
+
+ /**
+ * @brief Remove a range of elements.
+ * @param first Iterator pointing to the first element to be erased.
+ * @param last Iterator pointing to one past the last element to be
+ * erased.
+ * @return An iterator pointing to the element pointed to by @a last
+ * prior to erasing (or end()).
+ *
+ * This function will erase the elements in the range [first,last) and
+ * shorten the %vector accordingly.
+ *
+ * Note This operation could be expensive and if it is
+ * frequently used the user should consider using std::list.
+ * The user is also cautioned that this function only erases
+ * the elements, and that if the elements themselves are
+ * pointers, the pointed-to memory is not touched in any way.
+ * Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last);
+
+ /**
+ * @brief Swaps data with another %vector.
+ * @param x A %vector of the same element and allocator types.
+ *
+ * This exchanges the elements between two vectors in constant time.
+ * (Three pointers, so it should be quite fast.)
+ * Note that the global std::swap() function is specialized such that
+ * std::swap(v1,v2) will feed to this function.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(vector&& __x)
+#else
+ swap(vector& __x)
+#endif
+ {
+ std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
+ std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
+ std::swap(this->_M_impl._M_end_of_storage,
+ __x._M_impl._M_end_of_storage);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(),
+ __x._M_get_Tp_allocator());
+ }
+
+ /**
+ * Erases all the elements. Note that this function only erases the
+ * elements, and that if the elements themselves are pointers, the
+ * pointed-to memory is not touched in any way. Managing the pointer is
+ * the user's responsibility.
+ */
+ void
+ clear()
+ { _M_erase_at_end(this->_M_impl._M_start); }
+
+ protected:
+ /**
+ * Memory expansion handler. Uses the member allocation function to
+ * obtain @a n bytes of memory, and then copies [first,last) into it.
+ */
+ template<typename _ForwardIterator>
+ pointer
+ _M_allocate_and_copy(size_type __n,
+ _ForwardIterator __first, _ForwardIterator __last)
+ {
+ pointer __result = this->_M_allocate(__n);
+ __try
+ {
+ std::__uninitialized_copy_a(__first, __last, __result,
+ _M_get_Tp_allocator());
+ return __result;
+ }
+ __catch(...)
+ {
+ _M_deallocate(__result, __n);
+ __throw_exception_again;
+ }
+ }
+
+
+ // Internal constructor functions follow.
+
+ // Called by the range constructor to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
+ {
+ this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
+ this->_M_impl._M_end_of_storage =
+ this->_M_impl._M_start + static_cast<size_type>(__n);
+ _M_fill_initialize(static_cast<size_type>(__n), __value);
+ }
+
+ // Called by the range constructor to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::
+ iterator_category _IterCategory;
+ _M_range_initialize(__first, __last, _IterCategory());
+ }
+
+ // Called by the second initialize_dispatch above
+ template<typename _InputIterator>
+ void
+ _M_range_initialize(_InputIterator __first,
+ _InputIterator __last, std::input_iterator_tag)
+ {
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
+
+ // Called by the second initialize_dispatch above
+ template<typename _ForwardIterator>
+ void
+ _M_range_initialize(_ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag)
+ {
+ const size_type __n = std::distance(__first, __last);
+ this->_M_impl._M_start = this->_M_allocate(__n);
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
+ this->_M_impl._M_finish =
+ std::__uninitialized_copy_a(__first, __last,
+ this->_M_impl._M_start,
+ _M_get_Tp_allocator());
+ }
+
+ // Called by the first initialize_dispatch above and by the
+ // vector(n,value,a) constructor.
+ void
+ _M_fill_initialize(size_type __n, const value_type& __value)
+ {
+ std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
+ }
+
+
+ // Internal assign functions follow. The *_aux functions do the actual
+ // assignment work for the range versions.
+
+ // Called by the range assign to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign(__n, __val); }
+
+ // Called by the range assign to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::
+ iterator_category _IterCategory;
+ _M_assign_aux(__first, __last, _IterCategory());
+ }
+
+ // Called by the second assign_dispatch above
+ template<typename _InputIterator>
+ void
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag);
+
+ // Called by the second assign_dispatch above
+ template<typename _ForwardIterator>
+ void
+ _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag);
+
+ // Called by assign(n,t), and the range assign when it turns out
+ // to be the same thing.
+ void
+ _M_fill_assign(size_type __n, const value_type& __val);
+
+
+ // Internal insert functions follow.
+
+ // Called by the range insert to implement [23.1.1]/9
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+ __true_type)
+ { _M_fill_insert(__pos, __n, __val); }
+
+ // Called by the range insert to implement [23.1.1]/9
+ template<typename _InputIterator>
+ void
+ _M_insert_dispatch(iterator __pos, _InputIterator __first,
+ _InputIterator __last, __false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::
+ iterator_category _IterCategory;
+ _M_range_insert(__pos, __first, __last, _IterCategory());
+ }
+
+ // Called by the second insert_dispatch above
+ template<typename _InputIterator>
+ void
+ _M_range_insert(iterator __pos, _InputIterator __first,
+ _InputIterator __last, std::input_iterator_tag);
+
+ // Called by the second insert_dispatch above
+ template<typename _ForwardIterator>
+ void
+ _M_range_insert(iterator __pos, _ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag);
+
+ // Called by insert(p,n,x), and the range insert when it turns out to be
+ // the same thing.
+ void
+ _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
+
+ // Called by insert(p,x)
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ _M_insert_aux(iterator __position, const value_type& __x);
+#else
+ template<typename... _Args>
+ void
+ _M_insert_aux(iterator __position, _Args&&... __args);
+#endif
+
+ // Called by the latter.
+ size_type
+ _M_check_len(size_type __n, const char* __s) const
+ {
+ if (max_size() - size() < __n)
+ __throw_length_error(__N(__s));
+
+ const size_type __len = size() + std::max(size(), __n);
+ return (__len < size() || __len > max_size()) ? max_size() : __len;
+ }
+
+ // Internal erase functions follow.
+
+ // Called by erase(q1,q2), clear(), resize(), _M_fill_assign,
+ // _M_assign_aux.
+ void
+ _M_erase_at_end(pointer __pos)
+ {
+ std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
+ this->_M_impl._M_finish = __pos;
+ }
+ };
+
+
+ /**
+ * @brief Vector equality comparison.
+ * @param x A %vector.
+ * @param y A %vector of the same type as @a x.
+ * @return True iff the size and elements of the vectors are equal.
+ *
+ * This is an equivalence relation. It is linear in the size of the
+ * vectors. Vectors are considered equivalent if their sizes are equal,
+ * and if corresponding elements compare equal.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
+ { return (__x.size() == __y.size()
+ && std::equal(__x.begin(), __x.end(), __y.begin())); }
+
+ /**
+ * @brief Vector ordering relation.
+ * @param x A %vector.
+ * @param y A %vector of the same type as @a x.
+ * @return True iff @a x is lexicographically less than @a y.
+ *
+ * This is a total ordering relation. It is linear in the size of the
+ * vectors. The elements must be comparable with @c <.
+ *
+ * See std::lexicographical_compare() for how the determination is made.
+ */
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
+ { return std::lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end()); }
+
+ /// Based on operator==
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
+ { return __y < __x; }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ /// Based on operator<
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ /// See std::vector::swap().
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>&& __x, vector<_Tp, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _STL_VECTOR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stream_iterator.h b/gcc-4.4.0/libstdc++-v3/include/bits/stream_iterator.h
new file mode 100644
index 000000000..fce6c26d1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stream_iterator.h
@@ -0,0 +1,211 @@
+// Stream iterators
+
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stream_iterator.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STREAM_ITERATOR_H
+#define _STREAM_ITERATOR_H 1
+
+#pragma GCC system_header
+
+#include <debug/debug.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /// Provides input iterator semantics for streams.
+ template<typename _Tp, typename _CharT = char,
+ typename _Traits = char_traits<_CharT>, typename _Dist = ptrdiff_t>
+ class istream_iterator
+ : public iterator<input_iterator_tag, _Tp, _Dist, const _Tp*, const _Tp&>
+ {
+ public:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+
+ private:
+ istream_type* _M_stream;
+ _Tp _M_value;
+ bool _M_ok;
+
+ public:
+ /// Construct end of input stream iterator.
+ istream_iterator()
+ : _M_stream(0), _M_value(), _M_ok(false) {}
+
+ /// Construct start of input stream iterator.
+ istream_iterator(istream_type& __s)
+ : _M_stream(&__s)
+ { _M_read(); }
+
+ istream_iterator(const istream_iterator& __obj)
+ : _M_stream(__obj._M_stream), _M_value(__obj._M_value),
+ _M_ok(__obj._M_ok)
+ { }
+
+ const _Tp&
+ operator*() const
+ {
+ __glibcxx_requires_cond(_M_ok,
+ _M_message(__gnu_debug::__msg_deref_istream)
+ ._M_iterator(*this));
+ return _M_value;
+ }
+
+ const _Tp*
+ operator->() const { return &(operator*()); }
+
+ istream_iterator&
+ operator++()
+ {
+ __glibcxx_requires_cond(_M_ok,
+ _M_message(__gnu_debug::__msg_inc_istream)
+ ._M_iterator(*this));
+ _M_read();
+ return *this;
+ }
+
+ istream_iterator
+ operator++(int)
+ {
+ __glibcxx_requires_cond(_M_ok,
+ _M_message(__gnu_debug::__msg_inc_istream)
+ ._M_iterator(*this));
+ istream_iterator __tmp = *this;
+ _M_read();
+ return __tmp;
+ }
+
+ bool
+ _M_equal(const istream_iterator& __x) const
+ { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); }
+
+ private:
+ void
+ _M_read()
+ {
+ _M_ok = (_M_stream && *_M_stream) ? true : false;
+ if (_M_ok)
+ {
+ *_M_stream >> _M_value;
+ _M_ok = *_M_stream ? true : false;
+ }
+ }
+ };
+
+ /// Return true if x and y are both end or not end, or x and y are the same.
+ template<typename _Tp, typename _CharT, typename _Traits, typename _Dist>
+ inline bool
+ operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)
+ { return __x._M_equal(__y); }
+
+ /// Return false if x and y are both end or not end, or x and y are the same.
+ template <class _Tp, class _CharT, class _Traits, class _Dist>
+ inline bool
+ operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
+ const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)
+ { return !__x._M_equal(__y); }
+
+ /**
+ * @brief Provides output iterator semantics for streams.
+ *
+ * This class provides an iterator to write to an ostream. The type Tp is
+ * the only type written by this iterator and there must be an
+ * operator<<(Tp) defined.
+ *
+ * @param Tp The type to write to the ostream.
+ * @param CharT The ostream char_type.
+ * @param Traits The ostream char_traits.
+ */
+ template<typename _Tp, typename _CharT = char,
+ typename _Traits = char_traits<_CharT> >
+ class ostream_iterator
+ : public iterator<output_iterator_tag, void, void, void, void>
+ {
+ public:
+ //@{
+ /// Public typedef
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+ //@}
+
+ private:
+ ostream_type* _M_stream;
+ const _CharT* _M_string;
+
+ public:
+ /// Construct from an ostream.
+ ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
+
+ /**
+ * Construct from an ostream.
+ *
+ * The delimiter string @a c is written to the stream after every Tp
+ * written to the stream. The delimiter is not copied, and thus must
+ * not be destroyed while this iterator is in use.
+ *
+ * @param s Underlying ostream to write to.
+ * @param c CharT delimiter string to insert.
+ */
+ ostream_iterator(ostream_type& __s, const _CharT* __c)
+ : _M_stream(&__s), _M_string(__c) { }
+
+ /// Copy constructor.
+ ostream_iterator(const ostream_iterator& __obj)
+ : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { }
+
+ /// Writes @a value to underlying ostream using operator<<. If
+ /// constructed with delimiter string, writes delimiter to ostream.
+ ostream_iterator&
+ operator=(const _Tp& __value)
+ {
+ __glibcxx_requires_cond(_M_stream != 0,
+ _M_message(__gnu_debug::__msg_output_ostream)
+ ._M_iterator(*this));
+ *_M_stream << __value;
+ if (_M_string) *_M_stream << _M_string;
+ return *this;
+ }
+
+ ostream_iterator&
+ operator*()
+ { return *this; }
+
+ ostream_iterator&
+ operator++()
+ { return *this; }
+
+ ostream_iterator&
+ operator++(int)
+ { return *this; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/streambuf.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/streambuf.tcc
new file mode 100644
index 000000000..f3e6ce749
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/streambuf.tcc
@@ -0,0 +1,174 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file streambuf.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 27.5 Stream buffers
+//
+
+#ifndef _STREAMBUF_TCC
+#define _STREAMBUF_TCC 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_streambuf<_CharT, _Traits>::
+ xsgetn(char_type* __s, streamsize __n)
+ {
+ streamsize __ret = 0;
+ while (__ret < __n)
+ {
+ const streamsize __buf_len = this->egptr() - this->gptr();
+ if (__buf_len)
+ {
+ const streamsize __remaining = __n - __ret;
+ const streamsize __len = std::min(__buf_len, __remaining);
+ traits_type::copy(__s, this->gptr(), __len);
+ __ret += __len;
+ __s += __len;
+ this->gbump(__len);
+ }
+
+ if (__ret < __n)
+ {
+ const int_type __c = this->uflow();
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
+ {
+ traits_type::assign(*__s++, traits_type::to_char_type(__c));
+ ++__ret;
+ }
+ else
+ break;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ basic_streambuf<_CharT, _Traits>::
+ xsputn(const char_type* __s, streamsize __n)
+ {
+ streamsize __ret = 0;
+ while (__ret < __n)
+ {
+ const streamsize __buf_len = this->epptr() - this->pptr();
+ if (__buf_len)
+ {
+ const streamsize __remaining = __n - __ret;
+ const streamsize __len = std::min(__buf_len, __remaining);
+ traits_type::copy(this->pptr(), __s, __len);
+ __ret += __len;
+ __s += __len;
+ this->pbump(__len);
+ }
+
+ if (__ret < __n)
+ {
+ int_type __c = this->overflow(traits_type::to_int_type(*__s));
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
+ {
+ ++__ret;
+ ++__s;
+ }
+ else
+ break;
+ }
+ }
+ return __ret;
+ }
+
+ // Conceivably, this could be used to implement buffer-to-buffer
+ // copies, if this was ever desired in an un-ambiguous way by the
+ // standard.
+ template<typename _CharT, typename _Traits>
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin,
+ basic_streambuf<_CharT, _Traits>* __sbout,
+ bool& __ineof)
+ {
+ streamsize __ret = 0;
+ __ineof = true;
+ typename _Traits::int_type __c = __sbin->sgetc();
+ while (!_Traits::eq_int_type(__c, _Traits::eof()))
+ {
+ __c = __sbout->sputc(_Traits::to_char_type(__c));
+ if (_Traits::eq_int_type(__c, _Traits::eof()))
+ {
+ __ineof = false;
+ break;
+ }
+ ++__ret;
+ __c = __sbin->snextc();
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline streamsize
+ __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin,
+ basic_streambuf<_CharT, _Traits>* __sbout)
+ {
+ bool __ineof;
+ return __copy_streambufs_eof(__sbin, __sbout, __ineof);
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class basic_streambuf<char>;
+ extern template
+ streamsize
+ __copy_streambufs(basic_streambuf<char>*,
+ basic_streambuf<char>*);
+ extern template
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<char>*,
+ basic_streambuf<char>*, bool&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class basic_streambuf<wchar_t>;
+ extern template
+ streamsize
+ __copy_streambufs(basic_streambuf<wchar_t>*,
+ basic_streambuf<wchar_t>*);
+ extern template
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<wchar_t>*,
+ basic_streambuf<wchar_t>*, bool&);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/streambuf_iterator.h b/gcc-4.4.0/libstdc++-v3/include/bits/streambuf_iterator.h
new file mode 100644
index 000000000..d02b55534
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -0,0 +1,392 @@
+// Streambuf iterators
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file streambuf_iterator.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _STREAMBUF_ITERATOR_H
+#define _STREAMBUF_ITERATOR_H 1
+
+#pragma GCC system_header
+
+#include <streambuf>
+#include <debug/debug.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // 24.5.3 Template class istreambuf_iterator
+ /// Provides input iterator semantics for streambufs.
+ template<typename _CharT, typename _Traits>
+ class istreambuf_iterator
+ : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type,
+ _CharT*, _CharT&>
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::int_type int_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_istream<_CharT, _Traits> istream_type;
+ //@}
+
+ template<typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ ostreambuf_iterator<_CharT2> >::__type
+ copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
+ ostreambuf_iterator<_CharT2>);
+
+ template<bool _IsMove, typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ _CharT2*>::__type
+ __copy_move_a2(istreambuf_iterator<_CharT2>,
+ istreambuf_iterator<_CharT2>, _CharT2*);
+
+ template<typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ istreambuf_iterator<_CharT2> >::__type
+ find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
+ const _CharT2&);
+
+ private:
+ // 24.5.3 istreambuf_iterator
+ // p 1
+ // If the end of stream is reached (streambuf_type::sgetc()
+ // returns traits_type::eof()), the iterator becomes equal to
+ // the "end of stream" iterator value.
+ // NB: This implementation assumes the "end of stream" value
+ // is EOF, or -1.
+ mutable streambuf_type* _M_sbuf;
+ mutable int_type _M_c;
+
+ public:
+ /// Construct end of input stream iterator.
+ istreambuf_iterator() throw()
+ : _M_sbuf(0), _M_c(traits_type::eof()) { }
+
+ /// Construct start of input stream iterator.
+ istreambuf_iterator(istream_type& __s) throw()
+ : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { }
+
+ /// Construct start of streambuf iterator.
+ istreambuf_iterator(streambuf_type* __s) throw()
+ : _M_sbuf(__s), _M_c(traits_type::eof()) { }
+
+ /// Return the current character pointed to by iterator. This returns
+ /// streambuf.sgetc(). It cannot be assigned. NB: The result of
+ /// operator*() on an end of stream is undefined.
+ char_type
+ operator*() const
+ {
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+ // Dereferencing a past-the-end istreambuf_iterator is a
+ // libstdc++ extension
+ __glibcxx_requires_cond(!_M_at_eof(),
+ _M_message(__gnu_debug::__msg_deref_istreambuf)
+ ._M_iterator(*this));
+#endif
+ return traits_type::to_char_type(_M_get());
+ }
+
+ /// Advance the iterator. Calls streambuf.sbumpc().
+ istreambuf_iterator&
+ operator++()
+ {
+ __glibcxx_requires_cond(!_M_at_eof(),
+ _M_message(__gnu_debug::__msg_inc_istreambuf)
+ ._M_iterator(*this));
+ if (_M_sbuf)
+ {
+ _M_sbuf->sbumpc();
+ _M_c = traits_type::eof();
+ }
+ return *this;
+ }
+
+ /// Advance the iterator. Calls streambuf.sbumpc().
+ istreambuf_iterator
+ operator++(int)
+ {
+ __glibcxx_requires_cond(!_M_at_eof(),
+ _M_message(__gnu_debug::__msg_inc_istreambuf)
+ ._M_iterator(*this));
+
+ istreambuf_iterator __old = *this;
+ if (_M_sbuf)
+ {
+ __old._M_c = _M_sbuf->sbumpc();
+ _M_c = traits_type::eof();
+ }
+ return __old;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 110 istreambuf_iterator::equal not const
+ // NB: there is also number 111 (NAD, Future) pending on this function.
+ /// Return true both iterators are end or both are not end.
+ bool
+ equal(const istreambuf_iterator& __b) const
+ { return _M_at_eof() == __b._M_at_eof(); }
+
+ private:
+ int_type
+ _M_get() const
+ {
+ const int_type __eof = traits_type::eof();
+ int_type __ret = __eof;
+ if (_M_sbuf)
+ {
+ if (!traits_type::eq_int_type(_M_c, __eof))
+ __ret = _M_c;
+ else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()),
+ __eof))
+ _M_c = __ret;
+ else
+ _M_sbuf = 0;
+ }
+ return __ret;
+ }
+
+ bool
+ _M_at_eof() const
+ {
+ const int_type __eof = traits_type::eof();
+ return traits_type::eq_int_type(_M_get(), __eof);
+ }
+ };
+
+ template<typename _CharT, typename _Traits>
+ inline bool
+ operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
+ const istreambuf_iterator<_CharT, _Traits>& __b)
+ { return __a.equal(__b); }
+
+ template<typename _CharT, typename _Traits>
+ inline bool
+ operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
+ const istreambuf_iterator<_CharT, _Traits>& __b)
+ { return !__a.equal(__b); }
+
+ /// Provides output iterator semantics for streambufs.
+ template<typename _CharT, typename _Traits>
+ class ostreambuf_iterator
+ : public iterator<output_iterator_tag, void, void, void, void>
+ {
+ public:
+ // Types:
+ //@{
+ /// Public typedefs
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_streambuf<_CharT, _Traits> streambuf_type;
+ typedef basic_ostream<_CharT, _Traits> ostream_type;
+ //@}
+
+ template<typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ ostreambuf_iterator<_CharT2> >::__type
+ copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
+ ostreambuf_iterator<_CharT2>);
+
+ private:
+ streambuf_type* _M_sbuf;
+ bool _M_failed;
+
+ public:
+ /// Construct output iterator from ostream.
+ ostreambuf_iterator(ostream_type& __s) throw ()
+ : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { }
+
+ /// Construct output iterator from streambuf.
+ ostreambuf_iterator(streambuf_type* __s) throw ()
+ : _M_sbuf(__s), _M_failed(!_M_sbuf) { }
+
+ /// Write character to streambuf. Calls streambuf.sputc().
+ ostreambuf_iterator&
+ operator=(_CharT __c)
+ {
+ if (!_M_failed &&
+ _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof()))
+ _M_failed = true;
+ return *this;
+ }
+
+ /// Return *this.
+ ostreambuf_iterator&
+ operator*()
+ { return *this; }
+
+ /// Return *this.
+ ostreambuf_iterator&
+ operator++(int)
+ { return *this; }
+
+ /// Return *this.
+ ostreambuf_iterator&
+ operator++()
+ { return *this; }
+
+ /// Return true if previous operator=() failed.
+ bool
+ failed() const throw()
+ { return _M_failed; }
+
+ ostreambuf_iterator&
+ _M_put(const _CharT* __ws, streamsize __len)
+ {
+ if (__builtin_expect(!_M_failed, true)
+ && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len,
+ false))
+ _M_failed = true;
+ return *this;
+ }
+ };
+
+ // Overloads for streambuf iterators.
+ template<typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ ostreambuf_iterator<_CharT> >::__type
+ copy(istreambuf_iterator<_CharT> __first,
+ istreambuf_iterator<_CharT> __last,
+ ostreambuf_iterator<_CharT> __result)
+ {
+ if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed)
+ {
+ bool __ineof;
+ __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof);
+ if (!__ineof)
+ __result._M_failed = true;
+ }
+ return __result;
+ }
+
+ template<bool _IsMove, typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ ostreambuf_iterator<_CharT> >::__type
+ __copy_move_a2(_CharT* __first, _CharT* __last,
+ ostreambuf_iterator<_CharT> __result)
+ {
+ const streamsize __num = __last - __first;
+ if (__num > 0)
+ __result._M_put(__first, __num);
+ return __result;
+ }
+
+ template<bool _IsMove, typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ ostreambuf_iterator<_CharT> >::__type
+ __copy_move_a2(const _CharT* __first, const _CharT* __last,
+ ostreambuf_iterator<_CharT> __result)
+ {
+ const streamsize __num = __last - __first;
+ if (__num > 0)
+ __result._M_put(__first, __num);
+ return __result;
+ }
+
+ template<bool _IsMove, typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ _CharT*>::__type
+ __copy_move_a2(istreambuf_iterator<_CharT> __first,
+ istreambuf_iterator<_CharT> __last, _CharT* __result)
+ {
+ typedef istreambuf_iterator<_CharT> __is_iterator_type;
+ typedef typename __is_iterator_type::traits_type traits_type;
+ typedef typename __is_iterator_type::streambuf_type streambuf_type;
+ typedef typename traits_type::int_type int_type;
+
+ if (__first._M_sbuf && !__last._M_sbuf)
+ {
+ streambuf_type* __sb = __first._M_sbuf;
+ int_type __c = __sb->sgetc();
+ while (!traits_type::eq_int_type(__c, traits_type::eof()))
+ {
+ const streamsize __n = __sb->egptr() - __sb->gptr();
+ if (__n > 1)
+ {
+ traits_type::copy(__result, __sb->gptr(), __n);
+ __sb->gbump(__n);
+ __result += __n;
+ __c = __sb->underflow();
+ }
+ else
+ {
+ *__result++ = traits_type::to_char_type(__c);
+ __c = __sb->snextc();
+ }
+ }
+ }
+ return __result;
+ }
+
+ template<typename _CharT>
+ typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
+ istreambuf_iterator<_CharT> >::__type
+ find(istreambuf_iterator<_CharT> __first,
+ istreambuf_iterator<_CharT> __last, const _CharT& __val)
+ {
+ typedef istreambuf_iterator<_CharT> __is_iterator_type;
+ typedef typename __is_iterator_type::traits_type traits_type;
+ typedef typename __is_iterator_type::streambuf_type streambuf_type;
+ typedef typename traits_type::int_type int_type;
+
+ if (__first._M_sbuf && !__last._M_sbuf)
+ {
+ const int_type __ival = traits_type::to_int_type(__val);
+ streambuf_type* __sb = __first._M_sbuf;
+ int_type __c = __sb->sgetc();
+ while (!traits_type::eq_int_type(__c, traits_type::eof())
+ && !traits_type::eq_int_type(__c, __ival))
+ {
+ streamsize __n = __sb->egptr() - __sb->gptr();
+ if (__n > 1)
+ {
+ const _CharT* __p = traits_type::find(__sb->gptr(),
+ __n, __val);
+ if (__p)
+ __n = __p - __sb->gptr();
+ __sb->gbump(__n);
+ __c = __sb->sgetc();
+ }
+ else
+ __c = __sb->snextc();
+ }
+
+ if (!traits_type::eq_int_type(__c, traits_type::eof()))
+ __first._M_c = __c;
+ else
+ __first._M_sbuf = 0;
+ }
+ return __first;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/stringfwd.h b/gcc-4.4.0/libstdc++-v3/include/bits/stringfwd.h
new file mode 100644
index 000000000..c63e777b7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/stringfwd.h
@@ -0,0 +1,77 @@
+// String support -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stringfwd.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _STRINGFWD_H
+#define _STRINGFWD_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Alloc>
+ class allocator;
+
+ template<class _CharT>
+ struct char_traits;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_string;
+
+ template<> struct char_traits<char>;
+
+ typedef basic_string<char> string;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<> struct char_traits<wchar_t>;
+
+ typedef basic_string<wchar_t> wstring;
+#endif
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+ template<> struct char_traits<char16_t>;
+ template<> struct char_traits<char32_t>;
+
+ typedef basic_string<char16_t> u16string;
+ typedef basic_string<char32_t> u32string;
+
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _STRINGFWD_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/unique_ptr.h b/gcc-4.4.0/libstdc++-v3/include/bits/unique_ptr.h
new file mode 100644
index 000000000..b686d11fd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/unique_ptr.h
@@ -0,0 +1,450 @@
+// unique_ptr implementation -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file unique_ptr.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _UNIQUE_PTR_H
+#define _UNIQUE_PTR_H 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <bits/c++config.h>
+#include <debug/debug.h>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup pointer_abstractions
+ * @{
+ */
+
+ /// Primary template, default_delete.
+ template<typename _Tp>
+ struct default_delete
+ {
+ default_delete() { }
+
+ template<typename _Up>
+ default_delete(const default_delete<_Up>&) { }
+
+ void
+ operator()(_Tp* __ptr) const
+ {
+ static_assert(sizeof(_Tp)>0,
+ "can't delete pointer to incomplete type");
+ delete __ptr;
+ }
+ };
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 740 - omit specialization for array objects with a compile time length
+ /// Specialization, default_delete.
+ template<typename _Tp>
+ struct default_delete<_Tp[]>
+ {
+ void
+ operator()(_Tp* __ptr) const
+ {
+ static_assert(sizeof(_Tp)>0,
+ "can't delete pointer to incomplete type");
+ delete [] __ptr;
+ }
+ };
+
+ /// 20.7.12.2 unique_ptr for single objects.
+ template <typename _Tp, typename _Tp_Deleter = default_delete<_Tp> >
+ class unique_ptr
+ {
+ typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
+ typedef __tuple_type unique_ptr::* __unspecified_bool_type;
+ typedef _Tp* unique_ptr::* __unspecified_pointer_type;
+
+ public:
+ typedef _Tp* pointer;
+ typedef _Tp element_type;
+ typedef _Tp_Deleter deleter_type;
+
+ // Constructors.
+ unique_ptr()
+ : _M_t(pointer(), deleter_type())
+ { static_assert(!std::is_pointer<deleter_type>::value,
+ "constructed with null function pointer deleter"); }
+
+ explicit
+ unique_ptr(pointer __p)
+ : _M_t(__p, deleter_type())
+ { static_assert(!std::is_pointer<deleter_type>::value,
+ "constructed with null function pointer deleter"); }
+
+ unique_ptr(pointer __p,
+ typename std::conditional<std::is_reference<deleter_type>::value,
+ deleter_type, const deleter_type&>::type __d)
+ : _M_t(__p, __d) { }
+
+ unique_ptr(pointer __p,
+ typename std::remove_reference<deleter_type>::type&& __d)
+ : _M_t(std::move(__p), std::move(__d))
+ { static_assert(!std::is_reference<deleter_type>::value,
+ "rvalue deleter bound to reference"); }
+
+ // Move constructors.
+ unique_ptr(unique_ptr&& __u)
+ : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
+
+ template<typename _Up, typename _Up_Deleter>
+ unique_ptr(unique_ptr<_Up, _Up_Deleter>&& __u)
+ : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
+ { }
+
+ // Destructor.
+ ~unique_ptr() { reset(); }
+
+ // Assignment.
+ unique_ptr&
+ operator=(unique_ptr&& __u)
+ {
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
+ }
+
+ template<typename _Up, typename _Up_Deleter>
+ unique_ptr&
+ operator=(unique_ptr<_Up, _Up_Deleter>&& __u)
+ {
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
+ }
+
+ unique_ptr&
+ operator=(__unspecified_pointer_type)
+ {
+ reset();
+ return *this;
+ }
+
+ // Observers.
+ typename std::add_lvalue_reference<element_type>::type operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(get() != 0);
+ return *get();
+ }
+
+ pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(get() != 0);
+ return get();
+ }
+
+ pointer
+ get() const
+ { return std::get<0>(_M_t); }
+
+ typename std::add_lvalue_reference<deleter_type>::type
+ get_deleter()
+ { return std::get<1>(_M_t); }
+
+ typename std::add_lvalue_reference<
+ typename std::add_const<deleter_type>::type
+ >::type
+ get_deleter() const
+ { return std::get<1>(_M_t); }
+
+ operator __unspecified_bool_type () const
+ { return get() == 0 ? 0 : &unique_ptr::_M_t; }
+
+ // Modifiers.
+ pointer
+ release()
+ {
+ pointer __p = get();
+ std::get<0>(_M_t) = 0;
+ return __p;
+ }
+
+ void
+ reset(pointer __p = pointer())
+ {
+ if (__p != get())
+ {
+ get_deleter()(get());
+ std::get<0>(_M_t) = __p;
+ }
+ }
+
+ void
+ swap(unique_ptr&& __u)
+ {
+ using std::swap;
+ swap(_M_t, __u._M_t);
+ }
+
+ // Disable copy from lvalue.
+ unique_ptr(const unique_ptr&) = delete;
+
+ template<typename _Up, typename _Up_Deleter>
+ unique_ptr(const unique_ptr<_Up, _Up_Deleter>&) = delete;
+
+ unique_ptr& operator=(const unique_ptr&) = delete;
+
+ template<typename _Up, typename _Up_Deleter>
+ unique_ptr& operator=(const unique_ptr<_Up, _Up_Deleter>&) = delete;
+
+ private:
+ __tuple_type _M_t;
+ };
+
+ /// 20.7.12.3 unique_ptr for array objects with a runtime length
+ // [unique.ptr.runtime]
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 740 - omit specialization for array objects with a compile time length
+ template<typename _Tp, typename _Tp_Deleter>
+ class unique_ptr<_Tp[], _Tp_Deleter>
+ {
+ typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type;
+ typedef __tuple_type unique_ptr::* __unspecified_bool_type;
+ typedef _Tp* unique_ptr::* __unspecified_pointer_type;
+
+ public:
+ typedef _Tp* pointer;
+ typedef _Tp element_type;
+ typedef _Tp_Deleter deleter_type;
+
+ // Constructors.
+ unique_ptr()
+ : _M_t(pointer(), deleter_type())
+ { static_assert(!std::is_pointer<deleter_type>::value,
+ "constructed with null function pointer deleter"); }
+
+ explicit
+ unique_ptr(pointer __p)
+ : _M_t(__p, deleter_type())
+ { static_assert(!std::is_pointer<deleter_type>::value,
+ "constructed with null function pointer deleter"); }
+
+ unique_ptr(pointer __p,
+ typename std::conditional<std::is_reference<deleter_type>::value,
+ deleter_type, const deleter_type&>::type __d)
+ : _M_t(__p, __d) { }
+
+ unique_ptr(pointer __p,
+ typename std::remove_reference<deleter_type>::type && __d)
+ : _M_t(std::move(__p), std::move(__d))
+ { static_assert(!std::is_reference<deleter_type>::value,
+ "rvalue deleter bound to reference"); }
+
+ // Move constructors.
+ unique_ptr(unique_ptr&& __u)
+ : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter())) { }
+
+ template<typename _Up, typename _Up_Deleter>
+ unique_ptr(unique_ptr<_Up, _Up_Deleter>&& __u)
+ : _M_t(__u.release(), std::forward<deleter_type>(__u.get_deleter()))
+ { }
+
+ // Destructor.
+ ~unique_ptr() { reset(); }
+
+ // Assignment.
+ unique_ptr&
+ operator=(unique_ptr&& __u)
+ {
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
+ }
+
+ template<typename _Up, typename _Up_Deleter>
+ unique_ptr&
+ operator=(unique_ptr<_Up, _Up_Deleter>&& __u)
+ {
+ reset(__u.release());
+ get_deleter() = std::move(__u.get_deleter());
+ return *this;
+ }
+
+ unique_ptr&
+ operator=(__unspecified_pointer_type)
+ {
+ reset();
+ return *this;
+ }
+
+ // Observers.
+ typename std::add_lvalue_reference<element_type>::type
+ operator[](size_t __i) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(get() != 0);
+ return get()[__i];
+ }
+
+ pointer
+ get() const
+ { return std::get<0>(_M_t); }
+
+ typename std::add_lvalue_reference<deleter_type>::type
+ get_deleter()
+ { return std::get<1>(_M_t); }
+
+ typename std::add_lvalue_reference<
+ typename std::add_const<deleter_type>::type
+ >::type
+ get_deleter() const
+ { return std::get<1>(_M_t); }
+
+ operator __unspecified_bool_type () const
+ { return get() == 0 ? 0 : &unique_ptr::_M_t; }
+
+ // Modifiers.
+ pointer
+ release()
+ {
+ pointer __p = get();
+ std::get<0>(_M_t) = 0;
+ return __p;
+ }
+
+ void
+ reset(pointer __p = pointer())
+ {
+ if (__p != get())
+ {
+ get_deleter()(get());
+ std::get<0>(_M_t) = __p;
+ }
+ }
+
+ // DR 821.
+ template<typename _Up>
+ void reset(_Up) = delete;
+
+ void
+ swap(unique_ptr&& __u)
+ {
+ using std::swap;
+ swap(_M_t, __u._M_t);
+ }
+
+ // Disable copy from lvalue.
+ unique_ptr(const unique_ptr&) = delete;
+ unique_ptr& operator=(const unique_ptr&) = delete;
+
+ // Disable construction from convertible pointer types.
+ // (N2315 - 20.6.5.3.1)
+ template<typename _Up>
+ unique_ptr(_Up*, typename
+ std::conditional<std::is_reference<deleter_type>::value,
+ deleter_type, const deleter_type&>::type,
+ typename std::enable_if<std::is_convertible<_Up*,
+ pointer>::value>::type* = 0) = delete;
+
+ template<typename _Up>
+ unique_ptr(_Up*, typename std::remove_reference<deleter_type>::type&&,
+ typename std::enable_if<std::is_convertible<_Up*,
+ pointer>::value>::type* = 0) = delete;
+
+ template<typename _Up>
+ explicit
+ unique_ptr(_Up*, typename std::enable_if<std::is_convertible<_Up*,
+ pointer>::value>::type* = 0) = delete;
+
+ private:
+ __tuple_type _M_t;
+ };
+
+ template<typename _Tp, typename _Tp_Deleter>
+ inline void
+ swap(unique_ptr<_Tp, _Tp_Deleter>& __x,
+ unique_ptr<_Tp, _Tp_Deleter>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Tp_Deleter>
+ inline void
+ swap(unique_ptr<_Tp, _Tp_Deleter>&& __x,
+ unique_ptr<_Tp, _Tp_Deleter>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Tp_Deleter>
+ inline void
+ swap(unique_ptr<_Tp, _Tp_Deleter>& __x,
+ unique_ptr<_Tp, _Tp_Deleter>&& __y)
+ { __x.swap(__y); }
+
+ template<typename _Tp, typename _Tp_Deleter,
+ typename _Up, typename _Up_Deleter>
+ inline bool
+ operator==(const unique_ptr<_Tp, _Tp_Deleter>& __x,
+ const unique_ptr<_Up, _Up_Deleter>& __y)
+ { return __x.get() == __y.get(); }
+
+ template<typename _Tp, typename _Tp_Deleter,
+ typename _Up, typename _Up_Deleter>
+ inline bool
+ operator!=(const unique_ptr<_Tp, _Tp_Deleter>& __x,
+ const unique_ptr<_Up, _Up_Deleter>& __y)
+ { return !(__x.get() == __y.get()); }
+
+ template<typename _Tp, typename _Tp_Deleter,
+ typename _Up, typename _Up_Deleter>
+ inline bool
+ operator<(const unique_ptr<_Tp, _Tp_Deleter>& __x,
+ const unique_ptr<_Up, _Up_Deleter>& __y)
+ { return __x.get() < __y.get(); }
+
+ template<typename _Tp, typename _Tp_Deleter,
+ typename _Up, typename _Up_Deleter>
+ inline bool
+ operator<=(const unique_ptr<_Tp, _Tp_Deleter>& __x,
+ const unique_ptr<_Up, _Up_Deleter>& __y)
+ { return !(__y.get() < __x.get()); }
+
+ template<typename _Tp, typename _Tp_Deleter,
+ typename _Up, typename _Up_Deleter>
+ inline bool
+ operator>(const unique_ptr<_Tp, _Tp_Deleter>& __x,
+ const unique_ptr<_Up, _Up_Deleter>& __y)
+ { return __y.get() < __x.get(); }
+
+ template<typename _Tp, typename _Tp_Deleter,
+ typename _Up, typename _Up_Deleter>
+ inline bool
+ operator>=(const unique_ptr<_Tp, _Tp_Deleter>& __x,
+ const unique_ptr<_Up, _Up_Deleter>& __y)
+ { return !(__x.get() < __y.get()); }
+
+ // @} group pointer_abstractions
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _UNIQUE_PTR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/valarray_after.h b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_after.h
new file mode 100644
index 000000000..8a6a2568e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_after.h
@@ -0,0 +1,549 @@
+// The template and inlines for the -*- C++ -*- internal _Meta class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file valarray_after.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
+
+#ifndef _VALARRAY_AFTER_H
+#define _VALARRAY_AFTER_H 1
+
+#pragma GCC system_header
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ //
+ // gslice_array closure.
+ //
+ template<class _Dom>
+ class _GBase
+ {
+ public:
+ typedef typename _Dom::value_type value_type;
+
+ _GBase (const _Dom& __e, const valarray<size_t>& __i)
+ : _M_expr (__e), _M_index(__i) {}
+
+ value_type
+ operator[] (size_t __i) const
+ { return _M_expr[_M_index[__i]]; }
+
+ size_t
+ size () const
+ { return _M_index.size(); }
+
+ private:
+ const _Dom& _M_expr;
+ const valarray<size_t>& _M_index;
+ };
+
+ template<typename _Tp>
+ class _GBase<_Array<_Tp> >
+ {
+ public:
+ typedef _Tp value_type;
+
+ _GBase (_Array<_Tp> __a, const valarray<size_t>& __i)
+ : _M_array (__a), _M_index(__i) {}
+
+ value_type
+ operator[] (size_t __i) const
+ { return _M_array._M_data[_M_index[__i]]; }
+
+ size_t
+ size () const
+ { return _M_index.size(); }
+
+ private:
+ const _Array<_Tp> _M_array;
+ const valarray<size_t>& _M_index;
+ };
+
+ template<class _Dom>
+ struct _GClos<_Expr, _Dom>
+ : _GBase<_Dom>
+ {
+ typedef _GBase<_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _GClos (const _Dom& __e, const valarray<size_t>& __i)
+ : _Base (__e, __i) {}
+ };
+
+ template<typename _Tp>
+ struct _GClos<_ValArray, _Tp>
+ : _GBase<_Array<_Tp> >
+ {
+ typedef _GBase<_Array<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _GClos (_Array<_Tp> __a, const valarray<size_t>& __i)
+ : _Base (__a, __i) {}
+ };
+
+ //
+ // indirect_array closure
+ //
+ template<class _Dom>
+ class _IBase
+ {
+ public:
+ typedef typename _Dom::value_type value_type;
+
+ _IBase (const _Dom& __e, const valarray<size_t>& __i)
+ : _M_expr (__e), _M_index (__i) {}
+
+ value_type
+ operator[] (size_t __i) const
+ { return _M_expr[_M_index[__i]]; }
+
+ size_t
+ size() const
+ { return _M_index.size(); }
+
+ private:
+ const _Dom& _M_expr;
+ const valarray<size_t>& _M_index;
+ };
+
+ template<class _Dom>
+ struct _IClos<_Expr, _Dom>
+ : _IBase<_Dom>
+ {
+ typedef _IBase<_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _IClos (const _Dom& __e, const valarray<size_t>& __i)
+ : _Base (__e, __i) {}
+ };
+
+ template<typename _Tp>
+ struct _IClos<_ValArray, _Tp>
+ : _IBase<valarray<_Tp> >
+ {
+ typedef _IBase<valarray<_Tp> > _Base;
+ typedef _Tp value_type;
+
+ _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)
+ : _Base (__a, __i) {}
+ };
+
+ //
+ // class _Expr
+ //
+ template<class _Clos, typename _Tp>
+ class _Expr
+ {
+ public:
+ typedef _Tp value_type;
+
+ _Expr(const _Clos&);
+
+ const _Clos& operator()() const;
+
+ value_type operator[](size_t) const;
+ valarray<value_type> operator[](slice) const;
+ valarray<value_type> operator[](const gslice&) const;
+ valarray<value_type> operator[](const valarray<bool>&) const;
+ valarray<value_type> operator[](const valarray<size_t>&) const;
+
+ _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type>
+ operator+() const;
+
+ _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type>
+ operator-() const;
+
+ _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type>
+ operator~() const;
+
+ _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool>
+ operator!() const;
+
+ size_t size() const;
+ value_type sum() const;
+
+ valarray<value_type> shift(int) const;
+ valarray<value_type> cshift(int) const;
+
+ value_type min() const;
+ value_type max() const;
+
+ valarray<value_type> apply(value_type (*)(const value_type&)) const;
+ valarray<value_type> apply(value_type (*)(value_type)) const;
+
+ private:
+ const _Clos _M_closure;
+ };
+
+ template<class _Clos, typename _Tp>
+ inline
+ _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {}
+
+ template<class _Clos, typename _Tp>
+ inline const _Clos&
+ _Expr<_Clos, _Tp>::operator()() const
+ { return _M_closure; }
+
+ template<class _Clos, typename _Tp>
+ inline _Tp
+ _Expr<_Clos, _Tp>::operator[](size_t __i) const
+ { return _M_closure[__i]; }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::operator[](slice __s) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this)[__s];
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this)[__gs];
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::operator[](const valarray<bool>& __m) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this)[__m];
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::operator[](const valarray<size_t>& __i) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this)[__i];
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline size_t
+ _Expr<_Clos, _Tp>::size() const
+ { return _M_closure.size(); }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::shift(int __n) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n);
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::cshift(int __n) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n);
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);
+ return __v;
+ }
+
+ template<class _Clos, typename _Tp>
+ inline valarray<_Tp>
+ _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
+ {
+ valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);
+ return __v;
+ }
+
+ // XXX: replace this with a more robust summation algorithm.
+ template<class _Clos, typename _Tp>
+ inline _Tp
+ _Expr<_Clos, _Tp>::sum() const
+ {
+ size_t __n = _M_closure.size();
+ if (__n == 0)
+ return _Tp();
+ else
+ {
+ _Tp __s = _M_closure[--__n];
+ while (__n != 0)
+ __s += _M_closure[--__n];
+ return __s;
+ }
+ }
+
+ template<class _Clos, typename _Tp>
+ inline _Tp
+ _Expr<_Clos, _Tp>::min() const
+ { return __valarray_min(_M_closure); }
+
+ template<class _Clos, typename _Tp>
+ inline _Tp
+ _Expr<_Clos, _Tp>::max() const
+ { return __valarray_max(_M_closure); }
+
+ template<class _Dom, typename _Tp>
+ inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool>
+ _Expr<_Dom, _Tp>::operator!() const
+ {
+ typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure;
+ return _Expr<_Closure, _Tp>(_Closure(this->_M_closure));
+ }
+
+#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
+ template<class _Dom, typename _Tp> \
+ inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp> \
+ _Expr<_Dom, _Tp>::operator _Op() const \
+ { \
+ typedef _UnClos<_Name, std::_Expr, _Dom> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(this->_M_closure)); \
+ }
+
+ _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
+ _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
+ _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not)
+
+#undef _DEFINE_EXPR_UNARY_OPERATOR
+
+#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \
+ template<class _Dom1, class _Dom2> \
+ inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>, \
+ typename __fun<_Name, typename _Dom1::value_type>::result_type> \
+ operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v, \
+ const _Expr<_Dom2, typename _Dom2::value_type>& __w) \
+ { \
+ typedef typename _Dom1::value_type _Arg; \
+ typedef typename __fun<_Name, _Arg>::result_type _Value; \
+ typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure; \
+ return _Expr<_Closure, _Value>(_Closure(__v(), __w())); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom, \
+ typename _Dom::value_type>, \
+ typename __fun<_Name, typename _Dom::value_type>::result_type> \
+ operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v, \
+ const typename _Dom::value_type& __t) \
+ { \
+ typedef typename _Dom::value_type _Arg; \
+ typedef typename __fun<_Name, _Arg>::result_type _Value; \
+ typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure; \
+ return _Expr<_Closure, _Value>(_Closure(__v(), __t)); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<_Name, _Constant, _Expr, \
+ typename _Dom::value_type, _Dom>, \
+ typename __fun<_Name, typename _Dom::value_type>::result_type> \
+ operator _Op(const typename _Dom::value_type& __t, \
+ const _Expr<_Dom, typename _Dom::value_type>& __v) \
+ { \
+ typedef typename _Dom::value_type _Arg; \
+ typedef typename __fun<_Name, _Arg>::result_type _Value; \
+ typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure; \
+ return _Expr<_Closure, _Value>(_Closure(__t, __v())); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<_Name, _Expr, _ValArray, \
+ _Dom, typename _Dom::value_type>, \
+ typename __fun<_Name, typename _Dom::value_type>::result_type> \
+ operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \
+ const valarray<typename _Dom::value_type>& __v) \
+ { \
+ typedef typename _Dom::value_type _Arg; \
+ typedef typename __fun<_Name, _Arg>::result_type _Value; \
+ typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure; \
+ return _Expr<_Closure, _Value>(_Closure(__e(), __v)); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<_Name, _ValArray, _Expr, \
+ typename _Dom::value_type, _Dom>, \
+ typename __fun<_Name, typename _Dom::value_type>::result_type> \
+ operator _Op(const valarray<typename _Dom::value_type>& __v, \
+ const _Expr<_Dom, typename _Dom::value_type>& __e) \
+ { \
+ typedef typename _Dom::value_type _Tp; \
+ typedef typename __fun<_Name, _Tp>::result_type _Value; \
+ typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure; \
+ return _Expr<_Closure, _Value>(_Closure(__v, __e ())); \
+ }
+
+ _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
+ _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
+ _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)
+ _DEFINE_EXPR_BINARY_OPERATOR(/, __divides)
+ _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)
+ _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
+ _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
+ _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)
+ _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)
+ _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)
+ _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
+ _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)
+ _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)
+ _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)
+ _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
+ _DEFINE_EXPR_BINARY_OPERATOR(>, __greater)
+ _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)
+ _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)
+
+#undef _DEFINE_EXPR_BINARY_OPERATOR
+
+#define _DEFINE_EXPR_UNARY_FUNCTION(_Name) \
+ template<class _Dom> \
+ inline _Expr<_UnClos<__##_Name, _Expr, _Dom>, \
+ typename _Dom::value_type> \
+ _Name(const _Expr<_Dom, typename _Dom::value_type>& __e) \
+ { \
+ typedef typename _Dom::value_type _Tp; \
+ typedef _UnClos<__##_Name, _Expr, _Dom> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__e())); \
+ } \
+ \
+ template<typename _Tp> \
+ inline _Expr<_UnClos<__##_Name, _ValArray, _Tp>, _Tp> \
+ _Name(const valarray<_Tp>& __v) \
+ { \
+ typedef _UnClos<__##_Name, _ValArray, _Tp> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__v)); \
+ }
+
+ _DEFINE_EXPR_UNARY_FUNCTION(abs)
+ _DEFINE_EXPR_UNARY_FUNCTION(cos)
+ _DEFINE_EXPR_UNARY_FUNCTION(acos)
+ _DEFINE_EXPR_UNARY_FUNCTION(cosh)
+ _DEFINE_EXPR_UNARY_FUNCTION(sin)
+ _DEFINE_EXPR_UNARY_FUNCTION(asin)
+ _DEFINE_EXPR_UNARY_FUNCTION(sinh)
+ _DEFINE_EXPR_UNARY_FUNCTION(tan)
+ _DEFINE_EXPR_UNARY_FUNCTION(tanh)
+ _DEFINE_EXPR_UNARY_FUNCTION(atan)
+ _DEFINE_EXPR_UNARY_FUNCTION(exp)
+ _DEFINE_EXPR_UNARY_FUNCTION(log)
+ _DEFINE_EXPR_UNARY_FUNCTION(log10)
+ _DEFINE_EXPR_UNARY_FUNCTION(sqrt)
+
+#undef _DEFINE_EXPR_UNARY_FUNCTION
+
+#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun) \
+ template<class _Dom1, class _Dom2> \
+ inline _Expr<_BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2>, \
+ typename _Dom1::value_type> \
+ _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1, \
+ const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \
+ { \
+ typedef typename _Dom1::value_type _Tp; \
+ typedef _BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2())); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom, \
+ typename _Dom::value_type>, \
+ typename _Dom::value_type> \
+ _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \
+ const valarray<typename _Dom::value_type>& __v) \
+ { \
+ typedef typename _Dom::value_type _Tp; \
+ typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__e(), __v)); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr, \
+ typename _Dom::value_type, _Dom>, \
+ typename _Dom::value_type> \
+ _Fun(const valarray<typename _Dom::valarray>& __v, \
+ const _Expr<_Dom, typename _Dom::value_type>& __e) \
+ { \
+ typedef typename _Dom::value_type _Tp; \
+ typedef _BinClos<__##_Fun, _ValArray, _Expr, _Tp, _Dom> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__v, __e())); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<__##_Fun, _Expr, _Constant, _Dom, \
+ typename _Dom::value_type>, \
+ typename _Dom::value_type> \
+ _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \
+ const typename _Dom::value_type& __t) \
+ { \
+ typedef typename _Dom::value_type _Tp; \
+ typedef _BinClos<__##_Fun, _Expr, _Constant, _Dom, _Tp> _Closure;\
+ return _Expr<_Closure, _Tp>(_Closure(__e(), __t)); \
+ } \
+ \
+ template<class _Dom> \
+ inline _Expr<_BinClos<__##_Fun, _Constant, _Expr, \
+ typename _Dom::value_type, _Dom>, \
+ typename _Dom::value_type> \
+ _Fun(const typename _Dom::value_type& __t, \
+ const _Expr<_Dom, typename _Dom::value_type>& __e) \
+ { \
+ typedef typename _Dom::value_type _Tp; \
+ typedef _BinClos<__##_Fun, _Constant, _Expr, _Tp, _Dom> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__t, __e())); \
+ } \
+ \
+ template<typename _Tp> \
+ inline _Expr<_BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \
+ _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
+ { \
+ typedef _BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__v, __w)); \
+ } \
+ \
+ template<typename _Tp> \
+ inline _Expr<_BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \
+ _Fun(const valarray<_Tp>& __v, const _Tp& __t) \
+ { \
+ typedef _BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__v, __t)); \
+ } \
+ \
+ template<typename _Tp> \
+ inline _Expr<_BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \
+ _Fun(const _Tp& __t, const valarray<_Tp>& __v) \
+ { \
+ typedef _BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp> _Closure; \
+ return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \
+ }
+
+_DEFINE_EXPR_BINARY_FUNCTION(atan2)
+_DEFINE_EXPR_BINARY_FUNCTION(pow)
+
+#undef _DEFINE_EXPR_BINARY_FUNCTION
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _CPP_VALARRAY_AFTER_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.h b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.h
new file mode 100644
index 000000000..492891bc9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.h
@@ -0,0 +1,699 @@
+// The template and inlines for the -*- C++ -*- internal _Array helper class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file valarray_array.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _VALARRAY_ARRAY_H
+#define _VALARRAY_ARRAY_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+#include <cstdlib>
+#include <new>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ //
+ // Helper functions on raw pointers
+ //
+
+ // We get memory by the old fashion way
+ inline void*
+ __valarray_get_memory(size_t __n)
+ { return operator new(__n); }
+
+ template<typename _Tp>
+ inline _Tp*__restrict__
+ __valarray_get_storage(size_t __n)
+ {
+ return static_cast<_Tp*__restrict__>
+ (std::__valarray_get_memory(__n * sizeof(_Tp)));
+ }
+
+ // Return memory to the system
+ inline void
+ __valarray_release_memory(void* __p)
+ { operator delete(__p); }
+
+ // Turn a raw-memory into an array of _Tp filled with _Tp()
+ // This is required in 'valarray<T> v(n);'
+ template<typename _Tp, bool>
+ struct _Array_default_ctor
+ {
+ // Please note that this isn't exception safe. But
+ // valarrays aren't required to be exception safe.
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ {
+ while (__b != __e)
+ new(__b++) _Tp();
+ }
+ };
+
+ template<typename _Tp>
+ struct _Array_default_ctor<_Tp, true>
+ {
+ // For fundamental types, it suffices to say 'memset()'
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ { __builtin_memset(__b, 0, (__e - __b) * sizeof(_Tp)); }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_default_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ {
+ _Array_default_ctor<_Tp, __is_scalar<_Tp>::__value>::_S_do_it(__b, __e);
+ }
+
+ // Turn a raw-memory into an array of _Tp filled with __t
+ // This is the required in valarray<T> v(n, t). Also
+ // used in valarray<>::resize().
+ template<typename _Tp, bool>
+ struct _Array_init_ctor
+ {
+ // Please note that this isn't exception safe. But
+ // valarrays aren't required to be exception safe.
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)
+ {
+ while (__b != __e)
+ new(__b++) _Tp(__t);
+ }
+ };
+
+ template<typename _Tp>
+ struct _Array_init_ctor<_Tp, true>
+ {
+ inline static void
+ _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)
+ {
+ while (__b != __e)
+ *__b++ = __t;
+ }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e,
+ const _Tp __t)
+ {
+ _Array_init_ctor<_Tp, __is_pod(_Tp)>::_S_do_it(__b, __e, __t);
+ }
+
+ //
+ // copy-construct raw array [__o, *) from plain array [__b, __e)
+ // We can't just say 'memcpy()'
+ //
+ template<typename _Tp, bool>
+ struct _Array_copy_ctor
+ {
+ // Please note that this isn't exception safe. But
+ // valarrays aren't required to be exception safe.
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,
+ _Tp* __restrict__ __o)
+ {
+ while (__b != __e)
+ new(__o++) _Tp(*__b++);
+ }
+ };
+
+ template<typename _Tp>
+ struct _Array_copy_ctor<_Tp, true>
+ {
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,
+ _Tp* __restrict__ __o)
+ { __builtin_memcpy(__o, __b, (__e - __b) * sizeof(_Tp)); }
+ };
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct(const _Tp* __restrict__ __b,
+ const _Tp* __restrict__ __e,
+ _Tp* __restrict__ __o)
+ {
+ _Array_copy_ctor<_Tp, __is_pod(_Tp)>::_S_do_it(__b, __e, __o);
+ }
+
+ // copy-construct raw array [__o, *) from strided array __a[<__n : __s>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,
+ size_t __s, _Tp* __restrict__ __o)
+ {
+ if (__is_pod(_Tp))
+ while (__n--)
+ {
+ *__o++ = *__a;
+ __a += __s;
+ }
+ else
+ while (__n--)
+ {
+ new(__o++) _Tp(*__a);
+ __a += __s;
+ }
+ }
+
+ // copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]]
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct (const _Tp* __restrict__ __a,
+ const size_t* __restrict__ __i,
+ _Tp* __restrict__ __o, size_t __n)
+ {
+ if (__is_pod(_Tp))
+ while (__n--)
+ *__o++ = __a[*__i++];
+ else
+ while (__n--)
+ new (__o++) _Tp(__a[*__i++]);
+ }
+
+ // Do the necessary cleanup when we're done with arrays.
+ template<typename _Tp>
+ inline void
+ __valarray_destroy_elements(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
+ {
+ if (!__is_pod(_Tp))
+ while (__b != __e)
+ {
+ __b->~_Tp();
+ ++__b;
+ }
+ }
+
+ // Fill a plain array __a[<__n>] with __t
+ template<typename _Tp>
+ inline void
+ __valarray_fill(_Tp* __restrict__ __a, size_t __n, const _Tp& __t)
+ {
+ while (__n--)
+ *__a++ = __t;
+ }
+
+ // fill strided array __a[<__n-1 : __s>] with __t
+ template<typename _Tp>
+ inline void
+ __valarray_fill(_Tp* __restrict__ __a, size_t __n,
+ size_t __s, const _Tp& __t)
+ {
+ for (size_t __i = 0; __i < __n; ++__i, __a += __s)
+ *__a = __t;
+ }
+
+ // fill indirect array __a[__i[<__n>]] with __i
+ template<typename _Tp>
+ inline void
+ __valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i,
+ size_t __n, const _Tp& __t)
+ {
+ for (size_t __j = 0; __j < __n; ++__j, ++__i)
+ __a[*__i] = __t;
+ }
+
+ // copy plain array __a[<__n>] in __b[<__n>]
+ // For non-fundamental types, it is wrong to say 'memcpy()'
+ template<typename _Tp, bool>
+ struct _Array_copier
+ {
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)
+ {
+ while(__n--)
+ *__b++ = *__a++;
+ }
+ };
+
+ template<typename _Tp>
+ struct _Array_copier<_Tp, true>
+ {
+ inline static void
+ _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)
+ { __builtin_memcpy(__b, __a, __n * sizeof (_Tp)); }
+ };
+
+ // Copy a plain array __a[<__n>] into a play array __b[<>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __a, size_t __n,
+ _Tp* __restrict__ __b)
+ {
+ _Array_copier<_Tp, __is_pod(_Tp)>::_S_do_it(__a, __n, __b);
+ }
+
+ // Copy strided array __a[<__n : __s>] in plain __b[<__n>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __a, size_t __n, size_t __s,
+ _Tp* __restrict__ __b)
+ {
+ for (size_t __i = 0; __i < __n; ++__i, ++__b, __a += __s)
+ *__b = *__a;
+ }
+
+ // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __a, _Tp* __restrict__ __b,
+ size_t __n, size_t __s)
+ {
+ for (size_t __i = 0; __i < __n; ++__i, ++__a, __b += __s)
+ *__b = *__a;
+ }
+
+ // Copy strided array __src[<__n : __s1>] into another
+ // strided array __dst[< : __s2>]. Their sizes must match.
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __src, size_t __n, size_t __s1,
+ _Tp* __restrict__ __dst, size_t __s2)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ __dst[__i * __s2] = __src[__i * __s1];
+ }
+
+ // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __a,
+ const size_t* __restrict__ __i,
+ _Tp* __restrict__ __b, size_t __n)
+ {
+ for (size_t __j = 0; __j < __n; ++__j, ++__b, ++__i)
+ *__b = __a[*__i];
+ }
+
+ // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __a, size_t __n,
+ _Tp* __restrict__ __b, const size_t* __restrict__ __i)
+ {
+ for (size_t __j = 0; __j < __n; ++__j, ++__a, ++__i)
+ __b[*__i] = *__a;
+ }
+
+ // Copy the __n first elements of an indexed array __src[<__i>] into
+ // another indexed array __dst[<__j>].
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __src, size_t __n,
+ const size_t* __restrict__ __i,
+ _Tp* __restrict__ __dst, const size_t* __restrict__ __j)
+ {
+ for (size_t __k = 0; __k < __n; ++__k)
+ __dst[*__j++] = __src[*__i++];
+ }
+
+ //
+ // Compute the sum of elements in range [__f, __l)
+ // This is a naive algorithm. It suffers from cancelling.
+ // In the future try to specialize
+ // for _Tp = float, double, long double using a more accurate
+ // algorithm.
+ //
+ template<typename _Tp>
+ inline _Tp
+ __valarray_sum(const _Tp* __restrict__ __f, const _Tp* __restrict__ __l)
+ {
+ _Tp __r = _Tp();
+ while (__f != __l)
+ __r += *__f++;
+ return __r;
+ }
+
+ // Compute the product of all elements in range [__f, __l)
+ template<typename _Tp>
+ inline _Tp
+ __valarray_product(const _Tp* __restrict__ __f,
+ const _Tp* __restrict__ __l)
+ {
+ _Tp __r = _Tp(1);
+ while (__f != __l)
+ __r = __r * *__f++;
+ return __r;
+ }
+
+ // Compute the min/max of an array-expression
+ template<typename _Ta>
+ inline typename _Ta::value_type
+ __valarray_min(const _Ta& __a)
+ {
+ size_t __s = __a.size();
+ typedef typename _Ta::value_type _Value_type;
+ _Value_type __r = __s == 0 ? _Value_type() : __a[0];
+ for (size_t __i = 1; __i < __s; ++__i)
+ {
+ _Value_type __t = __a[__i];
+ if (__t < __r)
+ __r = __t;
+ }
+ return __r;
+ }
+
+ template<typename _Ta>
+ inline typename _Ta::value_type
+ __valarray_max(const _Ta& __a)
+ {
+ size_t __s = __a.size();
+ typedef typename _Ta::value_type _Value_type;
+ _Value_type __r = __s == 0 ? _Value_type() : __a[0];
+ for (size_t __i = 1; __i < __s; ++__i)
+ {
+ _Value_type __t = __a[__i];
+ if (__t > __r)
+ __r = __t;
+ }
+ return __r;
+ }
+
+ //
+ // Helper class _Array, first layer of valarray abstraction.
+ // All operations on valarray should be forwarded to this class
+ // whenever possible. -- gdr
+ //
+
+ template<typename _Tp>
+ struct _Array
+ {
+ explicit _Array(size_t);
+ explicit _Array(_Tp* const __restrict__);
+ explicit _Array(const valarray<_Tp>&);
+ _Array(const _Tp* __restrict__, size_t);
+
+ _Tp* begin() const;
+
+ _Tp* const __restrict__ _M_data;
+ };
+
+
+ // Copy-construct plain array __b[<__n>] from indexed array __a[__i[<__n>]]
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct(_Array<_Tp> __a, _Array<size_t> __i,
+ _Array<_Tp> __b, size_t __n)
+ { std::__valarray_copy_construct(__a._M_data, __i._M_data,
+ __b._M_data, __n); }
+
+ // Copy-construct plain array __b[<__n>] from strided array __a[<__n : __s>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy_construct(_Array<_Tp> __a, size_t __n, size_t __s,
+ _Array<_Tp> __b)
+ { std::__valarray_copy_construct(__a._M_data, __n, __s, __b._M_data); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t)
+ { std::__valarray_fill(__a._M_data, __n, __t); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill(_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t)
+ { std::__valarray_fill(__a._M_data, __n, __s, __t); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_fill(_Array<_Tp> __a, _Array<size_t> __i,
+ size_t __n, const _Tp& __t)
+ { std::__valarray_fill(__a._M_data, __i._M_data, __n, __t); }
+
+ // Copy a plain array __a[<__n>] into a play array __b[<>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b)
+ { std::__valarray_copy(__a._M_data, __n, __b._M_data); }
+
+ // Copy strided array __a[<__n : __s>] in plain __b[<__n>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)
+ { std::__valarray_copy(__a._M_data, __n, __s, __b._M_data); }
+
+ // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)
+ { __valarray_copy(__a._M_data, __b._M_data, __n, __s); }
+
+ // Copy strided array __src[<__n : __s1>] into another
+ // strided array __dst[< : __s2>]. Their sizes must match.
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s1,
+ _Array<_Tp> __b, size_t __s2)
+ { std::__valarray_copy(__a._M_data, __n, __s1, __b._M_data, __s2); }
+
+ // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, _Array<size_t> __i,
+ _Array<_Tp> __b, size_t __n)
+ { std::__valarray_copy(__a._M_data, __i._M_data, __b._M_data, __n); }
+
+ // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]]
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,
+ _Array<size_t> __i)
+ { std::__valarray_copy(__a._M_data, __n, __b._M_data, __i._M_data); }
+
+ // Copy the __n first elements of an indexed array __src[<__i>] into
+ // another indexed array __dst[<__j>].
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __src, size_t __n, _Array<size_t> __i,
+ _Array<_Tp> __dst, _Array<size_t> __j)
+ {
+ std::__valarray_copy(__src._M_data, __n, __i._M_data,
+ __dst._M_data, __j._M_data);
+ }
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array(size_t __n)
+ : _M_data(__valarray_get_storage<_Tp>(__n))
+ { std::__valarray_default_construct(_M_data, _M_data + __n); }
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array(_Tp* const __restrict__ __p)
+ : _M_data (__p) {}
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array(const valarray<_Tp>& __v)
+ : _M_data (__v._M_data) {}
+
+ template<typename _Tp>
+ inline
+ _Array<_Tp>::_Array(const _Tp* __restrict__ __b, size_t __s)
+ : _M_data(__valarray_get_storage<_Tp>(__s))
+ { std::__valarray_copy_construct(__b, __s, _M_data); }
+
+ template<typename _Tp>
+ inline _Tp*
+ _Array<_Tp>::begin () const
+ { return _M_data; }
+
+#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \
+ template<typename _Tp> \
+ inline void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, const _Tp& __t) \
+ { \
+ for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; ++__p) \
+ *__p _Op##= __t; \
+ } \
+ \
+ template<typename _Tp> \
+ inline void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \
+ { \
+ _Tp* __p = __a._M_data; \
+ for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; ++__p, ++__q) \
+ *__p _Op##= *__q; \
+ } \
+ \
+ template<typename _Tp, class _Dom> \
+ void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, \
+ const _Expr<_Dom, _Tp>& __e, size_t __n) \
+ { \
+ _Tp* __p(__a._M_data); \
+ for (size_t __i = 0; __i < __n; ++__i, ++__p) \
+ *__p _Op##= __e[__i]; \
+ } \
+ \
+ template<typename _Tp> \
+ inline void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, size_t __s, \
+ _Array<_Tp> __b) \
+ { \
+ _Tp* __q(__b._M_data); \
+ for (_Tp* __p = __a._M_data; __p < __a._M_data + __s * __n; \
+ __p += __s, ++__q) \
+ *__p _Op##= *__q; \
+ } \
+ \
+ template<typename _Tp> \
+ inline void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<_Tp> __b, \
+ size_t __n, size_t __s) \
+ { \
+ _Tp* __q(__b._M_data); \
+ for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \
+ ++__p, __q += __s) \
+ *__p _Op##= *__q; \
+ } \
+ \
+ template<typename _Tp, class _Dom> \
+ void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __s, \
+ const _Expr<_Dom, _Tp>& __e, size_t __n) \
+ { \
+ _Tp* __p(__a._M_data); \
+ for (size_t __i = 0; __i < __n; ++__i, __p += __s) \
+ *__p _Op##= __e[__i]; \
+ } \
+ \
+ template<typename _Tp> \
+ inline void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<size_t> __i, \
+ _Array<_Tp> __b, size_t __n) \
+ { \
+ _Tp* __q(__b._M_data); \
+ for (size_t* __j = __i._M_data; __j < __i._M_data + __n; \
+ ++__j, ++__q) \
+ __a._M_data[*__j] _Op##= *__q; \
+ } \
+ \
+ template<typename _Tp> \
+ inline void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \
+ _Array<_Tp> __b, _Array<size_t> __i) \
+ { \
+ _Tp* __p(__a._M_data); \
+ for (size_t* __j = __i._M_data; __j<__i._M_data + __n; \
+ ++__j, ++__p) \
+ *__p _Op##= __b._M_data[*__j]; \
+ } \
+ \
+ template<typename _Tp, class _Dom> \
+ void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<size_t> __i, \
+ const _Expr<_Dom, _Tp>& __e, size_t __n) \
+ { \
+ size_t* __j(__i._M_data); \
+ for (size_t __k = 0; __k<__n; ++__k, ++__j) \
+ __a._M_data[*__j] _Op##= __e[__k]; \
+ } \
+ \
+ template<typename _Tp> \
+ void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<bool> __m, \
+ _Array<_Tp> __b, size_t __n) \
+ { \
+ bool* __ok(__m._M_data); \
+ _Tp* __p(__a._M_data); \
+ for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; \
+ ++__q, ++__ok, ++__p) \
+ { \
+ while (! *__ok) \
+ { \
+ ++__ok; \
+ ++__p; \
+ } \
+ *__p _Op##= *__q; \
+ } \
+ } \
+ \
+ template<typename _Tp> \
+ void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \
+ _Array<_Tp> __b, _Array<bool> __m) \
+ { \
+ bool* __ok(__m._M_data); \
+ _Tp* __q(__b._M_data); \
+ for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \
+ ++__p, ++__ok, ++__q) \
+ { \
+ while (! *__ok) \
+ { \
+ ++__ok; \
+ ++__q; \
+ } \
+ *__p _Op##= *__q; \
+ } \
+ } \
+ \
+ template<typename _Tp, class _Dom> \
+ void \
+ _Array_augmented_##_Name(_Array<_Tp> __a, _Array<bool> __m, \
+ const _Expr<_Dom, _Tp>& __e, size_t __n) \
+ { \
+ bool* __ok(__m._M_data); \
+ _Tp* __p(__a._M_data); \
+ for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p) \
+ { \
+ while (! *__ok) \
+ { \
+ ++__ok; \
+ ++__p; \
+ } \
+ *__p _Op##= __e[__i]; \
+ } \
+ }
+
+ _DEFINE_ARRAY_FUNCTION(+, __plus)
+ _DEFINE_ARRAY_FUNCTION(-, __minus)
+ _DEFINE_ARRAY_FUNCTION(*, __multiplies)
+ _DEFINE_ARRAY_FUNCTION(/, __divides)
+ _DEFINE_ARRAY_FUNCTION(%, __modulus)
+ _DEFINE_ARRAY_FUNCTION(^, __bitwise_xor)
+ _DEFINE_ARRAY_FUNCTION(|, __bitwise_or)
+ _DEFINE_ARRAY_FUNCTION(&, __bitwise_and)
+ _DEFINE_ARRAY_FUNCTION(<<, __shift_left)
+ _DEFINE_ARRAY_FUNCTION(>>, __shift_right)
+
+#undef _DEFINE_ARRAY_FUNCTION
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/valarray_array.tcc>
+#endif
+
+#endif /* _ARRAY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.tcc
new file mode 100644
index 000000000..15cb7b1e2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_array.tcc
@@ -0,0 +1,241 @@
+// The template and inlines for the -*- C++ -*- internal _Array helper class.
+
+// Copyright (C) 1997, 1998, 1999, 2003, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file valarray_array.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _VALARRAY_ARRAY_TCC
+#define _VALARRAY_ARRAY_TCC 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Tp>
+ void
+ __valarray_fill(_Array<_Tp> __a, size_t __n, _Array<bool> __m,
+ const _Tp& __t)
+ {
+ _Tp* __p = __a._M_data;
+ bool* __ok (__m._M_data);
+ for (size_t __i=0; __i < __n; ++__i, ++__ok, ++__p)
+ {
+ while (!*__ok)
+ {
+ ++__ok;
+ ++__p;
+ }
+ *__p = __t;
+ }
+ }
+
+ // Copy n elements of a into consecutive elements of b. When m is
+ // false, the corresponding element of a is skipped. m must contain
+ // at least n true elements. a must contain at least n elements and
+ // enough elements to match up with m through the nth true element
+ // of m. I.e. if n is 10, m has 15 elements with 5 false followed
+ // by 10 true, a must have 15 elements.
+ template<typename _Tp>
+ void
+ __valarray_copy(_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b,
+ size_t __n)
+ {
+ _Tp* __p (__a._M_data);
+ bool* __ok (__m._M_data);
+ for (_Tp* __q = __b._M_data; __q < __b._M_data + __n;
+ ++__q, ++__ok, ++__p)
+ {
+ while (! *__ok)
+ {
+ ++__ok;
+ ++__p;
+ }
+ *__q = *__p;
+ }
+ }
+
+ // Copy n consecutive elements from a into elements of b. Elements
+ // of b are skipped if the corresponding element of m is false. m
+ // must contain at least n true elements. b must have at least as
+ // many elements as the index of the nth true element of m. I.e. if
+ // m has 15 elements with 5 false followed by 10 true, b must have
+ // at least 15 elements.
+ template<typename _Tp>
+ void
+ __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,
+ _Array<bool> __m)
+ {
+ _Tp* __q (__b._M_data);
+ bool* __ok (__m._M_data);
+ for (_Tp* __p = __a._M_data; __p < __a._M_data+__n;
+ ++__p, ++__ok, ++__q)
+ {
+ while (! *__ok)
+ {
+ ++__ok;
+ ++__q;
+ }
+ *__q = *__p;
+ }
+ }
+
+ // Copy n elements from a into elements of b. Elements of a are
+ // skipped if the corresponding element of m is false. Elements of
+ // b are skipped if the corresponding element of k is false. m and
+ // k must contain at least n true elements. a and b must have at
+ // least as many elements as the index of the nth true element of m.
+ template<typename _Tp>
+ void
+ __valarray_copy(_Array<_Tp> __a, _Array<bool> __m, size_t __n,
+ _Array<_Tp> __b, _Array<bool> __k)
+ {
+ _Tp* __p (__a._M_data);
+ _Tp* __q (__b._M_data);
+ bool* __srcok (__m._M_data);
+ bool* __dstok (__k._M_data);
+ for (size_t __i = 0; __i < __n;
+ ++__srcok, ++__p, ++__dstok, ++__q, ++__i)
+ {
+ while (! *__srcok)
+ {
+ ++__srcok;
+ ++__p;
+ }
+ while (! *__dstok)
+ {
+ ++__dstok;
+ ++__q;
+ }
+ *__q = *__p;
+ }
+ }
+
+ // Copy n consecutive elements of e into consecutive elements of a.
+ // I.e. a[i] = e[i].
+ template<typename _Tp, class _Dom>
+ void
+ __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a)
+ {
+ _Tp* __p (__a._M_data);
+ for (size_t __i = 0; __i < __n; ++__i, ++__p)
+ *__p = __e[__i];
+ }
+
+ // Copy n consecutive elements of e into elements of a using stride
+ // s. I.e., a[0] = e[0], a[s] = e[1], a[2*s] = e[2].
+ template<typename _Tp, class _Dom>
+ void
+ __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n,
+ _Array<_Tp> __a, size_t __s)
+ {
+ _Tp* __p (__a._M_data);
+ for (size_t __i = 0; __i < __n; ++__i, __p += __s)
+ *__p = __e[__i];
+ }
+
+ // Copy n consecutive elements of e into elements of a indexed by
+ // contents of i. I.e., a[i[0]] = e[0].
+ template<typename _Tp, class _Dom>
+ void
+ __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n,
+ _Array<_Tp> __a, _Array<size_t> __i)
+ {
+ size_t* __j (__i._M_data);
+ for (size_t __k = 0; __k < __n; ++__k, ++__j)
+ __a._M_data[*__j] = __e[__k];
+ }
+
+ // Copy n elements of e indexed by contents of f into elements of a
+ // indexed by contents of i. I.e., a[i[0]] = e[f[0]].
+ template<typename _Tp>
+ void
+ __valarray_copy(_Array<_Tp> __e, _Array<size_t> __f,
+ size_t __n,
+ _Array<_Tp> __a, _Array<size_t> __i)
+ {
+ size_t* __g (__f._M_data);
+ size_t* __j (__i._M_data);
+ for (size_t __k = 0; __k < __n; ++__k, ++__j, ++__g)
+ __a._M_data[*__j] = __e._M_data[*__g];
+ }
+
+ // Copy n consecutive elements of e into elements of a. Elements of
+ // a are skipped if the corresponding element of m is false. m must
+ // have at least n true elements and a must have at least as many
+ // elements as the index of the nth true element of m. I.e. if m
+ // has 5 false followed by 10 true elements and n == 10, a must have
+ // at least 15 elements.
+ template<typename _Tp, class _Dom>
+ void
+ __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n,
+ _Array<_Tp> __a, _Array<bool> __m)
+ {
+ bool* __ok (__m._M_data);
+ _Tp* __p (__a._M_data);
+ for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p)
+ {
+ while (! *__ok)
+ {
+ ++__ok;
+ ++__p;
+ }
+ *__p = __e[__i];
+ }
+ }
+
+
+ template<typename _Tp, class _Dom>
+ void
+ __valarray_copy_construct(const _Expr<_Dom, _Tp>& __e, size_t __n,
+ _Array<_Tp> __a)
+ {
+ _Tp* __p (__a._M_data);
+ for (size_t __i = 0; __i < __n; ++__i, ++__p)
+ new (__p) _Tp(__e[__i]);
+ }
+
+
+ template<typename _Tp>
+ void
+ __valarray_copy_construct(_Array<_Tp> __a, _Array<bool> __m,
+ _Array<_Tp> __b, size_t __n)
+ {
+ _Tp* __p (__a._M_data);
+ bool* __ok (__m._M_data);
+ for (_Tp* __q = __b._M_data; __q < __b._M_data+__n; ++__q, ++__ok, ++__p)
+ {
+ while (! *__ok)
+ {
+ ++__ok;
+ ++__p;
+ }
+ new (__q) _Tp(*__p);
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _VALARRAY_ARRAY_TCC */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/valarray_before.h b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_before.h
new file mode 100644
index 000000000..444129be6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/valarray_before.h
@@ -0,0 +1,730 @@
+// The template and inlines for the -*- C++ -*- internal _Meta class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file valarray_before.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
+
+#ifndef _VALARRAY_BEFORE_H
+#define _VALARRAY_BEFORE_H 1
+
+#pragma GCC system_header
+
+#include <bits/slice_array.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ //
+ // Implementing a loosened valarray return value is tricky.
+ // First we need to meet 26.3.1/3: we should not add more than
+ // two levels of template nesting. Therefore we resort to template
+ // template to "flatten" loosened return value types.
+ // At some point we use partial specialization to remove one level
+ // template nesting due to _Expr<>
+ //
+
+ // This class is NOT defined. It doesn't need to.
+ template<typename _Tp1, typename _Tp2> class _Constant;
+
+ // Implementations of unary functions applied to valarray<>s.
+ // I use hard-coded object functions here instead of a generic
+ // approach like pointers to function:
+ // 1) correctness: some functions take references, others values.
+ // we can't deduce the correct type afterwards.
+ // 2) efficiency -- object functions can be easily inlined
+ // 3) be Koenig-lookup-friendly
+
+ struct __abs
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return abs(__t); }
+ };
+
+ struct __cos
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return cos(__t); }
+ };
+
+ struct __acos
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return acos(__t); }
+ };
+
+ struct __cosh
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return cosh(__t); }
+ };
+
+ struct __sin
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return sin(__t); }
+ };
+
+ struct __asin
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return asin(__t); }
+ };
+
+ struct __sinh
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return sinh(__t); }
+ };
+
+ struct __tan
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return tan(__t); }
+ };
+
+ struct __atan
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return atan(__t); }
+ };
+
+ struct __tanh
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return tanh(__t); }
+ };
+
+ struct __exp
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return exp(__t); }
+ };
+
+ struct __log
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return log(__t); }
+ };
+
+ struct __log10
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return log10(__t); }
+ };
+
+ struct __sqrt
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return sqrt(__t); }
+ };
+
+ // In the past, we used to tailor operator applications semantics
+ // to the specialization of standard function objects (i.e. plus<>, etc.)
+ // That is incorrect. Therefore we provide our own surrogates.
+
+ struct __unary_plus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return +__t; }
+ };
+
+ struct __negate
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return -__t; }
+ };
+
+ struct __bitwise_not
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const
+ { return ~__t; }
+ };
+
+ struct __plus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x + __y; }
+ };
+
+ struct __minus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x - __y; }
+ };
+
+ struct __multiplies
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x * __y; }
+ };
+
+ struct __divides
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x / __y; }
+ };
+
+ struct __modulus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x % __y; }
+ };
+
+ struct __bitwise_xor
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x ^ __y; }
+ };
+
+ struct __bitwise_and
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x & __y; }
+ };
+
+ struct __bitwise_or
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x | __y; }
+ };
+
+ struct __shift_left
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x << __y; }
+ };
+
+ struct __shift_right
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x >> __y; }
+ };
+
+ struct __logical_and
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x && __y; }
+ };
+
+ struct __logical_or
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x || __y; }
+ };
+
+ struct __logical_not
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x) const { return !__x; }
+ };
+
+ struct __equal_to
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x == __y; }
+ };
+
+ struct __not_equal_to
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x != __y; }
+ };
+
+ struct __less
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x < __y; }
+ };
+
+ struct __greater
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x > __y; }
+ };
+
+ struct __less_equal
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x <= __y; }
+ };
+
+ struct __greater_equal
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x >= __y; }
+ };
+
+ // The few binary functions we miss.
+ struct __atan2
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return atan2(__x, __y); }
+ };
+
+ struct __pow
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return pow(__x, __y); }
+ };
+
+
+ // We need these bits in order to recover the return type of
+ // some functions/operators now that we're no longer using
+ // function templates.
+ template<typename, typename _Tp>
+ struct __fun
+ {
+ typedef _Tp result_type;
+ };
+
+ // several specializations for relational operators.
+ template<typename _Tp>
+ struct __fun<__logical_not, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__logical_and, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__logical_or, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__less, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__greater, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__less_equal, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__greater_equal, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__equal_to, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__not_equal_to, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ //
+ // Apply function taking a value/const reference closure
+ //
+
+ template<typename _Dom, typename _Arg>
+ class _FunBase
+ {
+ public:
+ typedef typename _Dom::value_type value_type;
+
+ _FunBase(const _Dom& __e, value_type __f(_Arg))
+ : _M_expr(__e), _M_func(__f) {}
+
+ value_type operator[](size_t __i) const
+ { return _M_func (_M_expr[__i]); }
+
+ size_t size() const { return _M_expr.size ();}
+
+ private:
+ const _Dom& _M_expr;
+ value_type (*_M_func)(_Arg);
+ };
+
+ template<class _Dom>
+ struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type>
+ {
+ typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
+ typedef typename _Base::value_type value_type;
+ typedef value_type _Tp;
+
+ _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}
+ };
+
+ template<typename _Tp>
+ struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>
+ {
+ typedef _FunBase<valarray<_Tp>, _Tp> _Base;
+ typedef _Tp value_type;
+
+ _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}
+ };
+
+ template<class _Dom>
+ struct _RefFunClos<_Expr, _Dom>
+ : _FunBase<_Dom, const typename _Dom::value_type&>
+ {
+ typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
+ typedef typename _Base::value_type value_type;
+ typedef value_type _Tp;
+
+ _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))
+ : _Base(__e, __f) {}
+ };
+
+ template<typename _Tp>
+ struct _RefFunClos<_ValArray, _Tp>
+ : _FunBase<valarray<_Tp>, const _Tp&>
+ {
+ typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
+ typedef _Tp value_type;
+
+ _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))
+ : _Base(__v, __f) {}
+ };
+
+ //
+ // Unary expression closure.
+ //
+
+ template<class _Oper, class _Arg>
+ class _UnBase
+ {
+ public:
+ typedef typename _Arg::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _UnBase(const _Arg& __e) : _M_expr(__e) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr[__i]); }
+
+ size_t size() const { return _M_expr.size(); }
+
+ private:
+ const _Arg& _M_expr;
+ };
+
+ template<class _Oper, class _Dom>
+ struct _UnClos<_Oper, _Expr, _Dom>
+ : _UnBase<_Oper, _Dom>
+ {
+ typedef _Dom _Arg;
+ typedef _UnBase<_Oper, _Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _UnClos(const _Arg& __e) : _Base(__e) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _UnClos<_Oper, _ValArray, _Tp>
+ : _UnBase<_Oper, valarray<_Tp> >
+ {
+ typedef valarray<_Tp> _Arg;
+ typedef _UnBase<_Oper, valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _UnClos(const _Arg& __e) : _Base(__e) {}
+ };
+
+
+ //
+ // Binary expression closure.
+ //
+
+ template<class _Oper, class _FirstArg, class _SecondArg>
+ class _BinBase
+ {
+ public:
+ typedef typename _FirstArg::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _BinBase(const _FirstArg& __e1, const _SecondArg& __e2)
+ : _M_expr1(__e1), _M_expr2(__e2) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr1[__i], _M_expr2[__i]); }
+
+ size_t size() const { return _M_expr1.size(); }
+
+ private:
+ const _FirstArg& _M_expr1;
+ const _SecondArg& _M_expr2;
+ };
+
+
+ template<class _Oper, class _Clos>
+ class _BinBase2
+ {
+ public:
+ typedef typename _Clos::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _BinBase2(const _Clos& __e, const _Vt& __t)
+ : _M_expr1(__e), _M_expr2(__t) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr1[__i], _M_expr2); }
+
+ size_t size() const { return _M_expr1.size(); }
+
+ private:
+ const _Clos& _M_expr1;
+ const _Vt& _M_expr2;
+ };
+
+ template<class _Oper, class _Clos>
+ class _BinBase1
+ {
+ public:
+ typedef typename _Clos::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _BinBase1(const _Vt& __t, const _Clos& __e)
+ : _M_expr1(__t), _M_expr2(__e) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr1, _M_expr2[__i]); }
+
+ size_t size() const { return _M_expr2.size(); }
+
+ private:
+ const _Vt& _M_expr1;
+ const _Clos& _M_expr2;
+ };
+
+ template<class _Oper, class _Dom1, class _Dom2>
+ struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
+ : _BinBase<_Oper, _Dom1, _Dom2>
+ {
+ typedef _BinBase<_Oper, _Dom1, _Dom2> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _BinClos<_Oper,_ValArray, _ValArray, _Tp, _Tp>
+ : _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> >
+ {
+ typedef _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)
+ : _Base(__v, __w) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper, _Expr, _ValArray, _Dom, typename _Dom::value_type>
+ : _BinBase<_Oper, _Dom, valarray<typename _Dom::value_type> >
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
+ : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper, _ValArray, _Expr, typename _Dom::value_type, _Dom>
+ : _BinBase<_Oper, valarray<typename _Dom::value_type>,_Dom>
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase<_Oper, valarray<_Tp>, _Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)
+ : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper, _Expr, _Constant, _Dom, typename _Dom::value_type>
+ : _BinBase2<_Oper, _Dom>
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase2<_Oper,_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper, _Constant, _Expr, typename _Dom::value_type, _Dom>
+ : _BinBase1<_Oper, _Dom>
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase1<_Oper, _Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _BinClos<_Oper, _ValArray, _Constant, _Tp, _Tp>
+ : _BinBase2<_Oper, valarray<_Tp> >
+ {
+ typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _BinClos<_Oper, _Constant, _ValArray, _Tp, _Tp>
+ : _BinBase1<_Oper, valarray<_Tp> >
+ {
+ typedef _BinBase1<_Oper, valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}
+ };
+
+ //
+ // slice_array closure.
+ //
+ template<typename _Dom>
+ class _SBase
+ {
+ public:
+ typedef typename _Dom::value_type value_type;
+
+ _SBase (const _Dom& __e, const slice& __s)
+ : _M_expr (__e), _M_slice (__s) {}
+
+ value_type
+ operator[] (size_t __i) const
+ { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; }
+
+ size_t
+ size() const
+ { return _M_slice.size (); }
+
+ private:
+ const _Dom& _M_expr;
+ const slice& _M_slice;
+ };
+
+ template<typename _Tp>
+ class _SBase<_Array<_Tp> >
+ {
+ public:
+ typedef _Tp value_type;
+
+ _SBase (_Array<_Tp> __a, const slice& __s)
+ : _M_array (__a._M_data+__s.start()), _M_size (__s.size()),
+ _M_stride (__s.stride()) {}
+
+ value_type
+ operator[] (size_t __i) const
+ { return _M_array._M_data[__i * _M_stride]; }
+
+ size_t
+ size() const
+ { return _M_size; }
+
+ private:
+ const _Array<_Tp> _M_array;
+ const size_t _M_size;
+ const size_t _M_stride;
+ };
+
+ template<class _Dom>
+ struct _SClos<_Expr, _Dom>
+ : _SBase<_Dom>
+ {
+ typedef _SBase<_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}
+ };
+
+ template<typename _Tp>
+ struct _SClos<_ValArray, _Tp>
+ : _SBase<_Array<_Tp> >
+ {
+ typedef _SBase<_Array<_Tp> > _Base;
+ typedef _Tp value_type;
+
+ _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _CPP_VALARRAY_BEFORE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/bits/vector.tcc b/gcc-4.4.0/libstdc++-v3/include/bits/vector.tcc
new file mode 100644
index 000000000..8f6749314
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/bits/vector.tcc
@@ -0,0 +1,681 @@
+// Vector implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file vector.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _VECTOR_TCC
+#define _VECTOR_TCC 1
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ template<typename _Tp, typename _Alloc>
+ void
+ vector<_Tp, _Alloc>::
+ reserve(size_type __n)
+ {
+ if (__n > this->max_size())
+ __throw_length_error(__N("vector::reserve"));
+ if (this->capacity() < __n)
+ {
+ const size_type __old_size = size();
+ pointer __tmp = _M_allocate_and_copy(__n,
+ _GLIBCXX_MAKE_MOVE_ITERATOR(this->_M_impl._M_start),
+ _GLIBCXX_MAKE_MOVE_ITERATOR(this->_M_impl._M_finish));
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __tmp;
+ this->_M_impl._M_finish = __tmp + __old_size;
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ vector<_Tp, _Alloc>::
+ emplace_back(_Args&&... __args)
+ {
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish,
+ std::forward<_Args>(__args)...);
+ ++this->_M_impl._M_finish;
+ }
+ else
+ _M_insert_aux(end(), std::forward<_Args>(__args)...);
+ }
+#endif
+
+ template<typename _Tp, typename _Alloc>
+ typename vector<_Tp, _Alloc>::iterator
+ vector<_Tp, _Alloc>::
+ insert(iterator __position, const value_type& __x)
+ {
+ const size_type __n = __position - begin();
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage
+ && __position == end())
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish, __x);
+ ++this->_M_impl._M_finish;
+ }
+ else
+ {
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
+ {
+ _Tp __x_copy = __x;
+ _M_insert_aux(__position, std::move(__x_copy));
+ }
+ else
+#endif
+ _M_insert_aux(__position, __x);
+ }
+ return iterator(this->_M_impl._M_start + __n);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ typename vector<_Tp, _Alloc>::iterator
+ vector<_Tp, _Alloc>::
+ erase(iterator __position)
+ {
+ if (__position + 1 != end())
+ _GLIBCXX_MOVE3(__position + 1, end(), __position);
+ --this->_M_impl._M_finish;
+ this->_M_impl.destroy(this->_M_impl._M_finish);
+ return __position;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ typename vector<_Tp, _Alloc>::iterator
+ vector<_Tp, _Alloc>::
+ erase(iterator __first, iterator __last)
+ {
+ if (__last != end())
+ _GLIBCXX_MOVE3(__last, end(), __first);
+ _M_erase_at_end(__first.base() + (end() - __last));
+ return __first;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ vector<_Tp, _Alloc>&
+ vector<_Tp, _Alloc>::
+ operator=(const vector<_Tp, _Alloc>& __x)
+ {
+ if (&__x != this)
+ {
+ const size_type __xlen = __x.size();
+ if (__xlen > capacity())
+ {
+ pointer __tmp = _M_allocate_and_copy(__xlen, __x.begin(),
+ __x.end());
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __tmp;
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __xlen;
+ }
+ else if (size() >= __xlen)
+ {
+ std::_Destroy(std::copy(__x.begin(), __x.end(), begin()),
+ end(), _M_get_Tp_allocator());
+ }
+ else
+ {
+ std::copy(__x._M_impl._M_start, __x._M_impl._M_start + size(),
+ this->_M_impl._M_start);
+ std::__uninitialized_copy_a(__x._M_impl._M_start + size(),
+ __x._M_impl._M_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ }
+ this->_M_impl._M_finish = this->_M_impl._M_start + __xlen;
+ }
+ return *this;
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ vector<_Tp, _Alloc>::
+ _M_fill_assign(size_t __n, const value_type& __val)
+ {
+ if (__n > capacity())
+ {
+ vector __tmp(__n, __val, _M_get_Tp_allocator());
+ __tmp.swap(*this);
+ }
+ else if (__n > size())
+ {
+ std::fill(begin(), end(), __val);
+ std::__uninitialized_fill_n_a(this->_M_impl._M_finish,
+ __n - size(), __val,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __n - size();
+ }
+ else
+ _M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val));
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _InputIterator>
+ void
+ vector<_Tp, _Alloc>::
+ _M_assign_aux(_InputIterator __first, _InputIterator __last,
+ std::input_iterator_tag)
+ {
+ pointer __cur(this->_M_impl._M_start);
+ for (; __first != __last && __cur != this->_M_impl._M_finish;
+ ++__cur, ++__first)
+ *__cur = *__first;
+ if (__first == __last)
+ _M_erase_at_end(__cur);
+ else
+ insert(end(), __first, __last);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _ForwardIterator>
+ void
+ vector<_Tp, _Alloc>::
+ _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ const size_type __len = std::distance(__first, __last);
+
+ if (__len > capacity())
+ {
+ pointer __tmp(_M_allocate_and_copy(__len, __first, __last));
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __tmp;
+ this->_M_impl._M_finish = this->_M_impl._M_start + __len;
+ this->_M_impl._M_end_of_storage = this->_M_impl._M_finish;
+ }
+ else if (size() >= __len)
+ _M_erase_at_end(std::copy(__first, __last, this->_M_impl._M_start));
+ else
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, size());
+ std::copy(__first, __mid, this->_M_impl._M_start);
+ this->_M_impl._M_finish =
+ std::__uninitialized_copy_a(__mid, __last,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ }
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ typename vector<_Tp, _Alloc>::iterator
+ vector<_Tp, _Alloc>::
+ emplace(iterator __position, _Args&&... __args)
+ {
+ const size_type __n = __position - begin();
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage
+ && __position == end())
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish,
+ std::forward<_Args>(__args)...);
+ ++this->_M_impl._M_finish;
+ }
+ else
+ _M_insert_aux(__position, std::forward<_Args>(__args)...);
+ return iterator(this->_M_impl._M_start + __n);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ vector<_Tp, _Alloc>::
+ _M_insert_aux(iterator __position, _Args&&... __args)
+#else
+ template<typename _Tp, typename _Alloc>
+ void
+ vector<_Tp, _Alloc>::
+ _M_insert_aux(iterator __position, const _Tp& __x)
+#endif
+ {
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish,
+ _GLIBCXX_MOVE(*(this->_M_impl._M_finish
+ - 1)));
+ ++this->_M_impl._M_finish;
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ _Tp __x_copy = __x;
+#endif
+ _GLIBCXX_MOVE_BACKWARD3(__position.base(),
+ this->_M_impl._M_finish - 2,
+ this->_M_impl._M_finish - 1);
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ *__position = __x_copy;
+#else
+ *__position = _Tp(std::forward<_Args>(__args)...);
+#endif
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(size_type(1), "vector::_M_insert_aux");
+ const size_type __elems_before = __position - begin();
+ pointer __new_start(this->_M_allocate(__len));
+ pointer __new_finish(__new_start);
+ __try
+ {
+ // The order of the three operations is dictated by the C++0x
+ // case, where the moves could alter a new element belonging
+ // to the existing vector. This is an issue only for callers
+ // taking the element by const lvalue ref (see 23.1/13).
+ this->_M_impl.construct(__new_start + __elems_before,
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ std::forward<_Args>(__args)...);
+#else
+ __x);
+#endif
+ __new_finish = 0;
+
+ __new_finish =
+ std::__uninitialized_move_a(this->_M_impl._M_start,
+ __position.base(), __new_start,
+ _M_get_Tp_allocator());
+ ++__new_finish;
+
+ __new_finish =
+ std::__uninitialized_move_a(__position.base(),
+ this->_M_impl._M_finish,
+ __new_finish,
+ _M_get_Tp_allocator());
+ }
+ __catch(...)
+ {
+ if (!__new_finish)
+ this->_M_impl.destroy(__new_start + __elems_before);
+ else
+ std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator());
+ _M_deallocate(__new_start, __len);
+ __throw_exception_again;
+ }
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __new_start;
+ this->_M_impl._M_finish = __new_finish;
+ this->_M_impl._M_end_of_storage = __new_start + __len;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ void
+ vector<_Tp, _Alloc>::
+ _M_fill_insert(iterator __position, size_type __n, const value_type& __x)
+ {
+ if (__n != 0)
+ {
+ if (size_type(this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_finish) >= __n)
+ {
+ value_type __x_copy = __x;
+ const size_type __elems_after = end() - __position;
+ pointer __old_finish(this->_M_impl._M_finish);
+ if (__elems_after > __n)
+ {
+ std::__uninitialized_move_a(this->_M_impl._M_finish - __n,
+ this->_M_impl._M_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __n;
+ _GLIBCXX_MOVE_BACKWARD3(__position.base(),
+ __old_finish - __n, __old_finish);
+ std::fill(__position.base(), __position.base() + __n,
+ __x_copy);
+ }
+ else
+ {
+ std::__uninitialized_fill_n_a(this->_M_impl._M_finish,
+ __n - __elems_after,
+ __x_copy,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __n - __elems_after;
+ std::__uninitialized_move_a(__position.base(), __old_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __elems_after;
+ std::fill(__position.base(), __old_finish, __x_copy);
+ }
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(__n, "vector::_M_fill_insert");
+ const size_type __elems_before = __position - begin();
+ pointer __new_start(this->_M_allocate(__len));
+ pointer __new_finish(__new_start);
+ __try
+ {
+ // See _M_insert_aux above.
+ std::__uninitialized_fill_n_a(__new_start + __elems_before,
+ __n, __x,
+ _M_get_Tp_allocator());
+ __new_finish = 0;
+
+ __new_finish =
+ std::__uninitialized_move_a(this->_M_impl._M_start,
+ __position.base(),
+ __new_start,
+ _M_get_Tp_allocator());
+ __new_finish += __n;
+
+ __new_finish =
+ std::__uninitialized_move_a(__position.base(),
+ this->_M_impl._M_finish,
+ __new_finish,
+ _M_get_Tp_allocator());
+ }
+ __catch(...)
+ {
+ if (!__new_finish)
+ std::_Destroy(__new_start + __elems_before,
+ __new_start + __elems_before + __n,
+ _M_get_Tp_allocator());
+ else
+ std::_Destroy(__new_start, __new_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(__new_start, __len);
+ __throw_exception_again;
+ }
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __new_start;
+ this->_M_impl._M_finish = __new_finish;
+ this->_M_impl._M_end_of_storage = __new_start + __len;
+ }
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _InputIterator>
+ void
+ vector<_Tp, _Alloc>::
+ _M_range_insert(iterator __pos, _InputIterator __first,
+ _InputIterator __last, std::input_iterator_tag)
+ {
+ for (; __first != __last; ++__first)
+ {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename _ForwardIterator>
+ void
+ vector<_Tp, _Alloc>::
+ _M_range_insert(iterator __position, _ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag)
+ {
+ if (__first != __last)
+ {
+ const size_type __n = std::distance(__first, __last);
+ if (size_type(this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_finish) >= __n)
+ {
+ const size_type __elems_after = end() - __position;
+ pointer __old_finish(this->_M_impl._M_finish);
+ if (__elems_after > __n)
+ {
+ std::__uninitialized_move_a(this->_M_impl._M_finish - __n,
+ this->_M_impl._M_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __n;
+ _GLIBCXX_MOVE_BACKWARD3(__position.base(),
+ __old_finish - __n, __old_finish);
+ std::copy(__first, __last, __position);
+ }
+ else
+ {
+ _ForwardIterator __mid = __first;
+ std::advance(__mid, __elems_after);
+ std::__uninitialized_copy_a(__mid, __last,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __n - __elems_after;
+ std::__uninitialized_move_a(__position.base(),
+ __old_finish,
+ this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ this->_M_impl._M_finish += __elems_after;
+ std::copy(__first, __mid, __position);
+ }
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(__n, "vector::_M_range_insert");
+ pointer __new_start(this->_M_allocate(__len));
+ pointer __new_finish(__new_start);
+ __try
+ {
+ __new_finish =
+ std::__uninitialized_move_a(this->_M_impl._M_start,
+ __position.base(),
+ __new_start,
+ _M_get_Tp_allocator());
+ __new_finish =
+ std::__uninitialized_copy_a(__first, __last,
+ __new_finish,
+ _M_get_Tp_allocator());
+ __new_finish =
+ std::__uninitialized_move_a(__position.base(),
+ this->_M_impl._M_finish,
+ __new_finish,
+ _M_get_Tp_allocator());
+ }
+ __catch(...)
+ {
+ std::_Destroy(__new_start, __new_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(__new_start, __len);
+ __throw_exception_again;
+ }
+ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
+ _M_get_Tp_allocator());
+ _M_deallocate(this->_M_impl._M_start,
+ this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ this->_M_impl._M_start = __new_start;
+ this->_M_impl._M_finish = __new_finish;
+ this->_M_impl._M_end_of_storage = __new_start + __len;
+ }
+ }
+ }
+
+
+ // vector<bool>
+
+ template<typename _Alloc>
+ void
+ vector<bool, _Alloc>::
+ reserve(size_type __n)
+ {
+ if (__n > this->max_size())
+ __throw_length_error(__N("vector::reserve"));
+ if (this->capacity() < __n)
+ {
+ _Bit_type* __q = this->_M_allocate(__n);
+ this->_M_impl._M_finish = _M_copy_aligned(begin(), end(),
+ iterator(__q, 0));
+ this->_M_deallocate();
+ this->_M_impl._M_start = iterator(__q, 0);
+ this->_M_impl._M_end_of_storage = (__q + (__n + int(_S_word_bit) - 1)
+ / int(_S_word_bit));
+ }
+ }
+
+ template<typename _Alloc>
+ void
+ vector<bool, _Alloc>::
+ _M_fill_insert(iterator __position, size_type __n, bool __x)
+ {
+ if (__n == 0)
+ return;
+ if (capacity() - size() >= __n)
+ {
+ std::copy_backward(__position, end(),
+ this->_M_impl._M_finish + difference_type(__n));
+ std::fill(__position, __position + difference_type(__n), __x);
+ this->_M_impl._M_finish += difference_type(__n);
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(__n, "vector<bool>::_M_fill_insert");
+ _Bit_type * __q = this->_M_allocate(__len);
+ iterator __i = _M_copy_aligned(begin(), __position,
+ iterator(__q, 0));
+ std::fill(__i, __i + difference_type(__n), __x);
+ this->_M_impl._M_finish = std::copy(__position, end(),
+ __i + difference_type(__n));
+ this->_M_deallocate();
+ this->_M_impl._M_end_of_storage = (__q + ((__len
+ + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ }
+ }
+
+ template<typename _Alloc>
+ template<typename _ForwardIterator>
+ void
+ vector<bool, _Alloc>::
+ _M_insert_range(iterator __position, _ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag)
+ {
+ if (__first != __last)
+ {
+ size_type __n = std::distance(__first, __last);
+ if (capacity() - size() >= __n)
+ {
+ std::copy_backward(__position, end(),
+ this->_M_impl._M_finish
+ + difference_type(__n));
+ std::copy(__first, __last, __position);
+ this->_M_impl._M_finish += difference_type(__n);
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(__n, "vector<bool>::_M_insert_range");
+ _Bit_type * __q = this->_M_allocate(__len);
+ iterator __i = _M_copy_aligned(begin(), __position,
+ iterator(__q, 0));
+ __i = std::copy(__first, __last, __i);
+ this->_M_impl._M_finish = std::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_impl._M_end_of_storage = (__q
+ + ((__len
+ + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ }
+ }
+ }
+
+ template<typename _Alloc>
+ void
+ vector<bool, _Alloc>::
+ _M_insert_aux(iterator __position, bool __x)
+ {
+ if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
+ {
+ std::copy_backward(__position, this->_M_impl._M_finish,
+ this->_M_impl._M_finish + 1);
+ *__position = __x;
+ ++this->_M_impl._M_finish;
+ }
+ else
+ {
+ const size_type __len =
+ _M_check_len(size_type(1), "vector<bool>::_M_insert_aux");
+ _Bit_type * __q = this->_M_allocate(__len);
+ iterator __i = _M_copy_aligned(begin(), __position,
+ iterator(__q, 0));
+ *__i++ = __x;
+ this->_M_impl._M_finish = std::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_impl._M_end_of_storage = (__q + ((__len
+ + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ }
+ }
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#endif /* _VECTOR_TCC */
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cassert b/gcc-4.4.0/libstdc++-v3/include/c/cassert
new file mode 100644
index 000000000..4f481ae10
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cassert
@@ -0,0 +1,33 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 19.2 Assertions
+//
+
+// No include guards on this header...
+
+#pragma GCC system_header
+
+#include_next <assert.h>
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cctype b/gcc-4.4.0/libstdc++-v3/include/c/cctype
new file mode 100644
index 000000000..1ac473de7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cctype
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: <ccytpe>
+//
+
+#ifndef _GLIBCXX_CCTYPE
+#define _GLIBCXX_CCTYPE 1
+
+#pragma GCC system_header
+
+#include_next <ctype.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cerrno b/gcc-4.4.0/libstdc++-v3/include/c/cerrno
new file mode 100644
index 000000000..b8e44df3c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cerrno
@@ -0,0 +1,50 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cerrno
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c errno.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std.
+ */
+
+//
+// ISO C++ 14882: 19.3 Error numbers
+//
+
+#ifndef _GLIBCXX_CERRNO
+#define _GLIBCXX_CERRNO 1
+
+#pragma GCC system_header
+
+#include_next <errno.h>
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef errno
+#define errno errno
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cfloat b/gcc-4.4.0/libstdc++-v3/include/c/cfloat
new file mode 100644
index 000000000..97359c068
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cfloat
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#ifndef _GLIBCXX_CFLOAT
+#define _GLIBCXX_CFLOAT 1
+
+#pragma GCC system_header
+
+#include_next <float.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/ciso646 b/gcc-4.4.0/libstdc++-v3/include/c/ciso646
new file mode 100644
index 000000000..12ad3b99c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/ciso646
@@ -0,0 +1,32 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2001, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ciso646
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c iso646.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std.
+ */
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/climits b/gcc-4.4.0/libstdc++-v3/include/c/climits
new file mode 100644
index 000000000..e338b6f32
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/climits
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#ifndef _GLIBCXX_CLIMITS
+#define _GLIBCXX_CLIMITS 1
+
+#pragma GCC system_header
+
+#include_next <limits.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/clocale b/gcc-4.4.0/libstdc++-v3/include/c/clocale
new file mode 100644
index 000000000..7ea60f0e8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/clocale
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#ifndef _GLIBCXX_CLOCALE
+#define _GLIBCXX_CLOCALE 1
+
+#pragma GCC system_header
+
+#include_next <locale.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cmath b/gcc-4.4.0/libstdc++-v3/include/c/cmath
new file mode 100644
index 000000000..fd3013b70
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cmath
@@ -0,0 +1,119 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 26.5 C library
+//
+
+#ifndef _GLIBCXX_CMATH
+#define _GLIBCXX_CMATH 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#include_next <math.h>
+
+// Get rid of those macros defined in <math.h> in lieu of real functions.
+#undef abs
+#undef div
+#undef acos
+#undef asin
+#undef atan
+#undef atan2
+#undef ceil
+#undef cos
+#undef cosh
+#undef exp
+#undef fabs
+#undef floor
+#undef fmod
+#undef frexp
+#undef ldexp
+#undef log
+#undef log10
+#undef modf
+#undef pow
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+
+#undef fpclassify
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef isnormal
+#undef signbit
+#undef isgreater
+#undef isgreaterequal
+#undef isless
+#undef islessequal
+#undef islessgreater
+#undef isunordered
+
+namespace std
+{
+ inline double
+ abs(double __x)
+ { return __builtin_fabs(__x); }
+
+ inline float
+ abs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ abs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+#if _GLIBCXX_HAVE_MODFF
+ inline float
+ modf(float __x, float* __iptr) { return modff(__x, __iptr); }
+#else
+ inline float
+ modf(float __x, float* __iptr)
+ {
+ double __tmp;
+ double __res = modf(static_cast<double>(__x), &__tmp);
+ *__iptr = static_cast<float>(__tmp);
+ return __res;
+ }
+#endif
+
+#if _GLIBCXX_HAVE_MODFL
+ inline long double
+ modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
+#else
+ inline long double
+ modf(long double __x, long double* __iptr)
+ {
+ double __tmp;
+ double __res = modf(static_cast<double>(__x), &__tmp);
+ * __iptr = static_cast<long double>(__tmp);
+ return __res;
+ }
+#endif
+}
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/csetjmp b/gcc-4.4.0/libstdc++-v3/include/c/csetjmp
new file mode 100644
index 000000000..1da475850
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/csetjmp
@@ -0,0 +1,44 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSETJMP
+#define _GLIBCXX_CSETJMP 1
+
+#pragma GCC system_header
+
+#include_next <setjmp.h>
+
+// Get rid of those macros defined in <setjmp.h> in lieu of real functions.
+#undef longjmp
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef setjmp
+#define setjmp(env) std::setjmp (env)
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/csignal b/gcc-4.4.0/libstdc++-v3/include/c/csignal
new file mode 100644
index 000000000..60243f03e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/csignal
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSIGNAL
+#define _GLIBCXX_CSIGNAL 1
+
+#pragma GCC system_header
+
+#include_next <signal.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cstdarg b/gcc-4.4.0/libstdc++-v3/include/c/cstdarg
new file mode 100644
index 000000000..78b73027c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cstdarg
@@ -0,0 +1,37 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSTDARG
+#define _GLIBCXX_CSTDARG 1
+
+#pragma GCC system_header
+
+#undef __need___va_list
+#include_next <stdarg.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cstddef b/gcc-4.4.0/libstdc++-v3/include/c/cstddef
new file mode 100644
index 000000000..36d18adec
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cstddef
@@ -0,0 +1,40 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 18.1 Types
+//
+
+#ifndef _GLIBCXX_CSTDDEF
+#define _GLIBCXX_CSTDDEF 1
+
+#pragma GCC system_header
+
+#define __need_size_t
+#define __need_ptrdiff_t
+#define __need_NULL
+#define __need_offsetof
+#include_next <stddef.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cstdio b/gcc-4.4.0/libstdc++-v3/include/c/cstdio
new file mode 100644
index 000000000..6245566d6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cstdio
@@ -0,0 +1,79 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.8.2 C Library files
+//
+
+#ifndef _GLIBCXX_CSTDIO
+#define _GLIBCXX_CSTDIO 1
+
+#pragma GCC system_header
+
+#include_next <stdio.h>
+
+// Get rid of those macros defined in <stdio.h> in lieu of real functions.
+#undef clearerr
+#undef fclose
+#undef feof
+#undef ferror
+#undef fflush
+#undef fgetc
+#undef fgetpos
+#undef fgets
+#undef fopen
+#undef fprintf
+#undef fputc
+#undef fputs
+#undef fread
+#undef freopen
+#undef fscanf
+#undef fseek
+#undef fsetpos
+#undef ftell
+#undef fwrite
+#undef getc
+#undef getchar
+#undef gets
+#undef perror
+#undef printf
+#undef putc
+#undef putchar
+#undef puts
+#undef remove
+#undef rename
+#undef rewind
+#undef scanf
+#undef setbuf
+#undef setvbuf
+#undef sprintf
+#undef sscanf
+#undef tmpfile
+#undef tmpnam
+#undef ungetc
+#undef vfprintf
+#undef vprintf
+#undef vsprintf
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cstdlib b/gcc-4.4.0/libstdc++-v3/include/c/cstdlib
new file mode 100644
index 000000000..93dd5da11
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cstdlib
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSTDLIB
+#define _GLIBCXX_CSTDLIB 1
+
+#pragma GCC system_header
+
+#include_next <stdlib.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cstring b/gcc-4.4.0/libstdc++-v3/include/c/cstring
new file mode 100644
index 000000000..27471691d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cstring
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSTRING
+#define _GLIBCXX_CSTRING 1
+
+#pragma GCC system_header
+
+#include_next <string.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/ctime b/gcc-4.4.0/libstdc++-v3/include/c/ctime
new file mode 100644
index 000000000..3d1371baf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/ctime
@@ -0,0 +1,36 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 20.5 Date and time
+//
+
+#ifndef _GLIBCXX_CTIME
+#define _GLIBCXX_CTIME 1
+
+#pragma GCC system_header
+
+#include_next <time.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cwchar b/gcc-4.4.0/libstdc++-v3/include/c/cwchar
new file mode 100644
index 000000000..7d9c61ea2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cwchar
@@ -0,0 +1,57 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CWCHAR
+#define _GLIBCXX_CWCHAR 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <ctime>
+
+#if _GLIBCXX_HAVE_WCHAR_H
+#include_next <wchar.h>
+#endif
+
+// Need to do a bit of trickery here with mbstate_t as char_traits
+// assumes it is in wchar.h, regardless of wchar_t specializations.
+#ifndef _GLIBCXX_HAVE_MBSTATE_T
+namespace std
+{
+ extern "C"
+ {
+ typedef struct
+ {
+ int __fill[6];
+ } mbstate_t;
+ }
+}
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c/cwctype b/gcc-4.4.0/libstdc++-v3/include/c/cwctype
new file mode 100644
index 000000000..48f64f99b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c/cwctype
@@ -0,0 +1,40 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2000, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: <cwctype>
+//
+
+#ifndef _GLIBCXX_CWCTYPE
+#define _GLIBCXX_CWCTYPE 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#if _GLIBCXX_HAVE_WCTYPE_H
+#include_next <wctype.h>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/assert.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/assert.h
new file mode 100644
index 000000000..d5697eb60
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/assert.h
@@ -0,0 +1,29 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file assert.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cassert>
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/complex.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/complex.h
new file mode 100644
index 000000000..7dc5926f1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/complex.h
@@ -0,0 +1,42 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file complex.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <bits/c++config.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <ccomplex>
+#else
+# if _GLIBCXX_HAVE_COMPLEX_H
+# include_next <complex.h>
+# endif
+#endif
+
+#ifndef _GLIBCXX_COMPLEX_H
+#define _GLIBCXX_COMPLEX_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/ctype.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/ctype.h
new file mode 100644
index 000000000..49ee9fd14
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/ctype.h
@@ -0,0 +1,50 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ctype.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cctype>
+
+#ifndef _GLIBCXX_CTYPE_H
+#define _GLIBCXX_CTYPE_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::isalnum;
+using std::isalpha;
+using std::iscntrl;
+using std::isdigit;
+using std::isgraph;
+using std::islower;
+using std::isprint;
+using std::ispunct;
+using std::isspace;
+using std::isupper;
+using std::isxdigit;
+using std::tolower;
+using std::toupper;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/errno.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/errno.h
new file mode 100644
index 000000000..1dbf49416
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/errno.h
@@ -0,0 +1,34 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file errno.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cerrno>
+
+#ifndef _GLIBCXX_ERRNO_H
+#define _GLIBCXX_ERRNO_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/fenv.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/fenv.h
new file mode 100644
index 000000000..5db6d9d01
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/fenv.h
@@ -0,0 +1,58 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file fenv.h
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_FENV_H
+#define _GLIBCXX_FENV_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#if _GLIBCXX_HAVE_FENV_H
+# include_next <fenv.h>
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cfenv>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cfenv>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif // _GLIBCXX_FENV_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/float.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/float.h
new file mode 100644
index 000000000..e65386fe6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/float.h
@@ -0,0 +1,34 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file float.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cfloat>
+
+#ifndef _GLIBCXX_FLOAT_H
+#define _GLIBCXX_FLOAT_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/inttypes.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/inttypes.h
new file mode 100644
index 000000000..31fd43169
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/inttypes.h
@@ -0,0 +1,76 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file inttypes.h
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_INTTYPES_H
+#define _GLIBCXX_INTTYPES_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+// For 8.11.1/1 (see C99, Note 184)
+# if _GLIBCXX_HAVE_INTTYPES_H
+# ifndef __STDC_FORMAT_MACROS
+# define _UNDEF__STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS
+# endif
+# include_next <inttypes.h>
+# ifdef _UNDEF__STDC_FORMAT_MACROS
+# undef __STDC_FORMAT_MACROS
+# undef _UNDEF__STDC_FORMAT_MACROS
+# endif
+# endif
+
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cinttypes>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cinttypes>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+
+#else
+
+# if _GLIBCXX_HAVE_INTTYPES_H
+# include_next <inttypes.h>
+# endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_INTTYPES_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/iso646.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/iso646.h
new file mode 100644
index 000000000..c2ad80689
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/iso646.h
@@ -0,0 +1,34 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file iso646.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <ciso646>
+
+#ifndef _GLIBCXX_ISO646_H
+#define _GLIBCXX_ISO646_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/limits.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/limits.h
new file mode 100644
index 000000000..95d91f0e6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/limits.h
@@ -0,0 +1,34 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file limits.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <climits>
+
+#ifndef _GLIBCXX_LIMITS_H
+#define _GLIBCXX_LIMITS_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/locale.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/locale.h
new file mode 100644
index 000000000..c0d4ae1cf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/locale.h
@@ -0,0 +1,40 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file locale.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <clocale>
+
+#ifndef _GLIBCXX_LOCALE_H
+#define _GLIBCXX_LOCALE_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::lconv;
+using std::setlocale;
+using std::localeconv;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/math.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/math.h
new file mode 100644
index 000000000..a7518d240
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/math.h
@@ -0,0 +1,77 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file math.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cmath>
+
+#ifndef _GLIBCXX_MATH_H
+#define _GLIBCXX_MATH_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::abs;
+using std::acos;
+using std::asin;
+using std::atan;
+using std::atan2;
+using std::cos;
+using std::sin;
+using std::tan;
+using std::cosh;
+using std::sinh;
+using std::tanh;
+using std::exp;
+using std::frexp;
+using std::ldexp;
+using std::log;
+using std::log10;
+using std::modf;
+using std::pow;
+using std::sqrt;
+using std::ceil;
+using std::fabs;
+using std::floor;
+using std::fmod;
+
+#if _GLIBCXX_USE_C99
+using std::fpclassify;
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::isnormal;
+using std::signbit;
+using std::isgreater;
+using std::isgreaterequal;
+using std::isless;
+using std::islessequal;
+using std::islessgreater;
+using std::isunordered;
+#endif
+
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/setjmp.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/setjmp.h
new file mode 100644
index 000000000..9293551f1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/setjmp.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file setjmp.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <csetjmp>
+
+#ifndef _GLIBCXX_SETJMP_H
+#define _GLIBCXX_SETJMP_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::jmp_buf;
+using std::longjmp;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/signal.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/signal.h
new file mode 100644
index 000000000..47697ca38
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/signal.h
@@ -0,0 +1,40 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file signal.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <csignal>
+
+#ifndef _GLIBCXX_SIGNAL_H
+#define _GLIBCXX_SIGNAL_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::sig_atomic_t;
+using std::raise;
+using std::signal;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdarg.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdarg.h
new file mode 100644
index 000000000..dc5e9d4e2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdarg.h
@@ -0,0 +1,38 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdarg.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cstdarg>
+
+#ifndef _GLIBCXX_STDARG_H
+#define _GLIBCXX_STDARG_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::va_list;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdatomic.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdatomic.h
new file mode 100644
index 000000000..71ddb8507
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdatomic.h
@@ -0,0 +1,218 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdatomic.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <bits/c++config.h>
+#include <stddef.h>
+#include <stdbool.h> // XXX need to define bool w/o stdbool.h in tr1/cstdbool
+
+#ifndef _GLIBCXX_STDATOMIC_H
+#define _GLIBCXX_STDATOMIC_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+_GLIBCXX_BEGIN_EXTERN_C
+
+ /**
+ * @defgroup atomics Atomics
+ *
+ * Components for performing atomic operations.
+ * @{
+ */
+
+ /// Enumeration for memory_order
+ typedef enum memory_order
+ {
+ memory_order_relaxed,
+ memory_order_consume,
+ memory_order_acquire,
+ memory_order_release,
+ memory_order_acq_rel,
+ memory_order_seq_cst
+ } memory_order;
+
+ // Base for atomic_flag.
+ typedef struct __atomic_flag_base
+ {
+ bool _M_i;
+ } __atomic_flag_base;
+
+#define ATOMIC_FLAG_INIT { false }
+
+ /// 29.2 Lock-free Property
+#if defined(_GLIBCXX_ATOMIC_BUILTINS_1) && defined(_GLIBCXX_ATOMIC_BUILTINS_2) \
+ && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_ATOMIC_BUILTINS_8)
+# define _GLIBCXX_ATOMIC_PROPERTY 2
+# define _GLIBCXX_ATOMIC_NAMESPACE __atomic2
+#elif defined(_GLIBCXX_ATOMIC_BUILTINS_1)
+# define _GLIBCXX_ATOMIC_PROPERTY 1
+# define _GLIBCXX_ATOMIC_NAMESPACE __atomic1
+#else
+# define _GLIBCXX_ATOMIC_PROPERTY 0
+# define _GLIBCXX_ATOMIC_NAMESPACE __atomic0
+#endif
+
+#define ATOMIC_INTEGRAL_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+#define ATOMIC_ADDRESS_LOCK_FREE _GLIBCXX_ATOMIC_PROPERTY
+
+ // Switch atomic integral base types based on C or C++. In
+ // addition, for "C" only provide type-generic macros for atomic
+ // operations. (As C++ accomplishes the same thing with sets of
+ // overloaded functions.
+#ifdef __cplusplus
+ inline namespace _GLIBCXX_ATOMIC_NAMESPACE { }
+# include <bits/atomicfwd_cxx.h>
+#else
+# include <bits/atomicfwd_c.h>
+#endif
+
+ // Typedefs for other atomic integral types.
+ typedef atomic_schar atomic_int_least8_t;
+ typedef atomic_uchar atomic_uint_least8_t;
+ typedef atomic_short atomic_int_least16_t;
+ typedef atomic_ushort atomic_uint_least16_t;
+ typedef atomic_int atomic_int_least32_t;
+ typedef atomic_uint atomic_uint_least32_t;
+ typedef atomic_llong atomic_int_least64_t;
+ typedef atomic_ullong atomic_uint_least64_t;
+
+ typedef atomic_schar atomic_int_fast8_t;
+ typedef atomic_uchar atomic_uint_fast8_t;
+ typedef atomic_short atomic_int_fast16_t;
+ typedef atomic_ushort atomic_uint_fast16_t;
+ typedef atomic_int atomic_int_fast32_t;
+ typedef atomic_uint atomic_uint_fast32_t;
+ typedef atomic_llong atomic_int_fast64_t;
+ typedef atomic_ullong atomic_uint_fast64_t;
+
+ typedef atomic_long atomic_intptr_t;
+ typedef atomic_ulong atomic_uintptr_t;
+
+ typedef atomic_long atomic_ssize_t;
+ typedef atomic_ulong atomic_size_t;
+
+ typedef atomic_llong atomic_intmax_t;
+ typedef atomic_ullong atomic_uintmax_t;
+
+ typedef atomic_long atomic_ptrdiff_t;
+
+ // Accessor functions for base atomic_flag type.
+ bool
+ atomic_flag_test_and_set_explicit(volatile __atomic_flag_base*, memory_order);
+
+ inline bool
+ atomic_flag_test_and_set(volatile __atomic_flag_base* __a)
+ { return atomic_flag_test_and_set_explicit(__a, memory_order_seq_cst); }
+
+ void
+ atomic_flag_clear_explicit(volatile __atomic_flag_base*, memory_order);
+
+ inline void
+ atomic_flag_clear(volatile __atomic_flag_base* __a)
+ { atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
+
+ void
+ __atomic_flag_wait_explicit(volatile __atomic_flag_base*, memory_order);
+
+ volatile __atomic_flag_base*
+ __atomic_flag_for_address(const volatile void* __z) __attribute__((const));
+
+ // Implementation specific defines.
+#define _ATOMIC_LOAD_(__a, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
+ atomic_flag_clear_explicit(__g, __x); \
+ __r; })
+
+#define _ATOMIC_STORE_(__a, __m, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __typeof__(__m) __v = (__m); \
+ volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ *__p = __v; \
+ atomic_flag_clear_explicit(__g, __x); \
+ __v; })
+
+#define _ATOMIC_MODIFY_(__a, __o, __m, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __typeof__(__m) __v = (__m); \
+ volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ __typeof__ _ATOMIC_MEMBER_ __r = *__p; \
+ *__p __o __v; \
+ atomic_flag_clear_explicit(__g, __x); \
+ __r; })
+
+#define _ATOMIC_CMPEXCHNG_(__a, __e, __m, __x) \
+ ({ volatile __typeof__ _ATOMIC_MEMBER_* __p = &_ATOMIC_MEMBER_; \
+ __typeof__(__e) __q = (__e); \
+ __typeof__(__m) __v = (__m); \
+ bool __r; \
+ volatile atomic_flag* __g = __atomic_flag_for_address(__p); \
+ __atomic_flag_wait_explicit(__g, __x); \
+ __typeof__ _ATOMIC_MEMBER_ __t__ = *__p; \
+ if (__t__ == *__q) { *__p = __v; __r = true; } \
+ else { *__q = __t__; __r = false; } \
+ atomic_flag_clear_explicit(__g, __x); \
+ __r; })
+
+ // @} group atomics
+
+_GLIBCXX_END_EXTERN_C
+_GLIBCXX_END_NAMESPACE
+
+// Inject into global namespace. XXX
+#if defined(__cplusplus) && !defined(_GLIBCXX_STDATOMIC)
+using std::memory_order;
+using std::memory_order_relaxed;
+using std::memory_order_consume;
+using std::memory_order_acquire;
+using std::memory_order_release;
+using std::memory_order_acq_rel;
+using std::memory_order_seq_cst;
+using std::atomic_flag;
+using std::atomic_bool;
+using std::atomic_char;
+using std::atomic_schar;
+using std::atomic_uchar;
+using std::atomic_short;
+using std::atomic_ushort;
+using std::atomic_int;
+using std::atomic_uint;
+using std::atomic_long;
+using std::atomic_ulong;
+using std::atomic_llong;
+using std::atomic_ullong;
+using std::atomic_wchar_t;
+using std::atomic_char16_t;
+using std::atomic_char32_t;
+using std::atomic_address;
+using std::atomic;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdbool.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdbool.h
new file mode 100644
index 000000000..27485d99d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdbool.h
@@ -0,0 +1,42 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdbool.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <bits/c++config.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <cstdbool>
+#else
+# if _GLIBCXX_HAVE_STDBOOL_H
+# include_next <stdbool.h>
+# endif
+#endif
+
+#ifndef _GLIBCXX_STDBOOL_H
+#define _GLIBCXX_STDBOOL_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stddef.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stddef.h
new file mode 100644
index 000000000..589f1e2dc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stddef.h
@@ -0,0 +1,39 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stddef.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cstddef>
+
+#ifndef _GLIBCXX_STDDEF_H
+#define _GLIBCXX_STDDEF_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::size_t;
+using std::ptrdiff_t;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdint.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdint.h
new file mode 100644
index 000000000..78a66d0d1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdint.h
@@ -0,0 +1,84 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdint.h
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_STDINT_H
+#define _GLIBCXX_STDINT_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+// For 8.22.1/1 (see C99, Notes 219, 220, 222)
+# if _GLIBCXX_HAVE_STDINT_H
+# ifndef __STDC_LIMIT_MACROS
+# define _UNDEF__STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+# endif
+# ifndef __STDC_CONSTANT_MACROS
+# define _UNDEF__STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+# endif
+# include_next <stdint.h>
+# ifdef _UNDEF__STDC_LIMIT_MACROS
+# undef __STDC_LIMIT_MACROS
+# undef _UNDEF__STDC_LIMIT_MACROS
+# endif
+# ifdef _UNDEF__STDC_CONSTANT_MACROS
+# undef __STDC_CONSTANT_MACROS
+# undef _UNDEF__STDC_CONSTANT_MACROS
+# endif
+# endif
+
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cstdint>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cstdint>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+
+#else
+
+# if _GLIBCXX_HAVE_STDINT_H
+# include_next <stdint.h>
+# endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_STDINT_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdio.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdio.h
new file mode 100644
index 000000000..51a447457
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdio.h
@@ -0,0 +1,86 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdio.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cstdio>
+
+#ifndef _GLIBCXX_STDIO_H
+#define _GLIBCXX_STDIO_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::FILE;
+using std::fpos_t;
+
+using std::remove;
+using std::rename;
+using std::tmpfile;
+using std::tmpnam;
+using std::fclose;
+using std::fflush;
+using std::fopen;
+using std::freopen;
+using std::setbuf;
+using std::setvbuf;
+using std::fprintf;
+using std::fscanf;
+using std::printf;
+using std::scanf;
+using std::snprintf;
+using std::sprintf;
+using std::sscanf;
+using std::vfprintf;
+using std::vfscanf;
+using std::vprintf;
+using std::vscanf;
+using std::vsnprintf;
+using std::vsprintf;
+using std::vsscanf;
+using std::fgetc;
+using std::fgets;
+using std::fputc;
+using std::fputs;
+using std::getc;
+using std::getchar;
+using std::gets;
+using std::putc;
+using std::putchar;
+using std::puts;
+using std::ungetc;
+using std::fread;
+using std::fwrite;
+using std::fgetpos;
+using std::fseek;
+using std::fsetpos;
+using std::ftell;
+using std::rewind;
+using std::clearerr;
+using std::feof;
+using std::ferror;
+using std::perror;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdlib.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdlib.h
new file mode 100644
index 000000000..a8c788ac2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/stdlib.h
@@ -0,0 +1,68 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdlib.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cstdlib>
+
+#ifndef _GLIBCXX_STDLIB_H
+#define _GLIBCXX_STDLIB_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::div_t;
+using std::ldiv_t;
+
+using std::abort;
+using std::abs;
+using std::atexit;
+using std::atof;
+using std::atoi;
+using std::atol;
+using std::bsearch;
+using std::calloc;
+using std::div;
+using std::exit;
+using std::free;
+using std::getenv;
+using std::labs;
+using std::ldiv;
+using std::malloc;
+using std::mblen;
+using std::mbstowcs;
+using std::mbtowc;
+using std::qsort;
+using std::rand;
+using std::realloc;
+using std::srand;
+using std::strtod;
+using std::strtol;
+using std::strtoul;
+using std::system;
+using std::wcstombs;
+using std::wctomb;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/string.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/string.h
new file mode 100644
index 000000000..fdb92a8b0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/string.h
@@ -0,0 +1,59 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file string.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cstring>
+
+#ifndef _GLIBCXX_STRING_H
+#define _GLIBCXX_STRING_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::memcpy;
+using std::memmove;
+using std::strcpy;
+using std::strncpy;
+using std::strcat;
+using std::strncat;
+using std::memcmp;
+using std::strcmp;
+using std::strcoll;
+using std::strncmp;
+using std::strxfrm;
+using std::memchr;
+using std::strchr;
+using std::strcspn;
+using std::strpbrk;
+using std::strrchr;
+using std::strspn;
+using std::strstr;
+using std::strtok;
+using std::memset;
+using std::strerror;
+using std::strlen;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/tgmath.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/tgmath.h
new file mode 100644
index 000000000..3d84d37a9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/tgmath.h
@@ -0,0 +1,42 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tgmath.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <bits/c++config.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <ctgmath>
+#else
+# if _GLIBCXX_HAVE_TGMATH_H
+# include_next <tgmath.h>
+# endif
+#endif
+
+#ifndef _GLIBCXX_TGMATH_H
+#define _GLIBCXX_TGMATH_H 1
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/time.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/time.h
new file mode 100644
index 000000000..96390df78
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/time.h
@@ -0,0 +1,61 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file time.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <ctime>
+
+#ifndef _GLIBCXX_TIME_H
+#define _GLIBCXX_TIME_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+// Get rid of those macros defined in <time.h> in lieu of real functions.
+#undef clock
+#undef difftime
+#undef mktime
+#undef time
+#undef asctime
+#undef ctime
+#undef gmtime
+#undef localtime
+#undef strftime
+
+using std::clock_t;
+using std::time_t;
+using std::tm;
+
+using std::clock;
+using std::difftime;
+using std::mktime;
+using std::time;
+using std::asctime;
+using std::ctime;
+using std::gmtime;
+using std::localtime;
+using std::strftime;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/wchar.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/wchar.h
new file mode 100644
index 000000000..c4c05a121
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/wchar.h
@@ -0,0 +1,116 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2003, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file wchar.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cwchar>
+
+#ifndef _GLIBCXX_WCHAR_H
+#define _GLIBCXX_WCHAR_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::mbstate_t;
+
+#if _GLIBCXX_USE_WCHAR_T
+using std::wint_t;
+
+using std::btowc;
+using std::wctob;
+using std::fgetwc;
+using std::fgetwc;
+using std::fgetws;
+using std::fputwc;
+using std::fputws;
+using std::fwide;
+using std::fwprintf;
+using std::fwscanf;
+using std::swprintf;
+using std::swscanf;
+using std::vfwprintf;
+#if _GLIBCXX_HAVE_VFWSCANF
+using std::vfwscanf;
+#endif
+using std::vswprintf;
+#if _GLIBCXX_HAVE_VSWSCANF
+using std::vswscanf;
+#endif
+using std::vwprintf;
+#if _GLIBCXX_HAVE_VWSCANF
+using std::vwscanf;
+#endif
+using std::wprintf;
+using std::wscanf;
+using std::getwc;
+using std::getwchar;
+using std::mbsinit;
+using std::mbrlen;
+using std::mbrtowc;
+using std::mbsrtowcs;
+using std::wcsrtombs;
+using std::putwc;
+using std::putwchar;
+using std::ungetwc;
+using std::wcrtomb;
+using std::wcstod;
+#if _GLIBCXX_HAVE_WCSTOF
+using std::wcstof;
+#endif
+using std::wcstol;
+using std::wcstoul;
+using std::wcscpy;
+using std::wcsncpy;
+using std::wcscat;
+using std::wcsncat;
+using std::wcscmp;
+using std::wcscoll;
+using std::wcsncmmp;
+using std::wcsxfrm;
+using std::wcschr;
+using std::wcscspn;
+using std::wcslen;
+using std::wcspbrk;
+using std::wcsrchr;
+using std::wcsspn;
+using std::wcsstr;
+using std::wcstok;
+using std::wmemchr;
+using std::wmemcmp;
+using std::wmemcpy;
+using std::wmemmove;
+using std::wmemset;
+using std::wcsftime;
+
+#if _GLIBCXX_USE_C99
+using std::wcstold;
+using std::wcstoll;
+using std::wcstoull;
+#endif
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_compatibility/wctype.h b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/wctype.h
new file mode 100644
index 000000000..33ae5b62f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_compatibility/wctype.h
@@ -0,0 +1,56 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file wctype.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cwctype>
+
+#ifndef _GLIBCXX_CWCTYPE_H
+#define _GLIBCXX_CWCTYPE_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+using std::wctype_t;
+using std::wctrans_t;
+using std::iswalpha;
+using std::iswupper;
+using std::iswlower;
+using std::iswdigit;
+using std::iswxdigit;
+using std::iswalnum;
+using std::iswspace;
+using std::iswpunct;
+using std::iswprint;
+using std::iswgraph;
+using std::iswcntrl;
+using std::iswctype;
+using std::towctrans;
+using std::towlower;
+using std::towupper;
+using std::wctrans;
+using std::wctype;
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cassert b/gcc-4.4.0/libstdc++-v3/include/c_global/cassert
new file mode 100644
index 000000000..186de0fbc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cassert
@@ -0,0 +1,45 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cassert
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c assert.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 19.2 Assertions
+//
+
+// No include guards on this header...
+
+#pragma GCC system_header
+
+#include <assert.h>
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/ccomplex b/gcc-4.4.0/libstdc++-v3/include/c_global/ccomplex
new file mode 100644
index 000000000..e347e1719
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/ccomplex
@@ -0,0 +1,44 @@
+// <ccomplex> -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/ccomplex
+ * This is a Standard C++ Library header.
+ */
+
+#pragma GCC system_header
+
+#ifndef _GLIBCXX_CCOMPLEX
+#define _GLIBCXX_CCOMPLEX 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <complex>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cctype b/gcc-4.4.0/libstdc++-v3/include/c_global/cctype
new file mode 100644
index 000000000..44ef4d4a0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cctype
@@ -0,0 +1,101 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cctype
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c ctype.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: <ccytpe>
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <ctype.h>
+
+#ifndef _GLIBCXX_CCTYPE
+#define _GLIBCXX_CCTYPE 1
+
+// Get rid of those macros defined in <ctype.h> in lieu of real functions.
+#undef isalnum
+#undef isalpha
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef tolower
+#undef toupper
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::isalnum;
+ using ::isalpha;
+ using ::iscntrl;
+ using ::isdigit;
+ using ::isgraph;
+ using ::islower;
+ using ::isprint;
+ using ::ispunct;
+ using ::isspace;
+ using ::isupper;
+ using ::isxdigit;
+ using ::tolower;
+ using ::toupper;
+
+_GLIBCXX_END_NAMESPACE
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cctype>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cctype>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cerrno b/gcc-4.4.0/libstdc++-v3/include/c_global/cerrno
new file mode 100644
index 000000000..371642936
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cerrno
@@ -0,0 +1,53 @@
+// The -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cerrno
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c errno.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 19.3 Error numbers
+//
+
+#pragma GCC system_header
+
+#include <errno.h>
+
+#ifndef _GLIBCXX_CERRNO
+#define _GLIBCXX_CERRNO 1
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef errno
+#define errno errno
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cfenv b/gcc-4.4.0/libstdc++-v3/include/c_global/cfenv
new file mode 100644
index 000000000..9b02c8cb9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cfenv
@@ -0,0 +1,61 @@
+// <cfenv> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cfenv
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CFENV
+#define _GLIBCXX_CFENV 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <bits/c++config.h>
+#if _GLIBCXX_HAVE_FENV_H
+# include <fenv.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cfenv>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cfenv>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // _GLIBCXX_CFENV
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cfloat b/gcc-4.4.0/libstdc++-v3/include/c_global/cfloat
new file mode 100644
index 000000000..54eb77887
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cfloat
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cfloat
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c float.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#pragma GCC system_header
+
+#include <float.h>
+
+#ifndef _GLIBCXX_CFLOAT
+#define _GLIBCXX_CFLOAT 1
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# ifndef DECIMAL_DIG
+# define DECIMAL_DIG __DECIMAL_DIG__
+# endif
+# ifndef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+# endif
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cinttypes b/gcc-4.4.0/libstdc++-v3/include/c_global/cinttypes
new file mode 100644
index 000000000..5ed1a2126
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cinttypes
@@ -0,0 +1,71 @@
+// <cinttypes> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cinttypes
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CINTTYPES
+#define _GLIBCXX_CINTTYPES 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <cstdint>
+
+// For 8.11.1/1 (see C99, Note 184)
+#if _GLIBCXX_HAVE_INTTYPES_H
+# ifndef __STDC_FORMAT_MACROS
+# define _UNDEF__STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS
+# endif
+# include <inttypes.h>
+# ifdef _UNDEF__STDC_FORMAT_MACROS
+# undef __STDC_FORMAT_MACROS
+# undef _UNDEF__STDC_FORMAT_MACROS
+# endif
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cinttypes>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cinttypes>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // _GLIBCXX_CINTTYPES
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/ciso646 b/gcc-4.4.0/libstdc++-v3/include/c_global/ciso646
new file mode 100644
index 000000000..a3c3f9b77
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/ciso646
@@ -0,0 +1,33 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ciso646
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c iso646.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/climits b/gcc-4.4.0/libstdc++-v3/include/c_global/climits
new file mode 100644
index 000000000..943d69e52
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/climits
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/climits
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c limits.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#pragma GCC system_header
+
+#include <limits.h>
+
+#ifndef _GLIBCXX_CLIMITS
+#define _GLIBCXX_CLIMITS 1
+
+#ifndef LLONG_MIN
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
+#endif
+
+#ifndef LLONG_MAX
+#define LLONG_MAX __LONG_LONG_MAX__
+#endif
+
+#ifndef ULLONG_MAX
+#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/clocale b/gcc-4.4.0/libstdc++-v3/include/c_global/clocale
new file mode 100644
index 000000000..eb955c9b1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/clocale
@@ -0,0 +1,61 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file clocale
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c locale.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <locale.h>
+
+#ifndef _GLIBCXX_CLOCALE
+#define _GLIBCXX_CLOCALE 1
+
+// Get rid of those macros defined in <locale.h> in lieu of real functions.
+#undef setlocale
+#undef localeconv
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::lconv;
+ using ::setlocale;
+ using ::localeconv;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cmath b/gcc-4.4.0/libstdc++-v3/include/c_global/cmath
new file mode 100644
index 000000000..9a63a011b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cmath
@@ -0,0 +1,631 @@
+// -*- C++ -*- C forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cmath
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c math.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 26.5 C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+#include <math.h>
+
+#ifndef _GLIBCXX_CMATH
+#define _GLIBCXX_CMATH 1
+
+// Get rid of those macros defined in <math.h> in lieu of real functions.
+#undef abs
+#undef div
+#undef acos
+#undef asin
+#undef atan
+#undef atan2
+#undef ceil
+#undef cos
+#undef cosh
+#undef exp
+#undef fabs
+#undef floor
+#undef fmod
+#undef frexp
+#undef ldexp
+#undef log
+#undef log10
+#undef modf
+#undef pow
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Forward declaration of a helper function. This really should be
+ // an `exported' forward declaration.
+ template<typename _Tp>
+ _Tp __cmath_power(_Tp, unsigned int);
+
+ template<typename _Tp>
+ inline _Tp
+ __pow_helper(_Tp __x, int __n)
+ {
+ return __n < 0
+ ? _Tp(1)/__cmath_power(__x, -__n)
+ : __cmath_power(__x, __n);
+ }
+
+ inline double
+ abs(double __x)
+ { return __builtin_fabs(__x); }
+
+ inline float
+ abs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ abs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+ using ::acos;
+
+ inline float
+ acos(float __x)
+ { return __builtin_acosf(__x); }
+
+ inline long double
+ acos(long double __x)
+ { return __builtin_acosl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ acos(_Tp __x)
+ { return __builtin_acos(__x); }
+
+ using ::asin;
+
+ inline float
+ asin(float __x)
+ { return __builtin_asinf(__x); }
+
+ inline long double
+ asin(long double __x)
+ { return __builtin_asinl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ asin(_Tp __x)
+ { return __builtin_asin(__x); }
+
+ using ::atan;
+
+ inline float
+ atan(float __x)
+ { return __builtin_atanf(__x); }
+
+ inline long double
+ atan(long double __x)
+ { return __builtin_atanl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ atan(_Tp __x)
+ { return __builtin_atan(__x); }
+
+ using ::atan2;
+
+ inline float
+ atan2(float __y, float __x)
+ { return __builtin_atan2f(__y, __x); }
+
+ inline long double
+ atan2(long double __y, long double __x)
+ { return __builtin_atan2l(__y, __x); }
+
+ template<typename _Tp, typename _Up>
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
+ atan2(_Tp __y, _Up __x)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return atan2(__type(__y), __type(__x));
+ }
+
+ using ::ceil;
+
+ inline float
+ ceil(float __x)
+ { return __builtin_ceilf(__x); }
+
+ inline long double
+ ceil(long double __x)
+ { return __builtin_ceill(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ ceil(_Tp __x)
+ { return __builtin_ceil(__x); }
+
+ using ::cos;
+
+ inline float
+ cos(float __x)
+ { return __builtin_cosf(__x); }
+
+ inline long double
+ cos(long double __x)
+ { return __builtin_cosl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ cos(_Tp __x)
+ { return __builtin_cos(__x); }
+
+ using ::cosh;
+
+ inline float
+ cosh(float __x)
+ { return __builtin_coshf(__x); }
+
+ inline long double
+ cosh(long double __x)
+ { return __builtin_coshl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ cosh(_Tp __x)
+ { return __builtin_cosh(__x); }
+
+ using ::exp;
+
+ inline float
+ exp(float __x)
+ { return __builtin_expf(__x); }
+
+ inline long double
+ exp(long double __x)
+ { return __builtin_expl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ exp(_Tp __x)
+ { return __builtin_exp(__x); }
+
+ using ::fabs;
+
+ inline float
+ fabs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ fabs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ fabs(_Tp __x)
+ { return __builtin_fabs(__x); }
+
+ using ::floor;
+
+ inline float
+ floor(float __x)
+ { return __builtin_floorf(__x); }
+
+ inline long double
+ floor(long double __x)
+ { return __builtin_floorl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ floor(_Tp __x)
+ { return __builtin_floor(__x); }
+
+ using ::fmod;
+
+ inline float
+ fmod(float __x, float __y)
+ { return __builtin_fmodf(__x, __y); }
+
+ inline long double
+ fmod(long double __x, long double __y)
+ { return __builtin_fmodl(__x, __y); }
+
+ using ::frexp;
+
+ inline float
+ frexp(float __x, int* __exp)
+ { return __builtin_frexpf(__x, __exp); }
+
+ inline long double
+ frexp(long double __x, int* __exp)
+ { return __builtin_frexpl(__x, __exp); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ frexp(_Tp __x, int* __exp)
+ { return __builtin_frexp(__x, __exp); }
+
+ using ::ldexp;
+
+ inline float
+ ldexp(float __x, int __exp)
+ { return __builtin_ldexpf(__x, __exp); }
+
+ inline long double
+ ldexp(long double __x, int __exp)
+ { return __builtin_ldexpl(__x, __exp); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ ldexp(_Tp __x, int __exp)
+ { return __builtin_ldexp(__x, __exp); }
+
+ using ::log;
+
+ inline float
+ log(float __x)
+ { return __builtin_logf(__x); }
+
+ inline long double
+ log(long double __x)
+ { return __builtin_logl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ log(_Tp __x)
+ { return __builtin_log(__x); }
+
+ using ::log10;
+
+ inline float
+ log10(float __x)
+ { return __builtin_log10f(__x); }
+
+ inline long double
+ log10(long double __x)
+ { return __builtin_log10l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ log10(_Tp __x)
+ { return __builtin_log10(__x); }
+
+ using ::modf;
+
+ inline float
+ modf(float __x, float* __iptr)
+ { return __builtin_modff(__x, __iptr); }
+
+ inline long double
+ modf(long double __x, long double* __iptr)
+ { return __builtin_modfl(__x, __iptr); }
+
+ using ::pow;
+
+ inline float
+ pow(float __x, float __y)
+ { return __builtin_powf(__x, __y); }
+
+ inline long double
+ pow(long double __x, long double __y)
+ { return __builtin_powl(__x, __y); }
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 550. What should the return type of pow(float,int) be?
+ inline double
+ pow(double __x, int __i)
+ { return __builtin_powi(__x, __i); }
+
+ inline float
+ pow(float __x, int __n)
+ { return __builtin_powif(__x, __n); }
+
+ inline long double
+ pow(long double __x, int __n)
+ { return __builtin_powil(__x, __n); }
+#endif
+
+ template<typename _Tp, typename _Up>
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
+ pow(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return pow(__type(__x), __type(__y));
+ }
+
+ using ::sin;
+
+ inline float
+ sin(float __x)
+ { return __builtin_sinf(__x); }
+
+ inline long double
+ sin(long double __x)
+ { return __builtin_sinl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ sin(_Tp __x)
+ { return __builtin_sin(__x); }
+
+ using ::sinh;
+
+ inline float
+ sinh(float __x)
+ { return __builtin_sinhf(__x); }
+
+ inline long double
+ sinh(long double __x)
+ { return __builtin_sinhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ sinh(_Tp __x)
+ { return __builtin_sinh(__x); }
+
+ using ::sqrt;
+
+ inline float
+ sqrt(float __x)
+ { return __builtin_sqrtf(__x); }
+
+ inline long double
+ sqrt(long double __x)
+ { return __builtin_sqrtl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ sqrt(_Tp __x)
+ { return __builtin_sqrt(__x); }
+
+ using ::tan;
+
+ inline float
+ tan(float __x)
+ { return __builtin_tanf(__x); }
+
+ inline long double
+ tan(long double __x)
+ { return __builtin_tanl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ tan(_Tp __x)
+ { return __builtin_tan(__x); }
+
+ using ::tanh;
+
+ inline float
+ tanh(float __x)
+ { return __builtin_tanhf(__x); }
+
+ inline long double
+ tanh(long double __x)
+ { return __builtin_tanhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ tanh(_Tp __x)
+ { return __builtin_tanh(__x); }
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99_MATH
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+// These are possible macros imported from C99-land.
+#undef fpclassify
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef isnormal
+#undef signbit
+#undef isgreater
+#undef isgreaterequal
+#undef isless
+#undef islessequal
+#undef islessgreater
+#undef isunordered
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ fpclassify(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
+ FP_SUBNORMAL, FP_ZERO, __type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isfinite(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isfinite(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isinf(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isinf(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isnan(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isnan(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isnormal(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isnormal(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ signbit(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_signbit(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isgreater(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isgreater(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isgreaterequal(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isgreaterequal(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isless(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isless(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ islessequal(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_islessequal(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ islessgreater(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_islessgreater(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isunordered(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isunordered(__type(__f1), __type(__f2));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
+#endif
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/cmath.tcc>
+#endif
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cmath>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cmath>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cmath.tcc b/gcc-4.4.0/libstdc++-v3/include/c_global/cmath.tcc
new file mode 100644
index 000000000..9f4c853a8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cmath.tcc
@@ -0,0 +1,55 @@
+// -*- C++ -*- C math library.
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// This file was written by Gabriel Dos Reis <gdr@codesourcery.com>
+
+/** @file cmath.tcc
+ * This is a Standard C++ Library file.
+ */
+
+#ifndef _GLIBCXX_CMATH_TCC
+#define _GLIBCXX_CMATH_TCC 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Tp>
+ inline _Tp
+ __cmath_power(_Tp __x, unsigned int __n)
+ {
+ _Tp __y = __n % 2 ? __x : _Tp(1);
+
+ while (__n >>= 1)
+ {
+ __x = __x * __x;
+ if (__n % 2)
+ __y = __y * __x;
+ }
+
+ return __y;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/csetjmp b/gcc-4.4.0/libstdc++-v3/include/c_global/csetjmp
new file mode 100644
index 000000000..6d7ecab47
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/csetjmp
@@ -0,0 +1,64 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file csetjmp
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c setjmp.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <setjmp.h>
+
+#ifndef _GLIBCXX_CSETJMP
+#define _GLIBCXX_CSETJMP 1
+
+// Get rid of those macros defined in <setjmp.h> in lieu of real functions.
+#undef longjmp
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef setjmp
+#define setjmp(env) setjmp (env)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::jmp_buf;
+ using ::longjmp;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/csignal b/gcc-4.4.0/libstdc++-v3/include/c_global/csignal
new file mode 100644
index 000000000..41af5e694
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/csignal
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file csignal
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c signal.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <signal.h>
+
+#ifndef _GLIBCXX_CSIGNAL
+#define _GLIBCXX_CSIGNAL 1
+
+// Get rid of those macros defined in <signal.h> in lieu of real functions.
+#undef raise
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::sig_atomic_t;
+ using ::signal;
+ using ::raise;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstdarg b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdarg
new file mode 100644
index 000000000..73327b1a3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdarg
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdarg
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdarg.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <stdarg.h>
+
+#ifndef _GLIBCXX_CSTDARG
+#define _GLIBCXX_CSTDARG 1
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef va_end
+#define va_end(ap) va_end (ap)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::va_list;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstdatomic b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdatomic
new file mode 100644
index 000000000..7489d97c0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdatomic
@@ -0,0 +1,848 @@
+// -*- C++ -*- header.
+
+// Copyright (C) 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cstdatomic
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdatomic.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+// Based on "C++ Atomic Types and Operations" by Hans Boehm and Lawrence Crowl.
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html
+
+#ifndef _GLIBCXX_STDATOMIC
+#define _GLIBCXX_STDATOMIC 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <stdatomic.h>
+#include <cstddef>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup atomics
+ * @{
+ */
+
+ /// kill_dependency
+ template<typename _Tp>
+ inline _Tp
+ kill_dependency(_Tp __y)
+ {
+ _Tp ret(__y);
+ return ret;
+ }
+
+ inline memory_order
+ __calculate_memory_order(memory_order __m)
+ {
+ const bool __cond1 = __m == memory_order_release;
+ const bool __cond2 = __m == memory_order_acq_rel;
+ memory_order __mo1(__cond1 ? memory_order_relaxed : __m);
+ memory_order __mo2(__cond2 ? memory_order_acquire : __mo1);
+ return __mo2;
+ }
+
+ //
+ // Three nested namespaces for atomic implementation details.
+ //
+ // The nested namespace inlined into std:: is determined by the value
+ // of the _GLIBCXX_ATOMIC_PROPERTY macro and the resulting
+ // ATOMIC_*_LOCK_FREE macros. See file stdatomic.h.
+ //
+ // 0 == __atomic0 == Never lock-free
+ // 1 == __atomic1 == Best available, sometimes lock-free
+ // 2 == __atomic2 == Always lock-free
+#include <bits/atomic_0.h>
+#include <bits/atomic_2.h>
+
+ /// atomic
+ /// 29.4.3, Generic atomic type, primary class template.
+ template<typename _Tp>
+ struct atomic
+ {
+ private:
+ _Tp _M_i;
+
+ public:
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(_Tp __i) : _M_i(__i) { }
+
+ operator _Tp() const volatile;
+
+ _Tp
+ operator=(_Tp __i) volatile { store(__i); return __i; }
+
+ bool
+ is_lock_free() const volatile;
+
+ void
+ store(_Tp, memory_order = memory_order_seq_cst) volatile;
+
+ _Tp
+ load(memory_order = memory_order_seq_cst) const volatile;
+
+ _Tp
+ exchange(_Tp __i, memory_order = memory_order_seq_cst) volatile;
+
+ bool
+ compare_exchange_weak(_Tp&, _Tp, memory_order, memory_order) volatile;
+
+ bool
+ compare_exchange_strong(_Tp&, _Tp, memory_order, memory_order) volatile;
+
+ bool
+ compare_exchange_weak(_Tp&, _Tp,
+ memory_order = memory_order_seq_cst) volatile;
+
+ bool
+ compare_exchange_strong(_Tp&, _Tp,
+ memory_order = memory_order_seq_cst) volatile;
+ };
+
+
+ /// Partial specialization for pointer types.
+ template<typename _Tp>
+ struct atomic<_Tp*> : atomic_address
+ {
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(_Tp* __v) : atomic_address(__v) { }
+
+ void
+ store(_Tp*, memory_order = memory_order_seq_cst) volatile;
+
+ _Tp*
+ load(memory_order = memory_order_seq_cst) const volatile;
+
+ _Tp*
+ exchange(_Tp*, memory_order = memory_order_seq_cst) volatile;
+
+ bool
+ compare_exchange_weak(_Tp*&, _Tp*, memory_order, memory_order) volatile;
+
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*, memory_order, memory_order) volatile;
+
+ bool
+ compare_exchange_weak(_Tp*&, _Tp*,
+ memory_order = memory_order_seq_cst) volatile;
+
+ bool
+ compare_exchange_strong(_Tp*&, _Tp*,
+ memory_order = memory_order_seq_cst) volatile;
+
+ _Tp*
+ fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+ _Tp*
+ fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
+
+ operator _Tp*() const volatile
+ { return load(); }
+
+ _Tp*
+ operator=(_Tp* __v) volatile
+ {
+ store(__v);
+ return __v;
+ }
+
+ _Tp*
+ operator++(int) volatile { return fetch_add(1); }
+
+ _Tp*
+ operator--(int) volatile { return fetch_sub(1); }
+
+ _Tp*
+ operator++() volatile { return fetch_add(1) + 1; }
+
+ _Tp*
+ operator--() volatile { return fetch_sub(1) - 1; }
+
+ _Tp*
+ operator+=(ptrdiff_t __d) volatile
+ { return fetch_add(__d) + __d; }
+
+ _Tp*
+ operator-=(ptrdiff_t __d) volatile
+ { return fetch_sub(__d) - __d; }
+ };
+
+
+ /// Explicit specialization for void*
+ template<>
+ struct atomic<void*> : public atomic_address
+ {
+ typedef void* __integral_type;
+ typedef atomic_address __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for bool.
+ template<>
+ struct atomic<bool> : public atomic_bool
+ {
+ typedef bool __integral_type;
+ typedef atomic_bool __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for char.
+ template<>
+ struct atomic<char> : public atomic_char
+ {
+ typedef char __integral_type;
+ typedef atomic_char __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for signed char.
+ template<>
+ struct atomic<signed char> : public atomic_schar
+ {
+ typedef signed char __integral_type;
+ typedef atomic_schar __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for unsigned char.
+ template<>
+ struct atomic<unsigned char> : public atomic_uchar
+ {
+ typedef unsigned char __integral_type;
+ typedef atomic_uchar __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for short.
+ template<>
+ struct atomic<short> : public atomic_short
+ {
+ typedef short __integral_type;
+ typedef atomic_short __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for unsigned short.
+ template<>
+ struct atomic<unsigned short> : public atomic_ushort
+ {
+ typedef unsigned short __integral_type;
+ typedef atomic_ushort __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for int.
+ template<>
+ struct atomic<int> : atomic_int
+ {
+ typedef int __integral_type;
+ typedef atomic_int __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for unsigned int.
+ template<>
+ struct atomic<unsigned int> : public atomic_uint
+ {
+ typedef unsigned int __integral_type;
+ typedef atomic_uint __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for long.
+ template<>
+ struct atomic<long> : public atomic_long
+ {
+ typedef long __integral_type;
+ typedef atomic_long __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for unsigned long.
+ template<>
+ struct atomic<unsigned long> : public atomic_ulong
+ {
+ typedef unsigned long __integral_type;
+ typedef atomic_ulong __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for long long.
+ template<>
+ struct atomic<long long> : public atomic_llong
+ {
+ typedef long long __integral_type;
+ typedef atomic_llong __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for unsigned long long.
+ template<>
+ struct atomic<unsigned long long> : public atomic_ullong
+ {
+ typedef unsigned long long __integral_type;
+ typedef atomic_ullong __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for wchar_t.
+ template<>
+ struct atomic<wchar_t> : public atomic_wchar_t
+ {
+ typedef wchar_t __integral_type;
+ typedef atomic_wchar_t __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for char16_t.
+ template<>
+ struct atomic<char16_t> : public atomic_char16_t
+ {
+ typedef char16_t __integral_type;
+ typedef atomic_char16_t __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+ /// Explicit specialization for char32_t.
+ template<>
+ struct atomic<char32_t> : public atomic_char32_t
+ {
+ typedef char32_t __integral_type;
+ typedef atomic_char32_t __base_type;
+
+ atomic() = default;
+ ~atomic() = default;
+ atomic(const atomic&) = delete;
+ atomic& operator=(const atomic&) = delete;
+
+ atomic(__integral_type __i) : __base_type(__i) { }
+
+ using __base_type::operator __integral_type;
+ using __base_type::operator=;
+ };
+
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::load(memory_order __m) const volatile
+ { return static_cast<_Tp*>(atomic_address::load(__m)); }
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::exchange(_Tp* __v, memory_order __m) volatile
+ { return static_cast<_Tp*>(atomic_address::exchange(__v, __m)); }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v, memory_order __m1,
+ memory_order __m2) volatile
+ {
+ void** __vr = reinterpret_cast<void**>(&__r);
+ void* __vv = static_cast<void*>(__v);
+ return atomic_address::compare_exchange_weak(*__vr, __vv, __m1, __m2);
+ }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
+ memory_order __m1,
+ memory_order __m2) volatile
+ {
+ void** __vr = reinterpret_cast<void**>(&__r);
+ void* __vv = static_cast<void*>(__v);
+ return atomic_address::compare_exchange_strong(*__vr, __vv, __m1, __m2);
+ }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_weak(_Tp*& __r, _Tp* __v,
+ memory_order __m) volatile
+ {
+ return compare_exchange_weak(__r, __v, __m,
+ __calculate_memory_order(__m));
+ }
+
+ template<typename _Tp>
+ bool
+ atomic<_Tp*>::compare_exchange_strong(_Tp*& __r, _Tp* __v,
+ memory_order __m) volatile
+ {
+ return compare_exchange_strong(__r, __v, __m,
+ __calculate_memory_order(__m));
+ }
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::fetch_add(ptrdiff_t __d, memory_order __m) volatile
+ {
+ void* __p = atomic_fetch_add_explicit(this, sizeof(_Tp) * __d, __m);
+ return static_cast<_Tp*>(__p);
+ }
+
+ template<typename _Tp>
+ _Tp*
+ atomic<_Tp*>::fetch_sub(ptrdiff_t __d, memory_order __m) volatile
+ {
+ void* __p = atomic_fetch_sub_explicit(this, sizeof(_Tp) * __d, __m);
+ return static_cast<_Tp*>(__p);
+ }
+
+ // Convenience function definitions, atomic_flag.
+ inline bool
+ atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __m)
+ { return __a->test_and_set(__m); }
+
+ inline void
+ atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __m)
+ { return __a->clear(__m); }
+
+
+ // Convenience function definitions, atomic_address.
+ inline bool
+ atomic_is_lock_free(const volatile atomic_address* __a)
+ { return __a->is_lock_free(); }
+
+ inline void
+ atomic_store(volatile atomic_address* __a, void* __v)
+ { __a->store(__v); }
+
+ inline void
+ atomic_store_explicit(volatile atomic_address* __a, void* __v,
+ memory_order __m)
+ { __a->store(__v, __m); }
+
+ inline void*
+ atomic_load(const volatile atomic_address* __a)
+ { return __a->load(); }
+
+ inline void*
+ atomic_load_explicit(const volatile atomic_address* __a, memory_order __m)
+ { return __a->load(__m); }
+
+ inline void*
+ atomic_exchange(volatile atomic_address* __a, void* __v)
+ { return __a->exchange(__v); }
+
+ inline void*
+ atomic_exchange_explicit(volatile atomic_address* __a, void* __v,
+ memory_order __m)
+ { return __a->exchange(__v, __m); }
+
+ inline bool
+ atomic_compare_exchange_weak(volatile atomic_address* __a,
+ void** __v1, void* __v2)
+ {
+ return __a->compare_exchange_weak(*__v1, __v2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ inline bool
+ atomic_compare_exchange_strong(volatile atomic_address* __a,
+ void** __v1, void* __v2)
+ {
+ return __a->compare_exchange_strong(*__v1, __v2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ inline bool
+ atomic_compare_exchange_weak_explicit(volatile atomic_address* __a,
+ void** __v1, void* __v2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_weak(*__v1, __v2, __m1, __m2); }
+
+ inline bool
+ atomic_compare_exchange_strong_explicit(volatile atomic_address* __a,
+ void** __v1, void* __v2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_strong(*__v1, __v2, __m1, __m2); }
+
+ inline void*
+ atomic_fetch_add_explicit(volatile atomic_address* __a, ptrdiff_t __d,
+ memory_order __m)
+ { return __a->fetch_add(__d, __m); }
+
+ inline void*
+ atomic_fetch_add(volatile atomic_address* __a, ptrdiff_t __d)
+ { return __a->fetch_add(__d); }
+
+ inline void*
+ atomic_fetch_sub_explicit(volatile atomic_address* __a, ptrdiff_t __d,
+ memory_order __m)
+ { return __a->fetch_sub(__d, __m); }
+
+ inline void*
+ atomic_fetch_sub(volatile atomic_address* __a, ptrdiff_t __d)
+ { return __a->fetch_sub(__d); }
+
+
+ // Convenience function definitions, atomic_bool.
+ inline bool
+ atomic_is_lock_free(const volatile atomic_bool* __a)
+ { return __a->is_lock_free(); }
+
+ inline void
+ atomic_store(volatile atomic_bool* __a, bool __i)
+ { __a->store(__i); }
+
+ inline void
+ atomic_store_explicit(volatile atomic_bool* __a, bool __i, memory_order __m)
+ { __a->store(__i, __m); }
+
+ inline bool
+ atomic_load(const volatile atomic_bool* __a)
+ { return __a->load(); }
+
+ inline bool
+ atomic_load_explicit(const volatile atomic_bool* __a, memory_order __m)
+ { return __a->load(__m); }
+
+ inline bool
+ atomic_exchange(volatile atomic_bool* __a, bool __i)
+ { return __a->exchange(__i); }
+
+ inline bool
+ atomic_exchange_explicit(volatile atomic_bool* __a, bool __i,
+ memory_order __m)
+ { return __a->exchange(__i, __m); }
+
+ inline bool
+ atomic_compare_exchange_weak(volatile atomic_bool* __a, bool* __i1, bool __i2)
+ {
+ return __a->compare_exchange_weak(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ inline bool
+ atomic_compare_exchange_strong(volatile atomic_bool* __a,
+ bool* __i1, bool __i2)
+ {
+ return __a->compare_exchange_strong(*__i1, __i2, memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ inline bool
+ atomic_compare_exchange_weak_explicit(volatile atomic_bool* __a, bool* __i1,
+ bool __i2, memory_order __m1,
+ memory_order __m2)
+ { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
+
+ inline bool
+ atomic_compare_exchange_strong_explicit(volatile atomic_bool* __a,
+ bool* __i1, bool __i2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
+
+
+
+ // Free standing functions. Template argument should be constricted
+ // to intergral types as specified in the standard.
+ template<typename _ITp>
+ inline void
+ atomic_store_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { __a->store(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_load_explicit(const volatile __atomic_base<_ITp>* __a,
+ memory_order __m)
+ { return __a->load(__m); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_exchange_explicit(volatile __atomic_base<_ITp>* __a,
+ _ITp __i, memory_order __m)
+ { return __a->exchange(__i, __m); }
+
+ template<typename _ITp>
+ inline bool
+ atomic_compare_exchange_weak_explicit(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2,
+ memory_order __m1, memory_order __m2)
+ { return __a->compare_exchange_weak(*__i1, __i2, __m1, __m2); }
+
+ template<typename _ITp>
+ inline bool
+ atomic_compare_exchange_strong_explicit(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2,
+ memory_order __m1,
+ memory_order __m2)
+ { return __a->compare_exchange_strong(*__i1, __i2, __m1, __m2); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_add_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_add(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_sub_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_sub(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_and_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_and(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_or_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_or(__i, __m); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_xor_explicit(volatile __atomic_base<_ITp>* __a, _ITp __i,
+ memory_order __m)
+ { return __a->fetch_xor(__i, __m); }
+
+ template<typename _ITp>
+ inline bool
+ atomic_is_lock_free(const volatile __atomic_base<_ITp>* __a)
+ { return __a->is_lock_free(); }
+
+ template<typename _ITp>
+ inline void
+ atomic_store(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { atomic_store_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_load(const volatile __atomic_base<_ITp>* __a)
+ { return atomic_load_explicit(__a, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_exchange(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_exchange_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline bool
+ atomic_compare_exchange_weak(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2)
+ {
+ return atomic_compare_exchange_weak_explicit(__a, __i1, __i2,
+ memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ template<typename _ITp>
+ inline bool
+ atomic_compare_exchange_strong(volatile __atomic_base<_ITp>* __a,
+ _ITp* __i1, _ITp __i2)
+ {
+ return atomic_compare_exchange_strong_explicit(__a, __i1, __i2,
+ memory_order_seq_cst,
+ memory_order_seq_cst);
+ }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_add(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_add_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_sub(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_sub_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_and(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_and_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_or(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_or_explicit(__a, __i, memory_order_seq_cst); }
+
+ template<typename _ITp>
+ inline _ITp
+ atomic_fetch_xor(volatile __atomic_base<_ITp>* __a, _ITp __i)
+ { return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
+
+ // @} group atomics
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstdbool b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdbool
new file mode 100644
index 000000000..3012c46b4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdbool
@@ -0,0 +1,44 @@
+// <cstdbool> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdbool
+ * This is a Standard C++ Library header.
+ */
+
+#pragma GCC system_header
+
+#ifndef _GLIBCXX_CSTDBOOL
+#define _GLIBCXX_CSTDBOOL 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+# include <bits/c++config.h>
+# if _GLIBCXX_HAVE_STDBOOL_H
+# include <stdbool.h>
+# endif
+#endif
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstddef b/gcc-4.4.0/libstdc++-v3/include/c_global/cstddef
new file mode 100644
index 000000000..bb16e75e0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstddef
@@ -0,0 +1,56 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cstddef
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stddef.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.1 Types
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <stddef.h>
+
+#ifndef _GLIBCXX_CSTDDEF
+#define _GLIBCXX_CSTDDEF 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::ptrdiff_t;
+ using ::size_t;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstdint b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdint
new file mode 100644
index 000000000..0927f8aae
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdint
@@ -0,0 +1,79 @@
+// <cstdint> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdint
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CSTDINT
+#define _GLIBCXX_CSTDINT 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <bits/c++config.h>
+
+// For 8.22.1/1 (see C99, Notes 219, 220, 222)
+#if _GLIBCXX_HAVE_STDINT_H
+# ifndef __STDC_LIMIT_MACROS
+# define _UNDEF__STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+# endif
+# ifndef __STDC_CONSTANT_MACROS
+# define _UNDEF__STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+# endif
+# include <stdint.h>
+# ifdef _UNDEF__STDC_LIMIT_MACROS
+# undef __STDC_LIMIT_MACROS
+# undef _UNDEF__STDC_LIMIT_MACROS
+# endif
+# ifdef _UNDEF__STDC_CONSTANT_MACROS
+# undef __STDC_CONSTANT_MACROS
+# undef _UNDEF__STDC_CONSTANT_MACROS
+# endif
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cstdint>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cstdint>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // _GLIBCXX_CSTDINT
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstdio b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdio
new file mode 100644
index 000000000..b4826e213
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdio
@@ -0,0 +1,205 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdio
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdio.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 27.8.2 C Library files
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <stdio.h>
+
+#ifndef _GLIBCXX_CSTDIO
+#define _GLIBCXX_CSTDIO 1
+
+// Get rid of those macros defined in <stdio.h> in lieu of real functions.
+#undef clearerr
+#undef fclose
+#undef feof
+#undef ferror
+#undef fflush
+#undef fgetc
+#undef fgetpos
+#undef fgets
+#undef fopen
+#undef fprintf
+#undef fputc
+#undef fputs
+#undef fread
+#undef freopen
+#undef fscanf
+#undef fseek
+#undef fsetpos
+#undef ftell
+#undef fwrite
+#undef getc
+#undef getchar
+#undef gets
+#undef perror
+#undef printf
+#undef putc
+#undef putchar
+#undef puts
+#undef remove
+#undef rename
+#undef rewind
+#undef scanf
+#undef setbuf
+#undef setvbuf
+#undef sprintf
+#undef sscanf
+#undef tmpfile
+#undef tmpnam
+#undef ungetc
+#undef vfprintf
+#undef vprintf
+#undef vsprintf
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::FILE;
+ using ::fpos_t;
+
+ using ::clearerr;
+ using ::fclose;
+ using ::feof;
+ using ::ferror;
+ using ::fflush;
+ using ::fgetc;
+ using ::fgetpos;
+ using ::fgets;
+ using ::fopen;
+ using ::fprintf;
+ using ::fputc;
+ using ::fputs;
+ using ::fread;
+ using ::freopen;
+ using ::fscanf;
+ using ::fseek;
+ using ::fsetpos;
+ using ::ftell;
+ using ::fwrite;
+ using ::getc;
+ using ::getchar;
+ using ::gets;
+ using ::perror;
+ using ::printf;
+ using ::putc;
+ using ::putchar;
+ using ::puts;
+ using ::remove;
+ using ::rename;
+ using ::rewind;
+ using ::scanf;
+ using ::setbuf;
+ using ::setvbuf;
+ using ::sprintf;
+ using ::sscanf;
+ using ::tmpfile;
+ using ::tmpnam;
+ using ::ungetc;
+ using ::vfprintf;
+ using ::vprintf;
+ using ::vsprintf;
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99
+
+#undef snprintf
+#undef vfscanf
+#undef vscanf
+#undef vsnprintf
+#undef vsscanf
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+ extern "C" int
+ (snprintf)(char * restrict, size_t, const char * restrict, ...);
+ extern "C" int
+ (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
+ extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
+ extern "C" int
+ (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
+ extern "C" int
+ (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
+#endif
+
+#if !_GLIBCXX_USE_C99_DYNAMIC
+ using ::snprintf;
+ using ::vfscanf;
+ using ::vscanf;
+ using ::vsnprintf;
+ using ::vsscanf;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::__gnu_cxx::snprintf;
+ using ::__gnu_cxx::vfscanf;
+ using ::__gnu_cxx::vscanf;
+ using ::__gnu_cxx::vsnprintf;
+ using ::__gnu_cxx::vsscanf;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cstdio>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cstdio>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstdlib b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdlib
new file mode 100644
index 000000000..a29031eb0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstdlib
@@ -0,0 +1,242 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdlib
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdlib.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+
+#ifndef _GLIBCXX_CSTDLIB
+#define _GLIBCXX_CSTDLIB 1
+
+#if !_GLIBCXX_HOSTED
+// The C standard does not require a freestanding implementation to
+// provide <stdlib.h>. However, the C++ standard does still require
+// <cstdlib> -- but only the functionality mentioned in
+// [lib.support.start.term].
+
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ extern "C" void abort(void);
+ extern "C" int atexit(void (*)());
+ extern "C" void exit(int);
+
+_GLIBCXX_END_NAMESPACE
+
+#else
+
+#include <stdlib.h>
+
+// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
+#undef abort
+#undef abs
+#undef atexit
+#undef atof
+#undef atoi
+#undef atol
+#undef bsearch
+#undef calloc
+#undef div
+#undef exit
+#undef free
+#undef getenv
+#undef labs
+#undef ldiv
+#undef malloc
+#undef mblen
+#undef mbstowcs
+#undef mbtowc
+#undef qsort
+#undef rand
+#undef realloc
+#undef srand
+#undef strtod
+#undef strtol
+#undef strtoul
+#undef system
+#undef wcstombs
+#undef wctomb
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::div_t;
+ using ::ldiv_t;
+
+ using ::abort;
+ using ::abs;
+ using ::atexit;
+ using ::atof;
+ using ::atoi;
+ using ::atol;
+ using ::bsearch;
+ using ::calloc;
+ using ::div;
+ using ::exit;
+ using ::free;
+ using ::getenv;
+ using ::labs;
+ using ::ldiv;
+ using ::malloc;
+#ifdef _GLIBCXX_HAVE_MBSTATE_T
+ using ::mblen;
+ using ::mbstowcs;
+ using ::mbtowc;
+#endif // _GLIBCXX_HAVE_MBSTATE_T
+ using ::qsort;
+ using ::rand;
+ using ::realloc;
+ using ::srand;
+ using ::strtod;
+ using ::strtol;
+ using ::strtoul;
+ using ::system;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ using ::wcstombs;
+ using ::wctomb;
+#endif // _GLIBCXX_USE_WCHAR_T
+
+ inline long
+ abs(long __i) { return labs(__i); }
+
+ inline ldiv_t
+ div(long __i, long __j) { return ldiv(__i, __j); }
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99
+
+#undef _Exit
+#undef llabs
+#undef lldiv
+#undef atoll
+#undef strtoll
+#undef strtoull
+#undef strtof
+#undef strtold
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::lldiv_t;
+#endif
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+ extern "C" void (_Exit)(int);
+#endif
+#if !_GLIBCXX_USE_C99_DYNAMIC
+ using ::_Exit;
+#endif
+
+ inline long long
+ abs(long long __x) { return __x >= 0 ? __x : -__x; }
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::llabs;
+
+ inline lldiv_t
+ div(long long __n, long long __d)
+ { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
+
+ using ::lldiv;
+#endif
+
+#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ extern "C" long long int (atoll)(const char *);
+ extern "C" long long int
+ (strtoll)(const char * restrict, char ** restrict, int);
+ extern "C" unsigned long long int
+ (strtoull)(const char * restrict, char ** restrict, int);
+#endif
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::atoll;
+ using ::strtoll;
+ using ::strtoull;
+#endif
+ using ::strtof;
+ using ::strtold;
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::__gnu_cxx::lldiv_t;
+#endif
+ using ::__gnu_cxx::_Exit;
+ using ::__gnu_cxx::abs;
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::__gnu_cxx::llabs;
+ using ::__gnu_cxx::div;
+ using ::__gnu_cxx::lldiv;
+#endif
+ using ::__gnu_cxx::atoll;
+ using ::__gnu_cxx::strtof;
+ using ::__gnu_cxx::strtoll;
+ using ::__gnu_cxx::strtoull;
+ using ::__gnu_cxx::strtold;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cstdlib>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cstdlib>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif // !_GLIBCXX_HOSTED
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cstring b/gcc-4.4.0/libstdc++-v3/include/c_global/cstring
new file mode 100644
index 000000000..de0ce2425
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cstring
@@ -0,0 +1,123 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cstring
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c string.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <string.h>
+
+#ifndef _GLIBCXX_CSTRING
+#define _GLIBCXX_CSTRING 1
+
+// Get rid of those macros defined in <string.h> in lieu of real functions.
+#undef memchr
+#undef memcmp
+#undef memcpy
+#undef memmove
+#undef memset
+#undef strcat
+#undef strchr
+#undef strcmp
+#undef strcoll
+#undef strcpy
+#undef strcspn
+#undef strerror
+#undef strlen
+#undef strncat
+#undef strncmp
+#undef strncpy
+#undef strpbrk
+#undef strrchr
+#undef strspn
+#undef strstr
+#undef strtok
+#undef strxfrm
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::memchr;
+ using ::memcmp;
+ using ::memcpy;
+ using ::memmove;
+ using ::memset;
+ using ::strcat;
+ using ::strcmp;
+ using ::strcoll;
+ using ::strcpy;
+ using ::strcspn;
+ using ::strerror;
+ using ::strlen;
+ using ::strncat;
+ using ::strncmp;
+ using ::strncpy;
+ using ::strspn;
+ using ::strtok;
+ using ::strxfrm;
+ using ::strchr;
+ using ::strpbrk;
+ using ::strrchr;
+ using ::strstr;
+
+#ifndef __CORRECT_ISO_CPP_STRING_H_PROTO
+ inline void*
+ memchr(void* __p, int __c, size_t __n)
+ { return memchr(const_cast<const void*>(__p), __c, __n); }
+
+ inline char*
+ strchr(char* __s1, int __n)
+ { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
+
+ inline char*
+ strpbrk(char* __s1, const char* __s2)
+ { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
+
+ inline char*
+ strrchr(char* __s1, int __n)
+ { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
+
+ inline char*
+ strstr(char* __s1, const char* __s2)
+ { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/ctgmath b/gcc-4.4.0/libstdc++-v3/include/c_global/ctgmath
new file mode 100644
index 000000000..3c6fcf735
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/ctgmath
@@ -0,0 +1,41 @@
+// <ctgmath> -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/ctgmath
+ * This is a Standard C++ Library header.
+ */
+
+#pragma GCC system_header
+
+#ifndef _GLIBCXX_CTGMATH
+#define _GLIBCXX_CTGMATH 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+# include <cmath>
+#endif
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/ctime b/gcc-4.4.0/libstdc++-v3/include/c_global/ctime
new file mode 100644
index 000000000..e236cf483
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/ctime
@@ -0,0 +1,78 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/ctime
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c time.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.5 Date and time
+//
+
+#pragma GCC system_header
+
+#include <cstddef>
+#include <time.h>
+
+#ifndef _GLIBCXX_CTIME
+#define _GLIBCXX_CTIME 1
+
+// Get rid of those macros defined in <time.h> in lieu of real functions.
+#undef clock
+#undef difftime
+#undef mktime
+#undef time
+#undef asctime
+#undef ctime
+#undef gmtime
+#undef localtime
+#undef strftime
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::clock_t;
+ using ::time_t;
+ using ::tm;
+
+ using ::clock;
+ using ::difftime;
+ using ::mktime;
+ using ::time;
+ using ::asctime;
+ using ::ctime;
+ using ::gmtime;
+ using ::localtime;
+ using ::strftime;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cwchar b/gcc-4.4.0/libstdc++-v3/include/c_global/cwchar
new file mode 100644
index 000000000..e5ea07e7d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cwchar
@@ -0,0 +1,291 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cwchar
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c wchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+
+#if _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+
+#ifndef _GLIBCXX_CWCHAR
+#define _GLIBCXX_CWCHAR 1
+
+// Need to do a bit of trickery here with mbstate_t as char_traits
+// assumes it is in wchar.h, regardless of wchar_t specializations.
+#ifndef _GLIBCXX_HAVE_MBSTATE_T
+extern "C"
+{
+ typedef struct
+ {
+ int __fill[6];
+ } mbstate_t;
+}
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::mbstate_t;
+
+_GLIBCXX_END_NAMESPACE
+
+// Get rid of those macros defined in <wchar.h> in lieu of real functions.
+#undef btowc
+#undef fgetwc
+#undef fgetws
+#undef fputwc
+#undef fputws
+#undef fwide
+#undef fwprintf
+#undef fwscanf
+#undef getwc
+#undef getwchar
+#undef mbrlen
+#undef mbrtowc
+#undef mbsinit
+#undef mbsrtowcs
+#undef putwc
+#undef putwchar
+#undef swprintf
+#undef swscanf
+#undef ungetwc
+#undef vfwprintf
+#if _GLIBCXX_HAVE_VFWSCANF
+# undef vfwscanf
+#endif
+#undef vswprintf
+#if _GLIBCXX_HAVE_VSWSCANF
+# undef vswscanf
+#endif
+#undef vwprintf
+#if _GLIBCXX_HAVE_VWSCANF
+# undef vwscanf
+#endif
+#undef wcrtomb
+#undef wcscat
+#undef wcschr
+#undef wcscmp
+#undef wcscoll
+#undef wcscpy
+#undef wcscspn
+#undef wcsftime
+#undef wcslen
+#undef wcsncat
+#undef wcsncmp
+#undef wcsncpy
+#undef wcspbrk
+#undef wcsrchr
+#undef wcsrtombs
+#undef wcsspn
+#undef wcsstr
+#undef wcstod
+#if _GLIBCXX_HAVE_WCSTOF
+# undef wcstof
+#endif
+#undef wcstok
+#undef wcstol
+#undef wcstoul
+#undef wcsxfrm
+#undef wctob
+#undef wmemchr
+#undef wmemcmp
+#undef wmemcpy
+#undef wmemmove
+#undef wmemset
+#undef wprintf
+#undef wscanf
+
+#if _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::wint_t;
+
+ using ::btowc;
+ using ::fgetwc;
+ using ::fgetws;
+ using ::fputwc;
+ using ::fputws;
+ using ::fwide;
+ using ::fwprintf;
+ using ::fwscanf;
+ using ::getwc;
+ using ::getwchar;
+ using ::mbrlen;
+ using ::mbrtowc;
+ using ::mbsinit;
+ using ::mbsrtowcs;
+ using ::putwc;
+ using ::putwchar;
+ using ::swprintf;
+ using ::swscanf;
+ using ::ungetwc;
+ using ::vfwprintf;
+#if _GLIBCXX_HAVE_VFWSCANF
+ using ::vfwscanf;
+#endif
+ using ::vswprintf;
+#if _GLIBCXX_HAVE_VSWSCANF
+ using ::vswscanf;
+#endif
+ using ::vwprintf;
+#if _GLIBCXX_HAVE_VWSCANF
+ using ::vwscanf;
+#endif
+ using ::wcrtomb;
+ using ::wcscat;
+ using ::wcscmp;
+ using ::wcscoll;
+ using ::wcscpy;
+ using ::wcscspn;
+ using ::wcsftime;
+ using ::wcslen;
+ using ::wcsncat;
+ using ::wcsncmp;
+ using ::wcsncpy;
+ using ::wcsrtombs;
+ using ::wcsspn;
+ using ::wcstod;
+#if _GLIBCXX_HAVE_WCSTOF
+ using ::wcstof;
+#endif
+ using ::wcstok;
+ using ::wcstol;
+ using ::wcstoul;
+ using ::wcsxfrm;
+ using ::wctob;
+ using ::wmemcmp;
+ using ::wmemcpy;
+ using ::wmemmove;
+ using ::wmemset;
+ using ::wprintf;
+ using ::wscanf;
+ using ::wcschr;
+ using ::wcspbrk;
+ using ::wcsrchr;
+ using ::wcsstr;
+ using ::wmemchr;
+
+#ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO
+ inline wchar_t*
+ wcschr(wchar_t* __p, wchar_t __c)
+ { return wcschr(const_cast<const wchar_t*>(__p), __c); }
+
+ inline wchar_t*
+ wcspbrk(wchar_t* __s1, const wchar_t* __s2)
+ { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
+
+ inline wchar_t*
+ wcsrchr(wchar_t* __p, wchar_t __c)
+ { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
+
+ inline wchar_t*
+ wcsstr(wchar_t* __s1, const wchar_t* __s2)
+ { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
+
+ inline wchar_t*
+ wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
+ { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99
+
+#undef wcstold
+#undef wcstoll
+#undef wcstoull
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+ extern "C" long double
+ (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
+#endif
+#if !_GLIBCXX_USE_C99_DYNAMIC
+ using ::wcstold;
+#endif
+#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ extern "C" long long int
+ (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
+ extern "C" unsigned long long int
+ (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
+#endif
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::wcstoll;
+ using ::wcstoull;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::__gnu_cxx::wcstold;
+ using ::__gnu_cxx::wcstoll;
+ using ::__gnu_cxx::wcstoull;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cwchar>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cwchar>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_global/cwctype b/gcc-4.4.0/libstdc++-v3/include/c_global/cwctype
new file mode 100644
index 000000000..4e94fec34
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_global/cwctype
@@ -0,0 +1,126 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cwctype
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c wctype.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: <cwctype>
+//
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#if _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
+
+#ifndef _GLIBCXX_CWCTYPE
+#define _GLIBCXX_CWCTYPE 1
+
+// Get rid of those macros defined in <wctype.h> in lieu of real functions.
+#undef iswalnum
+#undef iswalpha
+#if _GLIBCXX_HAVE_ISWBLANK
+# undef iswblank
+#endif
+#undef iswcntrl
+#undef iswctype
+#undef iswdigit
+#undef iswgraph
+#undef iswlower
+#undef iswprint
+#undef iswpunct
+#undef iswspace
+#undef iswupper
+#undef iswxdigit
+#undef towctrans
+#undef towlower
+#undef towupper
+#undef wctrans
+#undef wctype
+
+#if _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::wctrans_t;
+ using ::wctype_t;
+ using ::wint_t;
+
+ using ::iswalnum;
+ using ::iswalpha;
+#if _GLIBCXX_HAVE_ISWBLANK
+ using ::iswblank;
+#endif
+ using ::iswcntrl;
+ using ::iswctype;
+ using ::iswdigit;
+ using ::iswgraph;
+ using ::iswlower;
+ using ::iswprint;
+ using ::iswpunct;
+ using ::iswspace;
+ using ::iswupper;
+ using ::iswxdigit;
+ using ::towctrans;
+ using ::towlower;
+ using ::towupper;
+ using ::wctrans;
+ using ::wctype;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/cwctype>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/cwctype>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cassert b/gcc-4.4.0/libstdc++-v3/include/c_std/cassert
new file mode 100644
index 000000000..5cb21a651
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cassert
@@ -0,0 +1,44 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cassert
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c assert.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 19.2 Assertions
+//
+
+// No include guards on this header...
+
+#pragma GCC system_header
+
+#include <assert.h>
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cctype b/gcc-4.4.0/libstdc++-v3/include/c_std/cctype
new file mode 100644
index 000000000..5f16bbcaf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cctype
@@ -0,0 +1,81 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cctype
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c ctype.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: <ccytpe>
+//
+
+#ifndef _GLIBCXX_CCTYPE
+#define _GLIBCXX_CCTYPE 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <ctype.h>
+
+// Get rid of those macros defined in <ctype.h> in lieu of real functions.
+#undef isalnum
+#undef isalpha
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef tolower
+#undef toupper
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::isalnum;
+ using ::isalpha;
+ using ::iscntrl;
+ using ::isdigit;
+ using ::isgraph;
+ using ::islower;
+ using ::isprint;
+ using ::ispunct;
+ using ::isspace;
+ using ::isupper;
+ using ::isxdigit;
+ using ::tolower;
+ using ::toupper;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cerrno b/gcc-4.4.0/libstdc++-v3/include/c_std/cerrno
new file mode 100644
index 000000000..49b8b190f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cerrno
@@ -0,0 +1,52 @@
+// The -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cerrno
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c errno.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 19.3 Error numbers
+//
+
+#ifndef _GLIBCXX_CERRNO
+#define _GLIBCXX_CERRNO 1
+
+#pragma GCC system_header
+
+#include <errno.h>
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef errno
+#define errno errno
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cfloat b/gcc-4.4.0/libstdc++-v3/include/c_std/cfloat
new file mode 100644
index 000000000..4501f05e4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cfloat
@@ -0,0 +1,47 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cfloat
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c float.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#ifndef _GLIBCXX_CFLOAT
+#define _GLIBCXX_CFLOAT 1
+
+#pragma GCC system_header
+
+#include <float.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/ciso646 b/gcc-4.4.0/libstdc++-v3/include/c_std/ciso646
new file mode 100644
index 000000000..a3c3f9b77
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/ciso646
@@ -0,0 +1,33 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ciso646
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c iso646.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/climits b/gcc-4.4.0/libstdc++-v3/include/c_std/climits
new file mode 100644
index 000000000..6ed4c43f2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/climits
@@ -0,0 +1,47 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/climits
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c limits.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#ifndef _GLIBCXX_CLIMITS
+#define _GLIBCXX_CLIMITS 1
+
+#pragma GCC system_header
+
+#include <limits.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/clocale b/gcc-4.4.0/libstdc++-v3/include/c_std/clocale
new file mode 100644
index 000000000..c18bc5ee9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/clocale
@@ -0,0 +1,60 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file clocale
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c locale.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.2.2 Implementation properties: C library
+//
+
+#ifndef _GLIBCXX_CLOCALE
+#define _GLIBCXX_CLOCALE 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <locale.h>
+
+// Get rid of those macros defined in <locale.h> in lieu of real functions.
+#undef setlocale
+#undef localeconv
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::lconv;
+ using ::setlocale;
+ using ::localeconv;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cmath b/gcc-4.4.0/libstdc++-v3/include/c_std/cmath
new file mode 100644
index 000000000..a0bebc990
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cmath
@@ -0,0 +1,591 @@
+// -*- C++ -*- C forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cmath
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c math.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 26.5 C library
+//
+
+#ifndef _GLIBCXX_CMATH
+#define _GLIBCXX_CMATH 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+
+#include <math.h>
+
+// Get rid of those macros defined in <math.h> in lieu of real functions.
+#undef abs
+#undef div
+#undef acos
+#undef asin
+#undef atan
+#undef atan2
+#undef ceil
+#undef cos
+#undef cosh
+#undef exp
+#undef fabs
+#undef floor
+#undef fmod
+#undef frexp
+#undef ldexp
+#undef log
+#undef log10
+#undef modf
+#undef pow
+#undef sin
+#undef sinh
+#undef sqrt
+#undef tan
+#undef tanh
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Forward declaration of a helper function. This really should be
+ // an `exported' forward declaration.
+ template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);
+
+ inline double
+ abs(double __x)
+ { return __builtin_fabs(__x); }
+
+ inline float
+ abs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ abs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+ using ::acos;
+
+ inline float
+ acos(float __x)
+ { return __builtin_acosf(__x); }
+
+ inline long double
+ acos(long double __x)
+ { return __builtin_acosl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ acos(_Tp __x)
+ { return __builtin_acos(__x); }
+
+ using ::asin;
+
+ inline float
+ asin(float __x)
+ { return __builtin_asinf(__x); }
+
+ inline long double
+ asin(long double __x)
+ { return __builtin_asinl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ asin(_Tp __x)
+ { return __builtin_asin(__x); }
+
+ using ::atan;
+
+ inline float
+ atan(float __x)
+ { return __builtin_atanf(__x); }
+
+ inline long double
+ atan(long double __x)
+ { return __builtin_atanl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ atan(_Tp __x)
+ { return __builtin_atan(__x); }
+
+ using ::atan2;
+
+ inline float
+ atan2(float __y, float __x)
+ { return __builtin_atan2f(__y, __x); }
+
+ inline long double
+ atan2(long double __y, long double __x)
+ { return __builtin_atan2l(__y, __x); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value
+ && __is_integer<_Up>::__value,
+ double>::__type
+ atan2(_Tp __y, _Up __x)
+ { return __builtin_atan2(__y, __x); }
+
+ using ::ceil;
+
+ inline float
+ ceil(float __x)
+ { return __builtin_ceilf(__x); }
+
+ inline long double
+ ceil(long double __x)
+ { return __builtin_ceill(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ ceil(_Tp __x)
+ { return __builtin_ceil(__x); }
+
+ using ::cos;
+
+ inline float
+ cos(float __x)
+ { return __builtin_cosf(__x); }
+
+ inline long double
+ cos(long double __x)
+ { return __builtin_cosl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ cos(_Tp __x)
+ { return __builtin_cos(__x); }
+
+ using ::cosh;
+
+ inline float
+ cosh(float __x)
+ { return __builtin_coshf(__x); }
+
+ inline long double
+ cosh(long double __x)
+ { return __builtin_coshl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ cosh(_Tp __x)
+ { return __builtin_cosh(__x); }
+
+ using ::exp;
+
+ inline float
+ exp(float __x)
+ { return __builtin_expf(__x); }
+
+ inline long double
+ exp(long double __x)
+ { return __builtin_expl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ exp(_Tp __x)
+ { return __builtin_exp(__x); }
+
+ using ::fabs;
+
+ inline float
+ fabs(float __x)
+ { return __builtin_fabsf(__x); }
+
+ inline long double
+ fabs(long double __x)
+ { return __builtin_fabsl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ fabs(_Tp __x)
+ { return __builtin_fabs(__x); }
+
+ using ::floor;
+
+ inline float
+ floor(float __x)
+ { return __builtin_floorf(__x); }
+
+ inline long double
+ floor(long double __x)
+ { return __builtin_floorl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ floor(_Tp __x)
+ { return __builtin_floor(__x); }
+
+ using ::fmod;
+
+ inline float
+ fmod(float __x, float __y)
+ { return __builtin_fmodf(__x, __y); }
+
+ inline long double
+ fmod(long double __x, long double __y)
+ { return __builtin_fmodl(__x, __y); }
+
+ using ::frexp;
+
+ inline float
+ frexp(float __x, int* __exp)
+ { return __builtin_frexpf(__x, __exp); }
+
+ inline long double
+ frexp(long double __x, int* __exp)
+ { return __builtin_frexpl(__x, __exp); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ frexp(_Tp __x, int* __exp)
+ { return __builtin_frexp(__x, __exp); }
+
+ using ::ldexp;
+
+ inline float
+ ldexp(float __x, int __exp)
+ { return __builtin_ldexpf(__x, __exp); }
+
+ inline long double
+ ldexp(long double __x, int __exp)
+ { return __builtin_ldexpl(__x, __exp); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ ldexp(_Tp __x, int __exp)
+ { return __builtin_ldexp(__x, __exp); }
+
+ using ::log;
+
+ inline float
+ log(float __x)
+ { return __builtin_logf(__x); }
+
+ inline long double
+ log(long double __x)
+ { return __builtin_logl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ log(_Tp __x)
+ { return __builtin_log(__x); }
+
+ using ::log10;
+
+ inline float
+ log10(float __x)
+ { return __builtin_log10f(__x); }
+
+ inline long double
+ log10(long double __x)
+ { return __builtin_log10l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ log10(_Tp __x)
+ { return __builtin_log10(__x); }
+
+ using ::modf;
+
+ inline float
+ modf(float __x, float* __iptr)
+ { return __builtin_modff(__x, __iptr); }
+
+ inline long double
+ modf(long double __x, long double* __iptr)
+ { return __builtin_modfl(__x, __iptr); }
+
+ template<typename _Tp>
+ inline _Tp
+ __pow_helper(_Tp __x, int __n)
+ {
+ return __n < 0
+ ? _Tp(1)/__cmath_power(__x, -__n)
+ : __cmath_power(__x, __n);
+ }
+
+ using ::pow;
+
+ inline float
+ pow(float __x, float __y)
+ { return __builtin_powf(__x, __y); }
+
+ inline long double
+ pow(long double __x, long double __y)
+ { return __builtin_powl(__x, __y); }
+
+ inline double
+ pow(double __x, int __i)
+ { return __builtin_powi(__x, __i); }
+
+ inline float
+ pow(float __x, int __n)
+ { return __builtin_powif(__x, __n); }
+
+ inline long double
+ pow(long double __x, int __n)
+ { return __builtin_powil(__x, __n); }
+
+ using ::sin;
+
+ inline float
+ sin(float __x)
+ { return __builtin_sinf(__x); }
+
+ inline long double
+ sin(long double __x)
+ { return __builtin_sinl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ sin(_Tp __x)
+ { return __builtin_sin(__x); }
+
+ using ::sinh;
+
+ inline float
+ sinh(float __x)
+ { return __builtin_sinhf(__x); }
+
+ inline long double
+ sinh(long double __x)
+ { return __builtin_sinhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ sinh(_Tp __x)
+ { return __builtin_sinh(__x); }
+
+ using ::sqrt;
+
+ inline float
+ sqrt(float __x)
+ { return __builtin_sqrtf(__x); }
+
+ inline long double
+ sqrt(long double __x)
+ { return __builtin_sqrtl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ sqrt(_Tp __x)
+ { return __builtin_sqrt(__x); }
+
+ using ::tan;
+
+ inline float
+ tan(float __x)
+ { return __builtin_tanf(__x); }
+
+ inline long double
+ tan(long double __x)
+ { return __builtin_tanl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ tan(_Tp __x)
+ { return __builtin_tan(__x); }
+
+ using ::tanh;
+
+ inline float
+ tanh(float __x)
+ { return __builtin_tanhf(__x); }
+
+ inline long double
+ tanh(long double __x)
+ { return __builtin_tanhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
+ double>::__type
+ tanh(_Tp __x)
+ { return __builtin_tanh(__x); }
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99_MATH
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+// These are possible macros imported from C99-land.
+#undef fpclassify
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef isnormal
+#undef signbit
+#undef isgreater
+#undef isgreaterequal
+#undef isless
+#undef islessequal
+#undef islessgreater
+#undef isunordered
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ fpclassify(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
+ FP_SUBNORMAL, FP_ZERO, __type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isfinite(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isfinite(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isinf(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isinf(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isnan(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isnan(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isnormal(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isnormal(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ signbit(_Tp __f)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_signbit(__type(__f));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isgreater(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isgreater(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isgreaterequal(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isgreaterequal(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isless(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isless(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ islessequal(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_islessequal(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ islessgreater(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_islessgreater(__type(__f1), __type(__f2));
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
+ int>::__type
+ isunordered(_Tp __f1, _Tp __f2)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __builtin_isunordered(__type(__f1), __type(__f2));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
+#endif
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/cmath.tcc>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cmath.tcc b/gcc-4.4.0/libstdc++-v3/include/c_std/cmath.tcc
new file mode 100644
index 000000000..9f4c853a8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cmath.tcc
@@ -0,0 +1,55 @@
+// -*- C++ -*- C math library.
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// This file was written by Gabriel Dos Reis <gdr@codesourcery.com>
+
+/** @file cmath.tcc
+ * This is a Standard C++ Library file.
+ */
+
+#ifndef _GLIBCXX_CMATH_TCC
+#define _GLIBCXX_CMATH_TCC 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _Tp>
+ inline _Tp
+ __cmath_power(_Tp __x, unsigned int __n)
+ {
+ _Tp __y = __n % 2 ? __x : _Tp(1);
+
+ while (__n >>= 1)
+ {
+ __x = __x * __x;
+ if (__n % 2)
+ __y = __y * __x;
+ }
+
+ return __y;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/csetjmp b/gcc-4.4.0/libstdc++-v3/include/c_std/csetjmp
new file mode 100644
index 000000000..cd3bed28a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/csetjmp
@@ -0,0 +1,63 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file csetjmp
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c setjmp.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSETJMP
+#define _GLIBCXX_CSETJMP 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <setjmp.h>
+
+// Get rid of those macros defined in <setjmp.h> in lieu of real functions.
+#undef longjmp
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef setjmp
+#define setjmp(env) setjmp (env)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::jmp_buf;
+ using ::longjmp;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/csignal b/gcc-4.4.0/libstdc++-v3/include/c_std/csignal
new file mode 100644
index 000000000..50a8aecd1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/csignal
@@ -0,0 +1,59 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file csignal
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c signal.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSIGNAL
+#define _GLIBCXX_CSIGNAL 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <signal.h>
+
+// Get rid of those macros defined in <signal.h> in lieu of real functions.
+#undef raise
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::sig_atomic_t;
+ using ::signal;
+ using ::raise;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cstdarg b/gcc-4.4.0/libstdc++-v3/include/c_std/cstdarg
new file mode 100644
index 000000000..910fbd3f0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cstdarg
@@ -0,0 +1,59 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdarg
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdarg.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSTDARG
+#define _GLIBCXX_CSTDARG 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <stdarg.h>
+
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
+#ifndef va_end
+#define va_end(ap) va_end (ap)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::va_list;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cstddef b/gcc-4.4.0/libstdc++-v3/include/c_std/cstddef
new file mode 100644
index 000000000..87d48329e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cstddef
@@ -0,0 +1,55 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cstddef
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stddef.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 18.1 Types
+//
+
+#ifndef _GLIBCXX_CSTDDEF
+#define _GLIBCXX_CSTDDEF 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <stddef.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::ptrdiff_t;
+ using ::size_t;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cstdio b/gcc-4.4.0/libstdc++-v3/include/c_std/cstdio
new file mode 100644
index 000000000..2ec916105
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cstdio
@@ -0,0 +1,186 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdio
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdio.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 27.8.2 C Library files
+//
+
+#ifndef _GLIBCXX_CSTDIO
+#define _GLIBCXX_CSTDIO 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+
+#include <stdio.h>
+
+// Get rid of those macros defined in <stdio.h> in lieu of real functions.
+#undef clearerr
+#undef fclose
+#undef feof
+#undef ferror
+#undef fflush
+#undef fgetc
+#undef fgetpos
+#undef fgets
+#undef fopen
+#undef fprintf
+#undef fputc
+#undef fputs
+#undef fread
+#undef freopen
+#undef fscanf
+#undef fseek
+#undef fsetpos
+#undef ftell
+#undef fwrite
+#undef getc
+#undef getchar
+#undef gets
+#undef perror
+#undef printf
+#undef putc
+#undef putchar
+#undef puts
+#undef remove
+#undef rename
+#undef rewind
+#undef scanf
+#undef setbuf
+#undef setvbuf
+#undef sprintf
+#undef sscanf
+#undef tmpfile
+#undef tmpnam
+#undef ungetc
+#undef vfprintf
+#undef vprintf
+#undef vsprintf
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::FILE;
+ using ::fpos_t;
+
+ using ::clearerr;
+ using ::fclose;
+ using ::feof;
+ using ::ferror;
+ using ::fflush;
+ using ::fgetc;
+ using ::fgetpos;
+ using ::fgets;
+ using ::fopen;
+ using ::fprintf;
+ using ::fputc;
+ using ::fputs;
+ using ::fread;
+ using ::freopen;
+ using ::fscanf;
+ using ::fseek;
+ using ::fsetpos;
+ using ::ftell;
+ using ::fwrite;
+ using ::getc;
+ using ::getchar;
+ using ::gets;
+ using ::perror;
+ using ::printf;
+ using ::putc;
+ using ::putchar;
+ using ::puts;
+ using ::remove;
+ using ::rename;
+ using ::rewind;
+ using ::scanf;
+ using ::setbuf;
+ using ::setvbuf;
+ using ::sprintf;
+ using ::sscanf;
+ using ::tmpfile;
+ using ::tmpnam;
+ using ::ungetc;
+ using ::vfprintf;
+ using ::vprintf;
+ using ::vsprintf;
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99
+
+#undef snprintf
+#undef vfscanf
+#undef vscanf
+#undef vsnprintf
+#undef vsscanf
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+ extern "C" int
+ (snprintf)(char * restrict, size_t, const char * restrict, ...);
+ extern "C" int
+ (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
+ extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
+ extern "C" int
+ (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
+ extern "C" int
+ (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
+#endif
+
+#if !_GLIBCXX_USE_C99_DYNAMIC
+ using ::snprintf;
+ using ::vfscanf;
+ using ::vscanf;
+ using ::vsnprintf;
+ using ::vsscanf;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::__gnu_cxx::snprintf;
+ using ::__gnu_cxx::vfscanf;
+ using ::__gnu_cxx::vscanf;
+ using ::__gnu_cxx::vsnprintf;
+ using ::__gnu_cxx::vsscanf;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cstdlib b/gcc-4.4.0/libstdc++-v3/include/c_std/cstdlib
new file mode 100644
index 000000000..ecb45a4e2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cstdlib
@@ -0,0 +1,222 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cstdlib
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c stdlib.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSTDLIB
+#define _GLIBCXX_CSTDLIB 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+
+#if !_GLIBCXX_HOSTED
+// The C standard does not require a freestanding implementation to
+// provide <stdlib.h>. However, the C++ standard does still require
+// <cstdlib> -- but only the functionality mentioned in
+// [lib.support.start.term].
+
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ extern "C" void abort(void);
+ extern "C" int atexit(void (*)());
+ extern "C" void exit(int);
+
+_GLIBCXX_END_NAMESPACE
+
+#else
+
+#include <stdlib.h>
+
+// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
+#undef abort
+#undef abs
+#undef atexit
+#undef atof
+#undef atoi
+#undef atol
+#undef bsearch
+#undef calloc
+#undef div
+#undef exit
+#undef free
+#undef getenv
+#undef labs
+#undef ldiv
+#undef malloc
+#undef mblen
+#undef mbstowcs
+#undef mbtowc
+#undef qsort
+#undef rand
+#undef realloc
+#undef srand
+#undef strtod
+#undef strtol
+#undef strtoul
+#undef system
+#undef wcstombs
+#undef wctomb
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::div_t;
+ using ::ldiv_t;
+
+ using ::abort;
+ using ::abs;
+ using ::atexit;
+ using ::atof;
+ using ::atoi;
+ using ::atol;
+ using ::bsearch;
+ using ::calloc;
+ using ::div;
+ using ::exit;
+ using ::free;
+ using ::getenv;
+ using ::labs;
+ using ::ldiv;
+ using ::malloc;
+#ifdef _GLIBCXX_HAVE_MBSTATE_T
+ using ::mblen;
+ using ::mbstowcs;
+ using ::mbtowc;
+#endif // _GLIBCXX_HAVE_MBSTATE_T
+ using ::qsort;
+ using ::rand;
+ using ::realloc;
+ using ::srand;
+ using ::strtod;
+ using ::strtol;
+ using ::strtoul;
+ using ::system;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ using ::wcstombs;
+ using ::wctomb;
+#endif // _GLIBCXX_USE_WCHAR_T
+
+ inline long
+ abs(long __i) { return labs(__i); }
+
+ inline ldiv_t
+ div(long __i, long __j) { return ldiv(__i, __j); }
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99
+
+#undef _Exit
+#undef llabs
+#undef lldiv
+#undef atoll
+#undef strtoll
+#undef strtoull
+#undef strtof
+#undef strtold
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::lldiv_t;
+#endif
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+ extern "C" void (_Exit)(int);
+#endif
+#if !_GLIBCXX_USE_C99_DYNAMIC
+ using ::_Exit;
+#endif
+
+ inline long long
+ abs(long long __x) { return __x >= 0 ? __x : -__x; }
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::llabs;
+
+ inline lldiv_t
+ div(long long __n, long long __d)
+ { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
+
+ using ::lldiv;
+#endif
+
+#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ extern "C" long long int (atoll)(const char *);
+ extern "C" long long int
+ (strtoll)(const char * restrict, char ** restrict, int);
+ extern "C" unsigned long long int
+ (strtoull)(const char * restrict, char ** restrict, int);
+#endif
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::atoll;
+ using ::strtoll;
+ using ::strtoull;
+#endif
+ using ::strtof;
+ using ::strtold;
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::__gnu_cxx::lldiv_t;
+#endif
+ using ::__gnu_cxx::_Exit;
+ using ::__gnu_cxx::abs;
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::__gnu_cxx::llabs;
+ using ::__gnu_cxx::div;
+ using ::__gnu_cxx::lldiv;
+#endif
+ using ::__gnu_cxx::atoll;
+ using ::__gnu_cxx::strtof;
+ using ::__gnu_cxx::strtoll;
+ using ::__gnu_cxx::strtoull;
+ using ::__gnu_cxx::strtold;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _GLIBCXX_USE_C99
+
+#endif // !_GLIBCXX_HOSTED
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cstring b/gcc-4.4.0/libstdc++-v3/include/c_std/cstring
new file mode 100644
index 000000000..63afe8c6a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cstring
@@ -0,0 +1,122 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file cstring
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c string.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.4.6 C library
+//
+
+#ifndef _GLIBCXX_CSTRING
+#define _GLIBCXX_CSTRING 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <string.h>
+
+// Get rid of those macros defined in <string.h> in lieu of real functions.
+#undef memcpy
+#undef memmove
+#undef strcpy
+#undef strncpy
+#undef strcat
+#undef strncat
+#undef memcmp
+#undef strcmp
+#undef strcoll
+#undef strncmp
+#undef strxfrm
+#undef memchr
+#undef strchr
+#undef strcspn
+#undef strpbrk
+#undef strrchr
+#undef strspn
+#undef strstr
+#undef strtok
+#undef memset
+#undef strerror
+#undef strlen
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::memcpy;
+ using ::memmove;
+ using ::strcpy;
+ using ::strncpy;
+ using ::strcat;
+ using ::strncat;
+ using ::memcmp;
+ using ::strcmp;
+ using ::strcoll;
+ using ::strncmp;
+ using ::strxfrm;
+ using ::strcspn;
+ using ::strspn;
+ using ::strtok;
+ using ::memset;
+ using ::strerror;
+ using ::strlen;
+ using ::memchr;
+ using ::strchr;
+ using ::strpbrk;
+ using ::strrchr;
+ using ::strstr;
+
+#ifndef __CORRECT_ISO_CPP_STRING_H_PROTO
+ inline void*
+ memchr(void* __p, int __c, size_t __n)
+ { return memchr(const_cast<const void*>(__p), __c, __n); }
+
+ inline char*
+ strchr(char* __s1, int __n)
+ { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
+
+ inline char*
+ strpbrk(char* __s1, const char* __s2)
+ { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
+
+ inline char*
+ strrchr(char* __s1, int __n)
+ { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
+
+ inline char*
+ strstr(char* __s1, const char* __s2)
+ { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/ctime b/gcc-4.4.0/libstdc++-v3/include/c_std/ctime
new file mode 100644
index 000000000..97f904c02
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/ctime
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/ctime
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c time.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 20.5 Date and time
+//
+
+#ifndef _GLIBCXX_CTIME
+#define _GLIBCXX_CTIME 1
+
+#pragma GCC system_header
+
+#include <cstddef>
+#include <time.h>
+
+// Get rid of those macros defined in <time.h> in lieu of real functions.
+#undef clock
+#undef difftime
+#undef mktime
+#undef time
+#undef asctime
+#undef ctime
+#undef gmtime
+#undef localtime
+#undef strftime
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::clock_t;
+ using ::time_t;
+ using ::tm;
+
+ using ::clock;
+ using ::difftime;
+ using ::mktime;
+ using ::time;
+ using ::asctime;
+ using ::ctime;
+ using ::gmtime;
+ using ::localtime;
+ using ::strftime;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cwchar b/gcc-4.4.0/libstdc++-v3/include/c_std/cwchar
new file mode 100644
index 000000000..7baee6053
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cwchar
@@ -0,0 +1,272 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cwchar
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c wchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CWCHAR
+#define _GLIBCXX_CWCHAR 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+
+#if _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+
+// Need to do a bit of trickery here with mbstate_t as char_traits
+// assumes it is in wchar.h, regardless of wchar_t specializations.
+#ifndef _GLIBCXX_HAVE_MBSTATE_T
+extern "C"
+{
+ typedef struct
+ {
+ int __fill[6];
+ } mbstate_t;
+}
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::mbstate_t;
+
+_GLIBCXX_END_NAMESPACE
+
+// Get rid of those macros defined in <wchar.h> in lieu of real functions.
+#undef btowc
+#undef fgetwc
+#undef fgetws
+#undef fputwc
+#undef fputws
+#undef fwide
+#undef fwprintf
+#undef fwscanf
+#undef getwc
+#undef getwchar
+#undef mbrlen
+#undef mbrtowc
+#undef mbsinit
+#undef mbsrtowcs
+#undef putwc
+#undef putwchar
+#undef swprintf
+#undef swscanf
+#undef ungetwc
+#undef vfwprintf
+#if _GLIBCXX_HAVE_VFWSCANF
+# undef vfwscanf
+#endif
+#undef vswprintf
+#if _GLIBCXX_HAVE_VSWSCANF
+# undef vswscanf
+#endif
+#undef vwprintf
+#if _GLIBCXX_HAVE_VWSCANF
+# undef vwscanf
+#endif
+#undef wcrtomb
+#undef wcscat
+#undef wcschr
+#undef wcscmp
+#undef wcscoll
+#undef wcscpy
+#undef wcscspn
+#undef wcsftime
+#undef wcslen
+#undef wcsncat
+#undef wcsncmp
+#undef wcsncpy
+#undef wcspbrk
+#undef wcsrchr
+#undef wcsrtombs
+#undef wcsspn
+#undef wcsstr
+#undef wcstod
+#if _GLIBCXX_HAVE_WCSTOF
+# undef wcstof
+#endif
+#undef wcstok
+#undef wcstol
+#undef wcstoul
+#undef wcsxfrm
+#undef wctob
+#undef wmemchr
+#undef wmemcmp
+#undef wmemcpy
+#undef wmemmove
+#undef wmemset
+#undef wprintf
+#undef wscanf
+
+#if _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::wint_t;
+
+ using ::btowc;
+ using ::fgetwc;
+ using ::fgetws;
+ using ::fputwc;
+ using ::fputws;
+ using ::fwide;
+ using ::fwprintf;
+ using ::fwscanf;
+ using ::getwc;
+ using ::getwchar;
+ using ::mbrlen;
+ using ::mbrtowc;
+ using ::mbsinit;
+ using ::mbsrtowcs;
+ using ::putwc;
+ using ::putwchar;
+ using ::swprintf;
+ using ::swscanf;
+ using ::ungetwc;
+ using ::vfwprintf;
+#if _GLIBCXX_HAVE_VFWSCANF
+ using ::vfwscanf;
+#endif
+ using ::vswprintf;
+#if _GLIBCXX_HAVE_VSWSCANF
+ using ::vswscanf;
+#endif
+ using ::vwprintf;
+#if _GLIBCXX_HAVE_VWSCANF
+ using ::vwscanf;
+#endif
+ using ::wcrtomb;
+ using ::wcscat;
+ using ::wcscmp;
+ using ::wcscoll;
+ using ::wcscpy;
+ using ::wcscspn;
+ using ::wcsftime;
+ using ::wcslen;
+ using ::wcsncat;
+ using ::wcsncmp;
+ using ::wcsncpy;
+ using ::wcsrtombs;
+ using ::wcsspn;
+ using ::wcstod;
+#if _GLIBCXX_HAVE_WCSTOF
+ using ::wcstof;
+#endif
+ using ::wcstok;
+ using ::wcstol;
+ using ::wcstoul;
+ using ::wcsxfrm;
+ using ::wctob;
+ using ::wmemcmp;
+ using ::wmemcpy;
+ using ::wmemmove;
+ using ::wmemset;
+ using ::wprintf;
+ using ::wscanf;
+ using ::wcschr;
+ using ::wcspbrk;
+ using ::wcsrchr;
+ using ::wcsstr;
+ using ::wmemchr;
+
+#ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO
+ inline wchar_t*
+ wcschr(wchar_t* __p, wchar_t __c)
+ { return wcschr(const_cast<const wchar_t*>(__p), __c); }
+
+ inline wchar_t*
+ wcspbrk(wchar_t* __s1, const wchar_t* __s2)
+ { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
+
+ inline wchar_t*
+ wcsrchr(wchar_t* __p, wchar_t __c)
+ { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
+
+ inline wchar_t*
+ wcsstr(wchar_t* __s1, const wchar_t* __s2)
+ { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
+
+ inline wchar_t*
+ wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
+ { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#if _GLIBCXX_USE_C99
+
+#undef wcstold
+#undef wcstoll
+#undef wcstoull
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
+ extern "C" long double
+ (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
+#endif
+#if !_GLIBCXX_USE_C99_DYNAMIC
+ using ::wcstold;
+#endif
+#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ extern "C" long long int
+ (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
+ extern "C" unsigned long long int
+ (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
+#endif
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using ::wcstoll;
+ using ::wcstoull;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::__gnu_cxx::wcstold;
+ using ::__gnu_cxx::wcstoll;
+ using ::__gnu_cxx::wcstoull;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/c_std/cwctype b/gcc-4.4.0/libstdc++-v3/include/c_std/cwctype
new file mode 100644
index 000000000..54667ec60
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/c_std/cwctype
@@ -0,0 +1,107 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cwctype
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the "*.h" implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c wctype.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: <cwctype>
+//
+
+#ifndef _GLIBCXX_CWCTYPE
+#define _GLIBCXX_CWCTYPE 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#if _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
+
+// Get rid of those macros defined in <wctype.h> in lieu of real functions.
+#undef iswalnum
+#undef iswalpha
+#if _GLIBCXX_HAVE_ISWBLANK
+# undef iswblank
+#endif
+#undef iswcntrl
+#undef iswctype
+#undef iswdigit
+#undef iswgraph
+#undef iswlower
+#undef iswprint
+#undef iswpunct
+#undef iswspace
+#undef iswupper
+#undef iswxdigit
+#undef towctrans
+#undef towlower
+#undef towupper
+#undef wctrans
+#undef wctype
+
+#if _GLIBCXX_USE_WCHAR_T
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using ::wint_t; // cwchar
+
+ using ::wctype_t;
+ using ::wctrans_t;
+
+ using ::iswalnum;
+ using ::iswalpha;
+#if _GLIBCXX_HAVE_ISWBLANK
+ using ::iswblank;
+#endif
+ using ::iswcntrl;
+ using ::iswctype;
+ using ::iswdigit;
+ using ::iswgraph;
+ using ::iswlower;
+ using ::iswprint;
+ using ::iswpunct;
+ using ::iswspace;
+ using ::iswupper;
+ using ::iswxdigit;
+ using ::towctrans;
+ using ::towlower;
+ using ::towupper;
+ using ::wctrans;
+ using ::wctype;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif //_GLIBCXX_USE_WCHAR_T
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/bitset b/gcc-4.4.0/libstdc++-v3/include/debug/bitset
new file mode 100644
index 000000000..b4934423b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/bitset
@@ -0,0 +1,369 @@
+// Debugging bitset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/bitset
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_BITSET
+#define _GLIBCXX_DEBUG_BITSET
+
+#include <bitset>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std
+{
+namespace __debug
+{
+ template<size_t _Nb>
+ class bitset
+ : public _GLIBCXX_STD_D::bitset<_Nb>,
+ public __gnu_debug::_Safe_sequence_base
+ {
+ typedef _GLIBCXX_STD_D::bitset<_Nb> _Base;
+ typedef __gnu_debug::_Safe_sequence_base _Safe_base;
+
+ public:
+ // bit reference:
+ class reference
+ : private _Base::reference, public __gnu_debug::_Safe_iterator_base
+ {
+ typedef typename _Base::reference _Base_ref;
+
+ friend class bitset;
+ reference();
+
+ reference(const _Base_ref& __base, bitset* __seq)
+ : _Base_ref(__base), _Safe_iterator_base(__seq, false)
+ { }
+
+ public:
+ reference(const reference& __x)
+ : _Base_ref(__x), _Safe_iterator_base(__x, false)
+ { }
+
+ reference&
+ operator=(bool __x)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+ _M_message(__gnu_debug::__msg_bad_bitset_write)
+ ._M_iterator(*this));
+ *static_cast<_Base_ref*>(this) = __x;
+ return *this;
+ }
+
+ reference&
+ operator=(const reference& __x)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
+ _M_message(__gnu_debug::__msg_bad_bitset_read)
+ ._M_iterator(__x));
+ _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+ _M_message(__gnu_debug::__msg_bad_bitset_write)
+ ._M_iterator(*this));
+ *static_cast<_Base_ref*>(this) = __x;
+ return *this;
+ }
+
+ bool
+ operator~() const
+ {
+ _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+ _M_message(__gnu_debug::__msg_bad_bitset_read)
+ ._M_iterator(*this));
+ return ~(*static_cast<const _Base_ref*>(this));
+ }
+
+ operator bool() const
+ {
+ _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+ _M_message(__gnu_debug::__msg_bad_bitset_read)
+ ._M_iterator(*this));
+ return *static_cast<const _Base_ref*>(this);
+ }
+
+ reference&
+ flip()
+ {
+ _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+ _M_message(__gnu_debug::__msg_bad_bitset_flip)
+ ._M_iterator(*this));
+ _Base_ref::flip();
+ return *this;
+ }
+ };
+
+ // 23.3.5.1 constructors:
+ bitset() : _Base() { }
+
+ bitset(unsigned long __val) : _Base(__val) { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ explicit
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __pos = 0,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __n = (std::basic_string<_CharT, _Traits, _Alloc>::npos))
+ : _Base(__str, __pos, __n) { }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __pos,
+ typename std::basic_string<_CharT, _Traits, _Alloc>::size_type
+ __n,
+ _CharT __zero, _CharT __one = _CharT('1'))
+ : _Base(__str, __pos, __n, __zero, __one) { }
+
+ bitset(const _Base& __x) : _Base(__x), _Safe_base() { }
+
+ // 23.3.5.2 bitset operations:
+ bitset<_Nb>&
+ operator&=(const bitset<_Nb>& __rhs)
+ {
+ _M_base() &= __rhs;
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator|=(const bitset<_Nb>& __rhs)
+ {
+ _M_base() |= __rhs;
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator^=(const bitset<_Nb>& __rhs)
+ {
+ _M_base() ^= __rhs;
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator<<=(size_t __pos)
+ {
+ _M_base() <<= __pos;
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator>>=(size_t __pos)
+ {
+ _M_base() >>= __pos;
+ return *this;
+ }
+
+ bitset<_Nb>&
+ set()
+ {
+ _Base::set();
+ return *this;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 186. bitset::set() second parameter should be bool
+ bitset<_Nb>&
+ set(size_t __pos, bool __val = true)
+ {
+ _Base::set(__pos, __val);
+ return *this;
+ }
+
+ bitset<_Nb>&
+ reset()
+ {
+ _Base::reset();
+ return *this;
+ }
+
+ bitset<_Nb>&
+ reset(size_t __pos)
+ {
+ _Base::reset(__pos);
+ return *this;
+ }
+
+ bitset<_Nb> operator~() const { return bitset(~_M_base()); }
+
+ bitset<_Nb>&
+ flip()
+ {
+ _Base::flip();
+ return *this;
+ }
+
+ bitset<_Nb>&
+ flip(size_t __pos)
+ {
+ _Base::flip(__pos);
+ return *this;
+ }
+
+ // element access:
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 11. Bitset minor problems
+ reference
+ operator[](size_t __pos)
+ {
+ __glibcxx_check_subscript(__pos);
+ return reference(_M_base()[__pos], this);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 11. Bitset minor problems
+ bool
+ operator[](size_t __pos) const
+ {
+ __glibcxx_check_subscript(__pos);
+ return _M_base()[__pos];
+ }
+
+ using _Base::to_ulong;
+
+ template <typename _CharT, typename _Traits, typename _Alloc>
+ std::basic_string<_CharT, _Traits, _Alloc>
+ to_string() const
+ { return _M_base().template to_string<_CharT, _Traits, _Alloc>(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits, class _Alloc>
+ std::basic_string<_CharT, _Traits, _Alloc>
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ {
+ return _M_base().template
+ to_string<_CharT, _Traits, _Alloc>(__zero, __one);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 434. bitset::to_string() hard to use.
+ template<typename _CharT, typename _Traits>
+ std::basic_string<_CharT, _Traits, std::allocator<_CharT> >
+ to_string() const
+ { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 853. to_string needs updating with zero and one.
+ template<class _CharT, class _Traits>
+ std::basic_string<_CharT, _Traits, std::allocator<_CharT> >
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ { return to_string<_CharT, _Traits,
+ std::allocator<_CharT> >(__zero, __one); }
+
+ template<typename _CharT>
+ std::basic_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >
+ to_string() const
+ {
+ return to_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >();
+ }
+
+ template<class _CharT>
+ std::basic_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ {
+ return to_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >(__zero, __one);
+ }
+
+ std::basic_string<char, std::char_traits<char>, std::allocator<char> >
+ to_string() const
+ {
+ return to_string<char,std::char_traits<char>,std::allocator<char> >();
+ }
+
+ std::basic_string<char, std::char_traits<char>, std::allocator<char> >
+ to_string(char __zero, char __one = '1') const
+ {
+ return to_string<char, std::char_traits<char>,
+ std::allocator<char> >(__zero, __one);
+ }
+
+ using _Base::count;
+ using _Base::size;
+
+ bool
+ operator==(const bitset<_Nb>& __rhs) const
+ { return _M_base() == __rhs; }
+
+ bool
+ operator!=(const bitset<_Nb>& __rhs) const
+ { return _M_base() != __rhs; }
+
+ using _Base::test;
+ using _Base::all;
+ using _Base::any;
+ using _Base::none;
+
+ bitset<_Nb>
+ operator<<(size_t __pos) const
+ { return bitset<_Nb>(_M_base() << __pos); }
+
+ bitset<_Nb>
+ operator>>(size_t __pos) const
+ { return bitset<_Nb>(_M_base() >> __pos); }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+ };
+
+ template<size_t _Nb>
+ bitset<_Nb>
+ operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ { return bitset<_Nb>(__x) &= __y; }
+
+ template<size_t _Nb>
+ bitset<_Nb>
+ operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ { return bitset<_Nb>(__x) |= __y; }
+
+ template<size_t _Nb>
+ bitset<_Nb>
+ operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ { return bitset<_Nb>(__x) ^= __y; }
+
+ template<typename _CharT, typename _Traits, size_t _Nb>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
+ { return __is >> __x._M_base(); }
+
+ template<typename _CharT, typename _Traits, size_t _Nb>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bitset<_Nb>& __x)
+ { return __os << __x._M_base(); }
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/debug.h b/gcc-4.4.0/libstdc++-v3/include/debug/debug.h
new file mode 100644
index 000000000..305299b2f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/debug.h
@@ -0,0 +1,130 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/debug.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H
+#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1
+
+/** Macros and namespaces used by the implementation outside of debug
+ * wrappers to verify certain properties. The __glibcxx_requires_xxx
+ * macros are merely wrappers around the __glibcxx_check_xxx wrappers
+ * when we are compiling with debug mode, but disappear when we are
+ * in release mode so that there is no checking performed in, e.g.,
+ * the standard library algorithms.
+*/
+
+// Debug mode namespaces.
+
+/**
+ * @namespace std::__debug
+ * @brief GNU debug code, replaces standard behavior with debug behavior.
+ */
+namespace std
+{
+ namespace __debug { }
+}
+
+/** @namespace __gnu_debug
+ * @brief GNU debug classes for public use.
+*/
+namespace __gnu_debug
+{
+ using namespace std::__debug;
+}
+
+#ifndef _GLIBCXX_DEBUG
+
+# define _GLIBCXX_DEBUG_ASSERT(_Condition)
+# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
+# define _GLIBCXX_DEBUG_ONLY(_Statement) ;
+# define __glibcxx_requires_cond(_Cond,_Msg)
+# define __glibcxx_requires_valid_range(_First,_Last)
+# define __glibcxx_requires_sorted(_First,_Last)
+# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
+# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2)
+# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred)
+# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value)
+# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value)
+# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred)
+# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred)
+# define __glibcxx_requires_heap(_First,_Last)
+# define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
+# define __glibcxx_requires_nonempty()
+# define __glibcxx_requires_string(_String)
+# define __glibcxx_requires_string_len(_String,_Len)
+# define __glibcxx_requires_subscript(_N)
+
+#else
+
+# include <debug/macros.h>
+
+#define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition)
+
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
+#else
+# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
+#endif
+
+# define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement
+
+# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
+# define __glibcxx_requires_valid_range(_First,_Last) \
+ __glibcxx_check_valid_range(_First,_Last)
+# define __glibcxx_requires_sorted(_First,_Last) \
+ __glibcxx_check_sorted(_First,_Last)
+# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
+ __glibcxx_check_sorted_pred(_First,_Last,_Pred)
+# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \
+ __glibcxx_check_sorted_set(_First1,_Last1,_First2)
+# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \
+ __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred)
+# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \
+ __glibcxx_check_partitioned_lower(_First,_Last,_Value)
+# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \
+ __glibcxx_check_partitioned_upper(_First,_Last,_Value)
+# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \
+ __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred)
+# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \
+ __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred)
+# define __glibcxx_requires_heap(_First,_Last) \
+ __glibcxx_check_heap(_First,_Last)
+# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
+ __glibcxx_check_heap_pred(_First,_Last,_Pred)
+# define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
+# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
+# define __glibcxx_requires_string_len(_String,_Len) \
+ __glibcxx_check_string_len(_String,_Len)
+# define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
+
+# include <debug/functions.h>
+# include <debug/formatter.h>
+
+#endif
+
+#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/deque b/gcc-4.4.0/libstdc++-v3/include/debug/deque
new file mode 100644
index 000000000..b481fd14b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/deque
@@ -0,0 +1,515 @@
+// Debugging deque implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/deque
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_DEQUE
+#define _GLIBCXX_DEBUG_DEQUE 1
+
+#include <deque>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+ class deque
+ : public _GLIBCXX_STD_D::deque<_Tp, _Allocator>,
+ public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::deque<_Tp, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<deque> _Safe_base;
+
+ public:
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,deque>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,deque>
+ const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // 23.2.1.1 construct/copy/destroy:
+ explicit deque(const _Allocator& __a = _Allocator())
+ : _Base(__a) { }
+
+ explicit deque(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+
+ template<class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)
+ { }
+
+ deque(const deque& __x)
+ : _Base(__x), _Safe_base() { }
+
+ deque(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ deque(deque&& __x)
+ : _Base(std::forward<deque>(__x)), _Safe_base()
+ { this->_M_swap(__x); }
+
+ deque(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __a), _Safe_base() { }
+#endif
+
+ ~deque() { }
+
+ deque&
+ operator=(const deque& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ deque&
+ operator=(deque&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ deque&
+ operator=(initializer_list<value_type> __l)
+ {
+ *static_cast<_Base*>(this) = __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif
+
+ template<class _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::assign(__first, __last);
+ this->_M_invalidate_all();
+ }
+
+ void
+ assign(size_type __n, const _Tp& __t)
+ {
+ _Base::assign(__n, __t);
+ this->_M_invalidate_all();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ assign(initializer_list<value_type> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ }
+#endif
+
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // 23.2.1.2 capacity:
+ using _Base::size;
+ using _Base::max_size;
+
+ void
+ resize(size_type __sz, _Tp __c = _Tp())
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
+
+ bool __invalidate_all = __sz > this->size();
+ if (__sz < this->size())
+ this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
+
+ _Base::resize(__sz, __c);
+
+ if (__invalidate_all)
+ this->_M_invalidate_all();
+ }
+
+ using _Base::empty;
+
+ // element access:
+ reference
+ operator[](size_type __n)
+ {
+ __glibcxx_check_subscript(__n);
+ return _M_base()[__n];
+ }
+
+ const_reference
+ operator[](size_type __n) const
+ {
+ __glibcxx_check_subscript(__n);
+ return _M_base()[__n];
+ }
+
+ using _Base::at;
+
+ reference
+ front()
+ {
+ __glibcxx_check_nonempty();
+ return _Base::front();
+ }
+
+ const_reference
+ front() const
+ {
+ __glibcxx_check_nonempty();
+ return _Base::front();
+ }
+
+ reference
+ back()
+ {
+ __glibcxx_check_nonempty();
+ return _Base::back();
+ }
+
+ const_reference
+ back() const
+ {
+ __glibcxx_check_nonempty();
+ return _Base::back();
+ }
+
+ // 23.2.1.3 modifiers:
+ void
+ push_front(const _Tp& __x)
+ {
+ _Base::push_front(__x);
+ this->_M_invalidate_all();
+ }
+
+ void
+ push_back(const _Tp& __x)
+ {
+ _Base::push_back(__x);
+ this->_M_invalidate_all();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_front(_Tp&& __x)
+ { emplace_front(std::move(__x)); }
+
+ void
+ push_back(_Tp&& __x)
+ { emplace_back(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_front(_Args&&... __args)
+ {
+ _Base::emplace_front(std::forward<_Args>(__args)...);
+ this->_M_invalidate_all();
+ }
+
+ template<typename... _Args>
+ void
+ emplace_back(_Args&&... __args)
+ {
+ _Base::emplace_back(std::forward<_Args>(__args)...);
+ this->_M_invalidate_all();
+ }
+
+ template<typename... _Args>
+ iterator
+ emplace(iterator __position, _Args&&... __args)
+ {
+ __glibcxx_check_insert(__position);
+ typename _Base::iterator __res = _Base::emplace(__position.base(),
+ std::forward<_Args>(__args)...);
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+#endif
+
+ iterator
+ insert(iterator __position, const _Tp& __x)
+ {
+ __glibcxx_check_insert(__position);
+ typename _Base::iterator __res = _Base::insert(__position.base(), __x);
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ iterator
+ insert(iterator __position, _Tp&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ {
+ _Base::insert(__p, __l);
+ this->_M_invalidate_all();
+ }
+#endif
+
+ void
+ insert(iterator __position, size_type __n, const _Tp& __x)
+ {
+ __glibcxx_check_insert(__position);
+ _Base::insert(__position.base(), __n, __x);
+ this->_M_invalidate_all();
+ }
+
+ template<class _InputIterator>
+ void
+ insert(iterator __position,
+ _InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_insert_range(__position, __first, __last);
+ _Base::insert(__position.base(), __first, __last);
+ this->_M_invalidate_all();
+ }
+
+ void
+ pop_front()
+ {
+ __glibcxx_check_nonempty();
+ iterator __victim = begin();
+ __victim._M_invalidate();
+ _Base::pop_front();
+ }
+
+ void
+ pop_back()
+ {
+ __glibcxx_check_nonempty();
+ iterator __victim = end();
+ --__victim;
+ __victim._M_invalidate();
+ _Base::pop_back();
+ }
+
+ iterator
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ if (__position == begin() || __position == end()-1)
+ {
+ __position._M_invalidate();
+ return iterator(_Base::erase(__position.base()), this);
+ }
+ else
+ {
+ typename _Base::iterator __res = _Base::erase(__position.base());
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+ if (__first == begin() || __last == end())
+ {
+ this->_M_detach_singular();
+ for (iterator __position = __first; __position != __last; )
+ {
+ iterator __victim = __position++;
+ __victim._M_invalidate();
+ }
+ __try
+ {
+ return iterator(_Base::erase(__first.base(), __last.base()),
+ this);
+ }
+ __catch(...)
+ {
+ this->_M_revalidate_singular();
+ __throw_exception_again;
+ }
+ }
+ else
+ {
+ typename _Base::iterator __res = _Base::erase(__first.base(),
+ __last.base());
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(deque&& __x)
+#else
+ swap(deque& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+ };
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>&& __lhs, deque<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/formatter.h b/gcc-4.4.0/libstdc++-v3/include/debug/formatter.h
new file mode 100644
index 000000000..0538edb15
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/formatter.h
@@ -0,0 +1,392 @@
+// Debug-mode error formatting implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/formatter.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_FORMATTER_H
+#define _GLIBCXX_DEBUG_FORMATTER_H 1
+
+#include <typeinfo>
+#include <debug/debug.h>
+
+namespace __gnu_debug
+{
+ using std::type_info;
+
+ /** Determine if the two types are the same. */
+ template<typename _Type1, typename _Type2>
+ struct __is_same
+ {
+ static const bool value = false;
+ };
+
+ template<typename _Type>
+ struct __is_same<_Type, _Type>
+ {
+ static const bool value = true;
+ };
+
+ template<bool> struct __truth { };
+
+ class _Safe_sequence_base;
+
+ template<typename _Iterator, typename _Sequence>
+ class _Safe_iterator;
+
+ template<typename _Sequence>
+ class _Safe_sequence;
+
+ enum _Debug_msg_id
+ {
+ // General checks
+ __msg_valid_range,
+ __msg_insert_singular,
+ __msg_insert_different,
+ __msg_erase_bad,
+ __msg_erase_different,
+ __msg_subscript_oob,
+ __msg_empty,
+ __msg_unpartitioned,
+ __msg_unpartitioned_pred,
+ __msg_unsorted,
+ __msg_unsorted_pred,
+ __msg_not_heap,
+ __msg_not_heap_pred,
+ // std::bitset checks
+ __msg_bad_bitset_write,
+ __msg_bad_bitset_read,
+ __msg_bad_bitset_flip,
+ // std::list checks
+ __msg_self_splice,
+ __msg_splice_alloc,
+ __msg_splice_bad,
+ __msg_splice_other,
+ __msg_splice_overlap,
+ // iterator checks
+ __msg_init_singular,
+ __msg_init_copy_singular,
+ __msg_init_const_singular,
+ __msg_copy_singular,
+ __msg_bad_deref,
+ __msg_bad_inc,
+ __msg_bad_dec,
+ __msg_iter_subscript_oob,
+ __msg_advance_oob,
+ __msg_retreat_oob,
+ __msg_iter_compare_bad,
+ __msg_compare_different,
+ __msg_iter_order_bad,
+ __msg_order_different,
+ __msg_distance_bad,
+ __msg_distance_different,
+ // istream_iterator
+ __msg_deref_istream,
+ __msg_inc_istream,
+ // ostream_iterator
+ __msg_output_ostream,
+ // istreambuf_iterator
+ __msg_deref_istreambuf,
+ __msg_inc_istreambuf
+ };
+
+ class _Error_formatter
+ {
+ /// Whether an iterator is constant, mutable, or unknown
+ enum _Constness
+ {
+ __unknown_constness,
+ __const_iterator,
+ __mutable_iterator,
+ __last_constness
+ };
+
+ // The state of the iterator (fine-grained), if we know it.
+ enum _Iterator_state
+ {
+ __unknown_state,
+ __singular, // singular, may still be attached to a sequence
+ __begin, // dereferenceable, and at the beginning
+ __middle, // dereferenceable, not at the beginning
+ __end, // past-the-end, may be at beginning if sequence empty
+ __last_state
+ };
+
+ // Tags denoting the type of parameter for construction
+ struct _Is_iterator { };
+ struct _Is_sequence { };
+
+ // A parameter that may be referenced by an error message
+ struct _Parameter
+ {
+ enum
+ {
+ __unused_param,
+ __iterator,
+ __sequence,
+ __integer,
+ __string
+ } _M_kind;
+
+ union
+ {
+ // When _M_kind == __iterator
+ struct
+ {
+ const char* _M_name;
+ const void* _M_address;
+ const type_info* _M_type;
+ _Constness _M_constness;
+ _Iterator_state _M_state;
+ const void* _M_sequence;
+ const type_info* _M_seq_type;
+ } _M_iterator;
+
+ // When _M_kind == __sequence
+ struct
+ {
+ const char* _M_name;
+ const void* _M_address;
+ const type_info* _M_type;
+ } _M_sequence;
+
+ // When _M_kind == __integer
+ struct
+ {
+ const char* _M_name;
+ long _M_value;
+ } _M_integer;
+
+ // When _M_kind == __string
+ struct
+ {
+ const char* _M_name;
+ const char* _M_value;
+ } _M_string;
+ } _M_variant;
+
+ _Parameter() : _M_kind(__unused_param), _M_variant() { }
+
+ _Parameter(long __value, const char* __name)
+ : _M_kind(__integer), _M_variant()
+ {
+ _M_variant._M_integer._M_name = __name;
+ _M_variant._M_integer._M_value = __value;
+ }
+
+ _Parameter(const char* __value, const char* __name)
+ : _M_kind(__string), _M_variant()
+ {
+ _M_variant._M_string._M_name = __name;
+ _M_variant._M_string._M_value = __value;
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it,
+ const char* __name, _Is_iterator)
+ : _M_kind(__iterator), _M_variant()
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness =
+ __is_same<_Safe_iterator<_Iterator, _Sequence>,
+ typename _Sequence::iterator>::
+ value? __mutable_iterator : __const_iterator;
+ _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
+ _M_variant._M_iterator._M_seq_type = &typeid(_Sequence);
+
+ if (__it._M_singular())
+ _M_variant._M_iterator._M_state = __singular;
+ else
+ {
+ bool __is_begin = __it._M_is_begin();
+ bool __is_end = __it._M_is_end();
+ if (__is_end)
+ _M_variant._M_iterator._M_state = __end;
+ else if (__is_begin)
+ _M_variant._M_iterator._M_state = __begin;
+ else
+ _M_variant._M_iterator._M_state = __middle;
+ }
+ }
+
+ template<typename _Type>
+ _Parameter(const _Type*& __it, const char* __name, _Is_iterator)
+ : _M_kind(__iterator), _M_variant()
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness = __mutable_iterator;
+ _M_variant._M_iterator._M_state = __it? __unknown_state : __singular;
+ _M_variant._M_iterator._M_sequence = 0;
+ _M_variant._M_iterator._M_seq_type = 0;
+ }
+
+ template<typename _Type>
+ _Parameter(_Type*& __it, const char* __name, _Is_iterator)
+ : _M_kind(__iterator), _M_variant()
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness = __const_iterator;
+ _M_variant._M_iterator._M_state = __it? __unknown_state : __singular;
+ _M_variant._M_iterator._M_sequence = 0;
+ _M_variant._M_iterator._M_seq_type = 0;
+ }
+
+ template<typename _Iterator>
+ _Parameter(const _Iterator& __it, const char* __name, _Is_iterator)
+ : _M_kind(__iterator), _M_variant()
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness = __unknown_constness;
+ _M_variant._M_iterator._M_state =
+ __gnu_debug::__check_singular(__it)? __singular : __unknown_state;
+ _M_variant._M_iterator._M_sequence = 0;
+ _M_variant._M_iterator._M_seq_type = 0;
+ }
+
+ template<typename _Sequence>
+ _Parameter(const _Safe_sequence<_Sequence>& __seq,
+ const char* __name, _Is_sequence)
+ : _M_kind(__sequence), _M_variant()
+ {
+ _M_variant._M_sequence._M_name = __name;
+ _M_variant._M_sequence._M_address =
+ static_cast<const _Sequence*>(&__seq);
+ _M_variant._M_sequence._M_type = &typeid(_Sequence);
+ }
+
+ template<typename _Sequence>
+ _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence)
+ : _M_kind(__sequence), _M_variant()
+ {
+ _M_variant._M_sequence._M_name = __name;
+ _M_variant._M_sequence._M_address = &__seq;
+ _M_variant._M_sequence._M_type = &typeid(_Sequence);
+ }
+
+ void
+ _M_print_field(const _Error_formatter* __formatter,
+ const char* __name) const;
+
+ void
+ _M_print_description(const _Error_formatter* __formatter) const;
+ };
+
+ friend struct _Parameter;
+
+ public:
+ template<typename _Iterator>
+ const _Error_formatter&
+ _M_iterator(const _Iterator& __it, const char* __name = 0) const
+ {
+ if (_M_num_parameters < size_t(__max_parameters))
+ _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
+ _Is_iterator());
+ return *this;
+ }
+
+ const _Error_formatter&
+ _M_integer(long __value, const char* __name = 0) const
+ {
+ if (_M_num_parameters < size_t(__max_parameters))
+ _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
+ return *this;
+ }
+
+ const _Error_formatter&
+ _M_string(const char* __value, const char* __name = 0) const
+ {
+ if (_M_num_parameters < size_t(__max_parameters))
+ _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
+ return *this;
+ }
+
+ template<typename _Sequence>
+ const _Error_formatter&
+ _M_sequence(const _Sequence& __seq, const char* __name = 0) const
+ {
+ if (_M_num_parameters < size_t(__max_parameters))
+ _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
+ _Is_sequence());
+ return *this;
+ }
+
+ const _Error_formatter&
+ _M_message(const char* __text) const
+ { _M_text = __text; return *this; }
+
+ const _Error_formatter&
+ _M_message(_Debug_msg_id __id) const;
+
+ void
+ _M_error() const;
+
+ private:
+ _Error_formatter(const char* __file, size_t __line)
+ : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0),
+ _M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false)
+ { _M_get_max_length(); }
+
+ template<typename _Tp>
+ void
+ _M_format_word(char*, int, const char*, _Tp) const;
+
+ void
+ _M_print_word(const char* __word) const;
+
+ void
+ _M_print_string(const char* __string) const;
+
+ void
+ _M_get_max_length() const;
+
+ enum { __max_parameters = 9 };
+
+ const char* _M_file;
+ size_t _M_line;
+ mutable _Parameter _M_parameters[__max_parameters];
+ mutable size_t _M_num_parameters;
+ mutable const char* _M_text;
+ mutable size_t _M_max_length;
+ enum { _M_indent = 4 } ;
+ mutable size_t _M_column;
+ mutable bool _M_first_line;
+ mutable bool _M_wordwrap;
+
+ public:
+ static _Error_formatter
+ _M_at(const char* __file, size_t __line)
+ { return _Error_formatter(__file, __line); }
+ };
+} // namespace __gnu_debug
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/functions.h b/gcc-4.4.0/libstdc++-v3/include/debug/functions.h
new file mode 100644
index 000000000..a4b1d7858
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/functions.h
@@ -0,0 +1,383 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/functions.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H
+#define _GLIBCXX_DEBUG_FUNCTIONS_H 1
+
+#include <bits/c++config.h>
+#include <cstddef> // for ptrdiff_t
+#include <bits/stl_iterator_base_types.h> // for iterator_traits, categories
+#include <bits/cpp_type_traits.h> // for __is_integer
+
+namespace __gnu_debug
+{
+ template<typename _Iterator, typename _Sequence>
+ class _Safe_iterator;
+
+ // An arbitrary iterator pointer is not singular.
+ inline bool
+ __check_singular_aux(const void*) { return false; }
+
+ // We may have an iterator that derives from _Safe_iterator_base but isn't
+ // a _Safe_iterator.
+ template<typename _Iterator>
+ inline bool
+ __check_singular(_Iterator& __x)
+ { return __check_singular_aux(&__x); }
+
+ /** Non-NULL pointers are nonsingular. */
+ template<typename _Tp>
+ inline bool
+ __check_singular(const _Tp* __ptr)
+ { return __ptr == 0; }
+
+ /** Safe iterators know if they are singular. */
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ __check_singular(const _Safe_iterator<_Iterator, _Sequence>& __x)
+ { return __x._M_singular(); }
+
+ /** Assume that some arbitrary iterator is dereferenceable, because we
+ can't prove that it isn't. */
+ template<typename _Iterator>
+ inline bool
+ __check_dereferenceable(_Iterator&)
+ { return true; }
+
+ /** Non-NULL pointers are dereferenceable. */
+ template<typename _Tp>
+ inline bool
+ __check_dereferenceable(const _Tp* __ptr)
+ { return __ptr; }
+
+ /** Safe iterators know if they are singular. */
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ __check_dereferenceable(const _Safe_iterator<_Iterator, _Sequence>& __x)
+ { return __x._M_dereferenceable(); }
+
+ /** If the distance between two random access iterators is
+ * nonnegative, assume the range is valid.
+ */
+ template<typename _RandomAccessIterator>
+ inline bool
+ __valid_range_aux2(const _RandomAccessIterator& __first,
+ const _RandomAccessIterator& __last,
+ std::random_access_iterator_tag)
+ { return __last - __first >= 0; }
+
+ /** Can't test for a valid range with input iterators, because
+ * iteration may be destructive. So we just assume that the range
+ * is valid.
+ */
+ template<typename _InputIterator>
+ inline bool
+ __valid_range_aux2(const _InputIterator&, const _InputIterator&,
+ std::input_iterator_tag)
+ { return true; }
+
+ /** We say that integral types for a valid range, and defer to other
+ * routines to realize what to do with integral types instead of
+ * iterators.
+ */
+ template<typename _Integral>
+ inline bool
+ __valid_range_aux(const _Integral&, const _Integral&, std::__true_type)
+ { return true; }
+
+ /** We have iterators, so figure out what kind of iterators that are
+ * to see if we can check the range ahead of time.
+ */
+ template<typename _InputIterator>
+ inline bool
+ __valid_range_aux(const _InputIterator& __first,
+ const _InputIterator& __last, std::__false_type)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::iterator_category
+ _Category;
+ return __valid_range_aux2(__first, __last, _Category());
+ }
+
+ /** Don't know what these iterators are, or if they are even
+ * iterators (we may get an integral type for InputIterator), so
+ * see if they are integral and pass them on to the next phase
+ * otherwise.
+ */
+ template<typename _InputIterator>
+ inline bool
+ __valid_range(const _InputIterator& __first, const _InputIterator& __last)
+ {
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ return __valid_range_aux(__first, __last, _Integral());
+ }
+
+ /** Safe iterators know how to check if they form a valid range. */
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ __valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first,
+ const _Safe_iterator<_Iterator, _Sequence>& __last)
+ { return __first._M_valid_range(__last); }
+
+ /* Checks that [first, last) is a valid range, and then returns
+ * __first. This routine is useful when we can't use a separate
+ * assertion statement because, e.g., we are in a constructor.
+ */
+ template<typename _InputIterator>
+ inline _InputIterator
+ __check_valid_range(const _InputIterator& __first,
+ const _InputIterator& __last
+ __attribute__((__unused__)))
+ {
+ _GLIBCXX_DEBUG_ASSERT(__valid_range(__first, __last));
+ return __first;
+ }
+
+ /** Checks that __s is non-NULL or __n == 0, and then returns __s. */
+ template<typename _CharT, typename _Integer>
+ inline const _CharT*
+ __check_string(const _CharT* __s,
+ const _Integer& __n __attribute__((__unused__)))
+ {
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+ _GLIBCXX_DEBUG_ASSERT(__s != 0 || __n == 0);
+#endif
+ return __s;
+ }
+
+ /** Checks that __s is non-NULL and then returns __s. */
+ template<typename _CharT>
+ inline const _CharT*
+ __check_string(const _CharT* __s)
+ {
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+ _GLIBCXX_DEBUG_ASSERT(__s != 0);
+#endif
+ return __s;
+ }
+
+ // Can't check if an input iterator sequence is sorted, because we
+ // can't step through the sequence.
+ template<typename _InputIterator>
+ inline bool
+ __check_sorted_aux(const _InputIterator&, const _InputIterator&,
+ std::input_iterator_tag)
+ { return true; }
+
+ // Can verify if a forward iterator sequence is in fact sorted using
+ // std::__is_sorted
+ template<typename _ForwardIterator>
+ inline bool
+ __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,
+ std::forward_iterator_tag)
+ {
+ if (__first == __last)
+ return true;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (*__next < *__first)
+ return false;
+
+ return true;
+ }
+
+ // Can't check if an input iterator sequence is sorted, because we can't step
+ // through the sequence.
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ __check_sorted_aux(const _InputIterator&, const _InputIterator&,
+ _Predicate, std::input_iterator_tag)
+ { return true; }
+
+ // Can verify if a forward iterator sequence is in fact sorted using
+ // std::__is_sorted
+ template<typename _ForwardIterator, typename _Predicate>
+ inline bool
+ __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred, std::forward_iterator_tag)
+ {
+ if (__first == __last)
+ return true;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (__pred(*__next, *__first))
+ return false;
+
+ return true;
+ }
+
+ // Determine if a sequence is sorted.
+ template<typename _InputIterator>
+ inline bool
+ __check_sorted(const _InputIterator& __first, const _InputIterator& __last)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::iterator_category
+ _Category;
+
+ // Verify that the < operator for elements in the sequence is a
+ // StrictWeakOrdering by checking that it is irreflexive.
+ _GLIBCXX_DEBUG_ASSERT(__first == __last || !(*__first < *__first));
+
+ return __check_sorted_aux(__first, __last, _Category());
+ }
+
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ __check_sorted(const _InputIterator& __first, const _InputIterator& __last,
+ _Predicate __pred)
+ {
+ typedef typename std::iterator_traits<_InputIterator>::iterator_category
+ _Category;
+
+ // Verify that the predicate is StrictWeakOrdering by checking that it
+ // is irreflexive.
+ _GLIBCXX_DEBUG_ASSERT(__first == __last || !__pred(*__first, *__first));
+
+ return __check_sorted_aux(__first, __last, __pred, _Category());
+ }
+
+ template<typename _InputIterator>
+ inline bool
+ __check_sorted_set_aux(const _InputIterator& __first,
+ const _InputIterator& __last,
+ std::__true_type)
+ { return __check_sorted(__first, __last); }
+
+ template<typename _InputIterator>
+ inline bool
+ __check_sorted_set_aux(const _InputIterator&,
+ const _InputIterator&,
+ std::__false_type)
+ { return true; }
+
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ __check_sorted_set_aux(const _InputIterator& __first,
+ const _InputIterator& __last,
+ _Predicate __pred, std::__true_type)
+ { return __check_sorted(__first, __last, __pred); }
+
+ template<typename _InputIterator, typename _Predicate>
+ inline bool
+ __check_sorted_set_aux(const _InputIterator&,
+ const _InputIterator&, _Predicate,
+ std::__false_type)
+ { return true; }
+
+ // ... special variant used in std::merge, std::includes, std::set_*.
+ template<typename _InputIterator1, typename _InputIterator2>
+ inline bool
+ __check_sorted_set(const _InputIterator1& __first,
+ const _InputIterator1& __last,
+ const _InputIterator2&)
+ {
+ typedef typename std::iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename std::iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ typedef typename std::__are_same<_ValueType1, _ValueType2>::__type
+ _SameType;
+ return __check_sorted_set_aux(__first, __last, _SameType());
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _Predicate>
+ inline bool
+ __check_sorted_set(const _InputIterator1& __first,
+ const _InputIterator1& __last,
+ const _InputIterator2&, _Predicate __pred)
+ {
+ typedef typename std::iterator_traits<_InputIterator1>::value_type
+ _ValueType1;
+ typedef typename std::iterator_traits<_InputIterator2>::value_type
+ _ValueType2;
+
+ typedef typename std::__are_same<_ValueType1, _ValueType2>::__type
+ _SameType;
+ return __check_sorted_set_aux(__first, __last, __pred, _SameType());
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 270. Binary search requirements overly strict
+ // Determine if a sequence is partitioned w.r.t. this element.
+ template<typename _ForwardIterator, typename _Tp>
+ inline bool
+ __check_partitioned_lower(_ForwardIterator __first,
+ _ForwardIterator __last, const _Tp& __value)
+ {
+ while (__first != __last && *__first < __value)
+ ++__first;
+ while (__first != __last && !(*__first < __value))
+ ++__first;
+ return __first == __last;
+ }
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline bool
+ __check_partitioned_upper(_ForwardIterator __first,
+ _ForwardIterator __last, const _Tp& __value)
+ {
+ while (__first != __last && !(__value < *__first))
+ ++__first;
+ while (__first != __last && __value < *__first)
+ ++__first;
+ return __first == __last;
+ }
+
+ // Determine if a sequence is partitioned w.r.t. this element.
+ template<typename _ForwardIterator, typename _Tp, typename _Pred>
+ inline bool
+ __check_partitioned_lower(_ForwardIterator __first,
+ _ForwardIterator __last, const _Tp& __value,
+ _Pred __pred)
+ {
+ while (__first != __last && bool(__pred(*__first, __value)))
+ ++__first;
+ while (__first != __last && !bool(__pred(*__first, __value)))
+ ++__first;
+ return __first == __last;
+ }
+
+ template<typename _ForwardIterator, typename _Tp, typename _Pred>
+ inline bool
+ __check_partitioned_upper(_ForwardIterator __first,
+ _ForwardIterator __last, const _Tp& __value,
+ _Pred __pred)
+ {
+ while (__first != __last && !bool(__pred(__value, *__first)))
+ ++__first;
+ while (__first != __last && bool(__pred(__value, *__first)))
+ ++__first;
+ return __first == __last;
+ }
+} // namespace __gnu_debug
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/list b/gcc-4.4.0/libstdc++-v3/include/debug/list
new file mode 100644
index 000000000..39f763a33
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/list
@@ -0,0 +1,653 @@
+// Debugging list implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/list
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_LIST
+#define _GLIBCXX_DEBUG_LIST 1
+
+#include <list>
+#include <bits/stl_algo.h>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+ class list
+ : public _GLIBCXX_STD_D::list<_Tp, _Allocator>,
+ public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::list<_Tp, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<list> _Safe_base;
+
+ public:
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, list>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, list>
+ const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // 23.2.2.1 construct/copy/destroy:
+ explicit list(const _Allocator& __a = _Allocator())
+ : _Base(__a) { }
+
+ explicit list(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+
+ template<class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)
+ { }
+
+
+ list(const list& __x)
+ : _Base(__x), _Safe_base() { }
+
+ list(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ list(list&& __x)
+ : _Base(std::forward<list>(__x)), _Safe_base()
+ { this->_M_swap(__x); }
+
+ list(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __a), _Safe_base() { }
+#endif
+
+ ~list() { }
+
+ list&
+ operator=(const list& __x)
+ {
+ static_cast<_Base&>(*this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ list&
+ operator=(list&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ list&
+ operator=(initializer_list<value_type> __l)
+ {
+ static_cast<_Base&>(*this) = __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ void
+ assign(initializer_list<value_type> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ }
+#endif
+
+ template<class _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::assign(__first, __last);
+ this->_M_invalidate_all();
+ }
+
+ void
+ assign(size_type __n, const _Tp& __t)
+ {
+ _Base::assign(__n, __t);
+ this->_M_invalidate_all();
+ }
+
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // 23.2.2.2 capacity:
+ using _Base::empty;
+ using _Base::size;
+ using _Base::max_size;
+
+ void
+ resize(size_type __sz, _Tp __c = _Tp())
+ {
+ this->_M_detach_singular();
+
+ // if __sz < size(), invalidate all iterators in [begin+__sz, end())
+ iterator __victim = begin();
+ iterator __end = end();
+ for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
+ ++__victim;
+
+ while (__victim != __end)
+ {
+ iterator __real_victim = __victim++;
+ __real_victim._M_invalidate();
+ }
+
+ __try
+ {
+ _Base::resize(__sz, __c);
+ }
+ __catch(...)
+ {
+ this->_M_revalidate_singular();
+ __throw_exception_again;
+ }
+ }
+
+ // element access:
+ reference
+ front()
+ {
+ __glibcxx_check_nonempty();
+ return _Base::front();
+ }
+
+ const_reference
+ front() const
+ {
+ __glibcxx_check_nonempty();
+ return _Base::front();
+ }
+
+ reference
+ back()
+ {
+ __glibcxx_check_nonempty();
+ return _Base::back();
+ }
+
+ const_reference
+ back() const
+ {
+ __glibcxx_check_nonempty();
+ return _Base::back();
+ }
+
+ // 23.2.2.3 modifiers:
+ using _Base::push_front;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ using _Base::emplace_front;
+#endif
+
+ void
+ pop_front()
+ {
+ __glibcxx_check_nonempty();
+ iterator __victim = begin();
+ __victim._M_invalidate();
+ _Base::pop_front();
+ }
+
+ using _Base::push_back;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ using _Base::emplace_back;
+#endif
+
+ void
+ pop_back()
+ {
+ __glibcxx_check_nonempty();
+ iterator __victim = end();
+ --__victim;
+ __victim._M_invalidate();
+ _Base::pop_back();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ iterator
+ emplace(iterator __position, _Args&&... __args)
+ {
+ __glibcxx_check_insert(__position);
+ return iterator(_Base::emplace(__position.base(),
+ std::forward<_Args>(__args)...), this);
+ }
+#endif
+
+ iterator
+ insert(iterator __position, const _Tp& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return iterator(_Base::insert(__position.base(), __x), this);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ iterator
+ insert(iterator __position, _Tp&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ void
+ insert(iterator __p, initializer_list<value_type> __l)
+ {
+ __glibcxx_check_insert(__p);
+ _Base::insert(__p, __l);
+ }
+#endif
+
+ void
+ insert(iterator __position, size_type __n, const _Tp& __x)
+ {
+ __glibcxx_check_insert(__position);
+ _Base::insert(__position.base(), __n, __x);
+ }
+
+ template<class _InputIterator>
+ void
+ insert(iterator __position, _InputIterator __first,
+ _InputIterator __last)
+ {
+ __glibcxx_check_insert_range(__position, __first, __last);
+ _Base::insert(__position.base(), __first, __last);
+ }
+
+ iterator
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ __position._M_invalidate();
+ return iterator(_Base::erase(__position.base()), this);
+ }
+
+ iterator
+ erase(iterator __position, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__position, __last);
+ for (iterator __victim = __position; __victim != __last; )
+ {
+ iterator __old = __victim;
+ ++__victim;
+ __old._M_invalidate();
+ }
+ return iterator(_Base::erase(__position.base(), __last.base()), this);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(list&& __x)
+#else
+ swap(list& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ // 23.2.2.4 list operations:
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(iterator __position, list&& __x)
+#else
+ splice(iterator __position, list& __x)
+#endif
+ {
+ _GLIBCXX_DEBUG_VERIFY(&__x != this,
+ _M_message(__gnu_debug::__msg_self_splice)
+ ._M_sequence(*this, "this"));
+ this->splice(__position, _GLIBCXX_MOVE(__x), __x.begin(), __x.end());
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(iterator __position, list&& __x, iterator __i)
+#else
+ splice(iterator __position, list& __x, iterator __i)
+#endif
+ {
+ __glibcxx_check_insert(__position);
+
+ // We used to perform the splice_alloc check: not anymore, redundant
+ // after implementing the relevant bits of N1599.
+
+ _GLIBCXX_DEBUG_VERIFY(__i._M_dereferenceable(),
+ _M_message(__gnu_debug::__msg_splice_bad)
+ ._M_iterator(__i, "__i"));
+ _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__x),
+ _M_message(__gnu_debug::__msg_splice_other)
+ ._M_iterator(__i, "__i")._M_sequence(__x, "__x"));
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 250. splicing invalidates iterators
+ this->_M_transfer_iter(__i);
+ _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+ __i.base());
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(iterator __position, list&& __x, iterator __first,
+ iterator __last)
+#else
+ splice(iterator __position, list& __x, iterator __first,
+ iterator __last)
+#endif
+ {
+ __glibcxx_check_insert(__position);
+ __glibcxx_check_valid_range(__first, __last);
+ _GLIBCXX_DEBUG_VERIFY(__first._M_attached_to(&__x),
+ _M_message(__gnu_debug::__msg_splice_other)
+ ._M_sequence(__x, "x")
+ ._M_iterator(__first, "first"));
+
+ // We used to perform the splice_alloc check: not anymore, redundant
+ // after implementing the relevant bits of N1599.
+
+ for (iterator __tmp = __first; __tmp != __last; )
+ {
+ _GLIBCXX_DEBUG_VERIFY(&__x != this || __tmp != __position,
+ _M_message(__gnu_debug::__msg_splice_overlap)
+ ._M_iterator(__tmp, "position")
+ ._M_iterator(__first, "first")
+ ._M_iterator(__last, "last"));
+ iterator __victim = __tmp++;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 250. splicing invalidates iterators
+ this->_M_transfer_iter(__victim);
+ }
+
+ _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+ __first.base(), __last.base());
+ }
+
+ void
+ remove(const _Tp& __value)
+ {
+ for (iterator __x = begin(); __x.base() != _Base::end(); )
+ {
+ if (*__x == __value)
+ __x = erase(__x);
+ else
+ ++__x;
+ }
+ }
+
+ template<class _Predicate>
+ void
+ remove_if(_Predicate __pred)
+ {
+ for (iterator __x = begin(); __x.base() != _Base::end(); )
+ {
+ if (__pred(*__x))
+ __x = erase(__x);
+ else
+ ++__x;
+ }
+ }
+
+ void
+ unique()
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ if (__first == __last)
+ return;
+ iterator __next = __first;
+ while (++__next != __last)
+ {
+ if (*__first == *__next)
+ erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ template<class _BinaryPredicate>
+ void
+ unique(_BinaryPredicate __binary_pred)
+ {
+ iterator __first = begin();
+ iterator __last = end();
+ if (__first == __last)
+ return;
+ iterator __next = __first;
+ while (++__next != __last)
+ {
+ if (__binary_pred(*__first, *__next))
+ erase(__next);
+ else
+ __first = __next;
+ __next = __first;
+ }
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ merge(list&& __x)
+#else
+ merge(list& __x)
+#endif
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 300. list::merge() specification incomplete
+ if (this != &__x)
+ {
+ __glibcxx_check_sorted(_Base::begin(), _Base::end());
+ __glibcxx_check_sorted(__x.begin().base(), __x.end().base());
+ for (iterator __tmp = __x.begin(); __tmp != __x.end();)
+ {
+ iterator __victim = __tmp++;
+ this->_M_transfer_iter(__victim);
+ }
+ _Base::merge(_GLIBCXX_MOVE(__x._M_base()));
+ }
+ }
+
+ template<class _Compare>
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ merge(list&& __x, _Compare __comp)
+#else
+ merge(list& __x, _Compare __comp)
+#endif
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 300. list::merge() specification incomplete
+ if (this != &__x)
+ {
+ __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(),
+ __comp);
+ __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),
+ __comp);
+ for (iterator __tmp = __x.begin(); __tmp != __x.end();)
+ {
+ iterator __victim = __tmp++;
+ this->_M_transfer_iter(__victim);
+ }
+ _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp);
+ }
+ }
+
+ void
+ sort() { _Base::sort(); }
+
+ template<typename _StrictWeakOrdering>
+ void
+ sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); }
+
+ using _Base::reverse;
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>&& __lhs, list<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/macros.h b/gcc-4.4.0/libstdc++-v3/include/debug/macros.h
new file mode 100644
index 000000000..1a8ce69ca
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/macros.h
@@ -0,0 +1,246 @@
+// Debugging support implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/macros.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_MACROS_H
+#define _GLIBCXX_DEBUG_MACROS_H 1
+
+/**
+ * Macros used by the implementation to verify certain
+ * properties. These macros may only be used directly by the debug
+ * wrappers. Note that these are macros (instead of the more obviously
+ * "correct" choice of making them functions) because we need line and
+ * file information at the call site, to minimize the distance between
+ * the user error and where the error is reported.
+ *
+ */
+#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage) \
+ do \
+ { \
+ if (! (_Condition)) \
+ __gnu_debug::_Error_formatter::_M_at(__FILE__, __LINE__) \
+ ._ErrorMessage._M_error(); \
+ } while (false)
+
+// Verify that [_First, _Last) forms a valid iterator range.
+#define __glibcxx_check_valid_range(_First,_Last) \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \
+ _M_message(__gnu_debug::__msg_valid_range) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last))
+
+/** Verify that we can insert into *this with the iterator _Position.
+ * Insertion into a container at a specific position requires that
+ * the iterator be nonsingular (i.e., either dereferenceable or
+ * past-the-end) and that it reference the sequence we are inserting
+ * into. Note that this macro is only valid when the container is a
+ * _Safe_sequence and the iterator is a _Safe_iterator.
+*/
+#define __glibcxx_check_insert(_Position) \
+_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \
+ _M_message(__gnu_debug::__msg_insert_singular) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_Position, #_Position)); \
+_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
+ _M_message(__gnu_debug::__msg_insert_different) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_Position, #_Position))
+
+/** Verify that we can insert the values in the iterator range
+ * [_First, _Last) into *this with the iterator _Position. Insertion
+ * into a container at a specific position requires that the iterator
+ * be nonsingular (i.e., either dereferenceable or past-the-end),
+ * that it reference the sequence we are inserting into, and that the
+ * iterator range [_First, Last) is a valid (possibly empty)
+ * range. Note that this macro is only valid when the container is a
+ * _Safe_sequence and the iterator is a _Safe_iterator.
+ *
+ * @tbd We would like to be able to check for noninterference of
+ * _Position and the range [_First, _Last), but that can't (in
+ * general) be done.
+*/
+#define __glibcxx_check_insert_range(_Position,_First,_Last) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \
+ _M_message(__gnu_debug::__msg_insert_singular) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_Position, #_Position)); \
+_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
+ _M_message(__gnu_debug::__msg_insert_different) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_Position, #_Position))
+
+/** Verify that we can erase the element referenced by the iterator
+ * _Position. We can erase the element if the _Position iterator is
+ * dereferenceable and references this sequence.
+*/
+#define __glibcxx_check_erase(_Position) \
+_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \
+ _M_message(__gnu_debug::__msg_erase_bad) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_Position, #_Position)); \
+_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
+ _M_message(__gnu_debug::__msg_erase_different) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_Position, #_Position))
+
+/** Verify that we can erase the elements in the iterator range
+ * [_First, _Last). We can erase the elements if [_First, _Last) is a
+ * valid iterator range within this sequence.
+*/
+#define __glibcxx_check_erase_range(_First,_Last) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \
+ _M_message(__gnu_debug::__msg_erase_different) \
+ ._M_sequence(*this, "this") \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last))
+
+// Verify that the subscript _N is less than the container's size.
+#define __glibcxx_check_subscript(_N) \
+_GLIBCXX_DEBUG_VERIFY(_N < this->size(), \
+ _M_message(__gnu_debug::__msg_subscript_oob) \
+ ._M_sequence(*this, "this") \
+ ._M_integer(_N, #_N) \
+ ._M_integer(this->size(), "size"))
+
+// Verify that the container is nonempty
+#define __glibcxx_check_nonempty() \
+_GLIBCXX_DEBUG_VERIFY(! this->empty(), \
+ _M_message(__gnu_debug::__msg_empty) \
+ ._M_sequence(*this, "this"))
+
+// Verify that the iterator range [_First, _Last) is sorted
+#define __glibcxx_check_sorted(_First,_Last) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last), \
+ _M_message(__gnu_debug::__msg_unsorted) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last))
+
+/** Verify that the iterator range [_First, _Last) is sorted by the
+ predicate _Pred. */
+#define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last, _Pred), \
+ _M_message(__gnu_debug::__msg_unsorted_pred) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last) \
+ ._M_string(#_Pred))
+
+// Special variant for std::merge, std::includes, std::set_*
+#define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \
+__glibcxx_check_valid_range(_First1,_Last1); \
+_GLIBCXX_DEBUG_VERIFY( \
+ __gnu_debug::__check_sorted_set(_First1, _Last1, _First2), \
+ _M_message(__gnu_debug::__msg_unsorted) \
+ ._M_iterator(_First1, #_First1) \
+ ._M_iterator(_Last1, #_Last1))
+
+// Likewise with a _Pred.
+#define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \
+__glibcxx_check_valid_range(_First1,_Last1); \
+_GLIBCXX_DEBUG_VERIFY( \
+ __gnu_debug::__check_sorted_set(_First1, _Last1, _First2, _Pred), \
+ _M_message(__gnu_debug::__msg_unsorted_pred) \
+ ._M_iterator(_First1, #_First1) \
+ ._M_iterator(_Last1, #_Last1) \
+ ._M_string(#_Pred))
+
+/** Verify that the iterator range [_First, _Last) is partitioned
+ w.r.t. the value _Value. */
+#define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \
+ _Value), \
+ _M_message(__gnu_debug::__msg_unpartitioned) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last) \
+ ._M_string(#_Value))
+
+#define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \
+ _Value), \
+ _M_message(__gnu_debug::__msg_unpartitioned) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last) \
+ ._M_string(#_Value))
+
+/** Verify that the iterator range [_First, _Last) is partitioned
+ w.r.t. the value _Value and predicate _Pred. */
+#define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \
+ _Value, _Pred), \
+ _M_message(__gnu_debug::__msg_unpartitioned_pred) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last) \
+ ._M_string(#_Pred) \
+ ._M_string(#_Value))
+
+/** Verify that the iterator range [_First, _Last) is partitioned
+ w.r.t. the value _Value and predicate _Pred. */
+#define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \
+ _Value, _Pred), \
+ _M_message(__gnu_debug::__msg_unpartitioned_pred) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last) \
+ ._M_string(#_Pred) \
+ ._M_string(#_Value))
+
+// Verify that the iterator range [_First, _Last) is a heap
+#define __glibcxx_check_heap(_First,_Last) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last), \
+ _M_message(__gnu_debug::__msg_not_heap) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last))
+
+/** Verify that the iterator range [_First, _Last) is a heap
+ w.r.t. the predicate _Pred. */
+#define __glibcxx_check_heap_pred(_First,_Last,_Pred) \
+__glibcxx_check_valid_range(_First,_Last); \
+_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last, _Pred), \
+ _M_message(__gnu_debug::__msg_not_heap_pred) \
+ ._M_iterator(_First, #_First) \
+ ._M_iterator(_Last, #_Last) \
+ ._M_string(#_Pred))
+
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+# define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_ASSERT(_String != 0)
+# define __glibcxx_check_string_len(_String,_Len) \
+ _GLIBCXX_DEBUG_ASSERT(_String != 0 || _Len == 0)
+#else
+# define __glibcxx_check_string(_String)
+# define __glibcxx_check_string_len(_String,_Len)
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/map b/gcc-4.4.0/libstdc++-v3/include/debug/map
new file mode 100644
index 000000000..2d16b71d3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/map
@@ -0,0 +1,37 @@
+// Debugging map/multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/map
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_MAP
+#define _GLIBCXX_DEBUG_MAP 1
+
+#include <map>
+#include <debug/map.h>
+#include <debug/multimap.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/map.h b/gcc-4.4.0/libstdc++-v3/include/debug/map.h
new file mode 100644
index 000000000..de1e5a5e3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/map.h
@@ -0,0 +1,412 @@
+// Debugging map implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/map.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_MAP_H
+#define _GLIBCXX_DEBUG_MAP_H 1
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <utility>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+ class map
+ : public _GLIBCXX_STD_D::map<_Key, _Tp, _Compare, _Allocator>,
+ public __gnu_debug::_Safe_sequence<map<_Key, _Tp, _Compare, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::map<_Key, _Tp, _Compare, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<map> _Safe_base;
+
+ public:
+ // types:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, map>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, map>
+ const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ using _Base::value_compare;
+
+ // 23.3.1.1 construct/copy/destroy:
+ explicit map(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ map(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
+ __comp, __a), _Safe_base() { }
+
+ map(const map& __x)
+ : _Base(__x), _Safe_base() { }
+
+ map(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ map(map&& __x)
+ : _Base(std::forward<map>(__x)), _Safe_base()
+ { this->_M_swap(__x); }
+
+ map(initializer_list<value_type> __l,
+ const _Compare& __c = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __c, __a), _Safe_base() { }
+#endif
+
+ ~map() { }
+
+ map&
+ operator=(const map& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ map&
+ operator=(map&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+#endif
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 133. map missing get_allocator()
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // capacity:
+ using _Base::empty;
+ using _Base::size;
+ using _Base::max_size;
+
+ // 23.3.1.2 element access:
+ using _Base::operator[];
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 464. Suggestion for new member functions in standard containers.
+ using _Base::at;
+
+ // modifiers:
+ std::pair<iterator, bool>
+ insert(const value_type& __x)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
+ return std::pair<iterator, bool>(iterator(__res.first, this),
+ __res.second);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(std::initializer_list<value_type> __list)
+ { _Base::insert(__list); }
+#endif
+
+ iterator
+ insert(iterator __position, const value_type& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return iterator(_Base::insert(__position.base(), __x), this);
+ }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+ void
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ __position._M_invalidate();
+ _Base::erase(__position.base());
+ }
+
+ size_type
+ erase(const key_type& __x)
+ {
+ iterator __victim = find(__x);
+ if (__victim == end())
+ return 0;
+ else
+ {
+ __victim._M_invalidate();
+ _Base::erase(__victim.base());
+ return 1;
+ }
+ }
+
+ void
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+ while (__first != __last)
+ this->erase(__first++);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(map&& __x)
+#else
+ swap(map& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ }
+
+ void
+ clear()
+ { this->erase(begin(), end()); }
+
+ // observers:
+ using _Base::key_comp;
+ using _Base::value_comp;
+
+ // 23.3.1.3 map operations:
+ iterator
+ find(const key_type& __x)
+ { return iterator(_Base::find(__x), this); }
+
+ const_iterator
+ find(const key_type& __x) const
+ { return const_iterator(_Base::find(__x), this); }
+
+ using _Base::count;
+
+ iterator
+ lower_bound(const key_type& __x)
+ { return iterator(_Base::lower_bound(__x), this); }
+
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return const_iterator(_Base::lower_bound(__x), this); }
+
+ iterator
+ upper_bound(const key_type& __x)
+ { return iterator(_Base::upper_bound(__x), this); }
+
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return const_iterator(_Base::upper_bound(__x), this); }
+
+ std::pair<iterator,iterator>
+ equal_range(const key_type& __x)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ std::pair<_Base_iterator, _Base_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& __x) const
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ std::pair<_Base_const_iterator, _Base_const_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>&& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/multimap.h b/gcc-4.4.0/libstdc++-v3/include/debug/multimap.h
new file mode 100644
index 000000000..42741dac5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/multimap.h
@@ -0,0 +1,400 @@
+// Debugging multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/multimap.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_MULTIMAP_H
+#define _GLIBCXX_DEBUG_MULTIMAP_H 1
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <utility>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+ class multimap
+ : public _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator>,
+ public __gnu_debug::_Safe_sequence<multimap<_Key, _Tp,
+ _Compare, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
+
+ public:
+ // types:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multimap>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ multimap> const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ using _Base::value_compare;
+
+ // 23.3.1.1 construct/copy/destroy:
+ explicit multimap(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
+ __comp, __a) { }
+
+ multimap(const multimap& __x)
+ : _Base(__x), _Safe_base() { }
+
+ multimap(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multimap(multimap&& __x)
+ : _Base(std::forward<multimap>(__x)), _Safe_base()
+ { this->_M_swap(__x); }
+
+ multimap(initializer_list<value_type> __l,
+ const _Compare& __c = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __c, __a), _Safe_base() { }
+#endif
+
+ ~multimap() { }
+
+ multimap&
+ operator=(const multimap& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multimap&
+ operator=(multimap&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+#endif
+
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // capacity:
+ using _Base::empty;
+ using _Base::size;
+ using _Base::max_size;
+
+ // modifiers:
+ iterator
+ insert(const value_type& __x)
+ { return iterator(_Base::insert(__x), this); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(std::initializer_list<value_type> __list)
+ { _Base::insert(__list); }
+#endif
+
+ iterator
+ insert(iterator __position, const value_type& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return iterator(_Base::insert(__position.base(), __x), this);
+ }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+ void
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ __position._M_invalidate();
+ _Base::erase(__position.base());
+ }
+
+ size_type
+ erase(const key_type& __x)
+ {
+ std::pair<iterator, iterator> __victims = this->equal_range(__x);
+ size_type __count = 0;
+ while (__victims.first != __victims.second)
+ {
+ iterator __victim = __victims.first++;
+ __victim._M_invalidate();
+ _Base::erase(__victim.base());
+ ++__count;
+ }
+ return __count;
+ }
+
+ void
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+ while (__first != __last)
+ this->erase(__first++);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multimap&& __x)
+#else
+ swap(multimap& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ }
+
+ void
+ clear()
+ { this->erase(begin(), end()); }
+
+ // observers:
+ using _Base::key_comp;
+ using _Base::value_comp;
+
+ // 23.3.1.3 multimap operations:
+ iterator
+ find(const key_type& __x)
+ { return iterator(_Base::find(__x), this); }
+
+ const_iterator
+ find(const key_type& __x) const
+ { return const_iterator(_Base::find(__x), this); }
+
+ using _Base::count;
+
+ iterator
+ lower_bound(const key_type& __x)
+ { return iterator(_Base::lower_bound(__x), this); }
+
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return const_iterator(_Base::lower_bound(__x), this); }
+
+ iterator
+ upper_bound(const key_type& __x)
+ { return iterator(_Base::upper_bound(__x), this); }
+
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return const_iterator(_Base::upper_bound(__x), this); }
+
+ std::pair<iterator,iterator>
+ equal_range(const key_type& __x)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ std::pair<_Base_iterator, _Base_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& __x) const
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ std::pair<_Base_const_iterator, _Base_const_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>&& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/multiset.h b/gcc-4.4.0/libstdc++-v3/include/debug/multiset.h
new file mode 100644
index 000000000..3e4ee86a2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/multiset.h
@@ -0,0 +1,396 @@
+// Debugging multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/multiset.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_MULTISET_H
+#define _GLIBCXX_DEBUG_MULTISET_H 1
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <utility>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Key, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<_Key> >
+ class multiset
+ : public _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator>,
+ public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::multiset<_Key, _Compare, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base;
+
+ public:
+ // types:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multiset>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ multiset> const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // 23.3.3.1 construct/copy/destroy:
+ explicit multiset(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
+ __comp, __a) { }
+
+ multiset(const multiset& __x)
+ : _Base(__x), _Safe_base() { }
+
+ multiset(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multiset(multiset&& __x)
+ : _Base(std::forward<multiset>(__x)), _Safe_base()
+ { this->_M_swap(__x); }
+
+ multiset(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __comp, __a), _Safe_base() { }
+#endif
+
+ ~multiset() { }
+
+ multiset&
+ operator=(const multiset& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multiset&
+ operator=(multiset&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+#endif
+
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // capacity:
+ using _Base::empty;
+ using _Base::size;
+ using _Base::max_size;
+
+ // modifiers:
+ iterator
+ insert(const value_type& __x)
+ { return iterator(_Base::insert(__x), this); }
+
+ iterator
+ insert(iterator __position, const value_type& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return iterator(_Base::insert(__position.base(), __x), this);
+ }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+#endif
+
+ void
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ __position._M_invalidate();
+ _Base::erase(__position.base());
+ }
+
+ size_type
+ erase(const key_type& __x)
+ {
+ std::pair<iterator, iterator> __victims = this->equal_range(__x);
+ size_type __count = 0;
+ while (__victims.first != __victims.second)
+ {
+ iterator __victim = __victims.first++;
+ __victim._M_invalidate();
+ _Base::erase(__victim.base());
+ ++__count;
+ }
+ return __count;
+ }
+
+ void
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+ while (__first != __last)
+ this->erase(__first++);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multiset&& __x)
+#else
+ swap(multiset& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ }
+
+ void
+ clear()
+ { this->erase(begin(), end()); }
+
+ // observers:
+ using _Base::key_comp;
+ using _Base::value_comp;
+
+ // multiset operations:
+ iterator
+ find(const key_type& __x)
+ { return iterator(_Base::find(__x), this); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ const_iterator
+ find(const key_type& __x) const
+ { return const_iterator(_Base::find(__x), this); }
+
+ using _Base::count;
+
+ iterator
+ lower_bound(const key_type& __x)
+ { return iterator(_Base::lower_bound(__x), this); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return const_iterator(_Base::lower_bound(__x), this); }
+
+ iterator
+ upper_bound(const key_type& __x)
+ { return iterator(_Base::upper_bound(__x), this); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return const_iterator(_Base::upper_bound(__x), this); }
+
+ std::pair<iterator,iterator>
+ equal_range(const key_type& __x)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ std::pair<_Base_iterator, _Base_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& __x) const
+ {
+ typedef typename _Base::const_iterator _Base_iterator;
+ std::pair<_Base_iterator, _Base_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>& __x,
+ multiset<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>&& __x,
+ multiset<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>& __x,
+ multiset<_Key, _Compare, _Allocator>&& __y)
+ { return __x.swap(__y); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/safe_base.h b/gcc-4.4.0/libstdc++-v3/include/debug/safe_base.h
new file mode 100644
index 000000000..1bef5e7ef
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/safe_base.h
@@ -0,0 +1,220 @@
+// Safe sequence/iterator base implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/safe_base.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SAFE_BASE_H
+#define _GLIBCXX_DEBUG_SAFE_BASE_H 1
+
+#include <ext/concurrence.h>
+
+namespace __gnu_debug
+{
+ class _Safe_sequence_base;
+
+ /** \brief Basic functionality for a "safe" iterator.
+ *
+ * The %_Safe_iterator_base base class implements the functionality
+ * of a safe iterator that is not specific to a particular iterator
+ * type. It contains a pointer back to the sequence it references
+ * along with iterator version information and pointers to form a
+ * doubly-linked list of iterators referenced by the container.
+ *
+ * This class must not perform any operations that can throw an
+ * exception, or the exception guarantees of derived iterators will
+ * be broken.
+ */
+ class _Safe_iterator_base
+ {
+ public:
+ /** The sequence this iterator references; may be NULL to indicate
+ a singular iterator. */
+ _Safe_sequence_base* _M_sequence;
+
+ /** The version number of this iterator. The sentinel value 0 is
+ * used to indicate an invalidated iterator (i.e., one that is
+ * singular because of an operation on the container). This
+ * version number must equal the version number in the sequence
+ * referenced by _M_sequence for the iterator to be
+ * non-singular.
+ */
+ unsigned int _M_version;
+
+ /** Pointer to the previous iterator in the sequence's list of
+ iterators. Only valid when _M_sequence != NULL. */
+ _Safe_iterator_base* _M_prior;
+
+ /** Pointer to the next iterator in the sequence's list of
+ iterators. Only valid when _M_sequence != NULL. */
+ _Safe_iterator_base* _M_next;
+
+ protected:
+ /** Initializes the iterator and makes it singular. */
+ _Safe_iterator_base()
+ : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
+ { }
+
+ /** Initialize the iterator to reference the sequence pointed to
+ * by @p__seq. @p __constant is true when we are initializing a
+ * constant iterator, and false if it is a mutable iterator. Note
+ * that @p __seq may be NULL, in which case the iterator will be
+ * singular. Otherwise, the iterator will reference @p __seq and
+ * be nonsingular.
+ */
+ _Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant)
+ : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
+ { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); }
+
+ /** Initializes the iterator to reference the same sequence that
+ @p __x does. @p __constant is true if this is a constant
+ iterator, and false if it is mutable. */
+ _Safe_iterator_base(const _Safe_iterator_base& __x, bool __constant)
+ : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
+ { this->_M_attach(__x._M_sequence, __constant); }
+
+ _Safe_iterator_base&
+ operator=(const _Safe_iterator_base&);
+
+ explicit
+ _Safe_iterator_base(const _Safe_iterator_base&);
+
+ ~_Safe_iterator_base() { this->_M_detach(); }
+
+ /** For use in _Safe_iterator. */
+ __gnu_cxx::__mutex& _M_get_mutex();
+
+ public:
+ /** Attaches this iterator to the given sequence, detaching it
+ * from whatever sequence it was attached to originally. If the
+ * new sequence is the NULL pointer, the iterator is left
+ * unattached.
+ */
+ void _M_attach(_Safe_sequence_base* __seq, bool __constant);
+
+ /** Likewise, but not thread-safe. */
+ void _M_attach_single(_Safe_sequence_base* __seq, bool __constant);
+
+ /** Detach the iterator for whatever sequence it is attached to,
+ * if any.
+ */
+ void _M_detach();
+
+ /** Likewise, but not thread-safe. */
+ void _M_detach_single();
+
+ /** Determines if we are attached to the given sequence. */
+ bool _M_attached_to(const _Safe_sequence_base* __seq) const
+ { return _M_sequence == __seq; }
+
+ /** Is this iterator singular? */
+ bool _M_singular() const;
+
+ /** Can we compare this iterator to the given iterator @p __x?
+ Returns true if both iterators are nonsingular and reference
+ the same sequence. */
+ bool _M_can_compare(const _Safe_iterator_base& __x) const;
+ };
+
+ /**
+ * @brief Base class that supports tracking of iterators that
+ * reference a sequence.
+ *
+ * The %_Safe_sequence_base class provides basic support for
+ * tracking iterators into a sequence. Sequences that track
+ * iterators must derived from %_Safe_sequence_base publicly, so
+ * that safe iterators (which inherit _Safe_iterator_base) can
+ * attach to them. This class contains two linked lists of
+ * iterators, one for constant iterators and one for mutable
+ * iterators, and a version number that allows very fast
+ * invalidation of all iterators that reference the container.
+ *
+ * This class must ensure that no operation on it may throw an
+ * exception, otherwise "safe" sequences may fail to provide the
+ * exception-safety guarantees required by the C++ standard.
+ */
+ class _Safe_sequence_base
+ {
+ public:
+ /// The list of mutable iterators that reference this container
+ _Safe_iterator_base* _M_iterators;
+
+ /// The list of constant iterators that reference this container
+ _Safe_iterator_base* _M_const_iterators;
+
+ /// The container version number. This number may never be 0.
+ mutable unsigned int _M_version;
+
+ protected:
+ // Initialize with a version number of 1 and no iterators
+ _Safe_sequence_base()
+ : _M_iterators(0), _M_const_iterators(0), _M_version(1)
+ { }
+
+ /** Notify all iterators that reference this sequence that the
+ sequence is being destroyed. */
+ ~_Safe_sequence_base()
+ { this->_M_detach_all(); }
+
+ /** Detach all iterators, leaving them singular. */
+ void
+ _M_detach_all();
+
+ /** Detach all singular iterators.
+ * @post for all iterators i attached to this sequence,
+ * i->_M_version == _M_version.
+ */
+ void
+ _M_detach_singular();
+
+ /** Revalidates all attached singular iterators. This method may
+ * be used to validate iterators that were invalidated before
+ * (but for some reason, such as an exception, need to become
+ * valid again).
+ */
+ void
+ _M_revalidate_singular();
+
+ /** Swap this sequence with the given sequence. This operation
+ * also swaps ownership of the iterators, so that when the
+ * operation is complete all iterators that originally referenced
+ * one container now reference the other container.
+ */
+ void
+ _M_swap(_Safe_sequence_base& __x);
+
+ /** For use in _Safe_sequence. */
+ __gnu_cxx::__mutex& _M_get_mutex();
+
+ public:
+ /** Invalidates all iterators. */
+ void
+ _M_invalidate_all() const
+ { if (++_M_version == 0) _M_version = 1; }
+ };
+} // namespace __gnu_debug
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.h b/gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.h
new file mode 100644
index 000000000..dbdb32e22
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.h
@@ -0,0 +1,643 @@
+// Safe iterator implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/safe_iterator.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H
+#define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1
+
+#include <debug/debug.h>
+#include <debug/macros.h>
+#include <debug/functions.h>
+#include <debug/formatter.h>
+#include <debug/safe_base.h>
+#include <bits/stl_pair.h>
+#include <ext/type_traits.h>
+
+namespace __gnu_debug
+{
+ /** Iterators that derive from _Safe_iterator_base but that aren't
+ * _Safe_iterators can be determined singular or non-singular via
+ * _Safe_iterator_base.
+ */
+ inline bool
+ __check_singular_aux(const _Safe_iterator_base* __x)
+ { return __x->_M_singular(); }
+
+ /** \brief Safe iterator wrapper.
+ *
+ * The class template %_Safe_iterator is a wrapper around an
+ * iterator that tracks the iterator's movement among sequences and
+ * checks that operations performed on the "safe" iterator are
+ * legal. In additional to the basic iterator operations (which are
+ * validated, and then passed to the underlying iterator),
+ * %_Safe_iterator has member functions for iterator invalidation,
+ * attaching/detaching the iterator from sequences, and querying
+ * the iterator's state.
+ */
+ template<typename _Iterator, typename _Sequence>
+ class _Safe_iterator : public _Safe_iterator_base
+ {
+ typedef _Safe_iterator _Self;
+
+ /** The precision to which we can calculate the distance between
+ * two iterators.
+ */
+ enum _Distance_precision
+ {
+ __dp_equality, //< Can compare iterator equality, only
+ __dp_sign, //< Can determine equality and ordering
+ __dp_exact //< Can determine distance precisely
+ };
+
+ /// The underlying iterator
+ _Iterator _M_current;
+
+ /// Determine if this is a constant iterator.
+ bool
+ _M_constant() const
+ {
+ typedef typename _Sequence::const_iterator const_iterator;
+ return __is_same<const_iterator, _Safe_iterator>::value;
+ }
+
+ typedef std::iterator_traits<_Iterator> _Traits;
+
+ public:
+ typedef _Iterator _Base_iterator;
+ typedef typename _Traits::iterator_category iterator_category;
+ typedef typename _Traits::value_type value_type;
+ typedef typename _Traits::difference_type difference_type;
+ typedef typename _Traits::reference reference;
+ typedef typename _Traits::pointer pointer;
+
+ /// @post the iterator is singular and unattached
+ _Safe_iterator() : _M_current() { }
+
+ /**
+ * @brief Safe iterator construction from an unsafe iterator and
+ * its sequence.
+ *
+ * @pre @p seq is not NULL
+ * @post this is not singular
+ */
+ _Safe_iterator(const _Iterator& __i, const _Sequence* __seq)
+ : _Safe_iterator_base(__seq, _M_constant()), _M_current(__i)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+ _M_message(__msg_init_singular)
+ ._M_iterator(*this, "this"));
+ }
+
+ /**
+ * @brief Copy construction.
+ * @pre @p x is not singular
+ */
+ _Safe_iterator(const _Safe_iterator& __x)
+ : _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
+ {
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ _M_message(__msg_init_copy_singular)
+ ._M_iterator(*this, "this")
+ ._M_iterator(__x, "other"));
+ }
+
+ /**
+ * @brief Converting constructor from a mutable iterator to a
+ * constant iterator.
+ *
+ * @pre @p x is not singular
+ */
+ template<typename _MutableIterator>
+ _Safe_iterator(
+ const _Safe_iterator<_MutableIterator,
+ typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator,
+ typename _Sequence::iterator::_Base_iterator>::__value),
+ _Sequence>::__type>& __x)
+ : _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
+ {
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ _M_message(__msg_init_const_singular)
+ ._M_iterator(*this, "this")
+ ._M_iterator(__x, "other"));
+ }
+
+ /**
+ * @brief Copy assignment.
+ * @pre @p x is not singular
+ */
+ _Safe_iterator&
+ operator=(const _Safe_iterator& __x)
+ {
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ _M_message(__msg_copy_singular)
+ ._M_iterator(*this, "this")
+ ._M_iterator(__x, "other"));
+ _M_current = __x._M_current;
+ this->_M_attach(static_cast<_Sequence*>(__x._M_sequence));
+ return *this;
+ }
+
+ /**
+ * @brief Iterator dereference.
+ * @pre iterator is dereferenceable
+ */
+ reference
+ operator*() const
+ {
+
+ _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
+ _M_message(__msg_bad_deref)
+ ._M_iterator(*this, "this"));
+ return *_M_current;
+ }
+
+ /**
+ * @brief Iterator dereference.
+ * @pre iterator is dereferenceable
+ * @todo Make this correct w.r.t. iterators that return proxies
+ * @todo Use addressof() instead of & operator
+ */
+ pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
+ _M_message(__msg_bad_deref)
+ ._M_iterator(*this, "this"));
+ return &*_M_current;
+ }
+
+ // ------ Input iterator requirements ------
+ /**
+ * @brief Iterator preincrement
+ * @pre iterator is incrementable
+ */
+ _Safe_iterator&
+ operator++()
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
+ _M_message(__msg_bad_inc)
+ ._M_iterator(*this, "this"));
+ ++_M_current;
+ return *this;
+ }
+
+ /**
+ * @brief Iterator postincrement
+ * @pre iterator is incrementable
+ */
+ _Safe_iterator
+ operator++(int)
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
+ _M_message(__msg_bad_inc)
+ ._M_iterator(*this, "this"));
+ _Safe_iterator __tmp(*this);
+ ++_M_current;
+ return __tmp;
+ }
+
+ // ------ Bidirectional iterator requirements ------
+ /**
+ * @brief Iterator predecrement
+ * @pre iterator is decrementable
+ */
+ _Safe_iterator&
+ operator--()
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
+ _M_message(__msg_bad_dec)
+ ._M_iterator(*this, "this"));
+ --_M_current;
+ return *this;
+ }
+
+ /**
+ * @brief Iterator postdecrement
+ * @pre iterator is decrementable
+ */
+ _Safe_iterator
+ operator--(int)
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
+ _M_message(__msg_bad_dec)
+ ._M_iterator(*this, "this"));
+ _Safe_iterator __tmp(*this);
+ --_M_current;
+ return __tmp;
+ }
+
+ // ------ Random access iterator requirements ------
+ reference
+ operator[](const difference_type& __n) const
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
+ && this->_M_can_advance(__n+1),
+ _M_message(__msg_iter_subscript_oob)
+ ._M_iterator(*this)._M_integer(__n));
+
+ return _M_current[__n];
+ }
+
+ _Safe_iterator&
+ operator+=(const difference_type& __n)
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n),
+ _M_message(__msg_advance_oob)
+ ._M_iterator(*this)._M_integer(__n));
+ _M_current += __n;
+ return *this;
+ }
+
+ _Safe_iterator
+ operator+(const difference_type& __n) const
+ {
+ _Safe_iterator __tmp(*this);
+ __tmp += __n;
+ return __tmp;
+ }
+
+ _Safe_iterator&
+ operator-=(const difference_type& __n)
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n),
+ _M_message(__msg_retreat_oob)
+ ._M_iterator(*this)._M_integer(__n));
+ _M_current += -__n;
+ return *this;
+ }
+
+ _Safe_iterator
+ operator-(const difference_type& __n) const
+ {
+ _Safe_iterator __tmp(*this);
+ __tmp -= __n;
+ return __tmp;
+ }
+
+ // ------ Utilities ------
+ /**
+ * @brief Return the underlying iterator
+ */
+ _Iterator
+ base() const { return _M_current; }
+
+ /**
+ * @brief Conversion to underlying non-debug iterator to allow
+ * better interaction with non-debug containers.
+ */
+ operator _Iterator() const { return _M_current; }
+
+ /** Attach iterator to the given sequence. */
+ void
+ _M_attach(const _Sequence* __seq)
+ {
+ _Safe_iterator_base::_M_attach(const_cast<_Sequence*>(__seq),
+ _M_constant());
+ }
+
+ /** Likewise, but not thread-safe. */
+ void
+ _M_attach_single(const _Sequence* __seq)
+ {
+ _Safe_iterator_base::_M_attach_single(const_cast<_Sequence*>(__seq),
+ _M_constant());
+ }
+
+ /** Invalidate the iterator, making it singular. */
+ void
+ _M_invalidate();
+
+ /** Likewise, but not thread-safe. */
+ void
+ _M_invalidate_single();
+
+ /// Is the iterator dereferenceable?
+ bool
+ _M_dereferenceable() const
+ { return !this->_M_singular() && !_M_is_end(); }
+
+ /// Is the iterator incrementable?
+ bool
+ _M_incrementable() const { return this->_M_dereferenceable(); }
+
+ // Is the iterator decrementable?
+ bool
+ _M_decrementable() const { return !_M_singular() && !_M_is_begin(); }
+
+ // Can we advance the iterator @p __n steps (@p __n may be negative)
+ bool
+ _M_can_advance(const difference_type& __n) const;
+
+ // Is the iterator range [*this, __rhs) valid?
+ template<typename _Other>
+ bool
+ _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const;
+
+ // The sequence this iterator references.
+ const _Sequence*
+ _M_get_sequence() const
+ { return static_cast<const _Sequence*>(_M_sequence); }
+
+ /** Determine the distance between two iterators with some known
+ * precision.
+ */
+ template<typename _Iterator1, typename _Iterator2>
+ static std::pair<difference_type, _Distance_precision>
+ _M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs)
+ {
+ typedef typename std::iterator_traits<_Iterator1>::iterator_category
+ _Category;
+ return _M_get_distance(__lhs, __rhs, _Category());
+ }
+
+ template<typename _Iterator1, typename _Iterator2>
+ static std::pair<difference_type, _Distance_precision>
+ _M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
+ std::random_access_iterator_tag)
+ {
+ return std::make_pair(__rhs.base() - __lhs.base(), __dp_exact);
+ }
+
+ template<typename _Iterator1, typename _Iterator2>
+ static std::pair<difference_type, _Distance_precision>
+ _M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
+ std::forward_iterator_tag)
+ {
+ return std::make_pair(__lhs.base() == __rhs.base()? 0 : 1,
+ __dp_equality);
+ }
+
+ /// Is this iterator equal to the sequence's begin() iterator?
+ bool _M_is_begin() const
+ { return *this == static_cast<const _Sequence*>(_M_sequence)->begin(); }
+
+ /// Is this iterator equal to the sequence's end() iterator?
+ bool _M_is_end() const
+ { return *this == static_cast<const _Sequence*>(_M_sequence)->end(); }
+ };
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_compare_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_compare_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() == __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_compare_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_compare_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() == __rhs.base();
+ }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_compare_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_compare_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() != __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_compare_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_compare_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() != __rhs.base();
+ }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() < __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() < __rhs.base();
+ }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() <= __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() <= __rhs.base();
+ }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() > __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() > __rhs.base();
+ }
+
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline bool
+ operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() >= __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline bool
+ operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_iter_order_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_order_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() >= __rhs.base();
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR179 not only the various comparison
+ // operators but also operator- must accept mixed iterator/const_iterator
+ // parameters.
+ template<typename _IteratorL, typename _IteratorR, typename _Sequence>
+ inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type
+ operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
+ const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_distance_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_distance_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() - __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type
+ operator-(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
+ const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ {
+ _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
+ _M_message(__msg_distance_bad)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
+ _M_message(__msg_distance_different)
+ ._M_iterator(__lhs, "lhs")
+ ._M_iterator(__rhs, "rhs"));
+ return __lhs.base() - __rhs.base();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ inline _Safe_iterator<_Iterator, _Sequence>
+ operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n,
+ const _Safe_iterator<_Iterator, _Sequence>& __i)
+ { return __i + __n; }
+} // namespace __gnu_debug
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <debug/safe_iterator.tcc>
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.tcc b/gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.tcc
new file mode 100644
index 000000000..d4f2aee58
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/safe_iterator.tcc
@@ -0,0 +1,143 @@
+// Debugging iterator implementation (out of line) -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/safe_iterator.tcc
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC
+#define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1
+
+namespace __gnu_debug
+{
+ template<typename _Iterator, typename _Sequence>
+ bool
+ _Safe_iterator<_Iterator, _Sequence>::
+ _M_can_advance(const difference_type& __n) const
+ {
+ typedef typename _Sequence::const_iterator const_iterator;
+
+ if (this->_M_singular())
+ return false;
+ if (__n == 0)
+ return true;
+ if (__n < 0)
+ {
+ const_iterator __begin =
+ static_cast<const _Sequence*>(_M_sequence)->begin();
+ std::pair<difference_type, _Distance_precision> __dist =
+ this->_M_get_distance(__begin, *this);
+ bool __ok = ((__dist.second == __dp_exact && __dist.first >= -__n)
+ || (__dist.second != __dp_exact && __dist.first > 0));
+ return __ok;
+ }
+ else
+ {
+ const_iterator __end =
+ static_cast<const _Sequence*>(_M_sequence)->end();
+ std::pair<difference_type, _Distance_precision> __dist =
+ this->_M_get_distance(*this, __end);
+ bool __ok = ((__dist.second == __dp_exact && __dist.first >= __n)
+ || (__dist.second != __dp_exact && __dist.first > 0));
+ return __ok;
+ }
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ template<typename _Other>
+ bool
+ _Safe_iterator<_Iterator, _Sequence>::
+ _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const
+ {
+ if (!_M_can_compare(__rhs))
+ return false;
+
+ /* Determine if we can order the iterators without the help of
+ the container */
+ std::pair<difference_type, _Distance_precision> __dist =
+ this->_M_get_distance(*this, __rhs);
+ switch (__dist.second) {
+ case __dp_equality:
+ if (__dist.first == 0)
+ return true;
+ break;
+
+ case __dp_sign:
+ case __dp_exact:
+ return __dist.first >= 0;
+ }
+
+ /* We can only test for equality, but check if one of the
+ iterators is at an extreme. */
+ if (_M_is_begin() || __rhs._M_is_end())
+ return true;
+ else if (_M_is_end() || __rhs._M_is_begin())
+ return false;
+
+ // Assume that this is a valid range; we can't check anything else
+ return true;
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ void
+ _Safe_iterator<_Iterator, _Sequence>::
+ _M_invalidate()
+ {
+ __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
+ _M_invalidate_single();
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ void
+ _Safe_iterator<_Iterator, _Sequence>::
+ _M_invalidate_single()
+ {
+ typedef typename _Sequence::iterator iterator;
+ typedef typename _Sequence::const_iterator const_iterator;
+
+ if (!this->_M_singular())
+ {
+ for (_Safe_iterator_base* __iter = _M_sequence->_M_iterators;
+ __iter; __iter = __iter->_M_next)
+ {
+ iterator* __victim = static_cast<iterator*>(__iter);
+ if (this->base() == __victim->base())
+ __victim->_M_version = 0;
+ }
+
+ for (_Safe_iterator_base* __iter2 = _M_sequence->_M_const_iterators;
+ __iter2; __iter2 = __iter2->_M_next)
+ {
+ const_iterator* __victim = static_cast<const_iterator*>(__iter2);
+ if (__victim->base() == this->base())
+ __victim->_M_version = 0;
+ }
+ _M_version = 0;
+ }
+ }
+} // namespace __gnu_debug
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/safe_sequence.h b/gcc-4.4.0/libstdc++-v3/include/debug/safe_sequence.h
new file mode 100644
index 000000000..bbeac1d7d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/safe_sequence.h
@@ -0,0 +1,183 @@
+// Safe sequence implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/safe_sequence.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H
+#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1
+
+#include <debug/debug.h>
+#include <debug/macros.h>
+#include <debug/functions.h>
+#include <debug/safe_base.h>
+
+namespace __gnu_debug
+{
+ template<typename _Iterator, typename _Sequence>
+ class _Safe_iterator;
+
+ /** A simple function object that returns true if the passed-in
+ * value is not equal to the stored value. It saves typing over
+ * using both bind1st and not_equal.
+ */
+ template<typename _Type>
+ class _Not_equal_to
+ {
+ _Type __value;
+
+ public:
+ explicit _Not_equal_to(const _Type& __v) : __value(__v) { }
+
+ bool
+ operator()(const _Type& __x) const
+ { return __value != __x; }
+ };
+
+ /** A function object that returns true when the given random access
+ iterator is at least @c n steps away from the given iterator. */
+ template<typename _Iterator>
+ class _After_nth_from
+ {
+ typedef typename std::iterator_traits<_Iterator>::difference_type
+ difference_type;
+
+ _Iterator _M_base;
+ difference_type _M_n;
+
+ public:
+ _After_nth_from(const difference_type& __n, const _Iterator& __base)
+ : _M_base(__base), _M_n(__n) { }
+
+ bool
+ operator()(const _Iterator& __x) const
+ { return __x - _M_base >= _M_n; }
+ };
+
+ /**
+ * @brief Base class for constructing a "safe" sequence type that
+ * tracks iterators that reference it.
+ *
+ * The class template %_Safe_sequence simplifies the construction of
+ * "safe" sequences that track the iterators that reference the
+ * sequence, so that the iterators are notified of changes in the
+ * sequence that may affect their operation, e.g., if the container
+ * invalidates its iterators or is destructed. This class template
+ * may only be used by deriving from it and passing the name of the
+ * derived class as its template parameter via the curiously
+ * recurring template pattern. The derived class must have @c
+ * iterator and @const_iterator types that are instantiations of
+ * class template _Safe_iterator for this sequence. Iterators will
+ * then be tracked automatically.
+ */
+ template<typename _Sequence>
+ class _Safe_sequence : public _Safe_sequence_base
+ {
+ public:
+ /** Invalidates all iterators @c x that reference this sequence,
+ are not singular, and for which @c pred(x) returns @c
+ true. The user of this routine should be careful not to make
+ copies of the iterators passed to @p pred, as the copies may
+ interfere with the invalidation. */
+ template<typename _Predicate>
+ void
+ _M_invalidate_if(_Predicate __pred);
+
+ /** Transfers all iterators that reference this memory location
+ to this sequence from whatever sequence they are attached
+ to. */
+ template<typename _Iterator>
+ void
+ _M_transfer_iter(const _Safe_iterator<_Iterator, _Sequence>& __x);
+ };
+
+ template<typename _Sequence>
+ template<typename _Predicate>
+ void
+ _Safe_sequence<_Sequence>::
+ _M_invalidate_if(_Predicate __pred)
+ {
+ typedef typename _Sequence::iterator iterator;
+ typedef typename _Sequence::const_iterator const_iterator;
+
+ __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
+ for (_Safe_iterator_base* __iter = _M_iterators; __iter;)
+ {
+ iterator* __victim = static_cast<iterator*>(__iter);
+ __iter = __iter->_M_next;
+ if (!__victim->_M_singular())
+ {
+ if (__pred(__victim->base()))
+ __victim->_M_invalidate_single();
+ }
+ }
+
+ for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;)
+ {
+ const_iterator* __victim = static_cast<const_iterator*>(__iter2);
+ __iter2 = __iter2->_M_next;
+ if (!__victim->_M_singular())
+ {
+ if (__pred(__victim->base()))
+ __victim->_M_invalidate_single();
+ }
+ }
+ }
+
+ template<typename _Sequence>
+ template<typename _Iterator>
+ void
+ _Safe_sequence<_Sequence>::
+ _M_transfer_iter(const _Safe_iterator<_Iterator, _Sequence>& __x)
+ {
+ _Safe_sequence_base* __from = __x._M_sequence;
+ if (!__from)
+ return;
+
+ typedef typename _Sequence::iterator iterator;
+ typedef typename _Sequence::const_iterator const_iterator;
+
+ __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
+ for (_Safe_iterator_base* __iter = __from->_M_iterators; __iter;)
+ {
+ iterator* __victim = static_cast<iterator*>(__iter);
+ __iter = __iter->_M_next;
+ if (!__victim->_M_singular() && __victim->base() == __x.base())
+ __victim->_M_attach_single(static_cast<_Sequence*>(this));
+ }
+
+ for (_Safe_iterator_base* __iter2 = __from->_M_const_iterators;
+ __iter2;)
+ {
+ const_iterator* __victim = static_cast<const_iterator*>(__iter2);
+ __iter2 = __iter2->_M_next;
+ if (!__victim->_M_singular() && __victim->base() == __x.base())
+ __victim->_M_attach_single(static_cast<_Sequence*>(this));
+ }
+ }
+} // namespace __gnu_debug
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/set b/gcc-4.4.0/libstdc++-v3/include/debug/set
new file mode 100644
index 000000000..34f3ea5e4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/set
@@ -0,0 +1,37 @@
+// Debugging set/multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/set
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SET
+#define _GLIBCXX_DEBUG_SET 1
+
+#include <set>
+#include <debug/set.h>
+#include <debug/multiset.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/set.h b/gcc-4.4.0/libstdc++-v3/include/debug/set.h
new file mode 100644
index 000000000..a025b3dec
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/set.h
@@ -0,0 +1,401 @@
+// Debugging set implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/set.h
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_SET_H
+#define _GLIBCXX_DEBUG_SET_H 1
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <utility>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Key, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<_Key> >
+ class set
+ : public _GLIBCXX_STD_D::set<_Key,_Compare,_Allocator>,
+ public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::set<_Key, _Compare, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
+
+ public:
+ // types:
+ typedef _Key key_type;
+ typedef _Key value_type;
+ typedef _Compare key_compare;
+ typedef _Compare value_compare;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, set>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, set>
+ const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // 23.3.3.1 construct/copy/destroy:
+ explicit set(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ set(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
+ __comp, __a) { }
+
+ set(const set& __x)
+ : _Base(__x), _Safe_base() { }
+
+ set(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ set(set&& __x)
+ : _Base(std::forward<set>(__x)), _Safe_base()
+ { this->_M_swap(__x); }
+
+ set(initializer_list<value_type> __l,
+ const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __comp, __a), _Safe_base() { }
+#endif
+
+ ~set() { }
+
+ set&
+ operator=(const set& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ set&
+ operator=(set&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+#endif
+
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // capacity:
+ using _Base::empty;
+ using _Base::size;
+ using _Base::max_size;
+
+ // modifiers:
+ std::pair<iterator, bool>
+ insert(const value_type& __x)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
+ return std::pair<iterator, bool>(iterator(__res.first, this),
+ __res.second);
+ }
+
+ iterator
+ insert(iterator __position, const value_type& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return iterator(_Base::insert(__position.base(), __x), this);
+ }
+
+ template <typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+#endif
+
+ void
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ __position._M_invalidate();
+ _Base::erase(__position.base());
+ }
+
+ size_type
+ erase(const key_type& __x)
+ {
+ iterator __victim = find(__x);
+ if (__victim == end())
+ return 0;
+ else
+ {
+ __victim._M_invalidate();
+ _Base::erase(__victim.base());
+ return 1;
+ }
+ }
+
+ void
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+
+ while (__first != __last)
+ this->erase(__first++);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(set&& __x)
+#else
+ swap(set& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ }
+
+ void
+ clear()
+ { this->erase(begin(), end()); }
+
+ // observers:
+ using _Base::key_comp;
+ using _Base::value_comp;
+
+ // set operations:
+ iterator
+ find(const key_type& __x)
+ { return iterator(_Base::find(__x), this); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ const_iterator
+ find(const key_type& __x) const
+ { return const_iterator(_Base::find(__x), this); }
+
+ using _Base::count;
+
+ iterator
+ lower_bound(const key_type& __x)
+ { return iterator(_Base::lower_bound(__x), this); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ const_iterator
+ lower_bound(const key_type& __x) const
+ { return const_iterator(_Base::lower_bound(__x), this); }
+
+ iterator
+ upper_bound(const key_type& __x)
+ { return iterator(_Base::upper_bound(__x), this); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ const_iterator
+ upper_bound(const key_type& __x) const
+ { return const_iterator(_Base::upper_bound(__x), this); }
+
+ std::pair<iterator,iterator>
+ equal_range(const key_type& __x)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ std::pair<_Base_iterator, _Base_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 214. set::find() missing const overload
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& __x) const
+ {
+ typedef typename _Base::const_iterator _Base_iterator;
+ std::pair<_Base_iterator, _Base_iterator> __res =
+ _Base::equal_range(__x);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>& __x,
+ set<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>&& __x,
+ set<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>& __x,
+ set<_Key, _Compare, _Allocator>&& __y)
+ { return __x.swap(__y); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/string b/gcc-4.4.0/libstdc++-v3/include/debug/string
new file mode 100644
index 000000000..d88989add
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/string
@@ -0,0 +1,1074 @@
+// Debugging string implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2005, 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/string
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_STRING
+#define _GLIBCXX_DEBUG_STRING 1
+
+#include <string>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace __gnu_debug
+{
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
+ typename _Allocator = std::allocator<_CharT> >
+ class basic_string
+ : public std::basic_string<_CharT, _Traits, _Allocator>,
+ public __gnu_debug::_Safe_sequence<basic_string<_CharT, _Traits,
+ _Allocator> >
+ {
+ typedef std::basic_string<_CharT, _Traits, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<basic_string> _Safe_base;
+
+ public:
+ // types:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, basic_string>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ basic_string> const_iterator;
+
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ using _Base::npos;
+
+ // 21.3.1 construct/copy/destroy:
+ explicit basic_string(const _Allocator& __a = _Allocator())
+ : _Base(__a)
+ { }
+
+ // Provides conversion from a release-mode string to a debug-mode string
+ basic_string(const _Base& __base) : _Base(__base), _Safe_base() { }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 42. string ctors specify wrong default allocator
+ basic_string(const basic_string& __str)
+ : _Base(__str, 0, _Base::npos, __str.get_allocator()), _Safe_base()
+ { }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 42. string ctors specify wrong default allocator
+ basic_string(const basic_string& __str, size_type __pos,
+ size_type __n = _Base::npos,
+ const _Allocator& __a = _Allocator())
+ : _Base(__str, __pos, __n, __a)
+ { }
+
+ basic_string(const _CharT* __s, size_type __n,
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_string(__s, __n), __n, __a)
+ { }
+
+ basic_string(const _CharT* __s, const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_string(__s), __a)
+ { this->assign(__s); }
+
+ basic_string(size_type __n, _CharT __c,
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __c, __a)
+ { }
+
+ template<typename _InputIterator>
+ basic_string(_InputIterator __begin, _InputIterator __end,
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__begin, __end), __end, __a)
+ { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc())
+ : _Base(__l, __a)
+ { }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ ~basic_string() { }
+
+ basic_string&
+ operator=(const basic_string& __str)
+ {
+ *static_cast<_Base*>(this) = __str;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ operator=(const _CharT* __s)
+ {
+ __glibcxx_check_string(__s);
+ *static_cast<_Base*>(this) = __s;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ operator=(_CharT __c)
+ {
+ *static_cast<_Base*>(this) = __c;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string&
+ operator=(initializer_list<_CharT> __l)
+ {
+ *static_cast<_Base*>(this) = __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ // 21.3.2 iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+ // 21.3.3 capacity:
+ using _Base::size;
+ using _Base::length;
+ using _Base::max_size;
+
+ void
+ resize(size_type __n, _CharT __c)
+ {
+ _Base::resize(__n, __c);
+ this->_M_invalidate_all();
+ }
+
+ void
+ resize(size_type __n)
+ { this->resize(__n, _CharT()); }
+
+ using _Base::capacity;
+ using _Base::reserve;
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ using _Base::empty;
+
+ // 21.3.4 element access:
+ const_reference
+ operator[](size_type __pos) const
+ {
+ _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
+ _M_message(__gnu_debug::__msg_subscript_oob)
+ ._M_sequence(*this, "this")
+ ._M_integer(__pos, "__pos")
+ ._M_integer(this->size(), "size"));
+ return _M_base()[__pos];
+ }
+
+ reference
+ operator[](size_type __pos)
+ {
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+ __glibcxx_check_subscript(__pos);
+#else
+ // as an extension v3 allows s[s.size()] when s is non-const.
+ _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
+ _M_message(__gnu_debug::__msg_subscript_oob)
+ ._M_sequence(*this, "this")
+ ._M_integer(__pos, "__pos")
+ ._M_integer(this->size(), "size"));
+#endif
+ return _M_base()[__pos];
+ }
+
+ using _Base::at;
+
+ // 21.3.5 modifiers:
+ basic_string&
+ operator+=(const basic_string& __str)
+ {
+ _M_base() += __str;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ operator+=(const _CharT* __s)
+ {
+ __glibcxx_check_string(__s);
+ _M_base() += __s;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ operator+=(_CharT __c)
+ {
+ _M_base() += __c;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string&
+ operator+=(initializer_list<_CharT> __l)
+ {
+ _M_base() += __l;
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ basic_string&
+ append(const basic_string& __str)
+ {
+ _Base::append(__str);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ append(const basic_string& __str, size_type __pos, size_type __n)
+ {
+ _Base::append(__str, __pos, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ append(const _CharT* __s, size_type __n)
+ {
+ __glibcxx_check_string_len(__s, __n);
+ _Base::append(__s, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ append(const _CharT* __s)
+ {
+ __glibcxx_check_string(__s);
+ _Base::append(__s);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ append(size_type __n, _CharT __c)
+ {
+ _Base::append(__n, __c);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ template<typename _InputIterator>
+ basic_string&
+ append(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::append(__first, __last);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 7. string clause minor problems
+ void
+ push_back(_CharT __c)
+ {
+ _Base::push_back(__c);
+ this->_M_invalidate_all();
+ }
+
+ basic_string&
+ assign(const basic_string& __x)
+ {
+ _Base::assign(__x);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ assign(const basic_string& __str, size_type __pos, size_type __n)
+ {
+ _Base::assign(__str, __pos, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ assign(const _CharT* __s, size_type __n)
+ {
+ __glibcxx_check_string_len(__s, __n);
+ _Base::assign(__s, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ assign(const _CharT* __s)
+ {
+ __glibcxx_check_string(__s);
+ _Base::assign(__s);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ assign(size_type __n, _CharT __c)
+ {
+ _Base::assign(__n, __c);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ template<typename _InputIterator>
+ basic_string&
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::assign(__first, __last);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string&
+ assign(initializer_list<_CharT> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ basic_string&
+ insert(size_type __pos1, const basic_string& __str)
+ {
+ _Base::insert(__pos1, __str);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos1, const basic_string& __str,
+ size_type __pos2, size_type __n)
+ {
+ _Base::insert(__pos1, __str, __pos2, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos, const _CharT* __s, size_type __n)
+ {
+ __glibcxx_check_string(__s);
+ _Base::insert(__pos, __s, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos, const _CharT* __s)
+ {
+ __glibcxx_check_string(__s);
+ _Base::insert(__pos, __s);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ insert(size_type __pos, size_type __n, _CharT __c)
+ {
+ _Base::insert(__pos, __n, __c);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ iterator
+ insert(iterator __p, _CharT __c)
+ {
+ __glibcxx_check_insert(__p);
+ typename _Base::iterator __res = _Base::insert(__p.base(), __c);
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+
+ void
+ insert(iterator __p, size_type __n, _CharT __c)
+ {
+ __glibcxx_check_insert(__p);
+ _Base::insert(__p.base(), __n, __c);
+ this->_M_invalidate_all();
+ }
+
+ template<typename _InputIterator>
+ void
+ insert(iterator __p, _InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_insert_range(__p, __first, __last);
+ _Base::insert(__p.base(), __first, __last);
+ this->_M_invalidate_all();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ insert(iterator __p, initializer_list<_CharT> __l)
+ {
+ _Base::insert(__p, __l);
+ this->_M_invalidate_all();
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ basic_string&
+ erase(size_type __pos = 0, size_type __n = _Base::npos)
+ {
+ _Base::erase(__pos, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ iterator
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ typename _Base::iterator __res = _Base::erase(__position.base());
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+ typename _Base::iterator __res = _Base::erase(__first.base(),
+ __last.base());
+ this->_M_invalidate_all();
+ return iterator(__res, this);
+ }
+
+ basic_string&
+ replace(size_type __pos1, size_type __n1, const basic_string& __str)
+ {
+ _Base::replace(__pos1, __n1, __str);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2)
+ {
+ _Base::replace(__pos1, __n1, __str, __pos2, __n2);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2)
+ {
+ __glibcxx_check_string_len(__s, __n2);
+ _Base::replace(__pos, __n1, __s, __n2);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {
+ __glibcxx_check_string(__s);
+ _Base::replace(__pos, __n1, __s);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ {
+ _Base::replace(__pos, __n1, __n2, __c);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const basic_string& __str)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ _Base::replace(__i1.base(), __i2.base(), __str);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ __glibcxx_check_string_len(__s, __n);
+ _Base::replace(__i1.base(), __i2.base(), __s, __n);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ __glibcxx_check_string(__s);
+ _Base::replace(__i1.base(), __i2.base(), __s);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ basic_string&
+ replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ _Base::replace(__i1.base(), __i2.base(), __n, __c);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ template<typename _InputIterator>
+ basic_string&
+ replace(iterator __i1, iterator __i2,
+ _InputIterator __j1, _InputIterator __j2)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ __glibcxx_check_valid_range(__j1, __j2);
+ _Base::replace(__i1.base(), __i2.base(), __j1, __j2);
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ basic_string& replace(iterator __i1, iterator __i2,
+ initializer_list<_CharT> __l)
+ {
+ __glibcxx_check_erase_range(__i1, __i2);
+ _Base::replace(__i1.base(), __i2.base(), __l);
+ this->_M_invalidate_all();
+ return *this;
+ }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ size_type
+ copy(_CharT* __s, size_type __n, size_type __pos = 0) const
+ {
+ __glibcxx_check_string_len(__s, __n);
+ return _Base::copy(__s, __n, __pos);
+ }
+
+ void
+ swap(basic_string<_CharT,_Traits,_Allocator>& __x)
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ this->_M_invalidate_all();
+ __x._M_invalidate_all();
+ }
+
+ // 21.3.6 string operations:
+ const _CharT*
+ c_str() const
+ {
+ const _CharT* __res = _Base::c_str();
+ this->_M_invalidate_all();
+ return __res;
+ }
+
+ const _CharT*
+ data() const
+ {
+ const _CharT* __res = _Base::data();
+ this->_M_invalidate_all();
+ return __res;
+ }
+
+ using _Base::get_allocator;
+
+ size_type
+ find(const basic_string& __str, size_type __pos = 0) const
+ { return _Base::find(__str, __pos); }
+
+ size_type
+ find(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find(__s, __pos, __n);
+ }
+
+ size_type
+ find(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find(__s, __pos);
+ }
+
+ size_type
+ find(_CharT __c, size_type __pos = 0) const
+ { return _Base::find(__c, __pos); }
+
+ size_type
+ rfind(const basic_string& __str, size_type __pos = _Base::npos) const
+ { return _Base::rfind(__str, __pos); }
+
+ size_type
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_check_string_len(__s, __n);
+ return _Base::rfind(__s, __pos, __n);
+ }
+
+ size_type
+ rfind(const _CharT* __s, size_type __pos = _Base::npos) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::rfind(__s, __pos);
+ }
+
+ size_type
+ rfind(_CharT __c, size_type __pos = _Base::npos) const
+ { return _Base::rfind(__c, __pos); }
+
+ size_type
+ find_first_of(const basic_string& __str, size_type __pos = 0) const
+ { return _Base::find_first_of(__str, __pos); }
+
+ size_type
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_first_of(__s, __pos, __n);
+ }
+
+ size_type
+ find_first_of(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_first_of(__s, __pos);
+ }
+
+ size_type
+ find_first_of(_CharT __c, size_type __pos = 0) const
+ { return _Base::find_first_of(__c, __pos); }
+
+ size_type
+ find_last_of(const basic_string& __str,
+ size_type __pos = _Base::npos) const
+ { return _Base::find_last_of(__str, __pos); }
+
+ size_type
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_last_of(__s, __pos, __n);
+ }
+
+ size_type
+ find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_last_of(__s, __pos);
+ }
+
+ size_type
+ find_last_of(_CharT __c, size_type __pos = _Base::npos) const
+ { return _Base::find_last_of(__c, __pos); }
+
+ size_type
+ find_first_not_of(const basic_string& __str, size_type __pos = 0) const
+ { return _Base::find_first_not_of(__str, __pos); }
+
+ size_type
+ find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_check_string_len(__s, __n);
+ return _Base::find_first_not_of(__s, __pos, __n);
+ }
+
+ size_type
+ find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_first_not_of(__s, __pos);
+ }
+
+ size_type
+ find_first_not_of(_CharT __c, size_type __pos = 0) const
+ { return _Base::find_first_not_of(__c, __pos); }
+
+ size_type
+ find_last_not_of(const basic_string& __str,
+ size_type __pos = _Base::npos) const
+ { return _Base::find_last_not_of(__str, __pos); }
+
+ size_type
+ find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_last_not_of(__s, __pos, __n);
+ }
+
+ size_type
+ find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::find_last_not_of(__s, __pos);
+ }
+
+ size_type
+ find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const
+ { return _Base::find_last_not_of(__c, __pos); }
+
+ basic_string
+ substr(size_type __pos = 0, size_type __n = _Base::npos) const
+ { return basic_string(_Base::substr(__pos, __n)); }
+
+ int
+ compare(const basic_string& __str) const
+ { return _Base::compare(__str); }
+
+ int
+ compare(size_type __pos1, size_type __n1,
+ const basic_string& __str) const
+ { return _Base::compare(__pos1, __n1, __str); }
+
+ int
+ compare(size_type __pos1, size_type __n1, const basic_string& __str,
+ size_type __pos2, size_type __n2) const
+ { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); }
+
+ int
+ compare(const _CharT* __s) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::compare(__s);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 5. string::compare specification questionable
+ int
+ compare(size_type __pos1, size_type __n1, const _CharT* __s) const
+ {
+ __glibcxx_check_string(__s);
+ return _Base::compare(__pos1, __n1, __s);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 5. string::compare specification questionable
+ int
+ compare(size_type __pos1, size_type __n1,const _CharT* __s,
+ size_type __n2) const
+ {
+ __glibcxx_check_string_len(__s, __n2);
+ return _Base::compare(__pos1, __n1, __s, __n2);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ using _Safe_base::_M_invalidate_all;
+ };
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline basic_string<_CharT,_Traits,_Allocator>
+ operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline basic_string<_CharT,_Traits,_Allocator>
+ operator+(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline basic_string<_CharT,_Traits,_Allocator>
+ operator+(_CharT __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline basic_string<_CharT,_Traits,_Allocator>
+ operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline basic_string<_CharT,_Traits,_Allocator>
+ operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ _CharT __rhs)
+ { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator==(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return __lhs == __rhs._M_base();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return __lhs._M_base() == __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator!=(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return __lhs != __rhs._M_base();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return __lhs._M_base() != __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator<(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return __lhs < __rhs._M_base();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return __lhs._M_base() < __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator<=(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return __lhs <= __rhs._M_base();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return __lhs._M_base() <= __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator>=(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return __lhs >= __rhs._M_base();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return __lhs._M_base() >= __rhs;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator>(const _CharT* __lhs,
+ const basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ {
+ __glibcxx_check_string(__lhs);
+ return __lhs > __rhs._M_base();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline bool
+ operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_check_string(__rhs);
+ return __lhs._M_base() > __rhs;
+ }
+
+ // 21.3.7.8:
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ inline void
+ swap(basic_string<_CharT,_Traits,_Allocator>& __lhs,
+ basic_string<_CharT,_Traits,_Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const basic_string<_CharT, _Traits, _Allocator>& __str)
+ { return __os << __str._M_base(); }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ std::basic_istream<_CharT,_Traits>&
+ operator>>(std::basic_istream<_CharT,_Traits>& __is,
+ basic_string<_CharT,_Traits,_Allocator>& __str)
+ {
+ std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base();
+ __str._M_invalidate_all();
+ return __res;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ std::basic_istream<_CharT,_Traits>&
+ getline(std::basic_istream<_CharT,_Traits>& __is,
+ basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim)
+ {
+ std::basic_istream<_CharT,_Traits>& __res = getline(__is,
+ __str._M_base(),
+ __delim);
+ __str._M_invalidate_all();
+ return __res;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ std::basic_istream<_CharT,_Traits>&
+ getline(std::basic_istream<_CharT,_Traits>& __is,
+ basic_string<_CharT,_Traits,_Allocator>& __str)
+ {
+ std::basic_istream<_CharT,_Traits>& __res = getline(__is,
+ __str._M_base());
+ __str._M_invalidate_all();
+ return __res;
+ }
+
+ typedef basic_string<char> string;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef basic_string<wchar_t> wstring;
+#endif
+
+} // namespace __gnu_debug
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/unordered_map b/gcc-4.4.0/libstdc++-v3/include/debug/unordered_map
new file mode 100644
index 000000000..fd7c31eff
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/unordered_map
@@ -0,0 +1,608 @@
+// Debugging unordered_map/unordered_multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/unordered_map
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_UNORDERED_MAP
+#define _GLIBCXX_DEBUG_UNORDERED_MAP 1
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <unordered_map>
+#else
+# include <c++0x_warning.h>
+#endif
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <initializer_list>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Key, typename _Tp,
+ typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class unordered_map
+ : public _GLIBCXX_STD_D::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
+ public __gnu_debug::_Safe_sequence<unordered_map<_Key, _Tp, _Hash,
+ _Pred, _Alloc> >
+ {
+ typedef _GLIBCXX_STD_D::unordered_map<_Key, _Tp, _Hash,
+ _Pred, _Alloc> _Base;
+ typedef __gnu_debug::_Safe_sequence<unordered_map> _Safe_base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,
+ unordered_map> iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ unordered_map> const_iterator;
+
+ explicit
+ unordered_map(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a) { }
+
+ template<typename _InputIterator>
+ unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n,
+ __hf, __eql, __a), _Safe_base() { }
+
+ unordered_map(const unordered_map& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_map(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_map(unordered_map&& __x)
+ : _Base(std::forward<unordered_map>(__x)), _Safe_base() { }
+
+ unordered_map(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+
+ unordered_map&
+ operator=(const unordered_map& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ unordered_map&
+ operator=(unordered_map&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ unordered_map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
+ void
+ swap(unordered_map&& __x)
+ {
+ _Base::swap(__x);
+ _Safe_base::_M_swap(__x);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ // local versions
+ using _Base::begin;
+ using _Base::end;
+ using _Base::cbegin;
+ using _Base::cend;
+
+ std::pair<iterator, bool>
+ insert(const value_type& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(__obj);
+ return std::make_pair(iterator(__res.first, this), __res.second);
+ }
+
+ iterator
+ insert(iterator, const value_type& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(__obj);
+ return iterator(__res.first, this);
+ }
+
+ const_iterator
+ insert(const_iterator, const value_type& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(__obj);
+ return const_iterator(__res.first, this);
+ }
+
+ void
+ insert(std::initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+ iterator
+ find(const key_type& __key)
+ { return iterator(_Base::find(__key), this); }
+
+ const_iterator
+ find(const key_type& __key) const
+ { return const_iterator(_Base::find(__key), this); }
+
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __key)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const
+ {
+ typedef typename _Base::const_iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ size_type
+ erase(const key_type& __key)
+ {
+ size_type __ret(0);
+ iterator __victim(_Base::find(__key), this);
+ if (__victim != end())
+ {
+ this->erase(__victim);
+ __ret = 1;
+ }
+ return __ret;
+ }
+
+ iterator
+ erase(iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return iterator(_Base::erase(__it.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return const_iterator(_Base::erase(__it.base()), this);
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (iterator __tmp = __first; __tmp != __last;)
+ {
+ iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __first, const_iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (const_iterator __tmp = __first; __tmp != __last;)
+ {
+ const_iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return const_iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+
+ template<typename _Key, typename _Tp,
+ typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class unordered_multimap
+ : public _GLIBCXX_STD_D::unordered_multimap<_Key, _Tp, _Hash,
+ _Pred, _Alloc>,
+ public __gnu_debug::_Safe_sequence<unordered_multimap<_Key, _Tp, _Hash,
+ _Pred, _Alloc> >
+ {
+ typedef _GLIBCXX_STD_D::unordered_multimap<_Key, _Tp, _Hash,
+ _Pred, _Alloc> _Base;
+ typedef __gnu_debug::_Safe_sequence<unordered_multimap> _Safe_base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,
+ unordered_multimap> iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ unordered_multimap> const_iterator;
+
+ explicit
+ unordered_multimap(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a) { }
+
+ template<typename _InputIterator>
+ unordered_multimap(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n,
+ __hf, __eql, __a), _Safe_base() { }
+
+ unordered_multimap(const unordered_multimap& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_multimap(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_multimap(unordered_multimap&& __x)
+ : _Base(std::forward<unordered_multimap>(__x)), _Safe_base() { }
+
+ unordered_multimap(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+
+ unordered_multimap&
+ operator=(const unordered_multimap& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ unordered_multimap&
+ operator=(unordered_multimap&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ unordered_multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
+ void
+ swap(unordered_multimap&& __x)
+ {
+ _Base::swap(__x);
+ _Safe_base::_M_swap(__x);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ // local versions
+ using _Base::begin;
+ using _Base::end;
+ using _Base::cbegin;
+ using _Base::cend;
+
+ iterator
+ insert(const value_type& __obj)
+ { return iterator(_Base::insert(__obj), this); }
+
+ iterator
+ insert(iterator, const value_type& __obj)
+ { return iterator(_Base::insert(__obj), this); }
+
+ const_iterator
+ insert(const_iterator, const value_type& __obj)
+ { return const_iterator(_Base::insert(__obj), this); }
+
+ void
+ insert(std::initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+ iterator
+ find(const key_type& __key)
+ { return iterator(_Base::find(__key), this); }
+
+ const_iterator
+ find(const key_type& __key) const
+ { return const_iterator(_Base::find(__key), this); }
+
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __key)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const
+ {
+ typedef typename _Base::const_iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ size_type
+ erase(const key_type& __key)
+ {
+ size_type __ret(0);
+ iterator __victim(_Base::find(__key), this);
+ if (__victim != end())
+ {
+ this->erase(__victim);
+ __ret = 1;
+ }
+ return __ret;
+ }
+
+ iterator
+ erase(iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return iterator(_Base::erase(__it.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return const_iterator(_Base::erase(__it.base()), this);
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (iterator __tmp = __first; __tmp != __last;)
+ {
+ iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __first, const_iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (const_iterator __tmp = __first; __tmp != __last;)
+ {
+ const_iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return const_iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/unordered_set b/gcc-4.4.0/libstdc++-v3/include/debug/unordered_set
new file mode 100644
index 000000000..d340442a2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/unordered_set
@@ -0,0 +1,601 @@
+// Debugging unordered_set/unordered_multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/unordered_set
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_UNORDERED_SET
+#define _GLIBCXX_DEBUG_UNORDERED_SET 1
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <unordered_set>
+#else
+# include <c++0x_warning.h>
+#endif
+
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <initializer_list>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Value,
+ typename _Hash = std::hash<_Value>,
+ typename _Pred = std::equal_to<_Value>,
+ typename _Alloc = std::allocator<_Value> >
+ class unordered_set
+ : public _GLIBCXX_STD_D::unordered_set<_Value, _Hash, _Pred, _Alloc>,
+ public __gnu_debug::_Safe_sequence<unordered_set<_Value, _Hash,
+ _Pred, _Alloc> >
+ {
+ typedef _GLIBCXX_STD_D::unordered_set<_Value, _Hash,
+ _Pred, _Alloc> _Base;
+ typedef __gnu_debug::_Safe_sequence<unordered_set> _Safe_base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,
+ unordered_set> iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ unordered_set> const_iterator;
+
+ explicit
+ unordered_set(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a) { }
+
+ template<typename _InputIterator>
+ unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n,
+ __hf, __eql, __a), _Safe_base() { }
+
+ unordered_set(const unordered_set& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_set(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_set(unordered_set&& __x)
+ : _Base(std::forward<unordered_set>(__x)), _Safe_base() { }
+
+ unordered_set(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+
+ unordered_set&
+ operator=(const unordered_set& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ unordered_set&
+ operator=(unordered_set&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ unordered_set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
+ void
+ swap(unordered_set&& __x)
+ {
+ _Base::swap(__x);
+ _Safe_base::_M_swap(__x);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ // local versions
+ using _Base::begin;
+ using _Base::end;
+ using _Base::cbegin;
+ using _Base::cend;
+
+ std::pair<iterator, bool>
+ insert(const value_type& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(__obj);
+ return std::make_pair(iterator(__res.first, this), __res.second);
+ }
+
+ iterator
+ insert(iterator, const value_type& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(__obj);
+ return iterator(__res.first, this);
+ }
+
+ const_iterator
+ insert(const_iterator, const value_type& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(__obj);
+ return const_iterator(__res.first, this);
+ }
+
+ void
+ insert(std::initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+ iterator
+ find(const key_type& __key)
+ { return iterator(_Base::find(__key), this); }
+
+ const_iterator
+ find(const key_type& __key) const
+ { return const_iterator(_Base::find(__key), this); }
+
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __key)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const
+ {
+ typedef typename _Base::const_iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ size_type
+ erase(const key_type& __key)
+ {
+ size_type __ret(0);
+ iterator __victim(_Base::find(__key), this);
+ if (__victim != end())
+ {
+ this->erase(__victim);
+ __ret = 1;
+ }
+ return __ret;
+ }
+
+ iterator
+ erase(iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return iterator(_Base::erase(__it.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return const_iterator(_Base::erase(__it.base()), this);
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (iterator __tmp = __first; __tmp != __last;)
+ {
+ iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __first, const_iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (const_iterator __tmp = __first; __tmp != __last;)
+ {
+ const_iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return const_iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+
+ template<typename _Value,
+ typename _Hash = std::hash<_Value>,
+ typename _Pred = std::equal_to<_Value>,
+ typename _Alloc = std::allocator<_Value> >
+ class unordered_multiset
+ : public _GLIBCXX_STD_D::unordered_multiset<_Value, _Hash, _Pred, _Alloc>,
+ public __gnu_debug::_Safe_sequence<unordered_multiset<_Value, _Hash,
+ _Pred, _Alloc> >
+ {
+ typedef _GLIBCXX_STD_D::unordered_multiset<_Value, _Hash,
+ _Pred, _Alloc> _Base;
+ typedef __gnu_debug::_Safe_sequence<unordered_multiset> _Safe_base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,
+ unordered_multiset> iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
+ unordered_multiset> const_iterator;
+
+ explicit
+ unordered_multiset(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a) { }
+
+ template<typename _InputIterator>
+ unordered_multiset(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n,
+ __hf, __eql, __a), _Safe_base() { }
+
+ unordered_multiset(const unordered_multiset& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_multiset(const _Base& __x)
+ : _Base(__x), _Safe_base() { }
+
+ unordered_multiset(unordered_multiset&& __x)
+ : _Base(std::forward<unordered_multiset>(__x)), _Safe_base() { }
+
+ unordered_multiset(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+
+ unordered_multiset&
+ operator=(const unordered_multiset& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ this->_M_invalidate_all();
+ return *this;
+ }
+
+ unordered_multiset&
+ operator=(unordered_multiset&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ unordered_multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l);
+ return *this;
+ }
+
+ void
+ swap(unordered_multiset&& __x)
+ {
+ _Base::swap(__x);
+ _Safe_base::_M_swap(__x);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ }
+
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ // local versions
+ using _Base::begin;
+ using _Base::end;
+ using _Base::cbegin;
+ using _Base::cend;
+
+ iterator
+ insert(const value_type& __obj)
+ { return iterator(_Base::insert(__obj), this); }
+
+ iterator
+ insert(iterator, const value_type& __obj)
+ { return iterator(_Base::insert(__obj), this); }
+
+ const_iterator
+ insert(const_iterator, const value_type& __obj)
+ { return const_iterator(_Base::insert(__obj), this); }
+
+ void
+ insert(std::initializer_list<value_type> __l)
+ { _Base::insert(__l); }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::insert(__first, __last);
+ }
+
+ iterator
+ find(const key_type& __key)
+ { return iterator(_Base::find(__key), this); }
+
+ const_iterator
+ find(const key_type& __key) const
+ { return const_iterator(_Base::find(__key), this); }
+
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __key)
+ {
+ typedef typename _Base::iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(iterator(__res.first, this),
+ iterator(__res.second, this));
+ }
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const
+ {
+ typedef typename _Base::const_iterator _Base_iterator;
+ typedef std::pair<_Base_iterator, _Base_iterator> __pair_type;
+ __pair_type __res = _Base::equal_range(__key);
+ return std::make_pair(const_iterator(__res.first, this),
+ const_iterator(__res.second, this));
+ }
+
+ size_type
+ erase(const key_type& __key)
+ {
+ size_type __ret(0);
+ iterator __victim(_Base::find(__key), this);
+ if (__victim != end())
+ {
+ this->erase(__victim);
+ __ret = 1;
+ }
+ return __ret;
+ }
+
+ iterator
+ erase(iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return iterator(_Base::erase(__it.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __it)
+ {
+ __glibcxx_check_erase(__it);
+ __it._M_invalidate();
+ return const_iterator(_Base::erase(__it.base()), this);
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (iterator __tmp = __first; __tmp != __last;)
+ {
+ iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ const_iterator
+ erase(const_iterator __first, const_iterator __last)
+ {
+ __glibcxx_check_erase_range(__first, __last);
+ for (const_iterator __tmp = __first; __tmp != __last;)
+ {
+ const_iterator __victim = __tmp++;
+ __victim._M_invalidate();
+ }
+ return const_iterator(_Base::erase(__first.base(),
+ __last.base()), this);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ void
+ _M_invalidate_all()
+ {
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
+ this->_M_invalidate_if(_Not_equal(_M_base().end()));
+ }
+ };
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/debug/vector b/gcc-4.4.0/libstdc++-v3/include/debug/vector
new file mode 100644
index 000000000..97ab7bf58
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/debug/vector
@@ -0,0 +1,551 @@
+// Debugging vector implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file debug/vector
+ * This file is a GNU debug extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_DEBUG_VECTOR
+#define _GLIBCXX_DEBUG_VECTOR 1
+
+#include <vector>
+#include <utility>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+
+namespace std
+{
+namespace __debug
+{
+ template<typename _Tp,
+ typename _Allocator = std::allocator<_Tp> >
+ class vector
+ : public _GLIBCXX_STD_D::vector<_Tp, _Allocator>,
+ public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> >
+ {
+ typedef _GLIBCXX_STD_D::vector<_Tp, _Allocator> _Base;
+ typedef __gnu_debug::_Safe_sequence<vector> _Safe_base;
+
+ typedef typename _Base::const_iterator _Base_const_iterator;
+ typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
+
+ public:
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,vector>
+ iterator;
+ typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,vector>
+ const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // 23.2.4.1 construct/copy/destroy:
+ explicit vector(const _Allocator& __a = _Allocator())
+ : _Base(__a), _M_guaranteed_capacity(0) { }
+
+ explicit vector(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }
+
+ template<class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const _Allocator& __a = _Allocator())
+ : _Base(__gnu_debug::__check_valid_range(__first, __last),
+ __last, __a),
+ _M_guaranteed_capacity(0)
+ { _M_update_guaranteed_capacity(); }
+
+ vector(const vector& __x)
+ : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
+
+ /// Construction from a release-mode vector
+ vector(const _Base& __x)
+ : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector(vector&& __x)
+ : _Base(std::forward<vector>(__x)), _Safe_base(),
+ _M_guaranteed_capacity(this->size())
+ {
+ this->_M_swap(__x);
+ __x._M_guaranteed_capacity = 0;
+ }
+
+ vector(initializer_list<value_type> __l,
+ const allocator_type& __a = allocator_type())
+ : _Base(__l, __a), _Safe_base(),
+ _M_guaranteed_capacity(__l.size()) { }
+#endif
+
+ ~vector() { }
+
+ vector&
+ operator=(const vector& __x)
+ {
+ static_cast<_Base&>(*this) = __x;
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector&
+ operator=(vector&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+
+ vector&
+ operator=(initializer_list<value_type> __l)
+ {
+ static_cast<_Base&>(*this) = __l;
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ return *this;
+ }
+#endif
+
+ template<typename _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_valid_range(__first, __last);
+ _Base::assign(__first, __last);
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+
+ void
+ assign(size_type __n, const _Tp& __u)
+ {
+ _Base::assign(__n, __u);
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ assign(initializer_list<value_type> __l)
+ {
+ _Base::assign(__l);
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+#endif
+
+ using _Base::get_allocator;
+
+ // iterators:
+ iterator
+ begin()
+ { return iterator(_Base::begin(), this); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ iterator
+ end()
+ { return iterator(_Base::end(), this); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_Base::end(), this); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // 23.2.4.2 capacity:
+ using _Base::size;
+ using _Base::max_size;
+
+ void
+ resize(size_type __sz, _Tp __c = _Tp())
+ {
+ bool __realloc = _M_requires_reallocation(__sz);
+ if (__sz < this->size())
+ this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
+ _Base::resize(__sz, __c);
+ if (__realloc)
+ this->_M_invalidate_all();
+ }
+
+ size_type
+ capacity() const
+ {
+#ifdef _GLIBCXX_DEBUG_PEDANTIC
+ return _M_guaranteed_capacity;
+#else
+ return _Base::capacity();
+#endif
+ }
+
+ using _Base::empty;
+
+ void
+ reserve(size_type __n)
+ {
+ bool __realloc = _M_requires_reallocation(__n);
+ _Base::reserve(__n);
+ if (__n > _M_guaranteed_capacity)
+ _M_guaranteed_capacity = __n;
+ if (__realloc)
+ this->_M_invalidate_all();
+ }
+
+ // element access:
+ reference
+ operator[](size_type __n)
+ {
+ __glibcxx_check_subscript(__n);
+ return _M_base()[__n];
+ }
+
+ const_reference
+ operator[](size_type __n) const
+ {
+ __glibcxx_check_subscript(__n);
+ return _M_base()[__n];
+ }
+
+ using _Base::at;
+
+ reference
+ front()
+ {
+ __glibcxx_check_nonempty();
+ return _Base::front();
+ }
+
+ const_reference
+ front() const
+ {
+ __glibcxx_check_nonempty();
+ return _Base::front();
+ }
+
+ reference
+ back()
+ {
+ __glibcxx_check_nonempty();
+ return _Base::back();
+ }
+
+ const_reference
+ back() const
+ {
+ __glibcxx_check_nonempty();
+ return _Base::back();
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 464. Suggestion for new member functions in standard containers.
+ using _Base::data;
+
+ // 23.2.4.3 modifiers:
+ void
+ push_back(const _Tp& __x)
+ {
+ bool __realloc = _M_requires_reallocation(this->size() + 1);
+ _Base::push_back(__x);
+ if (__realloc)
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up = _Tp>
+ typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
+ void>::__type
+ push_back(_Tp&& __x)
+ { emplace_back(std::move(__x)); }
+
+ template<typename... _Args>
+ void
+ emplace_back(_Args&&... __args)
+ {
+ bool __realloc = _M_requires_reallocation(this->size() + 1);
+ _Base::emplace_back(std::forward<_Args>(__args)...);
+ if (__realloc)
+ this->_M_invalidate_all();
+ _M_update_guaranteed_capacity();
+ }
+#endif
+
+ void
+ pop_back()
+ {
+ __glibcxx_check_nonempty();
+ iterator __victim = end() - 1;
+ __victim._M_invalidate();
+ _Base::pop_back();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ iterator
+ emplace(iterator __position, _Args&&... __args)
+ {
+ __glibcxx_check_insert(__position);
+ bool __realloc = _M_requires_reallocation(this->size() + 1);
+ difference_type __offset = __position - begin();
+ typename _Base::iterator __res = _Base::emplace(__position.base(),
+ std::forward<_Args>(__args)...);
+ if (__realloc)
+ this->_M_invalidate_all();
+ else
+ this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
+ _M_update_guaranteed_capacity();
+ return iterator(__res, this);
+ }
+#endif
+
+ iterator
+ insert(iterator __position, const _Tp& __x)
+ {
+ __glibcxx_check_insert(__position);
+ bool __realloc = _M_requires_reallocation(this->size() + 1);
+ difference_type __offset = __position - begin();
+ typename _Base::iterator __res = _Base::insert(__position.base(),__x);
+ if (__realloc)
+ this->_M_invalidate_all();
+ else
+ this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
+ _M_update_guaranteed_capacity();
+ return iterator(__res, this);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Up = _Tp>
+ typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
+ iterator>::__type
+ insert(iterator __position, _Tp&& __x)
+ { return emplace(__position, std::move(__x)); }
+
+ void
+ insert(iterator __position, initializer_list<value_type> __l)
+ { this->insert(__position, __l.begin(), __l.end()); }
+#endif
+
+ void
+ insert(iterator __position, size_type __n, const _Tp& __x)
+ {
+ __glibcxx_check_insert(__position);
+ bool __realloc = _M_requires_reallocation(this->size() + __n);
+ difference_type __offset = __position - begin();
+ _Base::insert(__position.base(), __n, __x);
+ if (__realloc)
+ this->_M_invalidate_all();
+ else
+ this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
+ _M_update_guaranteed_capacity();
+ }
+
+ template<class _InputIterator>
+ void
+ insert(iterator __position,
+ _InputIterator __first, _InputIterator __last)
+ {
+ __glibcxx_check_insert_range(__position, __first, __last);
+
+ /* Hard to guess if invalidation will occur, because __last
+ - __first can't be calculated in all cases, so we just
+ punt here by checking if it did occur. */
+ typename _Base::iterator __old_begin = _M_base().begin();
+ difference_type __offset = __position - begin();
+ _Base::insert(__position.base(), __first, __last);
+
+ if (_M_base().begin() != __old_begin)
+ this->_M_invalidate_all();
+ else
+ this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
+ _M_update_guaranteed_capacity();
+ }
+
+ iterator
+ erase(iterator __position)
+ {
+ __glibcxx_check_erase(__position);
+ difference_type __offset = __position - begin();
+ typename _Base::iterator __res = _Base::erase(__position.base());
+ this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
+ return iterator(__res, this);
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 151. can't currently clear() empty container
+ __glibcxx_check_erase_range(__first, __last);
+
+ difference_type __offset = __first - begin();
+ typename _Base::iterator __res = _Base::erase(__first.base(),
+ __last.base());
+ this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
+ return iterator(__res, this);
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(vector&& __x)
+#else
+ swap(vector& __x)
+#endif
+ {
+ _Base::swap(__x);
+ this->_M_swap(__x);
+ std::swap(_M_guaranteed_capacity, __x._M_guaranteed_capacity);
+ }
+
+ void
+ clear()
+ {
+ _Base::clear();
+ this->_M_invalidate_all();
+ _M_guaranteed_capacity = 0;
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ private:
+ size_type _M_guaranteed_capacity;
+
+ bool
+ _M_requires_reallocation(size_type __elements)
+ { return __elements > this->capacity(); }
+
+ void
+ _M_update_guaranteed_capacity()
+ {
+ if (this->size() > _M_guaranteed_capacity)
+ _M_guaranteed_capacity = this->size();
+ }
+ };
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __debug
+} // namespace std
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/algorithm b/gcc-4.4.0/libstdc++-v3/include/ext/algorithm
new file mode 100644
index 000000000..3337d6c07
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/algorithm
@@ -0,0 +1,524 @@
+// Algorithm extensions -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/algorithm
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _EXT_ALGORITHM
+#define _EXT_ALGORITHM 1
+
+#pragma GCC system_header
+
+#include <algorithm>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::ptrdiff_t;
+ using std::min;
+ using std::pair;
+ using std::input_iterator_tag;
+ using std::random_access_iterator_tag;
+ using std::iterator_traits;
+
+ //--------------------------------------------------
+ // copy_n (not part of the C++ standard)
+
+ template<typename _InputIterator, typename _Size, typename _OutputIterator>
+ pair<_InputIterator, _OutputIterator>
+ __copy_n(_InputIterator __first, _Size __count,
+ _OutputIterator __result,
+ input_iterator_tag)
+ {
+ for ( ; __count > 0; --__count)
+ {
+ *__result = *__first;
+ ++__first;
+ ++__result;
+ }
+ return pair<_InputIterator, _OutputIterator>(__first, __result);
+ }
+
+ template<typename _RAIterator, typename _Size, typename _OutputIterator>
+ inline pair<_RAIterator, _OutputIterator>
+ __copy_n(_RAIterator __first, _Size __count,
+ _OutputIterator __result,
+ random_access_iterator_tag)
+ {
+ _RAIterator __last = __first + __count;
+ return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first,
+ __last,
+ __result));
+ }
+
+ /**
+ * @brief Copies the range [first,first+count) into [result,result+count).
+ * @param first An input iterator.
+ * @param count The number of elements to copy.
+ * @param result An output iterator.
+ * @return A std::pair composed of first+count and result+count.
+ *
+ * This is an SGI extension.
+ * This inline function will boil down to a call to @c memmove whenever
+ * possible. Failing that, if random access iterators are passed, then the
+ * loop count will be known (and therefore a candidate for compiler
+ * optimizations such as unrolling).
+ * @ingroup SGIextensions
+ */
+ template<typename _InputIterator, typename _Size, typename _OutputIterator>
+ inline pair<_InputIterator, _OutputIterator>
+ copy_n(_InputIterator __first, _Size __count, _OutputIterator __result)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_InputIterator>::value_type>)
+
+ return __copy_n(__first, __count, __result,
+ std::__iterator_category(__first));
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2>
+ int
+ __lexicographical_compare_3way(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2)
+ {
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (*__first1 < *__first2)
+ return -1;
+ if (*__first2 < *__first1)
+ return 1;
+ ++__first1;
+ ++__first2;
+ }
+ if (__first2 == __last2)
+ return !(__first1 == __last1);
+ else
+ return -1;
+ }
+
+ inline int
+ __lexicographical_compare_3way(const unsigned char* __first1,
+ const unsigned char* __last1,
+ const unsigned char* __first2,
+ const unsigned char* __last2)
+ {
+ const ptrdiff_t __len1 = __last1 - __first1;
+ const ptrdiff_t __len2 = __last2 - __first2;
+ const int __result = __builtin_memcmp(__first1, __first2,
+ min(__len1, __len2));
+ return __result != 0 ? __result
+ : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
+ }
+
+ inline int
+ __lexicographical_compare_3way(const char* __first1, const char* __last1,
+ const char* __first2, const char* __last2)
+ {
+#if CHAR_MAX == SCHAR_MAX
+ return __lexicographical_compare_3way((const signed char*) __first1,
+ (const signed char*) __last1,
+ (const signed char*) __first2,
+ (const signed char*) __last2);
+#else
+ return __lexicographical_compare_3way((const unsigned char*) __first1,
+ (const unsigned char*) __last1,
+ (const unsigned char*) __first2,
+ (const unsigned char*) __last2);
+#endif
+ }
+
+ /**
+ * @brief @c memcmp on steroids.
+ * @param first1 An input iterator.
+ * @param last1 An input iterator.
+ * @param first2 An input iterator.
+ * @param last2 An input iterator.
+ * @return An int, as with @c memcmp.
+ *
+ * The return value will be less than zero if the first range is
+ * "lexigraphically less than" the second, greater than zero if the second
+ * range is "lexigraphically less than" the first, and zero otherwise.
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ */
+ template<typename _InputIterator1, typename _InputIterator2>
+ int
+ lexicographical_compare_3way(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_InputIterator1>::value_type>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
+
+ return __lexicographical_compare_3way(__first1, __last1, __first2,
+ __last2);
+ }
+
+ // count and count_if: this version, whose return type is void, was present
+ // in the HP STL, and is retained as an extension for backward compatibility.
+ template<typename _InputIterator, typename _Tp, typename _Size>
+ void
+ count(_InputIterator __first, _InputIterator __last,
+ const _Tp& __value,
+ _Size& __n)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_EqualityComparableConcept<
+ typename iterator_traits<_InputIterator>::value_type >)
+ __glibcxx_function_requires(_EqualityComparableConcept<_Tp>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for ( ; __first != __last; ++__first)
+ if (*__first == __value)
+ ++__n;
+ }
+
+ template<typename _InputIterator, typename _Predicate, typename _Size>
+ void
+ count_if(_InputIterator __first, _InputIterator __last,
+ _Predicate __pred,
+ _Size& __n)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
+ typename iterator_traits<_InputIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ for ( ; __first != __last; ++__first)
+ if (__pred(*__first))
+ ++__n;
+ }
+
+ // random_sample and random_sample_n (extensions, not part of the standard).
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _ForwardIterator, typename _OutputIterator,
+ typename _Distance>
+ _OutputIterator
+ random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
+ _OutputIterator __out, const _Distance __n)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ _Distance __remaining = std::distance(__first, __last);
+ _Distance __m = min(__n, __remaining);
+
+ while (__m > 0)
+ {
+ if ((std::rand() % __remaining) < __m)
+ {
+ *__out = *__first;
+ ++__out;
+ --__m;
+ }
+ --__remaining;
+ ++__first;
+ }
+ return __out;
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _ForwardIterator, typename _OutputIterator,
+ typename _Distance, typename _RandomNumberGenerator>
+ _OutputIterator
+ random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
+ _OutputIterator __out, const _Distance __n,
+ _RandomNumberGenerator& __rand)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_function_requires(_UnaryFunctionConcept<
+ _RandomNumberGenerator, _Distance, _Distance>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ _Distance __remaining = std::distance(__first, __last);
+ _Distance __m = min(__n, __remaining);
+
+ while (__m > 0)
+ {
+ if (__rand(__remaining) < __m)
+ {
+ *__out = *__first;
+ ++__out;
+ --__m;
+ }
+ --__remaining;
+ ++__first;
+ }
+ return __out;
+ }
+
+ template<typename _InputIterator, typename _RandomAccessIterator,
+ typename _Distance>
+ _RandomAccessIterator
+ __random_sample(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __out,
+ const _Distance __n)
+ {
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out[__m] = *__first;
+
+ while (__first != __last)
+ {
+ ++__t;
+ _Distance __M = std::rand() % (__t);
+ if (__M < __n)
+ __out[__M] = *__first;
+ ++__first;
+ }
+ return __out + __m;
+ }
+
+ template<typename _InputIterator, typename _RandomAccessIterator,
+ typename _RandomNumberGenerator, typename _Distance>
+ _RandomAccessIterator
+ __random_sample(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __out,
+ _RandomNumberGenerator& __rand,
+ const _Distance __n)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_UnaryFunctionConcept<
+ _RandomNumberGenerator, _Distance, _Distance>)
+
+ _Distance __m = 0;
+ _Distance __t = __n;
+ for ( ; __first != __last && __m < __n; ++__m, ++__first)
+ __out[__m] = *__first;
+
+ while (__first != __last)
+ {
+ ++__t;
+ _Distance __M = __rand(__t);
+ if (__M < __n)
+ __out[__M] = *__first;
+ ++__first;
+ }
+ return __out + __m;
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _InputIterator, typename _RandomAccessIterator>
+ inline _RandomAccessIterator
+ random_sample(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __out_first,
+ _RandomAccessIterator __out_last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_valid_range(__out_first, __out_last);
+
+ return __random_sample(__first, __last,
+ __out_first, __out_last - __out_first);
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _InputIterator, typename _RandomAccessIterator,
+ typename _RandomNumberGenerator>
+ inline _RandomAccessIterator
+ random_sample(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __out_first,
+ _RandomAccessIterator __out_last,
+ _RandomNumberGenerator& __rand)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_requires_valid_range(__first, __last);
+ __glibcxx_requires_valid_range(__out_first, __out_last);
+
+ return __random_sample(__first, __last,
+ __out_first, __rand,
+ __out_last - __out_first);
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _RandomAccessIterator>
+ inline bool
+ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return std::__is_heap(__first, __last - __first);
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _RandomAccessIterator, typename _StrictWeakOrdering>
+ inline bool
+ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _StrictWeakOrdering __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
+ typename iterator_traits<_RandomAccessIterator>::value_type,
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return std::__is_heap(__first, __comp, __last - __first);
+ }
+
+ // is_sorted, a predicated testing whether a range is sorted in
+ // nondescending order. This is an extension, not part of the C++
+ // standard.
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _ForwardIterator>
+ bool
+ is_sorted(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return true;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (*__next < *__first)
+ return false;
+ return true;
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _ForwardIterator, typename _StrictWeakOrdering>
+ bool
+ is_sorted(_ForwardIterator __first, _ForwardIterator __last,
+ _StrictWeakOrdering __comp)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
+ typename iterator_traits<_ForwardIterator>::value_type,
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ if (__first == __last)
+ return true;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (__comp(*__next, *__first))
+ return false;
+ return true;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _EXT_ALGORITHM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/array_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/array_allocator.h
new file mode 100644
index 000000000..f36f273d1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/array_allocator.h
@@ -0,0 +1,154 @@
+// array allocator -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/array_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _ARRAY_ALLOCATOR_H
+#define _ARRAY_ALLOCATOR_H 1
+
+#include <cstddef>
+#include <new>
+#include <bits/functexcept.h>
+#include <tr1/array>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+
+ /// Base class.
+ template<typename _Tp>
+ class array_allocator_base
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ pointer
+ address(reference __x) const { return &__x; }
+
+ const_pointer
+ address(const_reference __x) const { return &__x; }
+
+ void
+ deallocate(pointer, size_type)
+ {
+ // Does nothing.
+ }
+
+ size_type
+ max_size() const throw()
+ { return size_t(-1) / sizeof(_Tp); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 402. wrong new expression in [some_] allocator::construct
+ void
+ construct(pointer __p, const _Tp& __val)
+ { ::new((void *)__p) value_type(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void
+ destroy(pointer __p) { __p->~_Tp(); }
+ };
+
+ /**
+ * @brief An allocator that uses previously allocated memory.
+ * This memory can be externally, globally, or otherwise allocated.
+ * @ingroup allocators
+ */
+ template<typename _Tp, typename _Array = std::tr1::array<_Tp, 1> >
+ class array_allocator : public array_allocator_base<_Tp>
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+ typedef _Array array_type;
+
+ private:
+ array_type* _M_array;
+ size_type _M_used;
+
+ public:
+ template<typename _Tp1, typename _Array1 = _Array>
+ struct rebind
+ { typedef array_allocator<_Tp1, _Array1> other; };
+
+ array_allocator(array_type* __array = NULL) throw()
+ : _M_array(__array), _M_used(size_type()) { }
+
+ array_allocator(const array_allocator& __o) throw()
+ : _M_array(__o._M_array), _M_used(__o._M_used) { }
+
+ template<typename _Tp1, typename _Array1>
+ array_allocator(const array_allocator<_Tp1, _Array1>&) throw()
+ : _M_array(NULL), _M_used(size_type()) { }
+
+ ~array_allocator() throw() { }
+
+ pointer
+ allocate(size_type __n, const void* = 0)
+ {
+ if (_M_array == 0 || _M_used + __n > _M_array->size())
+ std::__throw_bad_alloc();
+ pointer __ret = _M_array->begin() + _M_used;
+ _M_used += __n;
+ return __ret;
+ }
+ };
+
+ template<typename _Tp, typename _Array>
+ inline bool
+ operator==(const array_allocator<_Tp, _Array>&,
+ const array_allocator<_Tp, _Array>&)
+ { return true; }
+
+ template<typename _Tp, typename _Array>
+ inline bool
+ operator!=(const array_allocator<_Tp, _Array>&,
+ const array_allocator<_Tp, _Array>&)
+ { return false; }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/atomicity.h b/gcc-4.4.0/libstdc++-v3/include/ext/atomicity.h
new file mode 100644
index 000000000..bb891e8af
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/atomicity.h
@@ -0,0 +1,113 @@
+// Support for atomic operations -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file atomicity.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ATOMICITY_H
+#define _GLIBCXX_ATOMICITY_H 1
+
+#include <bits/c++config.h>
+#include <bits/gthr.h>
+#include <bits/atomic_word.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Functions for portable atomic access.
+ // To abstract locking primitives across all thread policies, use:
+ // __exchange_and_add_dispatch
+ // __atomic_add_dispatch
+#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+ static inline _Atomic_word
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
+ { return __sync_fetch_and_add(__mem, __val); }
+
+ static inline void
+ __atomic_add(volatile _Atomic_word* __mem, int __val)
+ { __sync_fetch_and_add(__mem, __val); }
+#else
+ _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add(volatile _Atomic_word*, int);
+
+ void
+ __attribute__ ((__unused__))
+ __atomic_add(volatile _Atomic_word*, int);
+#endif
+
+ static inline _Atomic_word
+ __exchange_and_add_single(_Atomic_word* __mem, int __val)
+ {
+ _Atomic_word __result = *__mem;
+ *__mem += __val;
+ return __result;
+ }
+
+ static inline void
+ __atomic_add_single(_Atomic_word* __mem, int __val)
+ { *__mem += __val; }
+
+ static inline _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add_dispatch(_Atomic_word* __mem, int __val)
+ {
+#ifdef __GTHREADS
+ if (__gthread_active_p())
+ return __exchange_and_add(__mem, __val);
+ else
+ return __exchange_and_add_single(__mem, __val);
+#else
+ return __exchange_and_add_single(__mem, __val);
+#endif
+ }
+
+ static inline void
+ __attribute__ ((__unused__))
+ __atomic_add_dispatch(_Atomic_word* __mem, int __val)
+ {
+#ifdef __GTHREADS
+ if (__gthread_active_p())
+ __atomic_add(__mem, __val);
+ else
+ __atomic_add_single(__mem, __val);
+#else
+ __atomic_add_single(__mem, __val);
+#endif
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+// Even if the CPU doesn't need a memory barrier, we need to ensure
+// that the compiler doesn't reorder memory accesses across the
+// barriers.
+#ifndef _GLIBCXX_READ_MEM_BARRIER
+#define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory")
+#endif
+#ifndef _GLIBCXX_WRITE_MEM_BARRIER
+#define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory")
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/bitmap_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/bitmap_allocator.h
new file mode 100644
index 000000000..3ad08fbef
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -0,0 +1,1145 @@
+// Bitmap Allocator. -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/bitmap_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _BITMAP_ALLOCATOR_H
+#define _BITMAP_ALLOCATOR_H 1
+
+#include <cstddef> // For std::size_t, and ptrdiff_t.
+#include <bits/functexcept.h> // For __throw_bad_alloc().
+#include <utility> // For std::pair.
+#include <functional> // For greater_equal, and less_equal.
+#include <new> // For operator new.
+#include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT
+#include <ext/concurrence.h>
+#include <bits/move.h>
+
+/** @brief The constant in the expression below is the alignment
+ * required in bytes.
+ */
+#define _BALLOC_ALIGN_BYTES 8
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+
+ namespace __detail
+ {
+ /** @class __mini_vector bitmap_allocator.h bitmap_allocator.h
+ *
+ * @brief __mini_vector<> is a stripped down version of the
+ * full-fledged std::vector<>.
+ *
+ * It is to be used only for built-in types or PODs. Notable
+ * differences are:
+ *
+ * @detail
+ * 1. Not all accessor functions are present.
+ * 2. Used ONLY for PODs.
+ * 3. No Allocator template argument. Uses ::operator new() to get
+ * memory, and ::operator delete() to free it.
+ * Caveat: The dtor does NOT free the memory allocated, so this a
+ * memory-leaking vector!
+ */
+ template<typename _Tp>
+ class __mini_vector
+ {
+ __mini_vector(const __mini_vector&);
+ __mini_vector& operator=(const __mini_vector&);
+
+ public:
+ typedef _Tp value_type;
+ typedef _Tp* pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef pointer iterator;
+
+ private:
+ pointer _M_start;
+ pointer _M_finish;
+ pointer _M_end_of_storage;
+
+ size_type
+ _M_space_left() const throw()
+ { return _M_end_of_storage - _M_finish; }
+
+ pointer
+ allocate(size_type __n)
+ { return static_cast<pointer>(::operator new(__n * sizeof(_Tp))); }
+
+ void
+ deallocate(pointer __p, size_type)
+ { ::operator delete(__p); }
+
+ public:
+ // Members used: size(), push_back(), pop_back(),
+ // insert(iterator, const_reference), erase(iterator),
+ // begin(), end(), back(), operator[].
+
+ __mini_vector() : _M_start(0), _M_finish(0),
+ _M_end_of_storage(0)
+ { }
+
+#if 0
+ ~__mini_vector()
+ {
+ if (this->_M_start)
+ {
+ this->deallocate(this->_M_start, this->_M_end_of_storage
+ - this->_M_start);
+ }
+ }
+#endif
+
+ size_type
+ size() const throw()
+ { return _M_finish - _M_start; }
+
+ iterator
+ begin() const throw()
+ { return this->_M_start; }
+
+ iterator
+ end() const throw()
+ { return this->_M_finish; }
+
+ reference
+ back() const throw()
+ { return *(this->end() - 1); }
+
+ reference
+ operator[](const size_type __pos) const throw()
+ { return this->_M_start[__pos]; }
+
+ void
+ insert(iterator __pos, const_reference __x);
+
+ void
+ push_back(const_reference __x)
+ {
+ if (this->_M_space_left())
+ {
+ *this->end() = __x;
+ ++this->_M_finish;
+ }
+ else
+ this->insert(this->end(), __x);
+ }
+
+ void
+ pop_back() throw()
+ { --this->_M_finish; }
+
+ void
+ erase(iterator __pos) throw();
+
+ void
+ clear() throw()
+ { this->_M_finish = this->_M_start; }
+ };
+
+ // Out of line function definitions.
+ template<typename _Tp>
+ void __mini_vector<_Tp>::
+ insert(iterator __pos, const_reference __x)
+ {
+ if (this->_M_space_left())
+ {
+ size_type __to_move = this->_M_finish - __pos;
+ iterator __dest = this->end();
+ iterator __src = this->end() - 1;
+
+ ++this->_M_finish;
+ while (__to_move)
+ {
+ *__dest = *__src;
+ --__dest; --__src; --__to_move;
+ }
+ *__pos = __x;
+ }
+ else
+ {
+ size_type __new_size = this->size() ? this->size() * 2 : 1;
+ iterator __new_start = this->allocate(__new_size);
+ iterator __first = this->begin();
+ iterator __start = __new_start;
+ while (__first != __pos)
+ {
+ *__start = *__first;
+ ++__start; ++__first;
+ }
+ *__start = __x;
+ ++__start;
+ while (__first != this->end())
+ {
+ *__start = *__first;
+ ++__start; ++__first;
+ }
+ if (this->_M_start)
+ this->deallocate(this->_M_start, this->size());
+
+ this->_M_start = __new_start;
+ this->_M_finish = __start;
+ this->_M_end_of_storage = this->_M_start + __new_size;
+ }
+ }
+
+ template<typename _Tp>
+ void __mini_vector<_Tp>::
+ erase(iterator __pos) throw()
+ {
+ while (__pos + 1 != this->end())
+ {
+ *__pos = __pos[1];
+ ++__pos;
+ }
+ --this->_M_finish;
+ }
+
+
+ template<typename _Tp>
+ struct __mv_iter_traits
+ {
+ typedef typename _Tp::value_type value_type;
+ typedef typename _Tp::difference_type difference_type;
+ };
+
+ template<typename _Tp>
+ struct __mv_iter_traits<_Tp*>
+ {
+ typedef _Tp value_type;
+ typedef ptrdiff_t difference_type;
+ };
+
+ enum
+ {
+ bits_per_byte = 8,
+ bits_per_block = sizeof(size_t) * size_t(bits_per_byte)
+ };
+
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _ForwardIterator
+ __lower_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val, _Compare __comp)
+ {
+ typedef typename __mv_iter_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename __mv_iter_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ _DistanceType __len = __last - __first;
+ _DistanceType __half;
+ _ForwardIterator __middle;
+
+ while (__len > 0)
+ {
+ __half = __len >> 1;
+ __middle = __first;
+ __middle += __half;
+ if (__comp(*__middle, __val))
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+ }
+
+ template<typename _InputIterator, typename _Predicate>
+ inline _InputIterator
+ __find_if(_InputIterator __first, _InputIterator __last, _Predicate __p)
+ {
+ while (__first != __last && !__p(*__first))
+ ++__first;
+ return __first;
+ }
+
+ /** @brief The number of Blocks pointed to by the address pair
+ * passed to the function.
+ */
+ template<typename _AddrPair>
+ inline size_t
+ __num_blocks(_AddrPair __ap)
+ { return (__ap.second - __ap.first) + 1; }
+
+ /** @brief The number of Bit-maps pointed to by the address pair
+ * passed to the function.
+ */
+ template<typename _AddrPair>
+ inline size_t
+ __num_bitmaps(_AddrPair __ap)
+ { return __num_blocks(__ap) / size_t(bits_per_block); }
+
+ // _Tp should be a pointer type.
+ template<typename _Tp>
+ class _Inclusive_between
+ : public std::unary_function<typename std::pair<_Tp, _Tp>, bool>
+ {
+ typedef _Tp pointer;
+ pointer _M_ptr_value;
+ typedef typename std::pair<_Tp, _Tp> _Block_pair;
+
+ public:
+ _Inclusive_between(pointer __ptr) : _M_ptr_value(__ptr)
+ { }
+
+ bool
+ operator()(_Block_pair __bp) const throw()
+ {
+ if (std::less_equal<pointer>()(_M_ptr_value, __bp.second)
+ && std::greater_equal<pointer>()(_M_ptr_value, __bp.first))
+ return true;
+ else
+ return false;
+ }
+ };
+
+ // Used to pass a Functor to functions by reference.
+ template<typename _Functor>
+ class _Functor_Ref
+ : public std::unary_function<typename _Functor::argument_type,
+ typename _Functor::result_type>
+ {
+ _Functor& _M_fref;
+
+ public:
+ typedef typename _Functor::argument_type argument_type;
+ typedef typename _Functor::result_type result_type;
+
+ _Functor_Ref(_Functor& __fref) : _M_fref(__fref)
+ { }
+
+ result_type
+ operator()(argument_type __arg)
+ { return _M_fref(__arg); }
+ };
+
+ /** @class _Ffit_finder bitmap_allocator.h bitmap_allocator.h
+ *
+ * @brief The class which acts as a predicate for applying the
+ * first-fit memory allocation policy for the bitmap allocator.
+ */
+ // _Tp should be a pointer type, and _Alloc is the Allocator for
+ // the vector.
+ template<typename _Tp>
+ class _Ffit_finder
+ : public std::unary_function<typename std::pair<_Tp, _Tp>, bool>
+ {
+ typedef typename std::pair<_Tp, _Tp> _Block_pair;
+ typedef typename __detail::__mini_vector<_Block_pair> _BPVector;
+ typedef typename _BPVector::difference_type _Counter_type;
+
+ size_t* _M_pbitmap;
+ _Counter_type _M_data_offset;
+
+ public:
+ _Ffit_finder() : _M_pbitmap(0), _M_data_offset(0)
+ { }
+
+ bool
+ operator()(_Block_pair __bp) throw()
+ {
+ // Set the _rover to the last physical location bitmap,
+ // which is the bitmap which belongs to the first free
+ // block. Thus, the bitmaps are in exact reverse order of
+ // the actual memory layout. So, we count down the bitmaps,
+ // which is the same as moving up the memory.
+
+ // If the used count stored at the start of the Bit Map headers
+ // is equal to the number of Objects that the current Block can
+ // store, then there is definitely no space for another single
+ // object, so just return false.
+ _Counter_type __diff =
+ __gnu_cxx::__detail::__num_bitmaps(__bp);
+
+ if (*(reinterpret_cast<size_t*>
+ (__bp.first) - (__diff + 1))
+ == __gnu_cxx::__detail::__num_blocks(__bp))
+ return false;
+
+ size_t* __rover = reinterpret_cast<size_t*>(__bp.first) - 1;
+
+ for (_Counter_type __i = 0; __i < __diff; ++__i)
+ {
+ _M_data_offset = __i;
+ if (*__rover)
+ {
+ _M_pbitmap = __rover;
+ return true;
+ }
+ --__rover;
+ }
+ return false;
+ }
+
+
+ size_t*
+ _M_get() const throw()
+ { return _M_pbitmap; }
+
+ _Counter_type
+ _M_offset() const throw()
+ { return _M_data_offset * size_t(bits_per_block); }
+ };
+
+
+ /** @class _Bitmap_counter bitmap_allocator.h bitmap_allocator.h
+ *
+ * @brief The bitmap counter which acts as the bitmap
+ * manipulator, and manages the bit-manipulation functions and
+ * the searching and identification functions on the bit-map.
+ */
+ // _Tp should be a pointer type.
+ template<typename _Tp>
+ class _Bitmap_counter
+ {
+ typedef typename __detail::__mini_vector<typename std::pair<_Tp, _Tp> >
+ _BPVector;
+ typedef typename _BPVector::size_type _Index_type;
+ typedef _Tp pointer;
+
+ _BPVector& _M_vbp;
+ size_t* _M_curr_bmap;
+ size_t* _M_last_bmap_in_block;
+ _Index_type _M_curr_index;
+
+ public:
+ // Use the 2nd parameter with care. Make sure that such an
+ // entry exists in the vector before passing that particular
+ // index to this ctor.
+ _Bitmap_counter(_BPVector& Rvbp, long __index = -1) : _M_vbp(Rvbp)
+ { this->_M_reset(__index); }
+
+ void
+ _M_reset(long __index = -1) throw()
+ {
+ if (__index == -1)
+ {
+ _M_curr_bmap = 0;
+ _M_curr_index = static_cast<_Index_type>(-1);
+ return;
+ }
+
+ _M_curr_index = __index;
+ _M_curr_bmap = reinterpret_cast<size_t*>
+ (_M_vbp[_M_curr_index].first) - 1;
+
+ _GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1);
+
+ _M_last_bmap_in_block = _M_curr_bmap
+ - ((_M_vbp[_M_curr_index].second
+ - _M_vbp[_M_curr_index].first + 1)
+ / size_t(bits_per_block) - 1);
+ }
+
+ // Dangerous Function! Use with extreme care. Pass to this
+ // function ONLY those values that are known to be correct,
+ // otherwise this will mess up big time.
+ void
+ _M_set_internal_bitmap(size_t* __new_internal_marker) throw()
+ { _M_curr_bmap = __new_internal_marker; }
+
+ bool
+ _M_finished() const throw()
+ { return(_M_curr_bmap == 0); }
+
+ _Bitmap_counter&
+ operator++() throw()
+ {
+ if (_M_curr_bmap == _M_last_bmap_in_block)
+ {
+ if (++_M_curr_index == _M_vbp.size())
+ _M_curr_bmap = 0;
+ else
+ this->_M_reset(_M_curr_index);
+ }
+ else
+ --_M_curr_bmap;
+ return *this;
+ }
+
+ size_t*
+ _M_get() const throw()
+ { return _M_curr_bmap; }
+
+ pointer
+ _M_base() const throw()
+ { return _M_vbp[_M_curr_index].first; }
+
+ _Index_type
+ _M_offset() const throw()
+ {
+ return size_t(bits_per_block)
+ * ((reinterpret_cast<size_t*>(this->_M_base())
+ - _M_curr_bmap) - 1);
+ }
+
+ _Index_type
+ _M_where() const throw()
+ { return _M_curr_index; }
+ };
+
+ /** @brief Mark a memory address as allocated by re-setting the
+ * corresponding bit in the bit-map.
+ */
+ inline void
+ __bit_allocate(size_t* __pbmap, size_t __pos) throw()
+ {
+ size_t __mask = 1 << __pos;
+ __mask = ~__mask;
+ *__pbmap &= __mask;
+ }
+
+ /** @brief Mark a memory address as free by setting the
+ * corresponding bit in the bit-map.
+ */
+ inline void
+ __bit_free(size_t* __pbmap, size_t __pos) throw()
+ {
+ size_t __mask = 1 << __pos;
+ *__pbmap |= __mask;
+ }
+ } // namespace __detail
+
+ /** @brief Generic Version of the bsf instruction.
+ */
+ inline size_t
+ _Bit_scan_forward(size_t __num)
+ { return static_cast<size_t>(__builtin_ctzl(__num)); }
+
+ /** @class free_list bitmap_allocator.h bitmap_allocator.h
+ *
+ * @brief The free list class for managing chunks of memory to be
+ * given to and returned by the bitmap_allocator.
+ */
+ class free_list
+ {
+ typedef size_t* value_type;
+ typedef __detail::__mini_vector<value_type> vector_type;
+ typedef vector_type::iterator iterator;
+ typedef __mutex __mutex_type;
+
+ struct _LT_pointer_compare
+ {
+ bool
+ operator()(const size_t* __pui,
+ const size_t __cui) const throw()
+ { return *__pui < __cui; }
+ };
+
+#if defined __GTHREADS
+ __mutex_type&
+ _M_get_mutex()
+ {
+ static __mutex_type _S_mutex;
+ return _S_mutex;
+ }
+#endif
+
+ vector_type&
+ _M_get_free_list()
+ {
+ static vector_type _S_free_list;
+ return _S_free_list;
+ }
+
+ /** @brief Performs validation of memory based on their size.
+ *
+ * @param __addr The pointer to the memory block to be
+ * validated.
+ *
+ * @detail Validates the memory block passed to this function and
+ * appropriately performs the action of managing the free list of
+ * blocks by adding this block to the free list or deleting this
+ * or larger blocks from the free list.
+ */
+ void
+ _M_validate(size_t* __addr) throw()
+ {
+ vector_type& __free_list = _M_get_free_list();
+ const vector_type::size_type __max_size = 64;
+ if (__free_list.size() >= __max_size)
+ {
+ // Ok, the threshold value has been reached. We determine
+ // which block to remove from the list of free blocks.
+ if (*__addr >= *__free_list.back())
+ {
+ // Ok, the new block is greater than or equal to the
+ // last block in the list of free blocks. We just free
+ // the new block.
+ ::operator delete(static_cast<void*>(__addr));
+ return;
+ }
+ else
+ {
+ // Deallocate the last block in the list of free lists,
+ // and insert the new one in its correct position.
+ ::operator delete(static_cast<void*>(__free_list.back()));
+ __free_list.pop_back();
+ }
+ }
+
+ // Just add the block to the list of free lists unconditionally.
+ iterator __temp = __gnu_cxx::__detail::__lower_bound
+ (__free_list.begin(), __free_list.end(),
+ *__addr, _LT_pointer_compare());
+
+ // We may insert the new free list before _temp;
+ __free_list.insert(__temp, __addr);
+ }
+
+ /** @brief Decides whether the wastage of memory is acceptable for
+ * the current memory request and returns accordingly.
+ *
+ * @param __block_size The size of the block available in the free
+ * list.
+ *
+ * @param __required_size The required size of the memory block.
+ *
+ * @return true if the wastage incurred is acceptable, else returns
+ * false.
+ */
+ bool
+ _M_should_i_give(size_t __block_size,
+ size_t __required_size) throw()
+ {
+ const size_t __max_wastage_percentage = 36;
+ if (__block_size >= __required_size &&
+ (((__block_size - __required_size) * 100 / __block_size)
+ < __max_wastage_percentage))
+ return true;
+ else
+ return false;
+ }
+
+ public:
+ /** @brief This function returns the block of memory to the
+ * internal free list.
+ *
+ * @param __addr The pointer to the memory block that was given
+ * by a call to the _M_get function.
+ */
+ inline void
+ _M_insert(size_t* __addr) throw()
+ {
+#if defined __GTHREADS
+ __gnu_cxx::__scoped_lock __bfl_lock(_M_get_mutex());
+#endif
+ // Call _M_validate to decide what should be done with
+ // this particular free list.
+ this->_M_validate(reinterpret_cast<size_t*>(__addr) - 1);
+ // See discussion as to why this is 1!
+ }
+
+ /** @brief This function gets a block of memory of the specified
+ * size from the free list.
+ *
+ * @param __sz The size in bytes of the memory required.
+ *
+ * @return A pointer to the new memory block of size at least
+ * equal to that requested.
+ */
+ size_t*
+ _M_get(size_t __sz) throw(std::bad_alloc);
+
+ /** @brief This function just clears the internal Free List, and
+ * gives back all the memory to the OS.
+ */
+ void
+ _M_clear();
+ };
+
+
+ // Forward declare the class.
+ template<typename _Tp>
+ class bitmap_allocator;
+
+ // Specialize for void:
+ template<>
+ class bitmap_allocator<void>
+ {
+ public:
+ typedef void* pointer;
+ typedef const void* const_pointer;
+
+ // Reference-to-void members are impossible.
+ typedef void value_type;
+ template<typename _Tp1>
+ struct rebind
+ {
+ typedef bitmap_allocator<_Tp1> other;
+ };
+ };
+
+ /**
+ * @brief Bitmap Allocator, primary template.
+ * @ingroup allocators
+ */
+ template<typename _Tp>
+ class bitmap_allocator : private free_list
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+ typedef free_list::__mutex_type __mutex_type;
+
+ template<typename _Tp1>
+ struct rebind
+ {
+ typedef bitmap_allocator<_Tp1> other;
+ };
+
+ private:
+ template<size_t _BSize, size_t _AlignSize>
+ struct aligned_size
+ {
+ enum
+ {
+ modulus = _BSize % _AlignSize,
+ value = _BSize + (modulus ? _AlignSize - (modulus) : 0)
+ };
+ };
+
+ struct _Alloc_block
+ {
+ char __M_unused[aligned_size<sizeof(value_type),
+ _BALLOC_ALIGN_BYTES>::value];
+ };
+
+
+ typedef typename std::pair<_Alloc_block*, _Alloc_block*> _Block_pair;
+
+ typedef typename
+ __detail::__mini_vector<_Block_pair> _BPVector;
+
+#if defined _GLIBCXX_DEBUG
+ // Complexity: O(lg(N)). Where, N is the number of block of size
+ // sizeof(value_type).
+ void
+ _S_check_for_free_blocks() throw()
+ {
+ typedef typename
+ __gnu_cxx::__detail::_Ffit_finder<_Alloc_block*> _FFF;
+ _FFF __fff;
+ typedef typename _BPVector::iterator _BPiter;
+ _BPiter __bpi =
+ __gnu_cxx::__detail::__find_if
+ (_S_mem_blocks.begin(), _S_mem_blocks.end(),
+ __gnu_cxx::__detail::_Functor_Ref<_FFF>(__fff));
+
+ _GLIBCXX_DEBUG_ASSERT(__bpi == _S_mem_blocks.end());
+ }
+#endif
+
+ /** @brief Responsible for exponentially growing the internal
+ * memory pool.
+ *
+ * @throw std::bad_alloc. If memory can not be allocated.
+ *
+ * @detail Complexity: O(1), but internally depends upon the
+ * complexity of the function free_list::_M_get. The part where
+ * the bitmap headers are written has complexity: O(X),where X
+ * is the number of blocks of size sizeof(value_type) within
+ * the newly acquired block. Having a tight bound.
+ */
+ void
+ _S_refill_pool() throw(std::bad_alloc)
+ {
+#if defined _GLIBCXX_DEBUG
+ _S_check_for_free_blocks();
+#endif
+
+ const size_t __num_bitmaps = (_S_block_size
+ / size_t(__detail::bits_per_block));
+ const size_t __size_to_allocate = sizeof(size_t)
+ + _S_block_size * sizeof(_Alloc_block)
+ + __num_bitmaps * sizeof(size_t);
+
+ size_t* __temp =
+ reinterpret_cast<size_t*>
+ (this->_M_get(__size_to_allocate));
+ *__temp = 0;
+ ++__temp;
+
+ // The Header information goes at the Beginning of the Block.
+ _Block_pair __bp =
+ std::make_pair(reinterpret_cast<_Alloc_block*>
+ (__temp + __num_bitmaps),
+ reinterpret_cast<_Alloc_block*>
+ (__temp + __num_bitmaps)
+ + _S_block_size - 1);
+
+ // Fill the Vector with this information.
+ _S_mem_blocks.push_back(__bp);
+
+ size_t __bit_mask = 0; // 0 Indicates all Allocated.
+ __bit_mask = ~__bit_mask; // 1 Indicates all Free.
+
+ for (size_t __i = 0; __i < __num_bitmaps; ++__i)
+ __temp[__i] = __bit_mask;
+
+ _S_block_size *= 2;
+ }
+
+
+ static _BPVector _S_mem_blocks;
+ static size_t _S_block_size;
+ static __gnu_cxx::__detail::
+ _Bitmap_counter<_Alloc_block*> _S_last_request;
+ static typename _BPVector::size_type _S_last_dealloc_index;
+#if defined __GTHREADS
+ static __mutex_type _S_mut;
+#endif
+
+ public:
+
+ /** @brief Allocates memory for a single object of size
+ * sizeof(_Tp).
+ *
+ * @throw std::bad_alloc. If memory can not be allocated.
+ *
+ * @detail Complexity: Worst case complexity is O(N), but that
+ * is hardly ever hit. If and when this particular case is
+ * encountered, the next few cases are guaranteed to have a
+ * worst case complexity of O(1)! That's why this function
+ * performs very well on average. You can consider this
+ * function to have a complexity referred to commonly as:
+ * Amortized Constant time.
+ */
+ pointer
+ _M_allocate_single_object() throw(std::bad_alloc)
+ {
+#if defined __GTHREADS
+ __gnu_cxx::__scoped_lock __bit_lock(_S_mut);
+#endif
+
+ // The algorithm is something like this: The last_request
+ // variable points to the last accessed Bit Map. When such a
+ // condition occurs, we try to find a free block in the
+ // current bitmap, or succeeding bitmaps until the last bitmap
+ // is reached. If no free block turns up, we resort to First
+ // Fit method.
+
+ // WARNING: Do not re-order the condition in the while
+ // statement below, because it relies on C++'s short-circuit
+ // evaluation. The return from _S_last_request->_M_get() will
+ // NOT be dereference able if _S_last_request->_M_finished()
+ // returns true. This would inevitably lead to a NULL pointer
+ // dereference if tinkered with.
+ while (_S_last_request._M_finished() == false
+ && (*(_S_last_request._M_get()) == 0))
+ {
+ _S_last_request.operator++();
+ }
+
+ if (__builtin_expect(_S_last_request._M_finished() == true, false))
+ {
+ // Fall Back to First Fit algorithm.
+ typedef typename
+ __gnu_cxx::__detail::_Ffit_finder<_Alloc_block*> _FFF;
+ _FFF __fff;
+ typedef typename _BPVector::iterator _BPiter;
+ _BPiter __bpi =
+ __gnu_cxx::__detail::__find_if
+ (_S_mem_blocks.begin(), _S_mem_blocks.end(),
+ __gnu_cxx::__detail::_Functor_Ref<_FFF>(__fff));
+
+ if (__bpi != _S_mem_blocks.end())
+ {
+ // Search was successful. Ok, now mark the first bit from
+ // the right as 0, meaning Allocated. This bit is obtained
+ // by calling _M_get() on __fff.
+ size_t __nz_bit = _Bit_scan_forward(*__fff._M_get());
+ __detail::__bit_allocate(__fff._M_get(), __nz_bit);
+
+ _S_last_request._M_reset(__bpi - _S_mem_blocks.begin());
+
+ // Now, get the address of the bit we marked as allocated.
+ pointer __ret = reinterpret_cast<pointer>
+ (__bpi->first + __fff._M_offset() + __nz_bit);
+ size_t* __puse_count =
+ reinterpret_cast<size_t*>
+ (__bpi->first)
+ - (__gnu_cxx::__detail::__num_bitmaps(*__bpi) + 1);
+
+ ++(*__puse_count);
+ return __ret;
+ }
+ else
+ {
+ // Search was unsuccessful. We Add more memory to the
+ // pool by calling _S_refill_pool().
+ _S_refill_pool();
+
+ // _M_Reset the _S_last_request structure to the first
+ // free block's bit map.
+ _S_last_request._M_reset(_S_mem_blocks.size() - 1);
+
+ // Now, mark that bit as allocated.
+ }
+ }
+
+ // _S_last_request holds a pointer to a valid bit map, that
+ // points to a free block in memory.
+ size_t __nz_bit = _Bit_scan_forward(*_S_last_request._M_get());
+ __detail::__bit_allocate(_S_last_request._M_get(), __nz_bit);
+
+ pointer __ret = reinterpret_cast<pointer>
+ (_S_last_request._M_base() + _S_last_request._M_offset() + __nz_bit);
+
+ size_t* __puse_count = reinterpret_cast<size_t*>
+ (_S_mem_blocks[_S_last_request._M_where()].first)
+ - (__gnu_cxx::__detail::
+ __num_bitmaps(_S_mem_blocks[_S_last_request._M_where()]) + 1);
+
+ ++(*__puse_count);
+ return __ret;
+ }
+
+ /** @brief Deallocates memory that belongs to a single object of
+ * size sizeof(_Tp).
+ *
+ * @detail Complexity: O(lg(N)), but the worst case is not hit
+ * often! This is because containers usually deallocate memory
+ * close to each other and this case is handled in O(1) time by
+ * the deallocate function.
+ */
+ void
+ _M_deallocate_single_object(pointer __p) throw()
+ {
+#if defined __GTHREADS
+ __gnu_cxx::__scoped_lock __bit_lock(_S_mut);
+#endif
+ _Alloc_block* __real_p = reinterpret_cast<_Alloc_block*>(__p);
+
+ typedef typename _BPVector::iterator _Iterator;
+ typedef typename _BPVector::difference_type _Difference_type;
+
+ _Difference_type __diff;
+ long __displacement;
+
+ _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0);
+
+
+ if (__gnu_cxx::__detail::_Inclusive_between<_Alloc_block*>
+ (__real_p) (_S_mem_blocks[_S_last_dealloc_index]))
+ {
+ _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index
+ <= _S_mem_blocks.size() - 1);
+
+ // Initial Assumption was correct!
+ __diff = _S_last_dealloc_index;
+ __displacement = __real_p - _S_mem_blocks[__diff].first;
+ }
+ else
+ {
+ _Iterator _iter = __gnu_cxx::__detail::
+ __find_if(_S_mem_blocks.begin(),
+ _S_mem_blocks.end(),
+ __gnu_cxx::__detail::
+ _Inclusive_between<_Alloc_block*>(__real_p));
+
+ _GLIBCXX_DEBUG_ASSERT(_iter != _S_mem_blocks.end());
+
+ __diff = _iter - _S_mem_blocks.begin();
+ __displacement = __real_p - _S_mem_blocks[__diff].first;
+ _S_last_dealloc_index = __diff;
+ }
+
+ // Get the position of the iterator that has been found.
+ const size_t __rotate = (__displacement
+ % size_t(__detail::bits_per_block));
+ size_t* __bitmapC =
+ reinterpret_cast<size_t*>
+ (_S_mem_blocks[__diff].first) - 1;
+ __bitmapC -= (__displacement / size_t(__detail::bits_per_block));
+
+ __detail::__bit_free(__bitmapC, __rotate);
+ size_t* __puse_count = reinterpret_cast<size_t*>
+ (_S_mem_blocks[__diff].first)
+ - (__gnu_cxx::__detail::__num_bitmaps(_S_mem_blocks[__diff]) + 1);
+
+ _GLIBCXX_DEBUG_ASSERT(*__puse_count != 0);
+
+ --(*__puse_count);
+
+ if (__builtin_expect(*__puse_count == 0, false))
+ {
+ _S_block_size /= 2;
+
+ // We can safely remove this block.
+ // _Block_pair __bp = _S_mem_blocks[__diff];
+ this->_M_insert(__puse_count);
+ _S_mem_blocks.erase(_S_mem_blocks.begin() + __diff);
+
+ // Reset the _S_last_request variable to reflect the
+ // erased block. We do this to protect future requests
+ // after the last block has been removed from a particular
+ // memory Chunk, which in turn has been returned to the
+ // free list, and hence had been erased from the vector,
+ // so the size of the vector gets reduced by 1.
+ if ((_Difference_type)_S_last_request._M_where() >= __diff--)
+ _S_last_request._M_reset(__diff);
+
+ // If the Index into the vector of the region of memory
+ // that might hold the next address that will be passed to
+ // deallocated may have been invalidated due to the above
+ // erase procedure being called on the vector, hence we
+ // try to restore this invariant too.
+ if (_S_last_dealloc_index >= _S_mem_blocks.size())
+ {
+ _S_last_dealloc_index =(__diff != -1 ? __diff : 0);
+ _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0);
+ }
+ }
+ }
+
+ public:
+ bitmap_allocator() throw()
+ { }
+
+ bitmap_allocator(const bitmap_allocator&)
+ { }
+
+ template<typename _Tp1>
+ bitmap_allocator(const bitmap_allocator<_Tp1>&) throw()
+ { }
+
+ ~bitmap_allocator() throw()
+ { }
+
+ pointer
+ allocate(size_type __n)
+ {
+ if (__builtin_expect(__n > this->max_size(), false))
+ std::__throw_bad_alloc();
+
+ if (__builtin_expect(__n == 1, true))
+ return this->_M_allocate_single_object();
+ else
+ {
+ const size_type __b = __n * sizeof(value_type);
+ return reinterpret_cast<pointer>(::operator new(__b));
+ }
+ }
+
+ pointer
+ allocate(size_type __n, typename bitmap_allocator<void>::const_pointer)
+ { return allocate(__n); }
+
+ void
+ deallocate(pointer __p, size_type __n) throw()
+ {
+ if (__builtin_expect(__p != 0, true))
+ {
+ if (__builtin_expect(__n == 1, true))
+ this->_M_deallocate_single_object(__p);
+ else
+ ::operator delete(__p);
+ }
+ }
+
+ pointer
+ address(reference __r) const
+ { return &__r; }
+
+ const_pointer
+ address(const_reference __r) const
+ { return &__r; }
+
+ size_type
+ max_size() const throw()
+ { return size_type(-1) / sizeof(value_type); }
+
+ void
+ construct(pointer __p, const_reference __data)
+ { ::new((void *)__p) value_type(__data); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void
+ destroy(pointer __p)
+ { __p->~value_type(); }
+ };
+
+ template<typename _Tp1, typename _Tp2>
+ bool
+ operator==(const bitmap_allocator<_Tp1>&,
+ const bitmap_allocator<_Tp2>&) throw()
+ { return true; }
+
+ template<typename _Tp1, typename _Tp2>
+ bool
+ operator!=(const bitmap_allocator<_Tp1>&,
+ const bitmap_allocator<_Tp2>&) throw()
+ { return false; }
+
+ // Static member definitions.
+ template<typename _Tp>
+ typename bitmap_allocator<_Tp>::_BPVector
+ bitmap_allocator<_Tp>::_S_mem_blocks;
+
+ template<typename _Tp>
+ size_t bitmap_allocator<_Tp>::_S_block_size =
+ 2 * size_t(__detail::bits_per_block);
+
+ template<typename _Tp>
+ typename __gnu_cxx::bitmap_allocator<_Tp>::_BPVector::size_type
+ bitmap_allocator<_Tp>::_S_last_dealloc_index = 0;
+
+ template<typename _Tp>
+ __gnu_cxx::__detail::_Bitmap_counter
+ <typename bitmap_allocator<_Tp>::_Alloc_block*>
+ bitmap_allocator<_Tp>::_S_last_request(_S_mem_blocks);
+
+#if defined __GTHREADS
+ template<typename _Tp>
+ typename bitmap_allocator<_Tp>::__mutex_type
+ bitmap_allocator<_Tp>::_S_mut;
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/cast.h b/gcc-4.4.0/libstdc++-v3/include/ext/cast.h
new file mode 100644
index 000000000..3ffad7c27
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/cast.h
@@ -0,0 +1,113 @@
+// <cast.h> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef _CAST_H
+#define _CAST_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx);
+
+ /**
+ * These functions are here to allow containers to support non standard
+ * pointer types. For normal pointers, these resolve to the use of the
+ * standard cast operation. For other types the functions will perform
+ * the apprpriate cast to/from the custom pointer class so long as that
+ * class meets the following conditions:
+ * 1) has a typedef element_type which names tehe type it points to.
+ * 2) has a get() const method which returns element_type*.
+ * 3) has a constructor which can take one element_type* argument.
+ */
+
+ /**
+ * This type supports the semantics of the pointer cast operators (below.)
+ */
+ template<typename _ToType>
+ struct _Caster
+ { typedef typename _ToType::element_type* type; };
+
+ template<typename _ToType>
+ struct _Caster<_ToType*>
+ { typedef _ToType* type; };
+
+ /**
+ * Casting operations for cases where _FromType is not a standard pointer.
+ * _ToType can be a standard or non-standard pointer. Given that _FromType
+ * is not a pointer, it must have a get() method that returns the standard
+ * pointer equivalent of the address it points to, and must have an
+ * element_type typedef which names the type it points to.
+ */
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __static_pointer_cast(const _FromType& __arg)
+ { return _ToType(static_cast<typename _Caster<_ToType>::
+ type>(__arg.get())); }
+
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __dynamic_pointer_cast(const _FromType& __arg)
+ { return _ToType(dynamic_cast<typename _Caster<_ToType>::
+ type>(__arg.get())); }
+
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __const_pointer_cast(const _FromType& __arg)
+ { return _ToType(const_cast<typename _Caster<_ToType>::
+ type>(__arg.get())); }
+
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __reinterpret_pointer_cast(const _FromType& __arg)
+ { return _ToType(reinterpret_cast<typename _Caster<_ToType>::
+ type>(__arg.get())); }
+
+ /**
+ * Casting operations for cases where _FromType is a standard pointer.
+ * _ToType can be a standard or non-standard pointer.
+ */
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __static_pointer_cast(_FromType* __arg)
+ { return _ToType(static_cast<typename _Caster<_ToType>::
+ type>(__arg)); }
+
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __dynamic_pointer_cast(_FromType* __arg)
+ { return _ToType(dynamic_cast<typename _Caster<_ToType>::
+ type>(__arg)); }
+
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __const_pointer_cast(_FromType* __arg)
+ { return _ToType(const_cast<typename _Caster<_ToType>::
+ type>(__arg)); }
+
+ template<typename _ToType, typename _FromType>
+ inline _ToType
+ __reinterpret_pointer_cast(_FromType* __arg)
+ { return _ToType(reinterpret_cast<typename _Caster<_ToType>::
+ type>(__arg)); }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _CAST_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/codecvt_specializations.h b/gcc-4.4.0/libstdc++-v3/include/ext/codecvt_specializations.h
new file mode 100644
index 000000000..89adb3f20
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/codecvt_specializations.h
@@ -0,0 +1,507 @@
+// Locale support (codecvt) -*- C++ -*-
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.2.1.5 Template class codecvt
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+/** @file ext/codecvt_specializations.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _EXT_CODECVT_SPECIALIZATIONS_H
+#define _EXT_CODECVT_SPECIALIZATIONS_H 1
+
+#include <bits/c++config.h>
+#include <locale>
+#include <iconv.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /// Extension to use iconv for dealing with character encodings.
+ // This includes conversions and comparisons between various character
+ // sets. This object encapsulates data that may need to be shared between
+ // char_traits, codecvt and ctype.
+ class encoding_state
+ {
+ public:
+ // Types:
+ // NB: A conversion descriptor subsumes and enhances the
+ // functionality of a simple state type such as mbstate_t.
+ typedef iconv_t descriptor_type;
+
+ protected:
+ // Name of internal character set encoding.
+ std::string _M_int_enc;
+
+ // Name of external character set encoding.
+ std::string _M_ext_enc;
+
+ // Conversion descriptor between external encoding to internal encoding.
+ descriptor_type _M_in_desc;
+
+ // Conversion descriptor between internal encoding to external encoding.
+ descriptor_type _M_out_desc;
+
+ // The byte-order marker for the external encoding, if necessary.
+ int _M_ext_bom;
+
+ // The byte-order marker for the internal encoding, if necessary.
+ int _M_int_bom;
+
+ // Number of external bytes needed to construct one complete
+ // character in the internal encoding.
+ // NB: -1 indicates variable, or stateful, encodings.
+ int _M_bytes;
+
+ public:
+ explicit
+ encoding_state()
+ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0), _M_bytes(0)
+ { }
+
+ explicit
+ encoding_state(const char* __int, const char* __ext,
+ int __ibom = 0, int __ebom = 0, int __bytes = 1)
+ : _M_int_enc(__int), _M_ext_enc(__ext), _M_in_desc(0), _M_out_desc(0),
+ _M_ext_bom(__ebom), _M_int_bom(__ibom), _M_bytes(__bytes)
+ { init(); }
+
+ // 21.1.2 traits typedefs
+ // p4
+ // typedef STATE_T state_type
+ // requires: state_type shall meet the requirements of
+ // CopyConstructible types (20.1.3)
+ // NB: This does not preserve the actual state of the conversion
+ // descriptor member, but it does duplicate the encoding
+ // information.
+ encoding_state(const encoding_state& __obj) : _M_in_desc(0), _M_out_desc(0)
+ { construct(__obj); }
+
+ // Need assignment operator as well.
+ encoding_state&
+ operator=(const encoding_state& __obj)
+ {
+ construct(__obj);
+ return *this;
+ }
+
+ ~encoding_state()
+ { destroy(); }
+
+ bool
+ good() const throw()
+ {
+ const descriptor_type __err = (iconv_t)(-1);
+ bool __test = _M_in_desc && _M_in_desc != __err;
+ __test &= _M_out_desc && _M_out_desc != __err;
+ return __test;
+ }
+
+ int
+ character_ratio() const
+ { return _M_bytes; }
+
+ const std::string
+ internal_encoding() const
+ { return _M_int_enc; }
+
+ int
+ internal_bom() const
+ { return _M_int_bom; }
+
+ const std::string
+ external_encoding() const
+ { return _M_ext_enc; }
+
+ int
+ external_bom() const
+ { return _M_ext_bom; }
+
+ const descriptor_type&
+ in_descriptor() const
+ { return _M_in_desc; }
+
+ const descriptor_type&
+ out_descriptor() const
+ { return _M_out_desc; }
+
+ protected:
+ void
+ init()
+ {
+ const descriptor_type __err = (iconv_t)(-1);
+ const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size();
+ if (!_M_in_desc && __have_encodings)
+ {
+ _M_in_desc = iconv_open(_M_int_enc.c_str(), _M_ext_enc.c_str());
+ if (_M_in_desc == __err)
+ std::__throw_runtime_error(__N("encoding_state::_M_init "
+ "creating iconv input descriptor failed"));
+ }
+ if (!_M_out_desc && __have_encodings)
+ {
+ _M_out_desc = iconv_open(_M_ext_enc.c_str(), _M_int_enc.c_str());
+ if (_M_out_desc == __err)
+ std::__throw_runtime_error(__N("encoding_state::_M_init "
+ "creating iconv output descriptor failed"));
+ }
+ }
+
+ void
+ construct(const encoding_state& __obj)
+ {
+ destroy();
+ _M_int_enc = __obj._M_int_enc;
+ _M_ext_enc = __obj._M_ext_enc;
+ _M_ext_bom = __obj._M_ext_bom;
+ _M_int_bom = __obj._M_int_bom;
+ _M_bytes = __obj._M_bytes;
+ init();
+ }
+
+ void
+ destroy() throw()
+ {
+ const descriptor_type __err = (iconv_t)(-1);
+ if (_M_in_desc && _M_in_desc != __err)
+ {
+ iconv_close(_M_in_desc);
+ _M_in_desc = 0;
+ }
+ if (_M_out_desc && _M_out_desc != __err)
+ {
+ iconv_close(_M_out_desc);
+ _M_out_desc = 0;
+ }
+ }
+ };
+
+ /// encoding_char_traits
+ // Custom traits type with encoding_state for the state type, and the
+ // associated fpos<encoding_state> for the position type, all other
+ // bits equivalent to the required char_traits instantiations.
+ template<typename _CharT>
+ struct encoding_char_traits : public std::char_traits<_CharT>
+ {
+ typedef encoding_state state_type;
+ typedef typename std::fpos<state_type> pos_type;
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ using __gnu_cxx::encoding_state;
+
+ /// codecvt<InternT, _ExternT, encoding_state> specialization.
+ // This partial specialization takes advantage of iconv to provide
+ // code conversions between a large number of character encodings.
+ template<typename _InternT, typename _ExternT>
+ class codecvt<_InternT, _ExternT, encoding_state>
+ : public __codecvt_abstract_base<_InternT, _ExternT, encoding_state>
+ {
+ public:
+ // Types:
+ typedef codecvt_base::result result;
+ typedef _InternT intern_type;
+ typedef _ExternT extern_type;
+ typedef __gnu_cxx::encoding_state state_type;
+ typedef state_type::descriptor_type descriptor_type;
+
+ // Data Members:
+ static locale::id id;
+
+ explicit
+ codecvt(size_t __refs = 0)
+ : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)
+ { }
+
+ explicit
+ codecvt(state_type& __enc, size_t __refs = 0)
+ : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)
+ { }
+
+ protected:
+ virtual
+ ~codecvt() { }
+
+ virtual result
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const;
+
+ virtual result
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const;
+
+ virtual result
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const;
+
+ virtual int
+ do_encoding() const throw();
+
+ virtual bool
+ do_always_noconv() const throw();
+
+ virtual int
+ do_length(state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const;
+
+ virtual int
+ do_max_length() const throw();
+ };
+
+ template<typename _InternT, typename _ExternT>
+ locale::id
+ codecvt<_InternT, _ExternT, encoding_state>::id;
+
+ // This adaptor works around the signature problems of the second
+ // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2
+ // uses 'char**', which matches the POSIX 1003.1-2001 standard.
+ // Using this adaptor, g++ will do the work for us.
+ template<typename _Tp>
+ inline size_t
+ __iconv_adaptor(size_t(*__func)(iconv_t, _Tp, size_t*, char**, size_t*),
+ iconv_t __cd, char** __inbuf, size_t* __inbytes,
+ char** __outbuf, size_t* __outbytes)
+ { return __func(__cd, (_Tp)__inbuf, __inbytes, __outbuf, __outbytes); }
+
+ template<typename _InternT, typename _ExternT>
+ codecvt_base::result
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_out(state_type& __state, const intern_type* __from,
+ const intern_type* __from_end, const intern_type*& __from_next,
+ extern_type* __to, extern_type* __to_end,
+ extern_type*& __to_next) const
+ {
+ result __ret = codecvt_base::error;
+ if (__state.good())
+ {
+ const descriptor_type& __desc = __state.out_descriptor();
+ const size_t __fmultiple = sizeof(intern_type);
+ size_t __fbytes = __fmultiple * (__from_end - __from);
+ const size_t __tmultiple = sizeof(extern_type);
+ size_t __tbytes = __tmultiple * (__to_end - __to);
+
+ // Argument list for iconv specifies a byte sequence. Thus,
+ // all to/from arrays must be brutally casted to char*.
+ char* __cto = reinterpret_cast<char*>(__to);
+ char* __cfrom;
+ size_t __conv;
+
+ // Some encodings need a byte order marker as the first item
+ // in the byte stream, to designate endian-ness. The default
+ // value for the byte order marker is NULL, so if this is
+ // the case, it's not necessary and we can just go on our
+ // merry way.
+ int __int_bom = __state.internal_bom();
+ if (__int_bom)
+ {
+ size_t __size = __from_end - __from;
+ intern_type* __cfixed = static_cast<intern_type*>
+ (__builtin_alloca(sizeof(intern_type) * (__size + 1)));
+ __cfixed[0] = static_cast<intern_type>(__int_bom);
+ char_traits<intern_type>::copy(__cfixed + 1, __from, __size);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, __desc, &__cfrom,
+ &__fbytes, &__cto, &__tbytes);
+ }
+ else
+ {
+ intern_type* __cfixed = const_cast<intern_type*>(__from);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__fbytes,
+ &__cto, &__tbytes);
+ }
+
+ if (__conv != size_t(-1))
+ {
+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);
+ __to_next = reinterpret_cast<extern_type*>(__cto);
+ __ret = codecvt_base::ok;
+ }
+ else
+ {
+ if (__fbytes < __fmultiple * (__from_end - __from))
+ {
+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);
+ __to_next = reinterpret_cast<extern_type*>(__cto);
+ __ret = codecvt_base::partial;
+ }
+ else
+ __ret = codecvt_base::error;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ codecvt_base::result
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_unshift(state_type& __state, extern_type* __to,
+ extern_type* __to_end, extern_type*& __to_next) const
+ {
+ result __ret = codecvt_base::error;
+ if (__state.good())
+ {
+ const descriptor_type& __desc = __state.in_descriptor();
+ const size_t __tmultiple = sizeof(intern_type);
+ size_t __tlen = __tmultiple * (__to_end - __to);
+
+ // Argument list for iconv specifies a byte sequence. Thus,
+ // all to/from arrays must be brutally casted to char*.
+ char* __cto = reinterpret_cast<char*>(__to);
+ size_t __conv = __iconv_adaptor(iconv,__desc, NULL, NULL,
+ &__cto, &__tlen);
+
+ if (__conv != size_t(-1))
+ {
+ __to_next = reinterpret_cast<extern_type*>(__cto);
+ if (__tlen == __tmultiple * (__to_end - __to))
+ __ret = codecvt_base::noconv;
+ else if (__tlen == 0)
+ __ret = codecvt_base::ok;
+ else
+ __ret = codecvt_base::partial;
+ }
+ else
+ __ret = codecvt_base::error;
+ }
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ codecvt_base::result
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_in(state_type& __state, const extern_type* __from,
+ const extern_type* __from_end, const extern_type*& __from_next,
+ intern_type* __to, intern_type* __to_end,
+ intern_type*& __to_next) const
+ {
+ result __ret = codecvt_base::error;
+ if (__state.good())
+ {
+ const descriptor_type& __desc = __state.in_descriptor();
+ const size_t __fmultiple = sizeof(extern_type);
+ size_t __flen = __fmultiple * (__from_end - __from);
+ const size_t __tmultiple = sizeof(intern_type);
+ size_t __tlen = __tmultiple * (__to_end - __to);
+
+ // Argument list for iconv specifies a byte sequence. Thus,
+ // all to/from arrays must be brutally casted to char*.
+ char* __cto = reinterpret_cast<char*>(__to);
+ char* __cfrom;
+ size_t __conv;
+
+ // Some encodings need a byte order marker as the first item
+ // in the byte stream, to designate endian-ness. The default
+ // value for the byte order marker is NULL, so if this is
+ // the case, it's not necessary and we can just go on our
+ // merry way.
+ int __ext_bom = __state.external_bom();
+ if (__ext_bom)
+ {
+ size_t __size = __from_end - __from;
+ extern_type* __cfixed = static_cast<extern_type*>
+ (__builtin_alloca(sizeof(extern_type) * (__size + 1)));
+ __cfixed[0] = static_cast<extern_type>(__ext_bom);
+ char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, __desc, &__cfrom,
+ &__flen, &__cto, &__tlen);
+ }
+ else
+ {
+ extern_type* __cfixed = const_cast<extern_type*>(__from);
+ __cfrom = reinterpret_cast<char*>(__cfixed);
+ __conv = __iconv_adaptor(iconv, __desc, &__cfrom,
+ &__flen, &__cto, &__tlen);
+ }
+
+
+ if (__conv != size_t(-1))
+ {
+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);
+ __to_next = reinterpret_cast<intern_type*>(__cto);
+ __ret = codecvt_base::ok;
+ }
+ else
+ {
+ if (__flen < static_cast<size_t>(__from_end - __from))
+ {
+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);
+ __to_next = reinterpret_cast<intern_type*>(__cto);
+ __ret = codecvt_base::partial;
+ }
+ else
+ __ret = codecvt_base::error;
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ int
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_encoding() const throw()
+ {
+ int __ret = 0;
+ if (sizeof(_ExternT) <= sizeof(_InternT))
+ __ret = sizeof(_InternT) / sizeof(_ExternT);
+ return __ret;
+ }
+
+ template<typename _InternT, typename _ExternT>
+ bool
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_always_noconv() const throw()
+ { return false; }
+
+ template<typename _InternT, typename _ExternT>
+ int
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_length(state_type&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return std::min(__max, static_cast<size_t>(__end - __from)); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 74. Garbled text for codecvt::do_max_length
+ template<typename _InternT, typename _ExternT>
+ int
+ codecvt<_InternT, _ExternT, encoding_state>::
+ do_max_length() const throw()
+ { return 1; }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/concurrence.h b/gcc-4.4.0/libstdc++-v3/include/ext/concurrence.h
new file mode 100644
index 000000000..71f8cd0a7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/concurrence.h
@@ -0,0 +1,322 @@
+// Support for concurrent programing -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file concurrence.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _CONCURRENCE_H
+#define _CONCURRENCE_H 1
+
+#include <exception>
+#include <bits/gthr.h>
+#include <bits/functexcept.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Available locking policies:
+ // _S_single single-threaded code that doesn't need to be locked.
+ // _S_mutex multi-threaded code that requires additional support
+ // from gthr.h or abstraction layers in concurrence.h.
+ // _S_atomic multi-threaded code using atomic operations.
+ enum _Lock_policy { _S_single, _S_mutex, _S_atomic };
+
+ // Compile time constant that indicates prefered locking policy in
+ // the current configuration.
+ static const _Lock_policy __default_lock_policy =
+#ifdef __GTHREADS
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \
+ && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4))
+ _S_atomic;
+#else
+ _S_mutex;
+#endif
+#else
+ _S_single;
+#endif
+
+ // NB: As this is used in libsupc++, need to only depend on
+ // exception. No stdexception classes, no use of std::string.
+ class __concurrence_lock_error : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+ { return "__gnu_cxx::__concurrence_lock_error"; }
+ };
+
+ class __concurrence_unlock_error : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+ { return "__gnu_cxx::__concurrence_unlock_error"; }
+ };
+
+ class __concurrence_broadcast_error : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+ { return "__gnu_cxx::__concurrence_broadcast_error"; }
+ };
+
+ class __concurrence_wait_error : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+ { return "__gnu_cxx::__concurrence_wait_error"; }
+ };
+
+ // Substitute for concurrence_error object in the case of -fno-exceptions.
+ inline void
+ __throw_concurrence_lock_error()
+ {
+#if __EXCEPTIONS
+ throw __concurrence_lock_error();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ inline void
+ __throw_concurrence_unlock_error()
+ {
+#if __EXCEPTIONS
+ throw __concurrence_unlock_error();
+#else
+ __builtin_abort();
+#endif
+ }
+
+#ifdef __GTHREAD_HAS_COND
+ inline void
+ __throw_concurrence_broadcast_error()
+ {
+#if __EXCEPTIONS
+ throw __concurrence_broadcast_error();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ inline void
+ __throw_concurrence_wait_error()
+ {
+#if __EXCEPTIONS
+ throw __concurrence_wait_error();
+#else
+ __builtin_abort();
+#endif
+ }
+#endif
+
+ class __mutex
+ {
+ private:
+ __gthread_mutex_t _M_mutex;
+
+ __mutex(const __mutex&);
+ __mutex& operator=(const __mutex&);
+
+ public:
+ __mutex()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+#if defined __GTHREAD_MUTEX_INIT
+ __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+ }
+#endif
+ }
+
+ void lock()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+ if (__gthread_mutex_lock(&_M_mutex) != 0)
+ __throw_concurrence_lock_error();
+ }
+#endif
+ }
+
+ void unlock()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+ if (__gthread_mutex_unlock(&_M_mutex) != 0)
+ __throw_concurrence_unlock_error();
+ }
+#endif
+ }
+
+ __gthread_mutex_t* gthread_mutex(void)
+ { return &_M_mutex; }
+ };
+
+ class __recursive_mutex
+ {
+ private:
+ __gthread_recursive_mutex_t _M_mutex;
+
+ __recursive_mutex(const __recursive_mutex&);
+ __recursive_mutex& operator=(const __recursive_mutex&);
+
+ public:
+ __recursive_mutex()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
+ __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+ }
+#endif
+ }
+
+ void lock()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+ if (__gthread_recursive_mutex_lock(&_M_mutex) != 0)
+ __throw_concurrence_lock_error();
+ }
+#endif
+ }
+
+ void unlock()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+ if (__gthread_recursive_mutex_unlock(&_M_mutex) != 0)
+ __throw_concurrence_unlock_error();
+ }
+#endif
+ }
+
+ __gthread_recursive_mutex_t* gthread_recursive_mutex(void)
+ { return &_M_mutex; }
+ };
+
+ /// Scoped lock idiom.
+ // Acquire the mutex here with a constructor call, then release with
+ // the destructor call in accordance with RAII style.
+ class __scoped_lock
+ {
+ public:
+ typedef __mutex __mutex_type;
+
+ private:
+ __mutex_type& _M_device;
+
+ __scoped_lock(const __scoped_lock&);
+ __scoped_lock& operator=(const __scoped_lock&);
+
+ public:
+ explicit __scoped_lock(__mutex_type& __name) : _M_device(__name)
+ { _M_device.lock(); }
+
+ ~__scoped_lock() throw()
+ { _M_device.unlock(); }
+ };
+
+#ifdef __GTHREAD_HAS_COND
+ class __cond
+ {
+ private:
+ __gthread_cond_t _M_cond;
+
+ __cond(const __cond&);
+ __cond& operator=(const __cond&);
+
+ public:
+ __cond()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+#if defined __GTHREAD_COND_INIT
+ __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
+ _M_cond = __tmp;
+#else
+ __GTHREAD_COND_INIT_FUNCTION(&_M_cond);
+#endif
+ }
+#endif
+ }
+
+ void broadcast()
+ {
+#if __GTHREADS
+ if (__gthread_active_p())
+ {
+ if (__gthread_cond_broadcast(&_M_cond) != 0)
+ __throw_concurrence_broadcast_error();
+ }
+#endif
+ }
+
+ void wait(__mutex *mutex)
+ {
+#if __GTHREADS
+ {
+ if (__gthread_cond_wait(&_M_cond, mutex->gthread_mutex()) != 0)
+ __throw_concurrence_wait_error();
+ }
+#endif
+ }
+
+ void wait_recursive(__recursive_mutex *mutex)
+ {
+#if __GTHREADS
+ {
+ if (__gthread_cond_wait_recursive(&_M_cond,
+ mutex->gthread_recursive_mutex())
+ != 0)
+ __throw_concurrence_wait_error();
+ }
+#endif
+ }
+ };
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/debug_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/debug_allocator.h
new file mode 100644
index 000000000..18d80498e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/debug_allocator.h
@@ -0,0 +1,124 @@
+// Allocators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996-1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/debug_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ * You should only include this header if you are using GCC 3 or later.
+ */
+
+#ifndef _DEBUG_ALLOCATOR_H
+#define _DEBUG_ALLOCATOR_H 1
+
+#include <stdexcept>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+
+ /**
+ * @brief A meta-allocator with debugging bits, as per [20.4].
+ * @ingroup allocators
+ *
+ * This is precisely the allocator defined in the C++ Standard.
+ * - all allocation calls operator new
+ * - all deallocation calls operator delete
+ */
+ template<typename _Alloc>
+ class debug_allocator
+ {
+ public:
+ typedef typename _Alloc::size_type size_type;
+ typedef typename _Alloc::difference_type difference_type;
+ typedef typename _Alloc::pointer pointer;
+ typedef typename _Alloc::const_pointer const_pointer;
+ typedef typename _Alloc::reference reference;
+ typedef typename _Alloc::const_reference const_reference;
+ typedef typename _Alloc::value_type value_type;
+
+ private:
+ // _M_extra is the number of objects that correspond to the
+ // extra space where debug information is stored.
+ size_type _M_extra;
+
+ _Alloc _M_allocator;
+
+ public:
+ debug_allocator()
+ {
+ const size_t __obj_size = sizeof(value_type);
+ _M_extra = (sizeof(size_type) + __obj_size - 1) / __obj_size;
+ }
+
+ pointer
+ allocate(size_type __n)
+ {
+ pointer __res = _M_allocator.allocate(__n + _M_extra);
+ size_type* __ps = reinterpret_cast<size_type*>(__res);
+ *__ps = __n;
+ return __res + _M_extra;
+ }
+
+ pointer
+ allocate(size_type __n, const void* __hint)
+ {
+ pointer __res = _M_allocator.allocate(__n + _M_extra, __hint);
+ size_type* __ps = reinterpret_cast<size_type*>(__res);
+ *__ps = __n;
+ return __res + _M_extra;
+ }
+
+ void
+ deallocate(pointer __p, size_type __n)
+ {
+ if (__p)
+ {
+ pointer __real_p = __p - _M_extra;
+ if (*reinterpret_cast<size_type*>(__real_p) != __n)
+ {
+ throw std::runtime_error("debug_allocator::deallocate"
+ " wrong size");
+ }
+ _M_allocator.deallocate(__real_p, __n + _M_extra);
+ }
+ else
+ throw std::runtime_error("debug_allocator::deallocate null pointer");
+ }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/enc_filebuf.h b/gcc-4.4.0/libstdc++-v3/include/ext/enc_filebuf.h
new file mode 100644
index 000000000..4f8356791
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/enc_filebuf.h
@@ -0,0 +1,62 @@
+// filebuf with encoding state type -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/enc_filebuf.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _EXT_ENC_FILEBUF_H
+#define _EXT_ENC_FILEBUF_H 1
+
+#include <fstream>
+#include <locale>
+#include <ext/codecvt_specializations.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /// class enc_filebuf.
+ template<typename _CharT>
+ class enc_filebuf
+ : public std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >
+ {
+ public:
+ typedef encoding_char_traits<_CharT> traits_type;
+ typedef typename traits_type::state_type state_type;
+ typedef typename traits_type::pos_type pos_type;
+
+ enc_filebuf(state_type& __state)
+ : std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >()
+ { this->_M_state_beg = __state; }
+
+ private:
+ // concept requirements:
+ // Set state type to something useful.
+ // Something more than copyconstructible is needed here, so
+ // require default and copy constructible + assignment operator.
+ __glibcxx_class_requires(state_type, _SGIAssignableConcept)
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/extptr_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/extptr_allocator.h
new file mode 100644
index 000000000..fab6b1d85
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/extptr_allocator.h
@@ -0,0 +1,176 @@
+// <extptr_allocator.h> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file ext/extptr_allocator.h
+ * @author Bob Walters
+ *
+ * An example allocator which uses an alternative pointer type from
+ * bits/pointer.h. Supports test cases which confirm container support
+ * for alternative pointers.
+ */
+
+#ifndef _EXTPTR_ALLOCATOR_H
+#define _EXTPTR_ALLOCATOR_H 1
+
+#include <memory>
+#include <limits>
+#include <ext/pointer.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /**
+ * @brief An example allocator which uses a non-standard pointer type.
+ * @ingroup allocators
+ *
+ * This allocator specifies that containers use a 'relative pointer' as it's
+ * pointer type. (See ext/pointer.h) Memory allocation in this example
+ * is still performed using std::allocator.
+ */
+ template<typename _Tp>
+ class _ExtPtr_allocator
+ {
+ public:
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ // Note the non-standard pointer types.
+ typedef _Pointer_adapter<_Relative_pointer_impl<_Tp> > pointer;
+ typedef _Pointer_adapter<_Relative_pointer_impl<const _Tp> >
+ const_pointer;
+
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template<typename _Up>
+ struct rebind
+ { typedef _ExtPtr_allocator<_Up> other; };
+
+ _ExtPtr_allocator() throw()
+ : _M_real_alloc() { }
+
+ _ExtPtr_allocator(const _ExtPtr_allocator &__rarg) throw()
+ : _M_real_alloc(__rarg._M_real_alloc) { }
+
+ template<typename _Up>
+ _ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg) throw()
+ : _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
+
+ ~_ExtPtr_allocator() throw()
+ { }
+
+ pointer address(reference __x) const
+ { return &__x; }
+
+ const_pointer address(const_reference __x) const
+ { return &__x; }
+
+ pointer allocate(size_type __n, void* __hint = 0)
+ { return _M_real_alloc.allocate(__n,__hint); }
+
+ void deallocate(pointer __p, size_type __n)
+ { _M_real_alloc.deallocate(__p.get(), __n); }
+
+ size_type max_size() const throw()
+ { return std::numeric_limits<size_type>::max() / sizeof(_Tp); }
+
+ void construct(pointer __p, const _Tp& __val)
+ { ::new(__p.get()) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new(__p.get()) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void destroy(pointer __p)
+ { __p->~_Tp(); }
+
+ template<typename _Up>
+ inline bool
+ operator==(const _ExtPtr_allocator<_Up>& __rarg)
+ { return _M_real_alloc == __rarg._M_getUnderlyingImp(); }
+
+ inline bool
+ operator==(const _ExtPtr_allocator& __rarg)
+ { return _M_real_alloc == __rarg._M_real_alloc; }
+
+ template<typename _Up>
+ inline bool
+ operator!=(const _ExtPtr_allocator<_Up>& __rarg)
+ { return _M_real_alloc != __rarg._M_getUnderlyingImp(); }
+
+ inline bool
+ operator!=(const _ExtPtr_allocator& __rarg)
+ { return _M_real_alloc != __rarg._M_real_alloc; }
+
+ template<typename _Up>
+ inline friend void
+ swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&);
+
+ // A method specific to this implementation.
+ const std::allocator<_Tp>&
+ _M_getUnderlyingImp() const
+ { return _M_real_alloc; }
+
+ private:
+ std::allocator<_Tp> _M_real_alloc;
+ };
+
+ // _ExtPtr_allocator<void> specialization.
+ template<>
+ class _ExtPtr_allocator<void>
+ {
+ public:
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef void value_type;
+
+ // Note the non-standard pointer types
+ typedef _Pointer_adapter<_Relative_pointer_impl<void> > pointer;
+ typedef _Pointer_adapter<_Relative_pointer_impl<const void> >
+ const_pointer;
+
+ template<typename _Up>
+ struct rebind
+ { typedef _ExtPtr_allocator<_Up> other; };
+
+ private:
+ std::allocator<void> _M_real_alloc;
+ };
+
+ template<typename _Tp>
+ inline void
+ swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg)
+ {
+ std::allocator<_Tp> __tmp( __rarg._M_real_alloc );
+ __rarg._M_real_alloc = __larg._M_real_alloc;
+ __larg._M_real_alloc = __tmp;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _EXTPTR_ALLOCATOR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/functional b/gcc-4.4.0/libstdc++-v3/include/ext/functional
new file mode 100644
index 000000000..30afd586b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/functional
@@ -0,0 +1,425 @@
+// Functional extensions -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/functional
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _EXT_FUNCTIONAL
+#define _EXT_FUNCTIONAL 1
+
+#pragma GCC system_header
+
+#include <functional>
+#include <cstddef>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::unary_function;
+ using std::binary_function;
+ using std::mem_fun1_t;
+ using std::const_mem_fun1_t;
+ using std::mem_fun1_ref_t;
+ using std::const_mem_fun1_ref_t;
+
+ /** The @c identity_element functions are not part of the C++
+ * standard; SGI provided them as an extension. Its argument is an
+ * operation, and its return value is the identity element for that
+ * operation. It is overloaded for addition and multiplication,
+ * and you can overload it for your own nefarious operations.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Tp>
+ inline _Tp
+ identity_element(std::plus<_Tp>)
+ { return _Tp(0); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Tp>
+ inline _Tp
+ identity_element(std::multiplies<_Tp>)
+ { return _Tp(1); }
+ /** @} */
+
+ /** As an extension to the binders, SGI provided composition functors and
+ * wrapper functions to aid in their creation. The @c unary_compose
+ * functor is constructed from two functions/functors, @c f and @c g.
+ * Calling @c operator() with a single argument @c x returns @c f(g(x)).
+ * The function @c compose1 takes the two functions and constructs a
+ * @c unary_compose variable for you.
+ *
+ * @c binary_compose is constructed from three functors, @c f, @c g1,
+ * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function
+ * @compose2 takes f, g1, and g2, and constructs the @c binary_compose
+ * instance for you. For example, if @c f returns an int, then
+ * \code
+ * int answer = (compose2(f,g1,g2))(x);
+ * \endcode
+ * is equivalent to
+ * \code
+ * int temp1 = g1(x);
+ * int temp2 = g2(x);
+ * int answer = f(temp1,temp2);
+ * \endcode
+ * But the first form is more compact, and can be passed around as a
+ * functor to other algorithms.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2>
+ class unary_compose
+ : public unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
+ {
+ protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+
+ public:
+ unary_compose(const _Operation1& __x, const _Operation2& __y)
+ : _M_fn1(__x), _M_fn2(__y) {}
+
+ typename _Operation1::result_type
+ operator()(const typename _Operation2::argument_type& __x) const
+ { return _M_fn1(_M_fn2(__x)); }
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2>
+ inline unary_compose<_Operation1, _Operation2>
+ compose1(const _Operation1& __fn1, const _Operation2& __fn2)
+ { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2, class _Operation3>
+ class binary_compose
+ : public unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
+ {
+ protected:
+ _Operation1 _M_fn1;
+ _Operation2 _M_fn2;
+ _Operation3 _M_fn3;
+
+ public:
+ binary_compose(const _Operation1& __x, const _Operation2& __y,
+ const _Operation3& __z)
+ : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
+
+ typename _Operation1::result_type
+ operator()(const typename _Operation2::argument_type& __x) const
+ { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Operation1, class _Operation2, class _Operation3>
+ inline binary_compose<_Operation1, _Operation2, _Operation3>
+ compose2(const _Operation1& __fn1, const _Operation2& __fn2,
+ const _Operation3& __fn3)
+ { return binary_compose<_Operation1, _Operation2, _Operation3>
+ (__fn1, __fn2, __fn3); }
+ /** @} */
+
+ /** As an extension, SGI provided a functor called @c identity. When a
+ * functor is required but no operations are desired, this can be used as a
+ * pass-through. Its @c operator() returns its argument unchanged.
+ *
+ * @addtogroup SGIextensions
+ */
+ template <class _Tp>
+ struct identity : public std::_Identity<_Tp> {};
+
+ /** @c select1st and @c select2nd are extensions provided by SGI. Their
+ * @c operator()s
+ * take a @c std::pair as an argument, and return either the first member
+ * or the second member, respectively. They can be used (especially with
+ * the composition functors) to "strip" data from a sequence before
+ * performing the remainder of an algorithm.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Pair>
+ struct select1st : public std::_Select1st<_Pair> {};
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Pair>
+ struct select2nd : public std::_Select2nd<_Pair> {};
+ /** @} */
+
+ // extension documented next
+ template <class _Arg1, class _Arg2>
+ struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1>
+ {
+ _Arg1
+ operator()(const _Arg1& __x, const _Arg2&) const
+ { return __x; }
+ };
+
+ template <class _Arg1, class _Arg2>
+ struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2>
+ {
+ _Arg2
+ operator()(const _Arg1&, const _Arg2& __y) const
+ { return __y; }
+ };
+
+ /** The @c operator() of the @c project1st functor takes two arbitrary
+ * arguments and returns the first one, while @c project2nd returns the
+ * second one. They are extensions provided by SGI.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Arg1, class _Arg2>
+ struct project1st : public _Project1st<_Arg1, _Arg2> {};
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Arg1, class _Arg2>
+ struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
+ /** @} */
+
+ // extension documented next
+ template <class _Result>
+ struct _Constant_void_fun
+ {
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
+
+ const result_type&
+ operator()() const
+ { return _M_val; }
+ };
+
+ template <class _Result, class _Argument>
+ struct _Constant_unary_fun
+ {
+ typedef _Argument argument_type;
+ typedef _Result result_type;
+ result_type _M_val;
+
+ _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
+
+ const result_type&
+ operator()(const _Argument&) const
+ { return _M_val; }
+ };
+
+ template <class _Result, class _Arg1, class _Arg2>
+ struct _Constant_binary_fun
+ {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ _Result _M_val;
+
+ _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
+
+ const result_type&
+ operator()(const _Arg1&, const _Arg2&) const
+ { return _M_val; }
+ };
+
+ /** These three functors are each constructed from a single arbitrary
+ * variable/value. Later, their @c operator()s completely ignore any
+ * arguments passed, and return the stored value.
+ * - @c constant_void_fun's @c operator() takes no arguments
+ * - @c constant_unary_fun's @c operator() takes one argument (ignored)
+ * - @c constant_binary_fun's @c operator() takes two arguments (ignored)
+ *
+ * The helper creator functions @c constant0, @c constant1, and
+ * @c constant2 each take a "result" argument and construct variables of
+ * the appropriate functor type.
+ *
+ * @addtogroup SGIextensions
+ * @{
+ */
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ struct constant_void_fun
+ : public _Constant_void_fun<_Result>
+ {
+ constant_void_fun(const _Result& __v)
+ : _Constant_void_fun<_Result>(__v) {}
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result, class _Argument = _Result>
+ struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
+ {
+ constant_unary_fun(const _Result& __v)
+ : _Constant_unary_fun<_Result, _Argument>(__v) {}
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1>
+ struct constant_binary_fun
+ : public _Constant_binary_fun<_Result, _Arg1, _Arg2>
+ {
+ constant_binary_fun(const _Result& __v)
+ : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
+ };
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ inline constant_void_fun<_Result>
+ constant0(const _Result& __val)
+ { return constant_void_fun<_Result>(__val); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ inline constant_unary_fun<_Result, _Result>
+ constant1(const _Result& __val)
+ { return constant_unary_fun<_Result, _Result>(__val); }
+
+ /// An \link SGIextensions SGI extension \endlink.
+ template <class _Result>
+ inline constant_binary_fun<_Result,_Result,_Result>
+ constant2(const _Result& __val)
+ { return constant_binary_fun<_Result, _Result, _Result>(__val); }
+ /** @} */
+
+ /** The @c subtractive_rng class is documented on
+ * <a href="http://www.sgi.com/tech/stl/">SGI's site</a>.
+ * Note that this code assumes that @c int is 32 bits.
+ *
+ * @ingroup SGIextensions
+ */
+ class subtractive_rng
+ : public unary_function<unsigned int, unsigned int>
+ {
+ private:
+ unsigned int _M_table[55];
+ size_t _M_index1;
+ size_t _M_index2;
+
+ public:
+ /// Returns a number less than the argument.
+ unsigned int
+ operator()(unsigned int __limit)
+ {
+ _M_index1 = (_M_index1 + 1) % 55;
+ _M_index2 = (_M_index2 + 1) % 55;
+ _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
+ return _M_table[_M_index1] % __limit;
+ }
+
+ void
+ _M_initialize(unsigned int __seed)
+ {
+ unsigned int __k = 1;
+ _M_table[54] = __seed;
+ size_t __i;
+ for (__i = 0; __i < 54; __i++)
+ {
+ size_t __ii = (21 * (__i + 1) % 55) - 1;
+ _M_table[__ii] = __k;
+ __k = __seed - __k;
+ __seed = _M_table[__ii];
+ }
+ for (int __loop = 0; __loop < 4; __loop++)
+ {
+ for (__i = 0; __i < 55; __i++)
+ _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
+ }
+ _M_index1 = 0;
+ _M_index2 = 31;
+ }
+
+ /// Ctor allowing you to initialize the seed.
+ subtractive_rng(unsigned int __seed)
+ { _M_initialize(__seed); }
+
+ /// Default ctor; initializes its state with some number you don't see.
+ subtractive_rng()
+ { _M_initialize(161803398u); }
+ };
+
+ // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,
+ // provided for backward compatibility, they are no longer part of
+ // the C++ standard.
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline mem_fun1_t<_Ret, _Tp, _Arg>
+ mem_fun1(_Ret (_Tp::*__f)(_Arg))
+ { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline const_mem_fun1_t<_Ret, _Tp, _Arg>
+ mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
+ { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+ template <class _Ret, class _Tp, class _Arg>
+ inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
+ { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/iterator b/gcc-4.4.0/libstdc++-v3/include/ext/iterator
new file mode 100644
index 000000000..83b4b578a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/iterator
@@ -0,0 +1,113 @@
+// HP/SGI iterator extensions -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/iterator
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _EXT_ITERATOR
+#define _EXT_ITERATOR 1
+
+#pragma GCC system_header
+
+#include <bits/concept_check.h>
+#include <iterator>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // There are two signatures for distance. In addition to the one
+ // taking two iterators and returning a result, there is another
+ // taking two iterators and a reference-to-result variable, and
+ // returning nothing. The latter seems to be an SGI extension.
+ // -- pedwards
+ template<typename _InputIterator, typename _Distance>
+ inline void
+ __distance(_InputIterator __first, _InputIterator __last,
+ _Distance& __n, std::input_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
+ while (__first != __last)
+ {
+ ++__first;
+ ++__n;
+ }
+ }
+
+ template<typename _RandomAccessIterator, typename _Distance>
+ inline void
+ __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Distance& __n, std::random_access_iterator_tag)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __n += __last - __first;
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _InputIterator, typename _Distance>
+ inline void
+ distance(_InputIterator __first, _InputIterator __last,
+ _Distance& __n)
+ {
+ // concept requirements -- taken care of in __distance
+ __distance(__first, __last, __n, std::__iterator_category(__first));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/malloc_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/malloc_allocator.h
new file mode 100644
index 000000000..4c4a72a17
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/malloc_allocator.h
@@ -0,0 +1,134 @@
+// Allocator that wraps "C" malloc -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/malloc_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _MALLOC_ALLOCATOR_H
+#define _MALLOC_ALLOCATOR_H 1
+
+#include <cstdlib>
+#include <new>
+#include <bits/functexcept.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+
+ /**
+ * @brief An allocator that uses malloc.
+ * @ingroup allocators
+ *
+ * This is precisely the allocator defined in the C++ Standard.
+ * - all allocation calls malloc
+ * - all deallocation calls free
+ */
+ template<typename _Tp>
+ class malloc_allocator
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template<typename _Tp1>
+ struct rebind
+ { typedef malloc_allocator<_Tp1> other; };
+
+ malloc_allocator() throw() { }
+
+ malloc_allocator(const malloc_allocator&) throw() { }
+
+ template<typename _Tp1>
+ malloc_allocator(const malloc_allocator<_Tp1>&) throw() { }
+
+ ~malloc_allocator() throw() { }
+
+ pointer
+ address(reference __x) const { return &__x; }
+
+ const_pointer
+ address(const_reference __x) const { return &__x; }
+
+ // NB: __n is permitted to be 0. The C++ standard says nothing
+ // about what the return value is when __n == 0.
+ pointer
+ allocate(size_type __n, const void* = 0)
+ {
+ if (__builtin_expect(__n > this->max_size(), false))
+ std::__throw_bad_alloc();
+
+ pointer __ret = static_cast<_Tp*>(std::malloc(__n * sizeof(_Tp)));
+ if (!__ret)
+ std::__throw_bad_alloc();
+ return __ret;
+ }
+
+ // __p is not permitted to be a null pointer.
+ void
+ deallocate(pointer __p, size_type)
+ { std::free(static_cast<void*>(__p)); }
+
+ size_type
+ max_size() const throw()
+ { return size_t(-1) / sizeof(_Tp); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 402. wrong new expression in [some_] allocator::construct
+ void
+ construct(pointer __p, const _Tp& __val)
+ { ::new((void *)__p) value_type(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void
+ destroy(pointer __p) { __p->~_Tp(); }
+ };
+
+ template<typename _Tp>
+ inline bool
+ operator==(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&)
+ { return true; }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&)
+ { return false; }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/memory b/gcc-4.4.0/libstdc++-v3/include/ext/memory
new file mode 100644
index 000000000..048ebe6ca
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/memory
@@ -0,0 +1,195 @@
+// Memory extensions -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/memory
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _EXT_MEMORY
+#define _EXT_MEMORY 1
+
+#pragma GCC system_header
+
+#include <memory>
+#include <bits/stl_tempbuf.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::ptrdiff_t;
+ using std::pair;
+ using std::__iterator_category;
+ using std::_Temporary_buffer;
+
+ template<typename _InputIter, typename _Size, typename _ForwardIter>
+ pair<_InputIter, _ForwardIter>
+ __uninitialized_copy_n(_InputIter __first, _Size __count,
+ _ForwardIter __result, std::input_iterator_tag)
+ {
+ _ForwardIter __cur = __result;
+ __try
+ {
+ for (; __count > 0 ; --__count, ++__first, ++__cur)
+ std::_Construct(&*__cur, *__first);
+ return pair<_InputIter, _ForwardIter>(__first, __cur);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __cur);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
+ inline pair<_RandomAccessIter, _ForwardIter>
+ __uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
+ _ForwardIter __result,
+ std::random_access_iterator_tag)
+ {
+ _RandomAccessIter __last = __first + __count;
+ return (pair<_RandomAccessIter, _ForwardIter>
+ (__last, std::uninitialized_copy(__first, __last, __result)));
+ }
+
+ template<typename _InputIter, typename _Size, typename _ForwardIter>
+ inline pair<_InputIter, _ForwardIter>
+ __uninitialized_copy_n(_InputIter __first, _Size __count,
+ _ForwardIter __result)
+ { return __uninitialized_copy_n(__first, __count, __result,
+ __iterator_category(__first)); }
+
+ /**
+ * @brief Copies the range [first,last) into result.
+ * @param first An input iterator.
+ * @param last An input iterator.
+ * @param result An output iterator.
+ * @return result + (first - last)
+ * @ingroup SGIextensions
+ *
+ * Like copy(), but does not require an initialized output range.
+ */
+ template<typename _InputIter, typename _Size, typename _ForwardIter>
+ inline pair<_InputIter, _ForwardIter>
+ uninitialized_copy_n(_InputIter __first, _Size __count,
+ _ForwardIter __result)
+ { return __uninitialized_copy_n(__first, __count, __result,
+ __iterator_category(__first)); }
+
+
+ // An alternative version of uninitialized_copy_n that constructs
+ // and destroys objects with a user-provided allocator.
+ template<typename _InputIter, typename _Size, typename _ForwardIter,
+ typename _Allocator>
+ pair<_InputIter, _ForwardIter>
+ __uninitialized_copy_n_a(_InputIter __first, _Size __count,
+ _ForwardIter __result,
+ _Allocator __alloc)
+ {
+ _ForwardIter __cur = __result;
+ __try
+ {
+ for (; __count > 0 ; --__count, ++__first, ++__cur)
+ __alloc.construct(&*__cur, *__first);
+ return pair<_InputIter, _ForwardIter>(__first, __cur);
+ }
+ __catch(...)
+ {
+ std::_Destroy(__result, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _InputIter, typename _Size, typename _ForwardIter,
+ typename _Tp>
+ inline pair<_InputIter, _ForwardIter>
+ __uninitialized_copy_n_a(_InputIter __first, _Size __count,
+ _ForwardIter __result,
+ std::allocator<_Tp>)
+ {
+ return uninitialized_copy_n(__first, __count, __result);
+ }
+
+ /**
+ * This class provides similar behavior and semantics of the standard
+ * functions get_temporary_buffer() and return_temporary_buffer(), but
+ * encapsulated in a type vaguely resembling a standard container.
+ *
+ * By default, a temporary_buffer<Iter> stores space for objects of
+ * whatever type the Iter iterator points to. It is constructed from a
+ * typical [first,last) range, and provides the begin(), end(), size()
+ * functions, as well as requested_size(). For non-trivial types, copies
+ * of *first will be used to initialize the storage.
+ *
+ * @c malloc is used to obtain underlying storage.
+ *
+ * Like get_temporary_buffer(), not all the requested memory may be
+ * available. Ideally, the created buffer will be large enough to hold a
+ * copy of [first,last), but if size() is less than requested_size(),
+ * then this didn't happen.
+ *
+ * @ingroup SGIextensions
+ */
+ template <class _ForwardIterator, class _Tp
+ = typename std::iterator_traits<_ForwardIterator>::value_type >
+ struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
+ {
+ /// Requests storage large enough to hold a copy of [first,last).
+ temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
+ : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) { }
+
+ /// Destroys objects and frees storage.
+ ~temporary_buffer() { }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/mt_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/mt_allocator.h
new file mode 100644
index 000000000..f03f3a610
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/mt_allocator.h
@@ -0,0 +1,751 @@
+// MT-optimized allocator -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/mt_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _MT_ALLOCATOR_H
+#define _MT_ALLOCATOR_H 1
+
+#include <new>
+#include <cstdlib>
+#include <bits/functexcept.h>
+#include <ext/atomicity.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+
+ typedef void (*__destroy_handler)(void*);
+
+ /// Base class for pool object.
+ struct __pool_base
+ {
+ // Using short int as type for the binmap implies we are never
+ // caching blocks larger than 32768 with this allocator.
+ typedef unsigned short int _Binmap_type;
+
+ // Variables used to configure the behavior of the allocator,
+ // assigned and explained in detail below.
+ struct _Tune
+ {
+ // Compile time constants for the default _Tune values.
+ enum { _S_align = 8 };
+ enum { _S_max_bytes = 128 };
+ enum { _S_min_bin = 8 };
+ enum { _S_chunk_size = 4096 - 4 * sizeof(void*) };
+ enum { _S_max_threads = 4096 };
+ enum { _S_freelist_headroom = 10 };
+
+ // Alignment needed.
+ // NB: In any case must be >= sizeof(_Block_record), that
+ // is 4 on 32 bit machines and 8 on 64 bit machines.
+ size_t _M_align;
+
+ // Allocation requests (after round-up to power of 2) below
+ // this value will be handled by the allocator. A raw new/
+ // call will be used for requests larger than this value.
+ // NB: Must be much smaller than _M_chunk_size and in any
+ // case <= 32768.
+ size_t _M_max_bytes;
+
+ // Size in bytes of the smallest bin.
+ // NB: Must be a power of 2 and >= _M_align (and of course
+ // much smaller than _M_max_bytes).
+ size_t _M_min_bin;
+
+ // In order to avoid fragmenting and minimize the number of
+ // new() calls we always request new memory using this
+ // value. Based on previous discussions on the libstdc++
+ // mailing list we have chosen the value below.
+ // See http://gcc.gnu.org/ml/libstdc++/2001-07/msg00077.html
+ // NB: At least one order of magnitude > _M_max_bytes.
+ size_t _M_chunk_size;
+
+ // The maximum number of supported threads. For
+ // single-threaded operation, use one. Maximum values will
+ // vary depending on details of the underlying system. (For
+ // instance, Linux 2.4.18 reports 4070 in
+ // /proc/sys/kernel/threads-max, while Linux 2.6.6 reports
+ // 65534)
+ size_t _M_max_threads;
+
+ // Each time a deallocation occurs in a threaded application
+ // we make sure that there are no more than
+ // _M_freelist_headroom % of used memory on the freelist. If
+ // the number of additional records is more than
+ // _M_freelist_headroom % of the freelist, we move these
+ // records back to the global pool.
+ size_t _M_freelist_headroom;
+
+ // Set to true forces all allocations to use new().
+ bool _M_force_new;
+
+ explicit
+ _Tune()
+ : _M_align(_S_align), _M_max_bytes(_S_max_bytes), _M_min_bin(_S_min_bin),
+ _M_chunk_size(_S_chunk_size), _M_max_threads(_S_max_threads),
+ _M_freelist_headroom(_S_freelist_headroom),
+ _M_force_new(std::getenv("GLIBCXX_FORCE_NEW") ? true : false)
+ { }
+
+ explicit
+ _Tune(size_t __align, size_t __maxb, size_t __minbin, size_t __chunk,
+ size_t __maxthreads, size_t __headroom, bool __force)
+ : _M_align(__align), _M_max_bytes(__maxb), _M_min_bin(__minbin),
+ _M_chunk_size(__chunk), _M_max_threads(__maxthreads),
+ _M_freelist_headroom(__headroom), _M_force_new(__force)
+ { }
+ };
+
+ struct _Block_address
+ {
+ void* _M_initial;
+ _Block_address* _M_next;
+ };
+
+ const _Tune&
+ _M_get_options() const
+ { return _M_options; }
+
+ void
+ _M_set_options(_Tune __t)
+ {
+ if (!_M_init)
+ _M_options = __t;
+ }
+
+ bool
+ _M_check_threshold(size_t __bytes)
+ { return __bytes > _M_options._M_max_bytes || _M_options._M_force_new; }
+
+ size_t
+ _M_get_binmap(size_t __bytes)
+ { return _M_binmap[__bytes]; }
+
+ size_t
+ _M_get_align()
+ { return _M_options._M_align; }
+
+ explicit
+ __pool_base()
+ : _M_options(_Tune()), _M_binmap(NULL), _M_init(false) { }
+
+ explicit
+ __pool_base(const _Tune& __options)
+ : _M_options(__options), _M_binmap(NULL), _M_init(false) { }
+
+ private:
+ explicit
+ __pool_base(const __pool_base&);
+
+ __pool_base&
+ operator=(const __pool_base&);
+
+ protected:
+ // Configuration options.
+ _Tune _M_options;
+
+ _Binmap_type* _M_binmap;
+
+ // Configuration of the pool object via _M_options can happen
+ // after construction but before initialization. After
+ // initialization is complete, this variable is set to true.
+ bool _M_init;
+ };
+
+
+ /**
+ * @brief Data describing the underlying memory pool, parameterized on
+ * threading support.
+ */
+ template<bool _Thread>
+ class __pool;
+
+ /// Specialization for single thread.
+ template<>
+ class __pool<false> : public __pool_base
+ {
+ public:
+ union _Block_record
+ {
+ // Points to the block_record of the next free block.
+ _Block_record* _M_next;
+ };
+
+ struct _Bin_record
+ {
+ // An "array" of pointers to the first free block.
+ _Block_record** _M_first;
+
+ // A list of the initial addresses of all allocated blocks.
+ _Block_address* _M_address;
+ };
+
+ void
+ _M_initialize_once()
+ {
+ if (__builtin_expect(_M_init == false, false))
+ _M_initialize();
+ }
+
+ void
+ _M_destroy() throw();
+
+ char*
+ _M_reserve_block(size_t __bytes, const size_t __thread_id);
+
+ void
+ _M_reclaim_block(char* __p, size_t __bytes);
+
+ size_t
+ _M_get_thread_id() { return 0; }
+
+ const _Bin_record&
+ _M_get_bin(size_t __which)
+ { return _M_bin[__which]; }
+
+ void
+ _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t)
+ { }
+
+ explicit __pool()
+ : _M_bin(NULL), _M_bin_size(1) { }
+
+ explicit __pool(const __pool_base::_Tune& __tune)
+ : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1) { }
+
+ private:
+ // An "array" of bin_records each of which represents a specific
+ // power of 2 size. Memory to this "array" is allocated in
+ // _M_initialize().
+ _Bin_record* _M_bin;
+
+ // Actual value calculated in _M_initialize().
+ size_t _M_bin_size;
+
+ void
+ _M_initialize();
+ };
+
+#ifdef __GTHREADS
+ /// Specialization for thread enabled, via gthreads.h.
+ template<>
+ class __pool<true> : public __pool_base
+ {
+ public:
+ // Each requesting thread is assigned an id ranging from 1 to
+ // _S_max_threads. Thread id 0 is used as a global memory pool.
+ // In order to get constant performance on the thread assignment
+ // routine, we keep a list of free ids. When a thread first
+ // requests memory we remove the first record in this list and
+ // stores the address in a __gthread_key. When initializing the
+ // __gthread_key we specify a destructor. When this destructor
+ // (i.e. the thread dies) is called, we return the thread id to
+ // the front of this list.
+ struct _Thread_record
+ {
+ // Points to next free thread id record. NULL if last record in list.
+ _Thread_record* _M_next;
+
+ // Thread id ranging from 1 to _S_max_threads.
+ size_t _M_id;
+ };
+
+ union _Block_record
+ {
+ // Points to the block_record of the next free block.
+ _Block_record* _M_next;
+
+ // The thread id of the thread which has requested this block.
+ size_t _M_thread_id;
+ };
+
+ struct _Bin_record
+ {
+ // An "array" of pointers to the first free block for each
+ // thread id. Memory to this "array" is allocated in
+ // _S_initialize() for _S_max_threads + global pool 0.
+ _Block_record** _M_first;
+
+ // A list of the initial addresses of all allocated blocks.
+ _Block_address* _M_address;
+
+ // An "array" of counters used to keep track of the amount of
+ // blocks that are on the freelist/used for each thread id.
+ // - Note that the second part of the allocated _M_used "array"
+ // actually hosts (atomic) counters of reclaimed blocks: in
+ // _M_reserve_block and in _M_reclaim_block those numbers are
+ // subtracted from the first ones to obtain the actual size
+ // of the "working set" of the given thread.
+ // - Memory to these "arrays" is allocated in _S_initialize()
+ // for _S_max_threads + global pool 0.
+ size_t* _M_free;
+ size_t* _M_used;
+
+ // Each bin has its own mutex which is used to ensure data
+ // integrity while changing "ownership" on a block. The mutex
+ // is initialized in _S_initialize().
+ __gthread_mutex_t* _M_mutex;
+ };
+
+ // XXX GLIBCXX_ABI Deprecated
+ void
+ _M_initialize(__destroy_handler);
+
+ void
+ _M_initialize_once()
+ {
+ if (__builtin_expect(_M_init == false, false))
+ _M_initialize();
+ }
+
+ void
+ _M_destroy() throw();
+
+ char*
+ _M_reserve_block(size_t __bytes, const size_t __thread_id);
+
+ void
+ _M_reclaim_block(char* __p, size_t __bytes);
+
+ const _Bin_record&
+ _M_get_bin(size_t __which)
+ { return _M_bin[__which]; }
+
+ void
+ _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block,
+ size_t __thread_id)
+ {
+ if (__gthread_active_p())
+ {
+ __block->_M_thread_id = __thread_id;
+ --__bin._M_free[__thread_id];
+ ++__bin._M_used[__thread_id];
+ }
+ }
+
+ // XXX GLIBCXX_ABI Deprecated
+ void
+ _M_destroy_thread_key(void*);
+
+ size_t
+ _M_get_thread_id();
+
+ explicit __pool()
+ : _M_bin(NULL), _M_bin_size(1), _M_thread_freelist(NULL)
+ { }
+
+ explicit __pool(const __pool_base::_Tune& __tune)
+ : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1),
+ _M_thread_freelist(NULL)
+ { }
+
+ private:
+ // An "array" of bin_records each of which represents a specific
+ // power of 2 size. Memory to this "array" is allocated in
+ // _M_initialize().
+ _Bin_record* _M_bin;
+
+ // Actual value calculated in _M_initialize().
+ size_t _M_bin_size;
+
+ _Thread_record* _M_thread_freelist;
+ void* _M_thread_freelist_initial;
+
+ void
+ _M_initialize();
+ };
+#endif
+
+ template<template <bool> class _PoolTp, bool _Thread>
+ struct __common_pool
+ {
+ typedef _PoolTp<_Thread> pool_type;
+
+ static pool_type&
+ _S_get_pool()
+ {
+ static pool_type _S_pool;
+ return _S_pool;
+ }
+ };
+
+ template<template <bool> class _PoolTp, bool _Thread>
+ struct __common_pool_base;
+
+ template<template <bool> class _PoolTp>
+ struct __common_pool_base<_PoolTp, false>
+ : public __common_pool<_PoolTp, false>
+ {
+ using __common_pool<_PoolTp, false>::_S_get_pool;
+
+ static void
+ _S_initialize_once()
+ {
+ static bool __init;
+ if (__builtin_expect(__init == false, false))
+ {
+ _S_get_pool()._M_initialize_once();
+ __init = true;
+ }
+ }
+ };
+
+#ifdef __GTHREADS
+ template<template <bool> class _PoolTp>
+ struct __common_pool_base<_PoolTp, true>
+ : public __common_pool<_PoolTp, true>
+ {
+ using __common_pool<_PoolTp, true>::_S_get_pool;
+
+ static void
+ _S_initialize()
+ { _S_get_pool()._M_initialize_once(); }
+
+ static void
+ _S_initialize_once()
+ {
+ static bool __init;
+ if (__builtin_expect(__init == false, false))
+ {
+ if (__gthread_active_p())
+ {
+ // On some platforms, __gthread_once_t is an aggregate.
+ static __gthread_once_t __once = __GTHREAD_ONCE_INIT;
+ __gthread_once(&__once, _S_initialize);
+ }
+
+ // Double check initialization. May be necessary on some
+ // systems for proper construction when not compiling with
+ // thread flags.
+ _S_get_pool()._M_initialize_once();
+ __init = true;
+ }
+ }
+ };
+#endif
+
+ /// Policy for shared __pool objects.
+ template<template <bool> class _PoolTp, bool _Thread>
+ struct __common_pool_policy : public __common_pool_base<_PoolTp, _Thread>
+ {
+ template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp,
+ bool _Thread1 = _Thread>
+ struct _M_rebind
+ { typedef __common_pool_policy<_PoolTp1, _Thread1> other; };
+
+ using __common_pool_base<_PoolTp, _Thread>::_S_get_pool;
+ using __common_pool_base<_PoolTp, _Thread>::_S_initialize_once;
+ };
+
+
+ template<typename _Tp, template <bool> class _PoolTp, bool _Thread>
+ struct __per_type_pool
+ {
+ typedef _Tp value_type;
+ typedef _PoolTp<_Thread> pool_type;
+
+ static pool_type&
+ _S_get_pool()
+ {
+ // Sane defaults for the _PoolTp.
+ typedef typename pool_type::_Block_record _Block_record;
+ const static size_t __a = (__alignof__(_Tp) >= sizeof(_Block_record)
+ ? __alignof__(_Tp) : sizeof(_Block_record));
+
+ typedef typename __pool_base::_Tune _Tune;
+ static _Tune _S_tune(__a, sizeof(_Tp) * 64,
+ sizeof(_Tp) * 2 >= __a ? sizeof(_Tp) * 2 : __a,
+ sizeof(_Tp) * size_t(_Tune::_S_chunk_size),
+ _Tune::_S_max_threads,
+ _Tune::_S_freelist_headroom,
+ std::getenv("GLIBCXX_FORCE_NEW") ? true : false);
+ static pool_type _S_pool(_S_tune);
+ return _S_pool;
+ }
+ };
+
+ template<typename _Tp, template <bool> class _PoolTp, bool _Thread>
+ struct __per_type_pool_base;
+
+ template<typename _Tp, template <bool> class _PoolTp>
+ struct __per_type_pool_base<_Tp, _PoolTp, false>
+ : public __per_type_pool<_Tp, _PoolTp, false>
+ {
+ using __per_type_pool<_Tp, _PoolTp, false>::_S_get_pool;
+
+ static void
+ _S_initialize_once()
+ {
+ static bool __init;
+ if (__builtin_expect(__init == false, false))
+ {
+ _S_get_pool()._M_initialize_once();
+ __init = true;
+ }
+ }
+ };
+
+ #ifdef __GTHREADS
+ template<typename _Tp, template <bool> class _PoolTp>
+ struct __per_type_pool_base<_Tp, _PoolTp, true>
+ : public __per_type_pool<_Tp, _PoolTp, true>
+ {
+ using __per_type_pool<_Tp, _PoolTp, true>::_S_get_pool;
+
+ static void
+ _S_initialize()
+ { _S_get_pool()._M_initialize_once(); }
+
+ static void
+ _S_initialize_once()
+ {
+ static bool __init;
+ if (__builtin_expect(__init == false, false))
+ {
+ if (__gthread_active_p())
+ {
+ // On some platforms, __gthread_once_t is an aggregate.
+ static __gthread_once_t __once = __GTHREAD_ONCE_INIT;
+ __gthread_once(&__once, _S_initialize);
+ }
+
+ // Double check initialization. May be necessary on some
+ // systems for proper construction when not compiling with
+ // thread flags.
+ _S_get_pool()._M_initialize_once();
+ __init = true;
+ }
+ }
+ };
+#endif
+
+ /// Policy for individual __pool objects.
+ template<typename _Tp, template <bool> class _PoolTp, bool _Thread>
+ struct __per_type_pool_policy
+ : public __per_type_pool_base<_Tp, _PoolTp, _Thread>
+ {
+ template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp,
+ bool _Thread1 = _Thread>
+ struct _M_rebind
+ { typedef __per_type_pool_policy<_Tp1, _PoolTp1, _Thread1> other; };
+
+ using __per_type_pool_base<_Tp, _PoolTp, _Thread>::_S_get_pool;
+ using __per_type_pool_base<_Tp, _PoolTp, _Thread>::_S_initialize_once;
+ };
+
+
+ /// Base class for _Tp dependent member functions.
+ template<typename _Tp>
+ class __mt_alloc_base
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ pointer
+ address(reference __x) const
+ { return &__x; }
+
+ const_pointer
+ address(const_reference __x) const
+ { return &__x; }
+
+ size_type
+ max_size() const throw()
+ { return size_t(-1) / sizeof(_Tp); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 402. wrong new expression in [some_] allocator::construct
+ void
+ construct(pointer __p, const _Tp& __val)
+ { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void
+ destroy(pointer __p) { __p->~_Tp(); }
+ };
+
+#ifdef __GTHREADS
+#define __thread_default true
+#else
+#define __thread_default false
+#endif
+
+ /**
+ * @brief This is a fixed size (power of 2) allocator which - when
+ * compiled with thread support - will maintain one freelist per
+ * size per thread plus a "global" one. Steps are taken to limit
+ * the per thread freelist sizes (by returning excess back to
+ * the "global" list).
+ * @ingroup allocators
+ *
+ * Further details:
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch32.html
+ */
+ template<typename _Tp,
+ typename _Poolp = __common_pool_policy<__pool, __thread_default> >
+ class __mt_alloc : public __mt_alloc_base<_Tp>
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+ typedef _Poolp __policy_type;
+ typedef typename _Poolp::pool_type __pool_type;
+
+ template<typename _Tp1, typename _Poolp1 = _Poolp>
+ struct rebind
+ {
+ typedef typename _Poolp1::template _M_rebind<_Tp1>::other pol_type;
+ typedef __mt_alloc<_Tp1, pol_type> other;
+ };
+
+ __mt_alloc() throw() { }
+
+ __mt_alloc(const __mt_alloc&) throw() { }
+
+ template<typename _Tp1, typename _Poolp1>
+ __mt_alloc(const __mt_alloc<_Tp1, _Poolp1>&) throw() { }
+
+ ~__mt_alloc() throw() { }
+
+ pointer
+ allocate(size_type __n, const void* = 0);
+
+ void
+ deallocate(pointer __p, size_type __n);
+
+ const __pool_base::_Tune
+ _M_get_options()
+ {
+ // Return a copy, not a reference, for external consumption.
+ return __policy_type::_S_get_pool()._M_get_options();
+ }
+
+ void
+ _M_set_options(__pool_base::_Tune __t)
+ { __policy_type::_S_get_pool()._M_set_options(__t); }
+ };
+
+ template<typename _Tp, typename _Poolp>
+ typename __mt_alloc<_Tp, _Poolp>::pointer
+ __mt_alloc<_Tp, _Poolp>::
+ allocate(size_type __n, const void*)
+ {
+ if (__builtin_expect(__n > this->max_size(), false))
+ std::__throw_bad_alloc();
+
+ __policy_type::_S_initialize_once();
+
+ // Requests larger than _M_max_bytes are handled by operator
+ // new/delete directly.
+ __pool_type& __pool = __policy_type::_S_get_pool();
+ const size_t __bytes = __n * sizeof(_Tp);
+ if (__pool._M_check_threshold(__bytes))
+ {
+ void* __ret = ::operator new(__bytes);
+ return static_cast<_Tp*>(__ret);
+ }
+
+ // Round up to power of 2 and figure out which bin to use.
+ const size_t __which = __pool._M_get_binmap(__bytes);
+ const size_t __thread_id = __pool._M_get_thread_id();
+
+ // Find out if we have blocks on our freelist. If so, go ahead
+ // and use them directly without having to lock anything.
+ char* __c;
+ typedef typename __pool_type::_Bin_record _Bin_record;
+ const _Bin_record& __bin = __pool._M_get_bin(__which);
+ if (__bin._M_first[__thread_id])
+ {
+ // Already reserved.
+ typedef typename __pool_type::_Block_record _Block_record;
+ _Block_record* __block = __bin._M_first[__thread_id];
+ __bin._M_first[__thread_id] = __block->_M_next;
+
+ __pool._M_adjust_freelist(__bin, __block, __thread_id);
+ __c = reinterpret_cast<char*>(__block) + __pool._M_get_align();
+ }
+ else
+ {
+ // Null, reserve.
+ __c = __pool._M_reserve_block(__bytes, __thread_id);
+ }
+ return static_cast<_Tp*>(static_cast<void*>(__c));
+ }
+
+ template<typename _Tp, typename _Poolp>
+ void
+ __mt_alloc<_Tp, _Poolp>::
+ deallocate(pointer __p, size_type __n)
+ {
+ if (__builtin_expect(__p != 0, true))
+ {
+ // Requests larger than _M_max_bytes are handled by
+ // operators new/delete directly.
+ __pool_type& __pool = __policy_type::_S_get_pool();
+ const size_t __bytes = __n * sizeof(_Tp);
+ if (__pool._M_check_threshold(__bytes))
+ ::operator delete(__p);
+ else
+ __pool._M_reclaim_block(reinterpret_cast<char*>(__p), __bytes);
+ }
+ }
+
+ template<typename _Tp, typename _Poolp>
+ inline bool
+ operator==(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&)
+ { return true; }
+
+ template<typename _Tp, typename _Poolp>
+ inline bool
+ operator!=(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&)
+ { return false; }
+
+#undef __thread_default
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/new_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/new_allocator.h
new file mode 100644
index 000000000..290c73a11
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/new_allocator.h
@@ -0,0 +1,130 @@
+// Allocator that wraps operator new -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/new_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _NEW_ALLOCATOR_H
+#define _NEW_ALLOCATOR_H 1
+
+#include <new>
+#include <bits/functexcept.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+
+ /**
+ * @brief An allocator that uses global new, as per [20.4].
+ * @ingroup allocators
+ *
+ * This is precisely the allocator defined in the C++ Standard.
+ * - all allocation calls operator new
+ * - all deallocation calls operator delete
+ */
+ template<typename _Tp>
+ class new_allocator
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template<typename _Tp1>
+ struct rebind
+ { typedef new_allocator<_Tp1> other; };
+
+ new_allocator() throw() { }
+
+ new_allocator(const new_allocator&) throw() { }
+
+ template<typename _Tp1>
+ new_allocator(const new_allocator<_Tp1>&) throw() { }
+
+ ~new_allocator() throw() { }
+
+ pointer
+ address(reference __x) const { return &__x; }
+
+ const_pointer
+ address(const_reference __x) const { return &__x; }
+
+ // NB: __n is permitted to be 0. The C++ standard says nothing
+ // about what the return value is when __n == 0.
+ pointer
+ allocate(size_type __n, const void* = 0)
+ {
+ if (__builtin_expect(__n > this->max_size(), false))
+ std::__throw_bad_alloc();
+
+ return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
+ }
+
+ // __p is not permitted to be a null pointer.
+ void
+ deallocate(pointer __p, size_type)
+ { ::operator delete(__p); }
+
+ size_type
+ max_size() const throw()
+ { return size_t(-1) / sizeof(_Tp); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 402. wrong new expression in [some_] allocator::construct
+ void
+ construct(pointer __p, const _Tp& __val)
+ { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void
+ destroy(pointer __p) { __p->~_Tp(); }
+ };
+
+ template<typename _Tp>
+ inline bool
+ operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
+ { return true; }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
+ { return false; }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/numeric b/gcc-4.4.0/libstdc++-v3/include/ext/numeric
new file mode 100644
index 000000000..5df5ee269
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/numeric
@@ -0,0 +1,146 @@
+// Numeric extensions -*- C++ -*-
+
+// Copyright (C) 2002, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/numeric
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _EXT_NUMERIC
+#define _EXT_NUMERIC 1
+
+#pragma GCC system_header
+
+#include <bits/concept_check.h>
+#include <numeric>
+
+#include <ext/functional> // For identity_element
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Returns __x ** __n, where __n >= 0. _Note that "multiplication"
+ // is required to be associative, but not necessarily commutative.
+ template<typename _Tp, typename _Integer, typename _MonoidOperation>
+ _Tp
+ __power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
+ {
+ if (__n == 0)
+ return identity_element(__monoid_op);
+ else
+ {
+ while ((__n & 1) == 0)
+ {
+ __n >>= 1;
+ __x = __monoid_op(__x, __x);
+ }
+
+ _Tp __result = __x;
+ __n >>= 1;
+ while (__n != 0)
+ {
+ __x = __monoid_op(__x, __x);
+ if ((__n & 1) != 0)
+ __result = __monoid_op(__result, __x);
+ __n >>= 1;
+ }
+ return __result;
+ }
+ }
+
+ template<typename _Tp, typename _Integer>
+ inline _Tp
+ __power(_Tp __x, _Integer __n)
+ { return __power(__x, __n, std::multiplies<_Tp>()); }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ // Alias for the internal name __power. Note that power is an extension,
+ // not part of the C++ standard.
+ template<typename _Tp, typename _Integer, typename _MonoidOperation>
+ inline _Tp
+ power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
+ { return __power(__x, __n, __monoid_op); }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template<typename _Tp, typename _Integer>
+ inline _Tp
+ power(_Tp __x, _Integer __n)
+ { return __power(__x, __n); }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ // iota is not part of the C++ standard. It is an extension.
+ template<typename _ForwardIter, typename _Tp>
+ void
+ iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<_ForwardIter>)
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp,
+ typename std::iterator_traits<_ForwardIter>::value_type>)
+
+ while (__first != __last)
+ *__first++ = __value++;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/numeric_traits.h b/gcc-4.4.0/libstdc++-v3/include/ext/numeric_traits.h
new file mode 100644
index 000000000..57fcf9c1f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/numeric_traits.h
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/numeric_traits.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _EXT_NUMERIC_TRAITS
+#define _EXT_NUMERIC_TRAITS 1
+
+#pragma GCC system_header
+
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Compile time constants for builtin types.
+ // Sadly std::numeric_limits member functions cannot be used for this.
+#define __glibcxx_signed(_Tp) ((_Tp)(-1) < 0)
+#define __glibcxx_digits(_Tp) \
+ (sizeof(_Tp) * __CHAR_BIT__ - __glibcxx_signed(_Tp))
+
+#define __glibcxx_min(_Tp) \
+ (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
+
+#define __glibcxx_max(_Tp) \
+ (__glibcxx_signed(_Tp) ? \
+ (((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)
+
+ template<typename _Value>
+ struct __numeric_traits_integer
+ {
+ // Only integers for initialization of member constant.
+ static const _Value __min = __glibcxx_min(_Value);
+ static const _Value __max = __glibcxx_max(_Value);
+
+ // NB: these two also available in std::numeric_limits as compile
+ // time constants, but <limits> is big and we avoid including it.
+ static const bool __is_signed = __glibcxx_signed(_Value);
+ static const int __digits = __glibcxx_digits(_Value);
+ };
+
+ template<typename _Value>
+ const _Value __numeric_traits_integer<_Value>::__min;
+
+ template<typename _Value>
+ const _Value __numeric_traits_integer<_Value>::__max;
+
+ template<typename _Value>
+ const bool __numeric_traits_integer<_Value>::__is_signed;
+
+ template<typename _Value>
+ const int __numeric_traits_integer<_Value>::__digits;
+
+#undef __glibcxx_signed
+#undef __glibcxx_digits
+#undef __glibcxx_min
+#undef __glibcxx_max
+
+#define __glibcxx_floating(_Tp, _Fval, _Dval, _LDval) \
+ (std::__are_same<_Tp, float>::__value ? _Fval \
+ : std::__are_same<_Tp, double>::__value ? _Dval : _LDval)
+
+#define __glibcxx_max_digits10(_Tp) \
+ (2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \
+ __LDBL_MANT_DIG__) * 3010 / 10000)
+
+#define __glibcxx_digits10(_Tp) \
+ __glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__)
+
+#define __glibcxx_max_exponent10(_Tp) \
+ __glibcxx_floating(_Tp, __FLT_MAX_10_EXP__, __DBL_MAX_10_EXP__, \
+ __LDBL_MAX_10_EXP__)
+
+ template<typename _Value>
+ struct __numeric_traits_floating
+ {
+ // Only floating point types. See N1822.
+ static const int __max_digits10 = __glibcxx_max_digits10(_Value);
+
+ // See above comment...
+ static const bool __is_signed = true;
+ static const int __digits10 = __glibcxx_digits10(_Value);
+ static const int __max_exponent10 = __glibcxx_max_exponent10(_Value);
+ };
+
+ template<typename _Value>
+ const int __numeric_traits_floating<_Value>::__max_digits10;
+
+ template<typename _Value>
+ const bool __numeric_traits_floating<_Value>::__is_signed;
+
+ template<typename _Value>
+ const int __numeric_traits_floating<_Value>::__digits10;
+
+ template<typename _Value>
+ const int __numeric_traits_floating<_Value>::__max_exponent10;
+
+ template<typename _Value>
+ struct __numeric_traits
+ : public __conditional_type<std::__is_integer<_Value>::__value,
+ __numeric_traits_integer<_Value>,
+ __numeric_traits_floating<_Value> >::__type
+ { };
+
+_GLIBCXX_END_NAMESPACE
+
+#undef __glibcxx_floating
+#undef __glibcxx_max_digits10
+#undef __glibcxx_digits10
+#undef __glibcxx_max_exponent10
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
new file mode 100644
index 000000000..7bccb88ff
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp
@@ -0,0 +1,683 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file assoc_container.hpp
+ * Contains associative containers.
+ */
+
+#ifndef PB_DS_ASSOC_CNTNR_HPP
+#define PB_DS_ASSOC_CNTNR_HPP
+
+#include <ext/typelist.h>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/standard_policies.hpp>
+#include <ext/pb_ds/detail/container_base_dispatch.hpp>
+#include <ext/pb_ds/detail/basic_tree_policy/traits.hpp>
+
+namespace __gnu_pbds
+{
+#define PB_DS_BASE_C_DEC \
+ detail::container_base_dispatch<Key, Mapped, Tag, Policy_Tl, Allocator>::type
+
+ // An abstract basic associative container.
+ template<typename Key,
+ typename Mapped,
+ typename Tag,
+ typename Policy_Tl,
+ typename Allocator>
+ class container_base : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef typename PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef Tag container_category;
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+
+ // key_type
+ typedef typename allocator_type::template rebind<Key>::other::value_type key_type;
+ typedef typename allocator_type::template rebind<key_type>::other key_rebind;
+ typedef typename key_rebind::reference key_reference;
+ typedef typename key_rebind::const_reference const_key_reference;
+ typedef typename key_rebind::pointer key_pointer;
+ typedef typename key_rebind::const_pointer const_key_pointer;
+
+ // mapped_type
+ typedef Mapped mapped_type;
+ typedef typename allocator_type::template rebind<mapped_type>::other mapped_rebind;
+ typedef typename mapped_rebind::reference mapped_reference;
+ typedef typename mapped_rebind::const_reference const_mapped_reference;
+ typedef typename mapped_rebind::pointer mapped_pointer;
+ typedef typename mapped_rebind::const_pointer const_mapped_pointer;
+
+ // value_type
+ typedef typename base_type::value_type value_type;
+ typedef typename allocator_type::template rebind<value_type>::other value_rebind;
+ typedef typename value_rebind::reference reference;
+ typedef typename value_rebind::const_reference const_reference;
+ typedef typename value_rebind::pointer pointer;
+ typedef typename value_rebind::const_pointer const_pointer;
+
+ // iterators
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_point_iterator const_point_iterator;
+
+ virtual
+ ~container_base() { }
+
+ protected:
+#define PB_DS_CLASS_NAME container_base
+#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
+#undef PB_DS_CLASS_NAME
+ };
+
+#undef PB_DS_BASE_C_DEC
+
+
+#define PB_DS_BASE_C_DEC \
+ container_base<Key, Mapped, Tag, typename __gnu_cxx::typelist::append< \
+ typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, detail::integral_constant<int, Store_Hash> >::type, Policy_TL>::type, Allocator>
+
+ // An abstract basic hash-based associative container.
+ template<typename Key,
+ typename Mapped,
+ typename Hash_Fn,
+ typename Eq_Fn,
+ typename Resize_Policy,
+ bool Store_Hash,
+ typename Tag,
+ typename Policy_TL,
+ typename Allocator>
+ class basic_hash_table : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ virtual
+ ~basic_hash_table() { }
+
+ protected:
+#define PB_DS_CLASS_NAME basic_hash_table
+#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
+#undef PB_DS_CLASS_NAME
+
+ private:
+ basic_hash_table&
+ operator=(const base_type&);
+ };
+
+#undef PB_DS_BASE_C_DEC
+
+
+#define PB_DS_BASE_C_DEC \
+ basic_hash_table<Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \
+ cc_hash_tag, \
+ typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, Allocator>
+
+ // A concrete collision-chaining hash-based associative container.
+ template<typename Key,
+ typename Mapped,
+ typename Hash_Fn = typename detail::default_hash_fn<Key>::type,
+ typename Eq_Fn = typename detail::default_eq_fn<Key>::type,
+ typename Comb_Hash_Fn = detail::default_comb_hash_fn::type,
+ typename Resize_Policy = typename detail::default_resize_policy<Comb_Hash_Fn>::type,
+ bool Store_Hash = detail::default_store_hash,
+ typename Allocator = std::allocator<char> >
+ class cc_hash_table : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef Hash_Fn hash_fn;
+ typedef Eq_Fn eq_fn;
+ typedef Resize_Policy resize_policy;
+ typedef Comb_Hash_Fn comb_hash_fn;
+
+ // Default constructor.
+ cc_hash_table() { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the Hash_Fn object of the container object.
+ cc_hash_table(const hash_fn& h)
+ : base_type(h) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, and
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object.
+ cc_hash_table(const hash_fn& h, const eq_fn& e)
+ : base_type(h, e) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, r_eq_fn
+ // will be copied by the eq_fn object of the container object, and
+ // r_comb_hash_fn will be copied by the comb_hash_fn object of the
+ // container object.
+ cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch)
+ : base_type(h, e, ch) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, r_eq_fn
+ // will be copied by the eq_fn object of the container object,
+ // r_comb_hash_fn will be copied by the comb_hash_fn object of the
+ // container object, and r_resize_policy will be copied by the
+ // resize_policy object of the container object.
+ cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch,
+ const resize_policy& rp)
+ : base_type(h, e, ch, rp) { }
+
+ // Constructor taking __iterators to a range of value_types. The
+ // value_types between first_it and last_it will be inserted into
+ // the container object.
+ template<typename It>
+ cc_hash_table(It first, It last)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object.
+ template<typename It>
+ cc_hash_table(It first, It last, const hash_fn& h)
+ : base_type(h)
+ { copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // and r_eq_fn will be copied by the eq_fn object of the container
+ // object.
+ template<typename It>
+ cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)
+ : base_type(h, e)
+ { copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object, and r_comb_hash_fn will be copied by the comb_hash_fn
+ // object of the container object.
+ template<typename It>
+ cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
+ const comb_hash_fn& ch)
+ : base_type(h, e, ch)
+ { copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object, r_comb_hash_fn will be copied by the comb_hash_fn
+ // object of the container object, and r_resize_policy will be
+ // copied by the resize_policy object of the container object.
+ template<typename It>
+ cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
+ const comb_hash_fn& ch, const resize_policy& rp)
+ : base_type(h, e, ch, rp)
+ { copy_from_range(first, last); }
+
+ cc_hash_table(const cc_hash_table& other)
+ : base_type((const base_type&)other)
+ { }
+
+ virtual
+ ~cc_hash_table() { }
+
+ cc_hash_table&
+ operator=(const cc_hash_table& other)
+ {
+ if (this != &other)
+ {
+ cc_hash_table tmp(other);
+ swap(tmp);
+ }
+ return *this;
+ }
+
+ void
+ swap(cc_hash_table& other)
+ { base_type::swap(other); }
+ };
+
+#undef PB_DS_BASE_C_DEC
+
+
+#define PB_DS_BASE_C_DEC \
+ basic_hash_table<Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \
+ gp_hash_tag, \
+ typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, Allocator>
+
+ // A concrete general-probing hash-based associative container.
+ template<typename Key,
+ typename Mapped,
+ typename Hash_Fn = typename detail::default_hash_fn<Key>::type,
+ typename Eq_Fn = typename detail::default_eq_fn<Key>::type,
+ typename Comb_Probe_Fn = detail::default_comb_hash_fn::type,
+ typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type,
+ typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type,
+ bool Store_Hash = detail::default_store_hash,
+ typename Allocator = std::allocator<char> >
+ class gp_hash_table : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef Hash_Fn hash_fn;
+ typedef Eq_Fn eq_fn;
+ typedef Comb_Probe_Fn comb_probe_fn;
+ typedef Probe_Fn probe_fn;
+ typedef Resize_Policy resize_policy;
+
+ // Default constructor.
+ gp_hash_table() { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object.
+ gp_hash_table(const hash_fn& h)
+ : base_type(h) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, and
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object.
+ gp_hash_table(const hash_fn& h, const eq_fn& e)
+ : base_type(h, e) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, r_eq_fn
+ // will be copied by the eq_fn object of the container object, and
+ // r_comb_probe_fn will be copied by the comb_probe_fn object of
+ // the container object.
+ gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp)
+ : base_type(h, e, cp) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, r_eq_fn
+ // will be copied by the eq_fn object of the container object,
+ // r_comb_probe_fn will be copied by the comb_probe_fn object of
+ // the container object, and r_probe_fn will be copied by the
+ // probe_fn object of the container object.
+ gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,
+ const probe_fn& p)
+ : base_type(h, e, cp, p) { }
+
+ // Constructor taking some policy objects. r_hash_fn will be
+ // copied by the hash_fn object of the container object, r_eq_fn
+ // will be copied by the eq_fn object of the container object,
+ // r_comb_probe_fn will be copied by the comb_probe_fn object of
+ // the container object, r_probe_fn will be copied by the probe_fn
+ // object of the container object, and r_resize_policy will be
+ // copied by the Resize_Policy object of the container object.
+ gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp,
+ const probe_fn& p, const resize_policy& rp)
+ : base_type(h, e, cp, p, rp) { }
+
+ // Constructor taking __iterators to a range of value_types. The
+ // value_types between first_it and last_it will be inserted into
+ // the container object.
+ template<typename It>
+ gp_hash_table(It first, It last)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object.
+ template<typename It>
+ gp_hash_table(It first, It last, const hash_fn& h)
+ : base_type(h)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // and r_eq_fn will be copied by the eq_fn object of the container
+ // object.
+ template<typename It>
+ gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)
+ : base_type(h, e)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object, and r_comb_probe_fn will be copied by the comb_probe_fn
+ // object of the container object.
+ template<typename It>
+ gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
+ const comb_probe_fn& cp)
+ : base_type(h, e, cp)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object, r_comb_probe_fn will be copied by the comb_probe_fn
+ // object of the container object, and r_probe_fn will be copied
+ // by the probe_fn object of the container object.
+ template<typename It>
+ gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
+ const comb_probe_fn& cp, const probe_fn& p)
+ : base_type(h, e, cp, p)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object. r_hash_fn
+ // will be copied by the hash_fn object of the container object,
+ // r_eq_fn will be copied by the eq_fn object of the container
+ // object, r_comb_probe_fn will be copied by the comb_probe_fn
+ // object of the container object, r_probe_fn will be copied by
+ // the probe_fn object of the container object, and
+ // r_resize_policy will be copied by the resize_policy object of
+ // the container object.
+ template<typename It>
+ gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,
+ const comb_probe_fn& cp, const probe_fn& p,
+ const resize_policy& rp)
+ : base_type(h, e, cp, p, rp)
+ { base_type::copy_from_range(first, last); }
+
+ gp_hash_table(const gp_hash_table& other)
+ : base_type((const base_type&)other)
+ { }
+
+ virtual
+ ~gp_hash_table() { }
+
+ gp_hash_table&
+ operator=(const gp_hash_table& other)
+ {
+ if (this != &other)
+ {
+ gp_hash_table tmp(other);
+ swap(tmp);
+ }
+ return *this;
+ }
+
+ void
+ swap(gp_hash_table& other)
+ { base_type::swap(other); }
+ };
+
+#undef PB_DS_BASE_C_DEC
+
+
+#define PB_DS_BASE_C_DEC \
+ container_base<Key, Mapped, Tag, Policy_Tl, Allocator>
+
+ // An abstract basic tree-like (tree, trie) associative container.
+ template<typename Key, typename Mapped, typename Tag,
+ typename Node_Update, typename Policy_Tl, typename Allocator>
+ class basic_tree : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef Node_Update node_update;
+
+ virtual
+ ~basic_tree() { }
+
+ protected:
+#define PB_DS_CLASS_NAME basic_tree
+#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>
+#undef PB_DS_CLASS_NAME
+ };
+
+#undef PB_DS_BASE_C_DEC
+
+
+#define PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC \
+ detail::tree_traits<Key, Mapped,Cmp_Fn,Node_Update,Tag, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ basic_tree<Key,Mapped,Tag,typename PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC::node_update, \
+ typename __gnu_cxx::typelist::create2<Cmp_Fn, PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC >::type, Allocator>
+
+ // A concrete basic tree-based associative container.
+ template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
+ typename Tag = rb_tree_tag,
+ template<typename Const_Node_Iterator, typename Node_Iterator, typename Cmp_Fn_, typename Allocator_>
+ class Node_Update = __gnu_pbds::null_tree_node_update,
+ typename Allocator = std::allocator<char> >
+ class tree : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ // Comparison functor type.
+ typedef Cmp_Fn cmp_fn;
+
+ tree() { }
+
+ // Constructor taking some policy objects. r_cmp_fn will be copied
+ // by the Cmp_Fn object of the container object.
+ tree(const cmp_fn& c)
+ : base_type(c) { }
+
+ // Constructor taking __iterators to a range of value_types. The
+ // value_types between first_it and last_it will be inserted into
+ // the container object.
+ template<typename It>
+ tree(It first, It last)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects The value_types between first_it and
+ // last_it will be inserted into the container object. r_cmp_fn
+ // will be copied by the cmp_fn object of the container object.
+ template<typename It>
+ tree(It first, It last, const cmp_fn& c)
+ : base_type(c)
+ { base_type::copy_from_range(first, last); }
+
+ tree(const tree& other)
+ : base_type((const base_type&)other) { }
+
+ virtual
+ ~tree() { }
+
+ tree&
+ operator=(const tree& other)
+ {
+ if (this != &other)
+ {
+ tree tmp(other);
+ swap(tmp);
+ }
+ return *this;
+ }
+
+ void
+ swap(tree& other)
+ { base_type::swap(other); }
+ };
+
+#undef PB_DS_BASE_C_DEC
+#undef PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC
+
+
+#define PB_DS_TRIE_NODE_AND_ITS_TRAITS \
+ detail::trie_traits<Key,Mapped,E_Access_Traits,Node_Update,Tag,Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ basic_tree<Key,Mapped,Tag, typename PB_DS_TRIE_NODE_AND_ITS_TRAITS::node_update, \
+ typename __gnu_cxx::typelist::create2<E_Access_Traits, PB_DS_TRIE_NODE_AND_ITS_TRAITS >::type, Allocator>
+
+ // A concrete basic trie-based associative container.
+ template<typename Key,
+ typename Mapped,
+ typename E_Access_Traits = typename detail::default_trie_e_access_traits<Key>::type,
+ typename Tag = pat_trie_tag,
+ template<typename Const_Node_Iterator,
+ typename Node_Iterator,
+ typename E_Access_Traits_,
+ typename Allocator_>
+ class Node_Update = null_trie_node_update,
+ typename Allocator = std::allocator<char> >
+ class trie : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ // Element access traits type.
+ typedef E_Access_Traits e_access_traits;
+
+ trie() { }
+
+ // Constructor taking some policy objects. r_e_access_traits will
+ // be copied by the E_Access_Traits object of the container
+ // object.
+ trie(const e_access_traits& t)
+ : base_type(t) { }
+
+ // Constructor taking __iterators to a range of value_types. The
+ // value_types between first_it and last_it will be inserted into
+ // the container object.
+ template<typename It>
+ trie(It first, It last)
+ { base_type::copy_from_range(first, last); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects. The value_types between first_it and
+ // last_it will be inserted into the container object.
+ template<typename It>
+ trie(It first, It last, const e_access_traits& t)
+ : base_type(t)
+ { base_type::copy_from_range(first, last); }
+
+ trie(const trie& other)
+ : base_type((const base_type&)other) { }
+
+ virtual
+ ~trie() { }
+
+ trie&
+ operator=(const trie& other)
+ {
+ if (this != &other)
+ {
+ trie tmp(other);
+ swap(tmp);
+ }
+ return *this;
+ }
+
+ void
+ swap(trie& other)
+ { base_type::swap(other); }
+ };
+
+#undef PB_DS_BASE_C_DEC
+#undef PB_DS_TRIE_NODE_AND_ITS_TRAITS
+
+
+#define PB_DS_BASE_C_DEC \
+ container_base<Key, Mapped, list_update_tag, \
+ typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type, Allocator>
+
+ // A list-update based associative container.
+ template<typename Key,
+ typename Mapped,
+ class Eq_Fn = typename detail::default_eq_fn<Key>::type,
+ class Update_Policy = detail::default_update_policy::type,
+ class Allocator = std::allocator<char> >
+ class list_update : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef Eq_Fn eq_fn;
+ typedef Update_Policy update_policy;
+ typedef Allocator allocator;
+
+ list_update() { }
+
+ // Constructor taking __iterators to a range of value_types. The
+ // value_types between first_it and last_it will be inserted into
+ // the container object.
+ template<typename It>
+ list_update(It first, It last)
+ { base_type::copy_from_range(first, last); }
+
+ list_update(const list_update& other)
+ : base_type((const base_type&)other) { }
+
+ virtual
+ ~list_update() { }
+
+ list_update&
+ operator=(const list_update& other)
+ {
+ if (this !=& other)
+ {
+ list_update tmp(other);
+ swap(tmp);
+ }
+ return *this;
+ }
+
+ void
+ swap(list_update& other)
+ { base_type::swap(other); }
+ };
+
+#undef PB_DS_BASE_C_DEC
+
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
new file mode 100644
index 000000000..0ca90dbc7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file basic_tree_policy_base.hpp
+ * Contains a base class for tree_like policies.
+ */
+
+#ifndef PB_DS_TREE_LIKE_POLICY_BASE_HPP
+#define PB_DS_TREE_LIKE_POLICY_BASE_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_C_DEC \
+ basic_tree_policy_base< \
+ Const_Node_Iterator, \
+ Node_Iterator, \
+ Allocator>
+
+ template<typename Const_Node_Iterator,
+ typename Node_Iterator,
+ typename Allocator>
+ struct basic_tree_policy_base
+ {
+ protected:
+ typedef typename Node_Iterator::value_type it_type;
+
+ typedef typename std::iterator_traits< it_type>::value_type value_type;
+
+ typedef typename value_type::first_type key_type;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ key_type>::type>::other::const_reference
+ const_key_reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ value_type>::type>::other::const_reference
+ const_reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ value_type>::type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ value_type>::type>::other::const_pointer
+ const_pointer;
+
+ static inline const_key_reference
+ extract_key(const_reference r_val)
+ {
+ return (r_val.first);
+ }
+
+ virtual it_type
+ end() = 0;
+
+ it_type
+ end_iterator() const
+ {
+ return (const_cast<PB_DS_CLASS_C_DEC* >(this)->end());
+ }
+
+ virtual
+ ~basic_tree_policy_base()
+ { }
+ };
+
+ template<typename Const_Node_Iterator, typename Allocator>
+ struct basic_tree_policy_base<
+ Const_Node_Iterator,
+ Const_Node_Iterator,
+ Allocator>
+ {
+ protected:
+ typedef typename Const_Node_Iterator::value_type it_type;
+
+ typedef typename std::iterator_traits< it_type>::value_type value_type;
+
+ typedef value_type key_type;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ key_type>::type>::other::const_reference
+ const_key_reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ value_type>::type>::other::const_reference
+ const_reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ value_type>::type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ value_type>::type>::other::const_pointer
+ const_pointer;
+
+ static inline const_key_reference
+ extract_key(const_reference r_val)
+ {
+ return (r_val);
+ }
+
+ virtual it_type
+ end() const = 0;
+
+ it_type
+ end_iterator() const
+ {
+ return (end());
+ }
+
+ virtual
+ ~basic_tree_policy_base()
+ { }
+ };
+
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_TREE_LIKE_POLICY_BASE_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
new file mode 100644
index 000000000..757b90956
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file null_node_metadata.hpp
+ * Contains an implementation class for tree-like classes.
+ */
+
+#ifndef PB_DS_NULL_NODE_METADATA_HPP
+#define PB_DS_NULL_NODE_METADATA_HPP
+
+#include <ext/pb_ds/detail/types_traits.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, class Data, class Allocator>
+ struct dumconst_node_iterator
+ {
+ private:
+ typedef typename types_traits<Key, Data, Allocator, false>::pointer const_iterator;
+
+ public:
+ typedef const_iterator value_type;
+ typedef const_iterator const_reference;
+ typedef const_reference reference;
+ };
+
+ struct null_node_metadata
+ { };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
new file mode 100644
index 000000000..b30829a81
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_tree_policy/traits.hpp
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file traits.hpp
+ * Contains an implementation class for tree-like classes.
+ */
+
+#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_NODE_AND_IT_TRAITS_HPP
+
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>
+#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>
+#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key,
+ typename Data,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator>
+ class Node_Update,
+ class Tag,
+ class Allocator>
+ struct tree_traits;
+
+ template<typename Key,
+ typename Data,
+ class E_Access_Traits,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class E_Access_Traits_,
+ class Allocator>
+ class Node_Update,
+ class Tag,
+ class Allocator>
+ struct trie_traits;
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>
+#include <ext/pb_ds/detail/splay_tree_/traits.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/traits.hpp>
+
+#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp
new file mode 100644
index 000000000..aac1397dd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/basic_types.hpp
@@ -0,0 +1,211 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file basic_types.hpp
+ * Contains basic types used by containers.
+ */
+
+#ifndef PB_DS_BASIC_TYPES_HPP
+#define PB_DS_BASIC_TYPES_HPP
+
+#include <algorithm>
+#include <utility>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, typename Mapped, typename Allocator, bool Store_Hash>
+ struct value_type_base;
+
+ /**
+ * Specialization of value_type_base for the case where the hash value
+ * is not stored alongside each value.
+ **/
+ template<typename Key, typename Mapped, typename Allocator>
+ struct value_type_base<Key, Mapped, Allocator, false>
+ {
+ typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
+ typedef typename mapped_type_allocator::value_type mapped_type;
+ typedef typename mapped_type_allocator::pointer mapped_pointer;
+ typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
+ typedef typename mapped_type_allocator::reference mapped_reference;
+ typedef typename mapped_type_allocator::const_reference const_mapped_reference;
+
+ typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
+ typedef typename value_type_allocator::value_type value_type;
+ typedef typename value_type_allocator::pointer pointer;
+ typedef typename value_type_allocator::const_pointer const_pointer;
+ typedef typename value_type_allocator::reference reference;
+ typedef typename value_type_allocator::const_reference const_reference;
+
+ struct stored_value_type
+ {
+ value_type m_value;
+ };
+ };
+
+ /**
+ * Specialization of value_type_base for the case where the hash value
+ * is stored alongside each value.
+ **/
+ template<typename Key, typename Mapped, typename Allocator>
+ struct value_type_base<Key, Mapped, Allocator, true>
+ {
+ typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;
+ typedef typename mapped_type_allocator::value_type mapped_type;
+ typedef typename mapped_type_allocator::pointer mapped_pointer;
+ typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
+ typedef typename mapped_type_allocator::reference mapped_reference;
+ typedef typename mapped_type_allocator::const_reference const_mapped_reference;
+
+ typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;
+ typedef typename value_type_allocator::value_type value_type;
+ typedef typename value_type_allocator::pointer pointer;
+ typedef typename value_type_allocator::const_pointer const_pointer;
+ typedef typename value_type_allocator::reference reference;
+ typedef typename value_type_allocator::const_reference const_reference;
+
+ struct stored_value_type
+ {
+ value_type m_value;
+ typename Allocator::size_type m_hash;
+ };
+ };
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ value_type_base<Key, null_mapped_type, Allocator, false>
+
+ /**
+ * Specialization of value_type_base for the case where the hash value
+ * is not stored alongside each value.
+ **/
+ template<typename Key, typename Allocator>
+ struct value_type_base<Key, null_mapped_type, Allocator, false>
+ {
+ typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
+ typedef typename mapped_type_allocator::value_type mapped_type;
+ typedef typename mapped_type_allocator::pointer mapped_pointer;
+ typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
+ typedef typename mapped_type_allocator::reference mapped_reference;
+ typedef typename mapped_type_allocator::const_reference const_mapped_reference;
+
+ typedef Key value_type;
+
+ typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
+ typedef typename value_type_allocator::pointer pointer;
+ typedef typename value_type_allocator::const_pointer const_pointer;
+ typedef typename value_type_allocator::reference reference;
+ typedef typename value_type_allocator::const_reference const_reference;
+
+ struct stored_value_type
+ {
+ value_type m_value;
+ };
+
+ static null_mapped_type s_null_mapped;
+ };
+
+ PB_DS_CLASS_T_DEC
+ null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ value_type_base<Key, null_mapped_type, Allocator, true>
+
+ /**
+ * Specialization of value_type_base for the case where the hash value
+ * is stored alongside each value.
+ **/
+ template<typename Key, typename Allocator>
+ struct value_type_base<Key, null_mapped_type, Allocator, true>
+ {
+ typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;
+ typedef typename mapped_type_allocator::value_type mapped_type;
+ typedef typename mapped_type_allocator::pointer mapped_pointer;
+ typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;
+ typedef typename mapped_type_allocator::reference mapped_reference;
+ typedef typename mapped_type_allocator::const_reference const_mapped_reference;
+
+ typedef Key value_type;
+
+ typedef typename Allocator::template rebind<value_type>::other value_type_allocator;
+ typedef typename value_type_allocator::pointer pointer;
+ typedef typename value_type_allocator::const_pointer const_pointer;
+ typedef typename value_type_allocator::reference reference;
+ typedef typename value_type_allocator::const_reference const_reference;
+
+ struct stored_value_type
+ {
+ value_type m_value;
+ typename Allocator::size_type m_hash;
+ };
+
+ static null_mapped_type s_null_mapped;
+ };
+
+ PB_DS_CLASS_T_DEC
+ null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ template<typename Key, typename Mapped>
+ struct no_throw_copies
+ {
+ typedef integral_constant<int, is_simple<Key>::value && is_simple<Mapped>::value> indicator;
+ };
+
+ template<typename Key>
+ struct no_throw_copies<Key, null_mapped_type>
+ {
+ typedef integral_constant<int, is_simple<Key>::value> indicator;
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
new file mode 100644
index 000000000..7315d951f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
@@ -0,0 +1,497 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file bin_search_tree_.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+/*
+ * This implementation uses an idea from the SGI STL (using a "header" node
+ * which is needed for efficient iteration).
+ */
+
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/tree_trace_base.hpp>
+#include <utility>
+#include <functional>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, class Cmp_Fn, \
+ class Node_And_It_Traits, class Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME \
+ bin_search_tree_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME \
+ bin_search_tree_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME< \
+ Key, \
+ Mapped, \
+ Cmp_Fn, \
+ Node_And_It_Traits, \
+ Allocator>
+
+#define PB_DS_TYPES_TRAITS_C_DEC \
+ types_traits< \
+ Key, \
+ Mapped, \
+ Allocator, \
+ false>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
+ typename Allocator::template rebind<Key>::other::const_reference>
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#endif
+
+#ifdef PB_DS_TREE_TRACE
+#define PB_DS_TREE_TRACE_BASE_C_DEC \
+ tree_trace_base< \
+ typename Node_And_It_Traits::const_node_iterator, \
+ typename Node_And_It_Traits::node_iterator, \
+ Cmp_Fn, \
+ true, \
+ Allocator>
+#endif
+
+ /**
+ * class description = "8i|\|4ree $34rc|-| 7r33 74813.">
+ **/
+ template<typename Key,
+ typename Mapped,
+ class Cmp_Fn,
+ class Node_And_It_Traits,
+ class Allocator>
+ class PB_DS_CLASS_NAME :
+#ifdef _GLIBCXX_DEBUG
+ public PB_DS_DEBUG_MAP_BASE_C_DEC,
+#endif
+#ifdef PB_DS_TREE_TRACE
+ public PB_DS_TREE_TRACE_BASE_C_DEC,
+#endif
+ public Cmp_Fn,
+ public PB_DS_TYPES_TRAITS_C_DEC,
+ public Node_And_It_Traits::node_update
+ {
+
+ protected:
+ typedef
+ typename Allocator::template rebind<
+ typename Node_And_It_Traits::node>::other
+ node_allocator;
+
+ typedef typename node_allocator::value_type node;
+
+ typedef typename node_allocator::pointer node_pointer;
+
+ typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+
+ typedef
+ typename Node_And_It_Traits::null_node_update_pointer
+ null_node_update_pointer;
+
+ private:
+ typedef cond_dealtor< node, Allocator> cond_dealtor_t;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_type key_type;
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_pointer key_pointer;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::const_key_pointer
+ const_key_pointer;
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_reference key_reference;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::const_key_reference
+ const_key_reference;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::mapped_type mapped_type;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::mapped_pointer
+ mapped_pointer;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_pointer
+ const_mapped_pointer;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::mapped_reference
+ mapped_reference;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_reference
+ const_mapped_reference;
+#endif
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::value_type value_type;
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::pointer pointer;
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::const_pointer const_pointer;
+
+ typedef typename PB_DS_TYPES_TRAITS_C_DEC::reference reference;
+
+ typedef
+ typename PB_DS_TYPES_TRAITS_C_DEC::const_reference
+ const_reference;
+
+ typedef
+ typename Node_And_It_Traits::const_point_iterator
+ const_point_iterator;
+
+ typedef const_point_iterator const_iterator;
+
+ typedef typename Node_And_It_Traits::point_iterator point_iterator;
+
+ typedef point_iterator iterator;
+
+ typedef
+ typename Node_And_It_Traits::const_reverse_iterator
+ const_reverse_iterator;
+
+ typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;
+
+ typedef
+ typename Node_And_It_Traits::const_node_iterator
+ const_node_iterator;
+
+ typedef typename Node_And_It_Traits::node_iterator node_iterator;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef Allocator allocator_type;
+
+ typedef typename Node_And_It_Traits::node_update node_update;
+
+ public:
+
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn);
+
+ PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_update);
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ ~PB_DS_CLASS_NAME();
+
+ inline bool
+ empty() const;
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ Cmp_Fn&
+ get_cmp_fn();
+
+ const Cmp_Fn&
+ get_cmp_fn() const;
+
+ inline point_iterator
+ lower_bound(const_key_reference r_key);
+
+ inline const_point_iterator
+ lower_bound(const_key_reference r_key) const;
+
+ inline point_iterator
+ upper_bound(const_key_reference r_key);
+
+ inline const_point_iterator
+ upper_bound(const_key_reference r_key) const;
+
+ inline point_iterator
+ find(const_key_reference r_key);
+
+ inline const_point_iterator
+ find(const_key_reference r_key) const;
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+ inline reverse_iterator
+ rbegin();
+
+ inline const_reverse_iterator
+ rbegin() const;
+
+ inline reverse_iterator
+ rend();
+
+ inline const_reverse_iterator
+ rend() const;
+
+ inline const_node_iterator
+ node_begin() const;
+
+ inline node_iterator
+ node_begin();
+
+ inline const_node_iterator
+ node_end() const;
+
+ inline node_iterator
+ node_end();
+
+ void
+ clear();
+
+ protected:
+
+ void
+ value_swap(PB_DS_CLASS_C_DEC& other);
+
+ void
+ initialize_min_max();
+
+ inline iterator
+ insert_imp_empty(const_reference r_value);
+
+ inline iterator
+ insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd);
+
+ inline node_pointer
+ get_new_node_for_leaf_insert(const_reference r_val, false_type);
+
+ inline node_pointer
+ get_new_node_for_leaf_insert(const_reference r_val, true_type);
+
+ inline void
+ actual_erase_node(node_pointer p_nd);
+
+ inline std::pair<node_pointer, bool>
+ erase(node_pointer p_nd);
+
+ inline void
+ update_min_max_for_erased_node(node_pointer p_nd);
+
+ static void
+ clear_imp(node_pointer p_nd);
+
+ inline std::pair<
+ point_iterator,
+ bool>
+ insert_leaf(const_reference r_value);
+
+ inline void
+ rotate_left(node_pointer p_x);
+
+ inline void
+ rotate_right(node_pointer p_y);
+
+ inline void
+ rotate_parent(node_pointer p_nd);
+
+ inline void
+ apply_update(node_pointer p_nd, null_node_update_pointer);
+
+ template<typename Node_Update_>
+ inline void
+ apply_update(node_pointer p_nd, Node_Update_* p_update);
+
+ inline void
+ update_to_top(node_pointer p_nd, null_node_update_pointer);
+
+ template<typename Node_Update_>
+ inline void
+ update_to_top(node_pointer p_nd, Node_Update_* p_update);
+
+ bool
+ join_prep(PB_DS_CLASS_C_DEC& other);
+
+ void
+ join_finish(PB_DS_CLASS_C_DEC& other);
+
+ bool
+ split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other);
+
+ void
+ split_finish(PB_DS_CLASS_C_DEC& other);
+
+ size_type
+ recursive_count(node_pointer p_nd) const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ void
+ structure_only_assert_valid() const;
+
+ void
+ assert_node_consistent(const node_pointer p_nd) const;
+#endif
+
+ private:
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_iterators() const;
+
+ void
+ assert_consistent_with_debug_base() const;
+
+ void
+ assert_node_consistent_with_left(const node_pointer p_nd) const;
+
+ void
+ assert_node_consistent_with_right(const node_pointer p_nd) const;
+
+ void
+ assert_consistent_with_debug_base(const node_pointer p_nd) const;
+
+ void
+ assert_min() const;
+
+ void
+ assert_min_imp(const node_pointer p_nd) const;
+
+ void
+ assert_max() const;
+
+ void
+ assert_max_imp(const node_pointer p_nd) const;
+
+ void
+ assert_size() const;
+
+ typedef std::pair< const_pointer, const_pointer> node_consistent_t;
+
+ node_consistent_t
+ assert_node_consistent_(const node_pointer p_nd) const;
+#endif
+
+ void
+ initialize();
+
+ node_pointer
+ recursive_copy_node(const node_pointer p_nd);
+
+ protected:
+ node_pointer m_p_head;
+
+ size_type m_size;
+
+ static node_allocator s_node_allocator;
+ };
+
+#include <ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+
+#undef PB_DS_CLASS_T_DEC
+
+#undef PB_DS_CLASS_NAME
+
+#undef PB_DS_TYPES_TRAITS_C_DEC
+
+#undef PB_DS_DEBUG_MAP_BASE_C_DEC
+
+#ifdef PB_DS_TREE_TRACE
+#undef PB_DS_TREE_TRACE_BASE_C_DEC
+#endif
+
+#undef PB_DS_V2F
+#undef PB_DS_EP2VP
+#undef PB_DS_V2S
+
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
new file mode 100644
index 000000000..370574c90
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cond_dtor_entry_dealtor.hpp
+ * Contains a binary tree container conditional deallocator
+ */
+
+class bin_search_tree_cond_dtor_entry_dealtor_
+{
+public:
+ inline
+ bin_search_tree_cond_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),
+ m_no_action_dtor(false)
+ { }
+
+ inline void
+ set_no_action_dtor()
+ {
+ m_no_action_dtor = true;
+ }
+
+ inline
+ ~bin_search_tree_cond_dtor_entry_dealtor_()
+ {
+ if (m_no_action_dtor)
+ return;
+
+ typename Allocator::template rebind<Node>::other().
+ deallocate(m_p_nd, 1);
+ }
+
+protected:
+ node_pointer m_p_nd;
+
+ bool m_no_action_dtor;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
new file mode 100644
index 000000000..612ecebbe
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cond_key_dtor_entry_dealtor.hpp
+ * Contains a binary tree container conditional deallocator
+ */
+
+class bin_seach_tree_cond_key_dtor_entry_dealtor_
+{
+public:
+ inline
+ bin_seach_tree_cond_key_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),
+ m_no_action_dtor(false),
+ m_key_destruct(false)
+ { }
+
+ inline void
+ set_no_action_dtor()
+ {
+ m_no_action_dtor = true;
+ }
+
+ inline void
+ set_key_destruct()
+ {
+ m_key_destruct = true;
+ }
+
+ inline
+ ~bin_seach_tree_cond_key_dtor_entry_dealtor_()
+ {
+ if (m_no_action_dtor)
+ return;
+
+ if (m_key_destruct)
+ m_p_nd->m_value.first.~Key();
+
+ bin_tree_base::s_alloc.deallocate(m_p_nd, 1);
+ }
+
+protected:
+ node_pointer m_p_nd;
+
+ bool m_no_action_dtor;
+
+ bool m_key_destruct;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..925d204dc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,218 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_allocator
+PB_DS_CLASS_C_DEC::s_node_allocator;
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+ Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+ Cmp_Fn(r_cmp_fn),
+ node_update(r_node_update),
+ m_p_head(s_node_allocator.allocate(1)),
+ m_size(0)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+#ifdef _GLIBCXX_DEBUG
+ debug_base(other),
+#endif
+#ifdef PB_DS_TREE_TRACE
+ PB_DS_TREE_TRACE_BASE_C_DEC(other),
+#endif
+ Cmp_Fn(other),
+ node_update(other),
+ m_p_head(s_node_allocator.allocate(1)),
+ m_size(0)
+{
+ initialize();
+ m_size = other.m_size;
+ _GLIBCXX_DEBUG_ONLY(other.structure_only_assert_valid();)
+
+ __try
+ {
+ m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
+ if (m_p_head->m_p_parent != NULL)
+ m_p_head->m_p_parent->m_p_parent = m_p_head;
+ m_size = other.m_size;
+ initialize_min_max();
+ }
+ __catch(...)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+ s_node_allocator.deallocate(m_p_head, 1);
+ __throw_exception_again;
+ }
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.structure_only_assert_valid();)
+ value_swap(other);
+ std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.structure_only_assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+value_swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
+ std::swap(m_p_head, other.m_p_head);
+ std::swap(m_size, other.m_size);
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_CLASS_NAME()
+{
+ clear();
+ s_node_allocator.deallocate(m_p_head, 1);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{
+ m_p_head->m_p_parent = NULL;
+ m_p_head->m_p_left = m_p_head;
+ m_p_head->m_p_right = m_p_head;
+ m_size = 0;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+recursive_copy_node(const node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return (NULL);
+
+ node_pointer p_ret = s_node_allocator.allocate(1);
+ __try
+ {
+ new (p_ret) node(*p_nd);
+ }
+ __catch(...)
+ {
+ s_node_allocator.deallocate(p_ret, 1);
+ __throw_exception_again;
+ }
+
+ p_ret->m_p_left = p_ret->m_p_right = NULL;
+
+ __try
+ {
+ p_ret->m_p_left = recursive_copy_node(p_nd->m_p_left);
+ p_ret->m_p_right = recursive_copy_node(p_nd->m_p_right);
+ }
+ __catch(...)
+ {
+ clear_imp(p_ret);
+ __throw_exception_again;
+ }
+
+ if (p_ret->m_p_left != NULL)
+ p_ret->m_p_left->m_p_parent = p_ret;
+
+ if (p_ret->m_p_right != NULL)
+ p_ret->m_p_right->m_p_parent = p_ret;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_ret);)
+ return p_ret;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize_min_max()
+{
+ if (m_p_head->m_p_parent == NULL)
+ {
+ m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
+ return;
+ }
+
+ {
+ node_pointer p_min = m_p_head->m_p_parent;
+ while (p_min->m_p_left != NULL)
+ p_min = p_min->m_p_left;
+ m_p_head->m_p_left = p_min;
+ }
+
+ {
+ node_pointer p_max = m_p_head->m_p_parent;
+ while (p_max->m_p_right != NULL)
+ p_max = p_max->m_p_right;
+ m_p_head->m_p_right = p_max;
+ }
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
new file mode 100644
index 000000000..e3447bd4b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
@@ -0,0 +1,272 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ structure_only_assert_valid();
+ assert_consistent_with_debug_base();
+ assert_size();
+ assert_iterators();
+ if (m_p_head->m_p_parent == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_size == 0);
+ }
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+structure_only_assert_valid() const
+{
+ _GLIBCXX_DEBUG_ASSERT(m_p_head != NULL);
+ if (m_p_head->m_p_parent == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);
+ }
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent->m_p_parent == m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left != m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right != m_p_head);
+ }
+
+ if (m_p_head->m_p_parent != NULL)
+ assert_node_consistent(m_p_head->m_p_parent);
+ assert_min();
+ assert_max();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_node_consistent(const node_pointer p_nd) const
+{
+ assert_node_consistent_(p_nd);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_consistent_t
+PB_DS_CLASS_C_DEC::
+assert_node_consistent_(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ return (std::make_pair((const_pointer)NULL,(const_pointer)NULL));
+
+ assert_node_consistent_with_left(p_nd);
+ assert_node_consistent_with_right(p_nd);
+
+ const std::pair<const_pointer, const_pointer>
+ l_range = assert_node_consistent_(p_nd->m_p_left);
+
+ if (l_range.second != NULL)
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*l_range.second),
+ PB_DS_V2F(p_nd->m_value)));
+
+ const std::pair<const_pointer, const_pointer>
+ r_range = assert_node_consistent_(p_nd->m_p_right);
+
+ if (r_range.first != NULL)
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
+ PB_DS_V2F(*r_range.first)));
+
+ return (std::make_pair((l_range.first != NULL)? l_range.first :& p_nd->m_value,(r_range.second != NULL)? r_range.second :& p_nd->m_value));
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_node_consistent_with_left(const node_pointer p_nd) const
+{
+ if (p_nd->m_p_left == NULL)
+ return;
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left->m_p_parent == p_nd);
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
+ PB_DS_V2F(p_nd->m_p_left->m_value)));
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_node_consistent_with_right(const node_pointer p_nd) const
+{
+ if (p_nd->m_p_right == NULL)
+ return;
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right->m_p_parent == p_nd);
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value),
+ PB_DS_V2F(p_nd->m_value)));
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_min() const
+{
+ assert_min_imp(m_p_head->m_p_parent);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_min_imp(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);
+ return;
+ }
+
+ if (p_nd->m_p_left == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd == m_p_head->m_p_left);
+ return;
+ }
+ assert_min_imp(p_nd->m_p_left);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_max() const
+{
+ assert_max_imp(m_p_head->m_p_parent);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_max_imp(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);
+ return;
+ }
+
+ if (p_nd->m_p_right == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd == m_p_head->m_p_right);
+ return;
+ }
+
+ assert_max_imp(p_nd->m_p_right);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_iterators() const
+{
+ size_type iterated_num = 0;
+ const_iterator prev_it = end();
+ for (const_iterator it = begin(); it != end(); ++it)
+ {
+ ++iterated_num;
+ _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)).m_p_nd == it.m_p_nd);
+ const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
+ --upper_bound_it;
+ _GLIBCXX_DEBUG_ASSERT(upper_bound_it.m_p_nd == it.m_p_nd);
+
+ if (prev_it != end())
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),
+ PB_DS_V2F(*it)));
+ prev_it = it;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(iterated_num == m_size);
+ size_type reverse_iterated_num = 0;
+ const_reverse_iterator reverse_prev_it = rend();
+ for (const_reverse_iterator reverse_it = rbegin(); reverse_it != rend();
+ ++reverse_it)
+ {
+ ++reverse_iterated_num;
+ _GLIBCXX_DEBUG_ASSERT(lower_bound(
+ PB_DS_V2F(*reverse_it)).m_p_nd == reverse_it.m_p_nd);
+
+ const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*reverse_it));
+ --upper_bound_it;
+ _GLIBCXX_DEBUG_ASSERT(upper_bound_it.m_p_nd == reverse_it.m_p_nd);
+ if (reverse_prev_it != rend())
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(*reverse_prev_it),
+ PB_DS_V2F(*reverse_it)));
+ reverse_prev_it = reverse_it;
+ }
+ _GLIBCXX_DEBUG_ASSERT(reverse_iterated_num == m_size);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_consistent_with_debug_base() const
+{
+ debug_base::check_size(m_size);
+ assert_consistent_with_debug_base(m_p_head->m_p_parent);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_consistent_with_debug_base(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ return;
+ debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value));
+ assert_consistent_with_debug_base(p_nd->m_p_left);
+ assert_consistent_with_debug_base(p_nd->m_p_right);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_size() const
+{
+ _GLIBCXX_DEBUG_ASSERT(recursive_count(m_p_head->m_p_parent) == m_size);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
new file mode 100644
index 000000000..a000c744c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+actual_erase_node(node_pointer p_z)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+
+ _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));
+
+ p_z->~node();
+
+ s_node_allocator.deallocate(p_z, 1);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update_min_max_for_erased_node(node_pointer p_z)
+{
+ if (m_size == 1)
+ {
+ m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
+
+ return;
+ }
+
+ if (m_p_head->m_p_left == p_z)
+ {
+ iterator it(p_z);
+
+ ++it;
+
+ m_p_head->m_p_left = it.m_p_nd;
+ }
+ else if (m_p_head->m_p_right == p_z)
+ {
+ iterator it(p_z);
+
+ --it;
+
+ m_p_head->m_p_right = it.m_p_nd;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+
+ clear_imp(m_p_head->m_p_parent);
+
+ m_size = 0;
+
+ initialize();
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear_imp(node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return;
+
+ clear_imp(p_nd->m_p_left);
+
+ clear_imp(p_nd->m_p_right);
+
+ p_nd->~node();
+
+ s_node_allocator.deallocate(p_nd, 1);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
new file mode 100644
index 000000000..413304b80
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
@@ -0,0 +1,182 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+lower_bound(const_key_reference r_key) const
+{
+ node_pointer p_pot = m_p_head;
+ node_pointer p_nd = m_p_head->m_p_parent;
+
+ while (p_nd != NULL)
+ if (Cmp_Fn::operator()(
+ PB_DS_V2F(p_nd->m_value),
+ r_key))
+ p_nd = p_nd->m_p_right;
+ else
+ {
+ p_pot = p_nd;
+
+ p_nd = p_nd->m_p_left;
+ }
+
+ return (iterator(p_pot));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+lower_bound(const_key_reference r_key)
+{
+ node_pointer p_pot = m_p_head;
+ node_pointer p_nd = m_p_head->m_p_parent;
+
+ while (p_nd != NULL)
+ if (Cmp_Fn::operator()(
+ PB_DS_V2F(p_nd->m_value),
+ r_key))
+ p_nd = p_nd->m_p_right;
+ else
+ {
+ p_pot = p_nd;
+
+ p_nd = p_nd->m_p_left;
+ }
+
+ return (iterator(p_pot));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+upper_bound(const_key_reference r_key) const
+{
+ node_pointer p_pot = m_p_head;
+ node_pointer p_nd = m_p_head->m_p_parent;
+
+ while (p_nd != NULL)
+ if (Cmp_Fn::operator()(r_key,
+ PB_DS_V2F(p_nd->m_value)))
+ {
+ p_pot = p_nd,
+
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+
+ return (const_iterator(p_pot));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+upper_bound(const_key_reference r_key)
+{
+ node_pointer p_pot = m_p_head;
+ node_pointer p_nd = m_p_head->m_p_parent;
+
+ while (p_nd != NULL)
+ if (Cmp_Fn::operator()(r_key,
+ PB_DS_V2F(p_nd->m_value)))
+ {
+ p_pot = p_nd,
+
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+
+ return (point_iterator(p_pot));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+
+ node_pointer p_pot = m_p_head;
+ node_pointer p_nd = m_p_head->m_p_parent;
+
+ while (p_nd != NULL)
+ if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
+ {
+ p_pot = p_nd;
+
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+
+ return point_iterator((p_pot != m_p_head&& Cmp_Fn::operator()(
+ r_key,
+ PB_DS_V2F(p_pot->m_value)))?
+ m_p_head : p_pot);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key) const
+{
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+
+ node_pointer p_pot = m_p_head;
+ node_pointer p_nd = m_p_head->m_p_parent;
+
+ while (p_nd != NULL)
+ if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
+ {
+ p_pot = p_nd;
+
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+
+ return const_point_iterator((p_pot != m_p_head&& Cmp_Fn::operator()(
+ r_key,
+ PB_DS_V2F(p_pot->m_value)))?
+ m_p_head : p_pot);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
new file mode 100644
index 000000000..b3e46112f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{
+ return (m_size == 0);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{
+ return (m_size);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{
+ return (s_node_allocator.max_size());
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
new file mode 100644
index 000000000..3abf0a08d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
@@ -0,0 +1,211 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert_leaf(const_reference r_value)
+{
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+
+ if (m_size == 0)
+ return (std::make_pair(
+ insert_imp_empty(r_value),
+ true));
+
+ node_pointer p_nd = m_p_head->m_p_parent;
+ node_pointer p_pot = m_p_head;
+
+ while (p_nd != NULL)
+ if (!Cmp_Fn::operator()(
+ PB_DS_V2F(p_nd->m_value),
+ PB_DS_V2F(r_value)))
+ {
+ p_pot = p_nd;
+
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+
+ if (p_pot == m_p_head)
+ return (std::make_pair(
+ insert_leaf_new(r_value, m_p_head->m_p_right, false),
+ true));
+
+ if (!Cmp_Fn::operator()(
+ PB_DS_V2F(r_value),
+ PB_DS_V2F(p_pot->m_value)))
+ {
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(
+ PB_DS_V2F(r_value)));
+
+ return (std::make_pair(p_pot, false));
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(
+ PB_DS_V2F(r_value)));
+
+ p_nd = p_pot->m_p_left;
+ if (p_nd == NULL)
+ return (std::make_pair(
+ insert_leaf_new(r_value, p_pot, true),
+ true));
+
+ while (p_nd->m_p_right != NULL)
+ p_nd = p_nd->m_p_right;
+
+ return (std::make_pair(
+ insert_leaf_new(r_value, p_nd, false),
+ true));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)
+{
+ node_pointer p_new_nd =
+ get_new_node_for_leaf_insert( r_value, traits_base::m_no_throw_copies_indicator);
+
+ if (left_nd)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == NULL);
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
+ PB_DS_V2F(r_value),
+ PB_DS_V2F(p_nd->m_value)));
+
+ p_nd->m_p_left = p_new_nd;
+
+ if (m_p_head->m_p_left == p_nd)
+ m_p_head->m_p_left = p_new_nd;
+ }
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == NULL);
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(
+ PB_DS_V2F(p_nd->m_value),
+ PB_DS_V2F(r_value)));
+
+ p_nd->m_p_right = p_new_nd;
+
+ if (m_p_head->m_p_right == p_nd)
+ m_p_head->m_p_right = p_new_nd;
+ }
+
+ p_new_nd->m_p_parent = p_nd;
+
+ p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_nd));
+
+ update_to_top(p_new_nd, (node_update* )this);
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(
+ PB_DS_V2F(r_value)));
+
+ return (iterator(p_new_nd));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+insert_imp_empty(const_reference r_value)
+{
+ node_pointer p_new_node =
+ get_new_node_for_leaf_insert( r_value, traits_base::m_no_throw_copies_indicator);
+
+ m_p_head->m_p_left = m_p_head->m_p_right =
+ m_p_head->m_p_parent = p_new_node;
+
+ p_new_node->m_p_parent = m_p_head;
+
+ p_new_node->m_p_left = p_new_node->m_p_right = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(
+ PB_DS_V2F(r_value)));
+
+ update_to_top(m_p_head->m_p_parent, (node_update* )this);
+
+ return (iterator(p_new_node));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+get_new_node_for_leaf_insert(const_reference r_val, false_type)
+{
+ node_pointer p_new_nd = s_node_allocator.allocate(1);
+
+ cond_dealtor_t cond(p_new_nd);
+
+ new (const_cast<void* >(
+ static_cast<const void* >(&p_new_nd->m_value)))
+ typename node::value_type(r_val);
+
+ cond.set_no_action();
+
+ p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;
+
+ ++m_size;
+
+ return (p_new_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+get_new_node_for_leaf_insert(const_reference r_val, true_type)
+{
+ node_pointer p_new_nd = s_node_allocator.allocate(1);
+
+ new (const_cast<void* >(
+ static_cast<const void* >(&p_new_nd->m_value)))
+ typename node::value_type(r_val);
+
+ p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;
+
+ ++m_size;
+
+ return (p_new_nd);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..ed7f1b172
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{
+ return (iterator(m_p_head->m_p_left));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{
+ return (const_iterator(m_p_head->m_p_left));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{
+ return (iterator(m_p_head));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{
+ return (const_iterator(m_p_head));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
+PB_DS_CLASS_C_DEC::
+rbegin() const
+{
+ return (const_reverse_iterator(m_p_head->m_p_right));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+rbegin()
+{
+ return (reverse_iterator(m_p_head->m_p_right));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+rend()
+{
+ return (reverse_iterator(m_p_head));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
+PB_DS_CLASS_C_DEC::
+rend() const
+{
+ return (const_reverse_iterator(m_p_head));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+node_begin() const
+{
+ return (const_node_iterator(m_p_head->m_p_parent));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_begin()
+{
+ return (node_iterator(m_p_head->m_p_parent));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+node_end() const
+{
+ return (const_node_iterator(NULL));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_end()
+{
+ return (node_iterator(NULL));
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
new file mode 100644
index 000000000..365f02b6e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
@@ -0,0 +1,237 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_iterators.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+#ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
+#define PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC \
+ bin_search_tree_const_node_it_< \
+ Node, \
+ Const_Iterator, \
+ Iterator, \
+ Allocator>
+
+ // Const node iterator.
+ template<typename Node,
+ class Const_Iterator,
+ class Iterator,
+ class Allocator>
+ class bin_search_tree_const_node_it_
+ {
+ private:
+
+ private:
+ typedef
+ typename Allocator::template rebind<
+ Node>::other::pointer
+ node_pointer;
+
+ public:
+
+ // Category.
+ typedef trivial_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef trivial_iterator_difference_type difference_type;
+
+ // __Iterator's value type.
+ typedef Const_Iterator value_type;
+
+ // __Iterator's reference type.
+ typedef Const_Iterator reference;
+
+ // __Iterator's __const reference type.
+ typedef Const_Iterator const_reference;
+
+ // Metadata type.
+ typedef typename Node::metadata_type metadata_type;
+
+ // Const metadata reference type.
+ typedef
+ typename Allocator::template rebind<
+ metadata_type>::other::const_reference
+ const_metadata_reference;
+
+ public:
+
+ // Default constructor.
+ /*
+ inline
+ bin_search_tree_const_node_it_()
+ */
+
+ inline
+ bin_search_tree_const_node_it_(const node_pointer p_nd = NULL) : m_p_nd(const_cast<node_pointer>(p_nd))
+ { }
+
+ // Access.
+ inline const_reference
+ operator*() const
+ {
+ return (Const_Iterator(m_p_nd));
+ }
+
+ // Metadata access.
+ inline const_metadata_reference
+ get_metadata() const
+ {
+ return (m_p_nd->get_metadata());
+ }
+
+ // Returns the __const node iterator associated with the left node.
+ inline PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
+ get_l_child() const
+ {
+ return (PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left));
+ }
+
+ // Returns the __const node iterator associated with the right node.
+ inline PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
+ get_r_child() const
+ {
+ return (PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right));
+ }
+
+ // Compares to a different iterator object.
+ inline bool
+ operator==(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const
+ {
+ return (m_p_nd == other.m_p_nd);
+ }
+
+ // Compares (negatively) to a different iterator object.
+ inline bool
+ operator!=(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const
+ {
+ return (m_p_nd != other.m_p_nd);
+ }
+
+ public:
+ node_pointer m_p_nd;
+ };
+
+#define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC \
+ bin_search_tree_node_it_< \
+ Node, \
+ Const_Iterator, \
+ Iterator, \
+ Allocator>
+
+ // Node iterator.
+ template<typename Node,
+ class Const_Iterator,
+ class Iterator,
+ class Allocator>
+ class bin_search_tree_node_it_ :
+ public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
+
+ {
+
+ private:
+ typedef
+ typename Allocator::template rebind<
+ Node>::other::pointer
+ node_pointer;
+
+ public:
+
+ // __Iterator's value type.
+ typedef Iterator value_type;
+
+ // __Iterator's reference type.
+ typedef Iterator reference;
+
+ // __Iterator's __const reference type.
+ typedef Iterator const_reference;
+
+ public:
+
+ // Default constructor.
+ /*
+ inline
+ bin_search_tree_node_it_();
+ */
+
+ inline
+ bin_search_tree_node_it_(const node_pointer p_nd = NULL) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(
+ const_cast<node_pointer>(p_nd))
+ { }
+
+ // Access.
+ inline Iterator
+ operator*() const
+ {
+ return (Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd));
+ }
+
+ // Returns the node iterator associated with the left node.
+ inline PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
+ get_l_child() const
+ {
+ return (PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
+ PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left));
+ }
+
+ // Returns the node iterator associated with the right node.
+ inline PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
+ get_r_child() const
+ {
+ return (PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(
+ PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right));
+ }
+
+ };
+
+#undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC
+
+#undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
new file mode 100644
index 000000000..bb249e070
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
@@ -0,0 +1,381 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file point_iterators.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+#ifndef PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP
+#define PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_TREE_CONST_IT_C_DEC \
+ bin_search_tree_const_it_< \
+ Node_Pointer, \
+ Value_Type, \
+ Pointer, \
+ Const_Pointer, \
+ Reference, \
+ Const_Reference, \
+ Is_Forward_Iterator, \
+ Allocator>
+
+#define PB_DS_TREE_CONST_ODIR_IT_C_DEC \
+ bin_search_tree_const_it_< \
+ Node_Pointer, \
+ Value_Type, \
+ Pointer, \
+ Const_Pointer, \
+ Reference, \
+ Const_Reference, \
+ !Is_Forward_Iterator, \
+ Allocator>
+
+#define PB_DS_TREE_IT_C_DEC \
+ bin_search_tree_it_< \
+ Node_Pointer, \
+ Value_Type, \
+ Pointer, \
+ Const_Pointer, \
+ Reference, \
+ Const_Reference, \
+ Is_Forward_Iterator, \
+ Allocator>
+
+#define PB_DS_TREE_ODIR_IT_C_DEC \
+ bin_search_tree_it_< \
+ Node_Pointer, \
+ Value_Type, \
+ Pointer, \
+ Const_Pointer, \
+ Reference, \
+ Const_Reference, \
+ !Is_Forward_Iterator, \
+ Allocator>
+
+ // Const iterator.
+ template<typename Node_Pointer,
+ typename Value_Type,
+ typename Pointer,
+ typename Const_Pointer,
+ typename Reference,
+ typename Const_Reference,
+ bool Is_Forward_Iterator,
+ class Allocator>
+ class bin_search_tree_const_it_
+ {
+
+ public:
+
+ typedef std::bidirectional_iterator_tag iterator_category;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef Pointer pointer;
+
+ typedef Const_Pointer const_pointer;
+
+ typedef Reference reference;
+
+ typedef Const_Reference const_reference;
+
+ public:
+
+ inline
+ bin_search_tree_const_it_(const Node_Pointer p_nd = NULL)
+ : m_p_nd(const_cast<Node_Pointer>(p_nd))
+ { }
+
+ inline
+ bin_search_tree_const_it_(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)
+ : m_p_nd(other.m_p_nd)
+ { }
+
+ inline
+ PB_DS_TREE_CONST_IT_C_DEC&
+ operator=(const PB_DS_TREE_CONST_IT_C_DEC& other)
+ {
+ m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline
+ PB_DS_TREE_CONST_IT_C_DEC&
+ operator=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)
+ {
+ m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline const_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ return &m_p_nd->m_value;
+ }
+
+ inline const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ return m_p_nd->m_value;
+ }
+
+ inline bool
+ operator==(const PB_DS_TREE_CONST_IT_C_DEC & other) const
+ { return m_p_nd == other.m_p_nd; }
+
+ inline bool
+ operator==(const PB_DS_TREE_CONST_ODIR_IT_C_DEC & other) const
+ { return m_p_nd == other.m_p_nd; }
+
+ inline bool
+ operator!=(const PB_DS_TREE_CONST_IT_C_DEC& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ inline bool
+ operator!=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ inline PB_DS_TREE_CONST_IT_C_DEC&
+ operator++()
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ inc(integral_constant<int,Is_Forward_Iterator>());
+ return *this;
+ }
+
+ inline PB_DS_TREE_CONST_IT_C_DEC
+ operator++(int)
+ {
+ PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);
+ operator++();
+ return ret_it;
+ }
+
+ inline PB_DS_TREE_CONST_IT_C_DEC&
+ operator--()
+ {
+ dec(integral_constant<int,Is_Forward_Iterator>());
+ return *this;
+ }
+
+ inline PB_DS_TREE_CONST_IT_C_DEC
+ operator--(int)
+ {
+ PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);
+ operator--();
+ return ret_it;
+ }
+
+ protected:
+ inline void
+ inc(false_type)
+ { dec(true_type()); }
+
+ void
+ inc(true_type)
+ {
+ if (m_p_nd->special()&&
+ m_p_nd->m_p_parent->m_p_parent == m_p_nd)
+ {
+ m_p_nd = m_p_nd->m_p_left;
+ return;
+ }
+
+ if (m_p_nd->m_p_right != NULL)
+ {
+ m_p_nd = m_p_nd->m_p_right;
+ while (m_p_nd->m_p_left != NULL)
+ m_p_nd = m_p_nd->m_p_left;
+ return;
+ }
+
+ Node_Pointer p_y = m_p_nd->m_p_parent;
+ while (m_p_nd == p_y->m_p_right)
+ {
+ m_p_nd = p_y;
+ p_y = p_y->m_p_parent;
+ }
+
+ if (m_p_nd->m_p_right != p_y)
+ m_p_nd = p_y;
+ }
+
+ inline void
+ dec(false_type)
+ { inc(true_type()); }
+
+ void
+ dec(true_type)
+ {
+ if (m_p_nd->special() && m_p_nd->m_p_parent->m_p_parent == m_p_nd)
+ {
+ m_p_nd = m_p_nd->m_p_right;
+ return;
+ }
+
+ if (m_p_nd->m_p_left != NULL)
+ {
+ Node_Pointer p_y = m_p_nd->m_p_left;
+ while (p_y->m_p_right != NULL)
+ p_y = p_y->m_p_right;
+ m_p_nd = p_y;
+ return;
+ }
+
+ Node_Pointer p_y = m_p_nd->m_p_parent;
+ while (m_p_nd == p_y->m_p_left)
+ {
+ m_p_nd = p_y;
+ p_y = p_y->m_p_parent;
+ }
+ if (m_p_nd->m_p_left != p_y)
+ m_p_nd = p_y;
+ }
+
+ public:
+ Node_Pointer m_p_nd;
+ };
+
+ // Iterator.
+ template<typename Node_Pointer,
+ typename Value_Type,
+ typename Pointer,
+ typename Const_Pointer,
+ typename Reference,
+ typename Const_Reference,
+ bool Is_Forward_Iterator,
+ class Allocator>
+ class bin_search_tree_it_ :
+ public PB_DS_TREE_CONST_IT_C_DEC
+
+ {
+
+ public:
+
+ inline
+ bin_search_tree_it_(const Node_Pointer p_nd = NULL)
+ : PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)
+ { }
+
+ inline
+ bin_search_tree_it_(const PB_DS_TREE_ODIR_IT_C_DEC& other)
+ : PB_DS_TREE_CONST_IT_C_DEC(other.m_p_nd)
+ { }
+
+ inline
+ PB_DS_TREE_IT_C_DEC&
+ operator=(const PB_DS_TREE_IT_C_DEC& other)
+ {
+ base_it_type::m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline
+ PB_DS_TREE_IT_C_DEC&
+ operator=(const PB_DS_TREE_ODIR_IT_C_DEC& other)
+ {
+ base_it_type::m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != NULL);
+ return &base_it_type::m_p_nd->m_value;
+ }
+
+ inline typename PB_DS_TREE_CONST_IT_C_DEC::reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != NULL);
+ return base_it_type::m_p_nd->m_value;
+ }
+
+ inline PB_DS_TREE_IT_C_DEC&
+ operator++()
+ {
+ PB_DS_TREE_CONST_IT_C_DEC:: operator++();
+ return *this;
+ }
+
+ inline PB_DS_TREE_IT_C_DEC
+ operator++(int)
+ {
+ PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);
+ operator++();
+ return ret_it;
+ }
+
+ inline PB_DS_TREE_IT_C_DEC&
+ operator--()
+ {
+ PB_DS_TREE_CONST_IT_C_DEC:: operator--();
+ return *this;
+ }
+
+ inline PB_DS_TREE_IT_C_DEC
+ operator--(int)
+ {
+ PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);
+ operator--();
+ return ret_it;
+ }
+
+ protected:
+ typedef PB_DS_TREE_CONST_IT_C_DEC base_it_type;
+ };
+
+#undef PB_DS_TREE_CONST_IT_C_DEC
+#undef PB_DS_TREE_CONST_ODIR_IT_C_DEC
+#undef PB_DS_TREE_IT_C_DEC
+#undef PB_DS_TREE_ODIR_IT_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..63f307d39
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn()
+{
+ return (*this);
+}
+
+PB_DS_CLASS_T_DEC
+const Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn() const
+{
+ return (*this);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
new file mode 100644
index 000000000..667ef8470
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file r_erase_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+actual_erase_node(node_pointer p_z)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+
+ _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));
+
+ p_z->~node();
+
+ s_node_allocator.deallocate(p_z, 1);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update_min_max_for_erased_node(node_pointer p_z)
+{
+ if (m_size == 1)
+ {
+ m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
+
+ return;
+ }
+
+ if (m_p_head->m_p_left == p_z)
+ {
+ iterator it(p_z);
+
+ ++it;
+
+ m_p_head->m_p_left = it.m_p_nd;
+ }
+ else if (m_p_head->m_p_right == p_z)
+ {
+ iterator it(p_z);
+
+ --it;
+
+ m_p_head->m_p_right = it.m_p_nd;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+
+ clear_imp(m_p_head->m_p_parent);
+
+ m_size = 0;
+
+ initialize();
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+
+ _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear_imp(node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return;
+
+ clear_imp(p_nd->m_p_left);
+
+ clear_imp(p_nd->m_p_right);
+
+ p_nd->~Node();
+
+ s_node_allocator.deallocate(p_nd, 1);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
new file mode 100644
index 000000000..0598657fe
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
@@ -0,0 +1,156 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file rotate_fn_imps.hpp
+ * Contains imps for rotating nodes.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rotate_left(node_pointer p_x)
+{
+ node_pointer p_y = p_x->m_p_right;
+
+ p_x->m_p_right = p_y->m_p_left;
+
+ if (p_y->m_p_left != NULL)
+ p_y->m_p_left->m_p_parent = p_x;
+
+ p_y->m_p_parent = p_x->m_p_parent;
+
+ if (p_x == m_p_head->m_p_parent)
+ m_p_head->m_p_parent = p_y;
+ else if (p_x == p_x->m_p_parent->m_p_left)
+ p_x->m_p_parent->m_p_left = p_y;
+ else
+ p_x->m_p_parent->m_p_right = p_y;
+
+ p_y->m_p_left = p_x;
+ p_x->m_p_parent = p_y;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
+
+ apply_update(p_x, (node_update* )this);
+ apply_update(p_x->m_p_parent, (node_update* )this);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rotate_right(node_pointer p_x)
+{
+ node_pointer p_y = p_x->m_p_left;
+
+ p_x->m_p_left = p_y->m_p_right;
+
+ if (p_y->m_p_right != NULL)
+ p_y->m_p_right->m_p_parent = p_x;
+
+ p_y->m_p_parent = p_x->m_p_parent;
+
+ if (p_x == m_p_head->m_p_parent)
+ m_p_head->m_p_parent = p_y;
+ else if (p_x == p_x->m_p_parent->m_p_right)
+ p_x->m_p_parent->m_p_right = p_y;
+ else
+ p_x->m_p_parent->m_p_left = p_y;
+
+ p_y->m_p_right = p_x;
+ p_x->m_p_parent = p_y;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
+
+ apply_update(p_x, (node_update* )this);
+ apply_update(p_x->m_p_parent, (node_update* )this);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rotate_parent(node_pointer p_nd)
+{
+ node_pointer p_parent = p_nd->m_p_parent;
+
+ if (p_nd == p_parent->m_p_left)
+ rotate_right(p_parent);
+ else
+ rotate_left(p_parent);
+
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent ||
+ p_nd->m_p_right == p_parent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+apply_update(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)
+{ }
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update_>
+inline void
+PB_DS_CLASS_C_DEC::
+apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
+{
+ node_update::operator()(
+ node_iterator(p_nd),
+ const_node_iterator(static_cast<node_pointer>(NULL)));
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update_>
+inline void
+PB_DS_CLASS_C_DEC::
+update_to_top(node_pointer p_nd, Node_Update_* p_update)
+{
+ while (p_nd != m_p_head)
+ {
+ apply_update(p_nd, p_update);
+
+ p_nd = p_nd->m_p_parent;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update_to_top(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)
+{ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..9d2bd6d74
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+bool
+PB_DS_CLASS_C_DEC::
+join_prep(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ if (other.m_size == 0)
+ return false;
+
+ if (m_size == 0)
+ {
+ value_swap(other);
+ return false;
+ }
+
+ const bool greater = Cmp_Fn::operator()(PB_DS_V2F(m_p_head->m_p_right->m_value), PB_DS_V2F(other.m_p_head->m_p_left->m_value));
+
+ const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(other.m_p_head->m_p_right->m_value), PB_DS_V2F(m_p_head->m_p_left->m_value));
+
+ if (!greater && !lesser)
+ __throw_join_error();
+
+ if (lesser)
+ value_swap(other);
+
+ m_size += other.m_size;
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+join_finish(PB_DS_CLASS_C_DEC& other)
+{
+ initialize_min_max();
+ other.initialize();
+}
+
+PB_DS_CLASS_T_DEC
+bool
+PB_DS_CLASS_C_DEC::
+split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ other.clear();
+
+ if (m_size == 0)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return false;
+ }
+
+ if (Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_left->m_value)))
+ {
+ value_swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return false;
+ }
+
+ if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_right->m_value)))
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return false;
+ }
+
+ if (m_size == 1)
+ {
+ value_swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return false;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split_finish(PB_DS_CLASS_C_DEC& other)
+{
+ other.initialize_min_max();
+ other.m_size = std::distance(other.begin(), other.end());
+ m_size -= other.m_size;
+ initialize_min_max();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+recursive_count(node_pointer p) const
+{
+ if (p == NULL)
+ return 0;
+ return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
new file mode 100644
index 000000000..58c30c3fe
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
@@ -0,0 +1,250 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file traits.hpp
+ * Contains an implementation for bin_search_tree_.
+ */
+
+#ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
+
+#include <ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Key,
+ typename Mapped,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn,
+ class Allocator>
+ class Node_Update,
+ class Node,
+ class Allocator>
+ struct bin_search_tree_traits
+ {
+ private:
+ typedef
+ types_traits<
+ Key,
+ Mapped,
+ Allocator,
+ false>
+ type_traits;
+
+ public:
+ typedef Node node;
+
+ typedef
+ bin_search_tree_const_it_<
+ typename Allocator::template rebind<
+ node>::other::pointer,
+ typename type_traits::value_type,
+ typename type_traits::pointer,
+ typename type_traits::const_pointer,
+ typename type_traits::reference,
+ typename type_traits::const_reference,
+ true,
+ Allocator>
+ const_point_iterator;
+
+ typedef
+ bin_search_tree_it_<
+ typename Allocator::template rebind<
+ node>::other::pointer,
+ typename type_traits::value_type,
+ typename type_traits::pointer,
+ typename type_traits::const_pointer,
+ typename type_traits::reference,
+ typename type_traits::const_reference,
+ true,
+ Allocator>
+ point_iterator;
+
+ typedef
+ bin_search_tree_const_it_<
+ typename Allocator::template rebind<
+ node>::other::pointer,
+ typename type_traits::value_type,
+ typename type_traits::pointer,
+ typename type_traits::const_pointer,
+ typename type_traits::reference,
+ typename type_traits::const_reference,
+ false,
+ Allocator>
+ const_reverse_iterator;
+
+ typedef
+ bin_search_tree_it_<
+ typename Allocator::template rebind<
+ node>::other::pointer,
+ typename type_traits::value_type,
+ typename type_traits::pointer,
+ typename type_traits::const_pointer,
+ typename type_traits::reference,
+ typename type_traits::const_reference,
+ false,
+ Allocator>
+ reverse_iterator;
+
+ typedef
+ bin_search_tree_const_node_it_<
+ Node,
+ const_point_iterator,
+ point_iterator,
+ Allocator>
+ const_node_iterator;
+
+ typedef
+ bin_search_tree_node_it_<
+ Node,
+ const_point_iterator,
+ point_iterator,
+ Allocator>
+ node_iterator;
+
+ typedef
+ Node_Update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>
+ node_update;
+
+ typedef
+ __gnu_pbds::null_tree_node_update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>*
+ null_node_update_pointer;
+ };
+
+ template<typename Key,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn,
+ class Allocator>
+ class Node_Update,
+ class Node,
+ class Allocator>
+ struct bin_search_tree_traits<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ Node,
+ Allocator>
+ {
+ private:
+ typedef
+ types_traits<
+ Key,
+ null_mapped_type,
+ Allocator,
+ false>
+ type_traits;
+
+ public:
+ typedef Node node;
+
+ typedef
+ bin_search_tree_const_it_<
+ typename Allocator::template rebind<
+ node>::other::pointer,
+ typename type_traits::value_type,
+ typename type_traits::pointer,
+ typename type_traits::const_pointer,
+ typename type_traits::reference,
+ typename type_traits::const_reference,
+ true,
+ Allocator>
+ const_point_iterator;
+
+ typedef const_point_iterator point_iterator;
+
+ typedef
+ bin_search_tree_const_it_<
+ typename Allocator::template rebind<
+ node>::other::pointer,
+ typename type_traits::value_type,
+ typename type_traits::pointer,
+ typename type_traits::const_pointer,
+ typename type_traits::reference,
+ typename type_traits::const_reference,
+ false,
+ Allocator>
+ const_reverse_iterator;
+
+ typedef const_reverse_iterator reverse_iterator;
+
+ typedef
+ bin_search_tree_const_node_it_<
+ Node,
+ const_point_iterator,
+ point_iterator,
+ Allocator>
+ const_node_iterator;
+
+ typedef const_node_iterator node_iterator;
+
+ typedef
+ Node_Update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>
+ node_update;
+
+ typedef
+ __gnu_pbds::null_tree_node_update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>*
+ null_node_update_pointer;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
new file mode 100644
index 000000000..576cba265
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
@@ -0,0 +1,357 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file binary_heap_.hpp
+ * Contains an implementation class for a binary heap.
+ */
+
+#ifndef PB_DS_BINARY_HEAP_HPP
+#define PB_DS_BINARY_HEAP_HPP
+
+/*
+ * Based on CLRS.
+ */
+
+#include <queue>
+#include <algorithm>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/binary_heap_/entry_cmp.hpp>
+#include <ext/pb_ds/detail/binary_heap_/entry_pred.hpp>
+#include <ext/pb_ds/detail/binary_heap_/resize_policy.hpp>
+#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/binary_heap_/const_iterator.hpp>
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+#include <iostream>
+#endif
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ binary_heap_<Value_Type, Cmp_Fn, Allocator>
+
+#define PB_DS_ENTRY_CMP_DEC \
+ entry_cmp<Value_Type, Cmp_Fn, is_simple<Value_Type>::value, Allocator>::type
+
+#define PB_DS_RESIZE_POLICY_DEC \
+ __gnu_pbds::detail::resize_policy<typename Allocator::size_type>
+
+ /**
+ * class description = "Base class for some types of h3ap$">
+ **/
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ class binary_heap_ : public PB_DS_ENTRY_CMP_DEC,
+ public PB_DS_RESIZE_POLICY_DEC
+ {
+
+ private:
+ enum
+ {
+ simple_value = is_simple<Value_Type>::value
+ };
+
+ typedef integral_constant<int, simple_value> no_throw_copies_t;
+
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other
+ value_allocator;
+
+ typedef
+ typename __conditional_type<
+ simple_value,
+ Value_Type,
+ typename value_allocator::pointer>::__type
+ entry;
+
+ typedef
+ typename Allocator::template rebind<
+ entry>::other
+ entry_allocator;
+
+ typedef typename entry_allocator::pointer entry_pointer;
+
+ typedef typename PB_DS_ENTRY_CMP_DEC entry_cmp;
+
+ typedef PB_DS_RESIZE_POLICY_DEC resize_policy;
+
+ typedef
+ cond_dealtor<
+ Value_Type,
+ Allocator>
+ cond_dealtor_t;
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::pointer
+ pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_pointer
+ const_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_reference
+ const_reference;
+
+ typedef
+ binary_heap_const_point_iterator_<
+ value_type,
+ entry,
+ simple_value,
+ Allocator>
+ const_point_iterator;
+
+ typedef const_point_iterator point_iterator;
+
+ typedef
+ binary_heap_const_iterator_<
+ value_type,
+ entry,
+ simple_value,
+ Allocator>
+ const_iterator;
+
+ typedef const_iterator iterator;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef Allocator allocator_type;
+
+ public:
+
+ binary_heap_();
+
+ binary_heap_(const Cmp_Fn& r_cmp_fn);
+
+ binary_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ ~binary_heap_();
+
+ inline bool
+ empty() const;
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ Cmp_Fn&
+ get_cmp_fn();
+
+ const Cmp_Fn&
+ get_cmp_fn() const;
+
+ inline point_iterator
+ push(const_reference r_val);
+
+ void
+ modify(point_iterator it, const_reference r_new_val);
+
+ inline const_reference
+ top() const;
+
+ inline void
+ pop();
+
+ inline void
+ erase(point_iterator it);
+
+ template<typename Pred>
+ typename PB_DS_CLASS_C_DEC::size_type
+ erase_if(Pred pred);
+
+ inline static void
+ erase_at(entry_pointer a_entries, size_type size, false_type);
+
+ inline static void
+ erase_at(entry_pointer a_entries, size_type size, true_type);
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+ void
+ clear();
+
+ template<typename Pred>
+ void
+ split(Pred pred, PB_DS_CLASS_C_DEC& other);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ protected:
+
+ template<typename It>
+ void
+ copy_from_range(It first_it, It last_it);
+
+ private:
+
+ void
+ value_swap(PB_DS_CLASS_C_DEC& other);
+
+ inline void
+ insert_value(const_reference r_val, false_type);
+
+ inline void
+ insert_value(value_type val, true_type);
+
+ inline void
+ insert_entry(entry e);
+
+ inline void
+ resize_for_insert_if_needed();
+
+ inline void
+ swap_value_imp(entry_pointer p_e, value_type new_val, true_type);
+
+ inline void
+ swap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type);
+
+ void
+ fix(entry_pointer p_e);
+
+ inline const_reference
+ top_imp(true_type) const;
+
+ inline const_reference
+ top_imp(false_type) const;
+
+ inline static size_type
+ left_child(size_type i);
+
+ inline static size_type
+ right_child(size_type i);
+
+ inline static size_type
+ parent(size_type i);
+
+ inline void
+ resize_for_erase_if_needed();
+
+ template<typename Pred>
+ size_type
+ partition(Pred pred);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+ void
+ trace_entry(const entry& r_e, false_type) const;
+
+ void
+ trace_entry(const entry& r_e, true_type) const;
+#endif
+
+ private:
+ static entry_allocator s_entry_allocator;
+
+ static value_allocator s_value_allocator;
+
+ static no_throw_copies_t s_no_throw_copies_ind;
+
+ size_type m_size;
+
+ size_type m_actual_size;
+
+ entry_pointer m_a_entries;
+ };
+
+#include <ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp>
+#include <ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_ENTRY_CMP_DEC
+#undef PB_DS_RESIZE_POLICY_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
new file mode 100644
index 000000000..9cb13f99c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_iterator.hpp
+ * Contains an iterator class returned by the table's const find and insert
+ * methods.
+ */
+
+#ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
+#define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP
+
+#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_C_DEC \
+ binary_heap_const_iterator_<Value_Type, Entry, Simple, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ binary_heap_const_point_iterator_<Value_Type, Entry, Simple, Allocator>
+
+ // Const point-type iterator.
+ template<typename Value_Type,
+ typename Entry,
+ bool Simple,
+ class Allocator>
+ class binary_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+ {
+
+ private:
+ typedef typename PB_DS_BASE_C_DEC::entry_pointer entry_pointer;
+
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+
+ // Category.
+ typedef std::forward_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef typename Allocator::difference_type difference_type;
+
+ // Iterator's value type.
+ typedef typename base_type::value_type value_type;
+
+ // Iterator's pointer type.
+ typedef typename base_type::pointer pointer;
+
+ // Iterator's const pointer type.
+ typedef typename base_type::const_pointer const_pointer;
+
+ // Iterator's reference type.
+ typedef typename base_type::reference reference;
+
+ // Iterator's const reference type.
+ typedef typename base_type::const_reference const_reference;
+
+ public:
+
+ inline
+ binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e)
+ { }
+
+ // Default constructor.
+ inline
+ binary_heap_const_iterator_()
+ { }
+
+ // Copy constructor.
+ inline
+ binary_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
+ { }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const PB_DS_CLASS_C_DEC& other) const
+ {
+ return base_type::m_p_e == other.m_p_e;
+ }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const PB_DS_CLASS_C_DEC& other) const
+ {
+ return base_type::m_p_e != other.m_p_e;
+ }
+
+ inline PB_DS_CLASS_C_DEC&
+ operator++()
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != NULL);
+ inc();
+ return *this;
+ }
+
+ inline PB_DS_CLASS_C_DEC
+ operator++(int)
+ {
+ PB_DS_CLASS_C_DEC ret_it(base_type::m_p_e);
+ operator++();
+ return ret_it;
+ }
+
+ private:
+ void
+ inc()
+ { ++base_type::m_p_e; }
+ };
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
new file mode 100644
index 000000000..d4013db16
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
@@ -0,0 +1,144 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_point_iterator.hpp
+ * Contains an iterator class returned by the table's const find and insert
+ * methods.
+ */
+
+#ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP
+#define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ // Const point-type iterator.
+ template<typename Value_Type, typename Entry, bool Simple,
+ typename Allocator>
+ class binary_heap_const_point_iterator_
+ {
+ protected:
+ typedef typename Allocator::template rebind<Entry>::other::pointer entry_pointer;
+
+ public:
+ // Category.
+ typedef trivial_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef trivial_iterator_difference_type difference_type;
+
+ // Iterator's value type.
+ typedef Value_Type value_type;
+
+ // Iterator's pointer type.
+ typedef typename Allocator::template rebind<value_type>::other::pointer
+ pointer;
+
+ // Iterator's const pointer type.
+ typedef
+ typename Allocator::template rebind<value_type>::other::const_pointer
+ const_pointer;
+
+ // Iterator's reference type.
+ typedef
+ typename Allocator::template rebind<value_type>::other::reference
+ reference;
+
+ // Iterator's const reference type.
+ typedef
+ typename Allocator::template rebind<value_type>::other::const_reference
+ const_reference;
+
+ inline
+ binary_heap_const_point_iterator_(entry_pointer p_e) : m_p_e(p_e)
+ { }
+
+ // Default constructor.
+ inline
+ binary_heap_const_point_iterator_() : m_p_e(NULL) { }
+
+ // Copy constructor.
+ inline
+ binary_heap_const_point_iterator_(const binary_heap_const_point_iterator_& other)
+ : m_p_e(other.m_p_e)
+ { }
+
+ // Access.
+ inline const_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_e != NULL);
+ return to_ptr(integral_constant<int, Simple>());
+ }
+
+ // Access.
+ inline const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_e != NULL);
+ return *to_ptr(integral_constant<int, Simple>());
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const binary_heap_const_point_iterator_& other) const
+ { return m_p_e == other.m_p_e; }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const binary_heap_const_point_iterator_& other) const
+ { return m_p_e != other.m_p_e; }
+
+ private:
+ inline const_pointer
+ to_ptr(true_type) const
+ { return m_p_e; }
+
+ inline const_pointer
+ to_ptr(false_type) const
+ { return *m_p_e; }
+
+ public:
+ entry_pointer m_p_e;
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..a77a02521
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for binary_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::entry_allocator
+PB_DS_CLASS_C_DEC::s_entry_allocator;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::value_allocator
+PB_DS_CLASS_C_DEC::s_value_allocator;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::no_throw_copies_t
+PB_DS_CLASS_C_DEC::s_no_throw_copies_ind;
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ {
+ insert_value(*first_it, s_no_throw_copies_ind);
+ ++first_it;
+ }
+
+ std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binary_heap_() :
+ m_size(0),
+ m_actual_size(resize_policy::min_size),
+ m_a_entries(s_entry_allocator.allocate(m_actual_size))
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binary_heap_(const Cmp_Fn& r_cmp_fn) :
+ entry_cmp(r_cmp_fn),
+ m_size(0),
+ m_actual_size(resize_policy::min_size),
+ m_a_entries(s_entry_allocator.allocate(m_actual_size))
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binary_heap_(const PB_DS_CLASS_C_DEC& other) :
+ entry_cmp(other),
+ resize_policy(other),
+ m_size(0),
+ m_actual_size(other.m_actual_size),
+ m_a_entries(s_entry_allocator.allocate(m_actual_size))
+{
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
+
+ const_iterator first_it = other.begin();
+ const_iterator last_it = other.end();
+
+ __try
+ {
+ while (first_it != last_it)
+ {
+ insert_value(*first_it, s_no_throw_copies_ind);
+ ++first_it;
+ }
+ }
+ __catch(...)
+ {
+ for (size_type i = 0; i < m_size; ++i)
+ erase_at(m_a_entries, i, s_no_throw_copies_ind);
+
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+ __throw_exception_again;
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);
+
+ value_swap(other);
+ std::swap((entry_cmp& )(*this), (entry_cmp& )other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+value_swap(PB_DS_CLASS_C_DEC& other)
+{
+ std::swap(m_a_entries, other.m_a_entries);
+ std::swap(m_size, other.m_size);
+ std::swap(m_actual_size, other.m_actual_size);
+ static_cast<resize_policy*>(this)->swap(other);
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~binary_heap_()
+{
+ for (size_type i = 0; i < m_size; ++i)
+ erase_at(m_a_entries, i, s_no_throw_copies_ind);
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..fcfecfd50
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+#ifdef PB_DS_REGRESSION
+ s_entry_allocator.check_allocated(m_a_entries, m_actual_size);
+#endif
+
+ resize_policy::assert_valid();
+ _GLIBCXX_DEBUG_ASSERT(m_size <= m_actual_size);
+ for (size_type i = 0; i < m_size; ++i)
+ {
+#ifdef PB_DS_REGRESSION
+ s_value_allocator.check_allocated(m_a_entries[i], 1);
+#endif
+
+ if (left_child(i) < m_size)
+ _GLIBCXX_DEBUG_ASSERT(!entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child(i)]));
+
+ _GLIBCXX_DEBUG_ASSERT(parent(left_child(i)) == i);
+
+ if (right_child(i) < m_size)
+ _GLIBCXX_DEBUG_ASSERT(!entry_cmp::operator()(m_a_entries[i], m_a_entries[right_child(i)]));
+
+ _GLIBCXX_DEBUG_ASSERT(parent(right_child(i)) == i);
+ }
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
new file mode 100644
index 000000000..b0a9b5b0d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file entry_cmp.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+#ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP
+#define PB_DS_BINARY_HEAP_ENTRY_CMP_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Value_Type,
+ class Cmp_Fn,
+ bool No_Throw,
+ class Allocator>
+ struct entry_cmp
+ {
+ typedef Cmp_Fn type;
+ };
+
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ struct entry_cmp<
+ Value_Type,
+ Cmp_Fn,
+ false,
+ Allocator>
+ {
+ public:
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other::const_pointer
+ entry;
+
+ struct type : public Cmp_Fn
+ {
+ public:
+ inline
+ type()
+ { }
+
+ inline
+ type(const Cmp_Fn& other) : Cmp_Fn(other)
+ { }
+
+ inline bool
+ operator()(entry p_lhs, entry p_rhs) const
+ {
+ return Cmp_Fn::operator()(*p_lhs, * p_rhs);
+ }
+ };
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
new file mode 100644
index 000000000..185529e15
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file entry_pred.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+#ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP
+#define PB_DS_BINARY_HEAP_ENTRY_PRED_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Value_Type,
+ class Pred,
+ bool No_Throw,
+ class Allocator>
+ struct entry_pred
+ {
+ typedef Pred type;
+ };
+
+ template<typename Value_Type, class Pred, class Allocator>
+ struct entry_pred<
+ Value_Type,
+ Pred,
+ false,
+ Allocator>
+ {
+ public:
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other::const_pointer
+ entry;
+
+ struct type : public Pred
+ {
+ public:
+ inline
+ type()
+ { }
+
+ inline
+ type(const Pred& other) : Pred(other)
+ { }
+
+ inline bool
+ operator()(entry p_v) const
+ {
+ return Pred::operator()(*p_v);
+ }
+ };
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
new file mode 100644
index 000000000..30f3a4854
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
@@ -0,0 +1,246 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ for (size_type i = 0; i < m_size; ++i)
+ erase_at(m_a_entries, i, s_no_throw_copies_ind);
+
+ __try
+ {
+ const size_type actual_size = resize_policy::get_new_size_for_arbitrary(0);
+
+ entry_pointer a_entries = s_entry_allocator.allocate(actual_size);
+
+ resize_policy::notify_arbitrary(actual_size);
+
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+
+ m_actual_size = actual_size;
+
+ m_a_entries = a_entries;
+ }
+ __catch(...)
+ { }
+
+ m_size = 0;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_at(entry_pointer a_entries, size_type i, false_type)
+{
+ a_entries[i]->~value_type();
+
+ s_value_allocator.deallocate(a_entries[i], 1);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_at(entry_pointer, size_type, true_type)
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+pop()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!empty());
+
+ erase_at(m_a_entries, 0, s_no_throw_copies_ind);
+
+ std::pop_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+
+ resize_for_erase_if_needed();
+
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ typedef
+ typename entry_pred<
+ value_type,
+ Pred,
+ simple_value,
+ Allocator>::type
+ pred_t;
+
+ const size_type left = partition(pred_t(pred));
+
+ _GLIBCXX_DEBUG_ASSERT(m_size >= left);
+
+ const size_type ersd = m_size - left;
+
+ for (size_type i = left; i < m_size; ++i)
+ erase_at(m_a_entries, i, s_no_throw_copies_ind);
+
+ __try
+ {
+ const size_type actual_size =
+ resize_policy::get_new_size_for_arbitrary(left);
+
+ entry_pointer a_entries = s_entry_allocator.allocate(actual_size);
+
+ std::copy(m_a_entries, m_a_entries + left, a_entries);
+
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+
+ m_actual_size = actual_size;
+
+ resize_policy::notify_arbitrary(m_actual_size);
+ }
+ __catch(...)
+ { };
+
+ m_size = left;
+
+ std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return ersd;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+erase(point_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!empty());
+
+ const size_type fix_pos = it.m_p_e - m_a_entries;
+
+ std::swap(*it.m_p_e, m_a_entries[m_size - 1]);
+
+ erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
+
+ resize_for_erase_if_needed();
+
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+
+ _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);
+
+ if (fix_pos != m_size)
+ fix(m_a_entries + fix_pos);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+resize_for_erase_if_needed()
+{
+ if (!resize_policy::resize_needed_for_shrink(m_size))
+ return;
+
+ __try
+ {
+ const size_type new_actual_size =
+ resize_policy::get_new_size_for_shrink();
+
+ entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);
+
+ resize_policy::notify_shrink_resize();
+
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ std::copy(m_a_entries, m_a_entries + m_size - 1, a_new_entries);
+
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+
+ m_actual_size = new_actual_size;
+
+ m_a_entries = a_new_entries;
+ }
+ __catch(...)
+ { }
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+partition(Pred pred)
+{
+ size_type left = 0;
+ size_type right = m_size - 1;
+
+ while (right + 1 != left)
+ {
+ _GLIBCXX_DEBUG_ASSERT(left <= m_size);
+
+ if (!pred(m_a_entries[left]))
+ ++left;
+ else if (pred(m_a_entries[right]))
+ --right;
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(left < right);
+
+ std::swap(m_a_entries[left], m_a_entries[right]);
+
+ ++left;
+ --right;
+ }
+ }
+
+ return left;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
new file mode 100644
index 000000000..28d4a8c80
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reference
+PB_DS_CLASS_C_DEC::
+top() const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!empty());
+
+ return top_imp(s_no_throw_copies_ind);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reference
+PB_DS_CLASS_C_DEC::
+top_imp(true_type) const
+{
+ return* m_a_entries;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reference
+PB_DS_CLASS_C_DEC::
+top_imp(false_type) const
+{
+ return** m_a_entries;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+left_child(size_type i)
+{
+ return i* 2 + 1;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+right_child(size_type i)
+{
+ return i* 2 + 2;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+parent(size_type i)
+{
+ return (i - 1) / 2;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
new file mode 100644
index 000000000..d29279318
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{
+ return (m_size == 0);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{
+ return (m_size);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{
+ return (s_entry_allocator.max_size());
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
new file mode 100644
index 000000000..f13a3cb19
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
@@ -0,0 +1,183 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+push(const_reference r_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ insert_value(r_val, s_no_throw_copies_ind);
+ std::push_heap(m_a_entries, m_a_entries + m_size,
+ static_cast<entry_cmp&>(*this));
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return point_iterator(m_a_entries);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+insert_value(value_type val, true_type)
+{
+ resize_for_insert_if_needed();
+
+ m_a_entries[m_size++] = val;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+insert_value(const_reference r_val, false_type)
+{
+ resize_for_insert_if_needed();
+ pointer p_new = s_value_allocator.allocate(1);
+ cond_dealtor_t cond(p_new);
+ new (p_new) value_type(r_val);
+ cond.set_no_action();
+ m_a_entries[m_size++] = p_new;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+insert_entry(entry e)
+{
+ resize_for_insert_if_needed();
+ m_a_entries[m_size++] = e;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+resize_for_insert_if_needed()
+{
+ if (!resize_policy::resize_needed_for_grow(m_size))
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_size < m_actual_size);
+ return;
+ }
+
+ const size_type new_actual_size = resize_policy::get_new_size_for_grow();
+ entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);
+ resize_policy::notify_grow_resize();
+ std::copy(m_a_entries, m_a_entries + m_size, a_new_entries);
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+ m_actual_size = new_actual_size;
+ m_a_entries = a_new_entries;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+modify(point_iterator it, const_reference r_new_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ swap_value_imp(it.m_p_e, r_new_val, s_no_throw_copies_ind);
+ fix(it.m_p_e);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+fix(entry_pointer p_e)
+{
+ size_type i = p_e - m_a_entries;
+ if (i > 0 && entry_cmp::operator()(m_a_entries[parent(i)], m_a_entries[i]))
+ {
+ size_type parent_i = parent(i);
+ while (i > 0
+ && entry_cmp::operator()(m_a_entries[parent_i], m_a_entries[i]))
+ {
+ std::swap(m_a_entries[i], m_a_entries[parent_i]);
+ i = parent_i;
+ parent_i = parent(i);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return;
+ }
+
+ while (i < m_size)
+ {
+ const size_type left_child_i = left_child(i);
+ const size_type right_child_i = right_child(i);
+ _GLIBCXX_DEBUG_ASSERT(right_child_i > left_child_i);
+ const bool smaller_than_left_child = left_child_i < m_size &&
+ entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child_i]);
+
+ const bool smaller_than_right_child = right_child_i < m_size &&
+ entry_cmp::operator()(m_a_entries[i], m_a_entries[right_child_i]);
+
+ const bool swap_with_r_child = smaller_than_right_child && (!smaller_than_left_child || entry_cmp::operator()(m_a_entries[left_child_i], m_a_entries[right_child_i]));
+
+ const bool swap_with_l_child = !swap_with_r_child && smaller_than_left_child;
+
+ if (swap_with_l_child)
+ {
+ std::swap(m_a_entries[i], m_a_entries[left_child_i]);
+ i = left_child_i;
+ }
+ else if (swap_with_r_child)
+ {
+ std::swap(m_a_entries[i], m_a_entries[right_child_i]);
+ i = right_child_i;
+ }
+ else
+ i = m_size;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+swap_value_imp(entry_pointer p_e, value_type new_val, true_type)
+{
+ * p_e = new_val;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+swap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type)
+{
+ value_type tmp(r_new_val);
+ (*p_e)->swap(tmp);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..db0a64ea8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{
+ return (iterator(m_a_entries));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{
+ return (const_iterator(m_a_entries));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{
+ return (iterator(m_a_entries + m_size));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{
+ return (const_iterator(m_a_entries + m_size));
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..11a7b8915
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn()
+{
+ return (*this);
+}
+
+PB_DS_CLASS_T_DEC
+const Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn() const
+{
+ return (*this);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
new file mode 100644
index 000000000..588fb3d1d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
@@ -0,0 +1,253 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_policy.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+#ifndef PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP
+#define PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+
+#define PB_DS_CLASS_C_DEC resize_policy<Size_Type>
+
+ template<typename Size_Type>
+ class resize_policy
+ {
+ public:
+ typedef Size_Type size_type;
+
+ enum
+ {
+ min_size = 16
+ };
+
+ public:
+ inline
+ resize_policy();
+
+ inline void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ inline bool
+ resize_needed_for_grow(size_type size) const;
+
+ inline bool
+ resize_needed_for_shrink(size_type size) const;
+
+ inline bool
+ grow_needed(size_type size) const;
+
+ inline bool
+ shrink_needed(size_type size) const;
+
+ inline size_type
+ get_new_size_for_grow() const;
+
+ inline size_type
+ get_new_size_for_shrink() const;
+
+ size_type
+ get_new_size_for_arbitrary(size_type size) const;
+
+ inline void
+ notify_grow_resize();
+
+ inline void
+ notify_shrink_resize();
+
+ void
+ notify_arbitrary(size_type actual_size);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ private:
+ enum
+ {
+ ratio = 8,
+ factor = 2
+ };
+
+ private:
+ size_type m_next_shrink_size;
+ size_type m_next_grow_size;
+ };
+
+ PB_DS_CLASS_T_DEC
+ inline
+ PB_DS_CLASS_C_DEC::
+ resize_policy() :
+ m_next_shrink_size(0),
+ m_next_grow_size(min_size)
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ std::swap(m_next_shrink_size, other.m_next_shrink_size);
+ std::swap(m_next_grow_size, other.m_next_grow_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline bool
+ PB_DS_CLASS_C_DEC::
+ resize_needed_for_grow(size_type size) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);
+ return size == m_next_grow_size;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline bool
+ PB_DS_CLASS_C_DEC::
+ resize_needed_for_shrink(size_type size) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);
+ return size == m_next_shrink_size;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_new_size_for_grow() const
+ { return m_next_grow_size* factor; }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_new_size_for_shrink() const
+ {
+ const size_type half_size = m_next_grow_size / factor;
+ return std::max(static_cast<size_type>(min_size), half_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_new_size_for_arbitrary(size_type size) const
+ {
+ size_type ret = min_size;
+ while (ret < size)
+ ret *= factor;
+ return ret;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ notify_grow_resize()
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= min_size);
+ m_next_grow_size *= factor;
+ m_next_shrink_size = m_next_grow_size / ratio;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ notify_shrink_resize()
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ m_next_shrink_size /= factor;
+ if (m_next_shrink_size == 1)
+ m_next_shrink_size = 0;
+
+ m_next_grow_size =
+ std::max(m_next_grow_size / factor, static_cast<size_type>(min_size));
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ notify_arbitrary(size_type actual_size)
+ {
+ m_next_grow_size = actual_size;
+ m_next_shrink_size = m_next_grow_size / ratio;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ assert_valid() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_next_shrink_size == 0 ||
+ m_next_shrink_size* ratio == m_next_grow_size);
+
+ _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= min_size);
+ }
+#endif
+
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ trace() const
+ {
+ std::cerr << "shrink = " << m_next_shrink_size <<
+ " grow = " << m_next_grow_size << std::endl;
+ }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..04b7d548f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+void
+PB_DS_CLASS_C_DEC::
+split(Pred pred, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ typedef
+ typename entry_pred<
+ value_type,
+ Pred,
+ simple_value,
+ Allocator>::type
+ pred_t;
+
+ const size_type left = partition(pred_t(pred));
+
+ _GLIBCXX_DEBUG_ASSERT(m_size >= left);
+
+ const size_type ersd = m_size - left;
+
+ _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);
+
+ const size_type actual_size =
+ resize_policy::get_new_size_for_arbitrary(left);
+
+ const size_type other_actual_size =
+ other.get_new_size_for_arbitrary(ersd);
+
+ entry_pointer a_entries = NULL;
+ entry_pointer a_other_entries = NULL;
+
+ __try
+ {
+ a_entries = s_entry_allocator.allocate(actual_size);
+
+ a_other_entries = s_entry_allocator.allocate(other_actual_size);
+ }
+ __catch(...)
+ {
+ if (a_entries != NULL)
+ s_entry_allocator.deallocate(a_entries, actual_size);
+
+ if (a_other_entries != NULL)
+ s_entry_allocator.deallocate(a_other_entries, other_actual_size);
+
+ __throw_exception_again;
+ };
+
+ for (size_type i = 0; i < other.m_size; ++i)
+ erase_at(other.m_a_entries, i, s_no_throw_copies_ind);
+
+ _GLIBCXX_DEBUG_ASSERT(actual_size >= left);
+ std::copy(m_a_entries, m_a_entries + left, a_entries);
+ std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);
+
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+ s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
+
+ m_actual_size = actual_size;
+ other.m_actual_size = other_actual_size;
+
+ m_size = left;
+ other.m_size = ersd;
+
+ m_a_entries = a_entries;
+ other.m_a_entries = a_other_entries;
+
+ std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+ std::make_heap(other.m_a_entries, other.m_a_entries + other.m_size, static_cast<entry_cmp& >(other));
+
+ resize_policy::notify_arbitrary(m_actual_size);
+ other.notify_arbitrary(other.m_actual_size);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ const size_type len = m_size + other.m_size;
+ const size_type actual_size = resize_policy::get_new_size_for_arbitrary(len);
+
+ entry_pointer a_entries = NULL;
+ entry_pointer a_other_entries = NULL;
+
+ __try
+ {
+ a_entries = s_entry_allocator.allocate(actual_size);
+ a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
+ }
+ __catch(...)
+ {
+ if (a_entries != NULL)
+ s_entry_allocator.deallocate(a_entries, actual_size);
+
+ if (a_other_entries != NULL)
+ s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
+
+ __throw_exception_again;
+ }
+
+ std::copy(m_a_entries, m_a_entries + m_size, a_entries);
+ std::copy(other.m_a_entries, other.m_a_entries + other.m_size, a_entries + m_size);
+
+ s_entry_allocator.deallocate(m_a_entries, m_actual_size);
+ m_a_entries = a_entries;
+ m_size = len;
+ m_actual_size = actual_size;
+
+ resize_policy::notify_arbitrary(actual_size);
+
+ std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));
+
+ s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
+ other.m_a_entries = a_other_entries;
+ other.m_size = 0;
+ other.m_actual_size = resize_policy::min_size;
+
+ other.notify_arbitrary(resize_policy::min_size);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
new file mode 100644
index 000000000..36bd66f75
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains an implementation class for a binary_heap.
+ */
+
+#ifdef PB_DS_BINARY_HEAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << this << std::endl;
+
+ std::cerr << m_a_entries << std::endl;
+
+ for (size_type i = 0; i < m_size; ++i)
+ trace_entry(m_a_entries[i], s_no_throw_copies_ind);
+
+ std::cerr << std::endl;
+
+ std::cerr << "size = " << m_size << " " << "actual_size = " << m_actual_size << std::endl;
+
+ resize_policy::trace();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_entry(const entry& r_e, false_type) const
+{
+ std::cout << r_e << " " <<* r_e << std::endl;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_entry(const entry& r_e, true_type) const
+{
+ std::cout << r_e << std::endl;
+}
+
+#endif // #ifdef PB_DS_BINARY_HEAP_TRACE_
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
new file mode 100644
index 000000000..3b4d6e91e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file binomial_heap_.hpp
+ * Contains an implementation class for a binomial heap.
+ */
+
+/*
+ * Binomial heap.
+ * Vuillemin J is the mastah.
+ * Modified from CLRS.
+ */
+
+#include <debug/debug.h>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ binomial_heap_<Value_Type, Cmp_Fn, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+
+ /**
+ * class description = "8y|\|0|\/|i41 h34p 74813">
+ **/
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ class binomial_heap_ : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+ typedef typename base_type::node_pointer node_pointer;
+ typedef typename base_type::const_node_pointer const_node_pointer;
+
+ public:
+ typedef Value_Type value_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::const_point_iterator const_point_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::cmp_fn cmp_fn;
+ typedef typename base_type::allocator_type allocator_type;
+
+ binomial_heap_();
+
+ binomial_heap_(const Cmp_Fn& r_cmp_fn);
+
+ binomial_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ ~binomial_heap_();
+
+ protected:
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+ };
+
+#include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+
+#undef PB_DS_CLASS_T_DEC
+
+#undef PB_DS_BASE_C_DEC
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..ef0937e42
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation for binomial_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binomial_heap_()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binomial_heap_(const Cmp_Fn& r_cmp_fn) :
+ PB_DS_BASE_C_DEC(r_cmp_fn)
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binomial_heap_(const PB_DS_CLASS_C_DEC& other) :
+ PB_DS_BASE_C_DEC(other)
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~binomial_heap_() { }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..10bec6959
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation for binomial_heap_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{ base_type::assert_valid(true); }
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
new file mode 100644
index 000000000..1d66d1b14
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
@@ -0,0 +1,234 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file binomial_heap_base_.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+#ifndef PB_DS_BINOMIAL_HEAP_BASE_HPP
+#define PB_DS_BINOMIAL_HEAP_BASE_HPP
+
+/*
+ * Binomial heap base.
+ * Vuillemin J is the mastah.
+ * Modified from CLRS.
+ */
+
+#include <debug/debug.h>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
+ typename Allocator::size_type, \
+ Allocator, false>
+#else
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
+ typename Allocator::size_type, Allocator>
+#endif
+
+ /**
+ * class description = "8y|\|0|\/|i41 h34p 74813">
+ **/
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ class binomial_heap_base_ : public PB_DS_BASE_C_DEC
+ {
+
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ protected:
+ typedef typename base_type::node node;
+
+ typedef typename base_type::node_pointer node_pointer;
+
+ typedef typename base_type::const_node_pointer const_node_pointer;
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::pointer
+ pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_pointer
+ const_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_reference
+ const_reference;
+
+ typedef
+ typename PB_DS_BASE_C_DEC::const_point_iterator
+ const_point_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::iterator iterator;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef Allocator allocator_type;
+
+ public:
+
+ inline point_iterator
+ push(const_reference r_val);
+
+ void
+ modify(point_iterator it, const_reference r_new_val);
+
+ inline const_reference
+ top() const;
+
+ void
+ pop();
+
+ void
+ erase(point_iterator it);
+
+ inline void
+ clear();
+
+ template<typename Pred>
+ size_type
+ erase_if(Pred pred);
+
+ template<typename Pred>
+ void
+ split(Pred pred, PB_DS_CLASS_C_DEC& other);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+
+ binomial_heap_base_();
+
+ binomial_heap_base_(const Cmp_Fn& r_cmp_fn);
+
+ binomial_heap_base_(const PB_DS_CLASS_C_DEC& other);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ ~binomial_heap_base_();
+
+ template<typename It>
+ void
+ copy_from_range(It first_it, It last_it);
+
+ inline void
+ find_max();
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid(bool strictly_binomial) const;
+
+ void
+ assert_max() const;
+#endif
+
+ private:
+
+ inline node_pointer
+ fix(node_pointer p_nd) const;
+
+ inline void
+ insert_node(node_pointer p_nd);
+
+ inline void
+ remove_parentless_node(node_pointer p_nd);
+
+ inline node_pointer
+ join(node_pointer p_lhs, node_pointer p_rhs) const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_node_consistent(const_node_pointer, bool, bool) const;
+#endif
+
+ protected:
+ node_pointer m_p_max;
+ };
+
+#include <ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_BASE_C_DEC
+
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..274c93378
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ push(*(first_it++));
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binomial_heap_base_() :
+ m_p_max(NULL)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binomial_heap_base_(const Cmp_Fn& r_cmp_fn) :
+ PB_DS_BASE_C_DEC(r_cmp_fn),
+ m_p_max(NULL)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+binomial_heap_base_(const PB_DS_CLASS_C_DEC& other) :
+ PB_DS_BASE_C_DEC(other),
+ m_p_max(NULL)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+
+ base_type::swap(other);
+
+ std::swap(m_p_max, other.m_p_max);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~binomial_heap_base_()
+{ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
new file mode 100644
index 000000000..9a07f0e7d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid(bool strictly_binomial) const
+{
+ base_type::assert_valid();
+ assert_node_consistent(base_type::m_p_root, strictly_binomial, true);
+ assert_max();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_max() const
+{
+ if (m_p_max == NULL)
+ return;
+ _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);
+ for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value,
+ it.m_p_nd->m_value));
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_node_consistent(const_node_pointer p_nd, bool strictly_binomial,
+ bool increasing) const
+{
+ _GLIBCXX_DEBUG_ASSERT(increasing || strictly_binomial);
+ base_type::assert_node_consistent(p_nd, false);
+ if (p_nd == NULL)
+ return;
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == base_type::degree(p_nd));
+ _GLIBCXX_DEBUG_ASSERT(base_type::size_under_node(p_nd) ==
+ static_cast<size_type>(1 << p_nd->m_metadata));
+ assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing);
+ assert_node_consistent(p_nd->m_p_l_child, true, false);
+ if (p_nd->m_p_next_sibling != NULL)
+ {
+ if (increasing)
+ {
+ if (strictly_binomial)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata
+ < p_nd->m_p_next_sibling->m_metadata);
+ else
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata
+ <= p_nd->m_p_next_sibling->m_metadata);
+ }
+ else
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata
+ > p_nd->m_p_next_sibling->m_metadata);
+ }
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
new file mode 100644
index 000000000..a4cf90c20
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+pop()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ if (m_p_max == NULL)
+ find_max();
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+
+ node_pointer p_nd = m_p_max;
+
+ remove_parentless_node(m_p_max);
+
+ base_type::actual_erase_node(p_nd);
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+remove_parentless_node(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == NULL);
+
+ node_pointer p_cur_root = p_nd == base_type::m_p_root?
+ p_nd->m_p_next_sibling :
+ base_type::m_p_root;
+
+ if (p_cur_root != NULL)
+ p_cur_root->m_p_prev_or_parent = NULL;
+
+ if (p_nd->m_p_prev_or_parent != NULL)
+ p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
+
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+
+ node_pointer p_child = p_nd->m_p_l_child;
+
+ if (p_child != NULL)
+ {
+ p_child->m_p_prev_or_parent = NULL;
+
+ while (p_child->m_p_next_sibling != NULL)
+ p_child = p_child->m_p_next_sibling;
+ }
+
+ m_p_max = NULL;
+
+ base_type::m_p_root = join(p_cur_root, p_child);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ base_type::clear();
+
+ m_p_max = NULL;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase(point_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ base_type::bubble_to_top(it.m_p_nd);
+
+ remove_parentless_node(it.m_p_nd);
+
+ base_type::actual_erase_node(it.m_p_nd);
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ }
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+ if (base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+ return 0;
+ }
+
+ base_type::to_linked_list();
+
+ node_pointer p_out = base_type::prune(pred);
+
+ size_type ersd = 0;
+
+ while (p_out != NULL)
+ {
+ ++ersd;
+
+ node_pointer p_next = p_out->m_p_next_sibling;
+
+ base_type::actual_erase_node(p_out);
+
+ p_out = p_next;
+ }
+
+ node_pointer p_cur = base_type::m_p_root;
+
+ base_type::m_p_root = NULL;
+
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+
+ p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = NULL;
+
+ p_cur->m_metadata = 0;
+
+ p_cur->m_p_next_sibling = base_type::m_p_root;
+
+ if (base_type::m_p_root != NULL)
+ base_type::m_p_root->m_p_prev_or_parent = p_cur;
+
+ base_type::m_p_root = p_cur;
+
+ base_type::m_p_root = fix(base_type::m_p_root);
+
+ p_cur = p_next;
+ }
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+ return ersd;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
new file mode 100644
index 000000000..ad7f65129
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reference
+PB_DS_CLASS_C_DEC::
+top() const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(false);)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ if (m_p_max == NULL)
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max();
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+ return m_p_max->m_value;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+find_max()
+{
+ node_pointer p_cur = base_type::m_p_root;
+
+ m_p_max = p_cur;
+
+ while (p_cur != NULL)
+ {
+ if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value))
+ m_p_max = p_cur;
+
+ p_cur = p_cur->m_p_next_sibling;
+ }
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
new file mode 100644
index 000000000..e67d0df14
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
@@ -0,0 +1,216 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+push(const_reference r_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+ node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
+
+ insert_node(p_nd);
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+ return point_iterator(p_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+insert_node(node_pointer p_nd)
+{
+ if (base_type::m_p_root == NULL)
+ {
+ p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent =
+ p_nd->m_p_l_child = NULL;
+
+ p_nd->m_metadata = 0;
+
+ base_type::m_p_root = p_nd;
+
+ return;
+ }
+
+ if (base_type::m_p_root->m_metadata > 0)
+ {
+ p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL;
+
+ p_nd->m_p_next_sibling = base_type::m_p_root;
+
+ base_type::m_p_root->m_p_prev_or_parent = p_nd;
+
+ base_type::m_p_root = p_nd;
+
+ p_nd->m_metadata = 0;
+
+ return;
+ }
+
+ if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
+ {
+ p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling;
+
+ p_nd->m_p_prev_or_parent = NULL;
+
+ p_nd->m_metadata = 1;
+
+ p_nd->m_p_l_child = base_type::m_p_root;
+
+ base_type::m_p_root->m_p_prev_or_parent = p_nd;
+
+ base_type::m_p_root->m_p_next_sibling = NULL;
+
+ base_type::m_p_root = p_nd;
+ }
+ else
+ {
+ p_nd->m_p_next_sibling = NULL;
+
+ p_nd->m_p_l_child = NULL;
+
+ p_nd->m_p_prev_or_parent = base_type::m_p_root;
+
+ p_nd->m_metadata = 0;
+
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root->m_p_l_child == 0);
+ base_type::m_p_root->m_p_l_child = p_nd;
+
+ base_type::m_p_root->m_metadata = 1;
+ }
+
+ base_type::m_p_root = fix(base_type::m_p_root);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+fix(node_pointer p_nd) const
+{
+ while (p_nd->m_p_next_sibling != NULL&&
+ p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata)
+ {
+ node_pointer p_next = p_nd->m_p_next_sibling;
+
+ if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
+ {
+ p_next->m_p_prev_or_parent =
+ p_nd->m_p_prev_or_parent;
+
+ if (p_nd->m_p_prev_or_parent != NULL)
+ p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next;
+
+ base_type::make_child_of(p_nd, p_next);
+
+ ++p_next->m_metadata;
+
+ p_nd = p_next;
+ }
+ else
+ {
+ p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
+
+ if (p_nd->m_p_next_sibling != NULL)
+ p_next->m_p_next_sibling = NULL;
+
+ base_type::make_child_of(p_next, p_nd);
+
+ ++p_nd->m_metadata;
+ }
+ }
+
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
+
+ return p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+modify(point_iterator it, const_reference r_new_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ node_pointer p_nd = it.m_p_nd;
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false);)
+
+ const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val);
+
+ p_nd->m_value = r_new_val;
+
+ if (bubble_up)
+ {
+ node_pointer p_parent = base_type::parent(p_nd);
+
+ while (p_parent != NULL&&
+ Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value))
+ {
+ base_type::swap_with_parent(p_nd, p_parent);
+
+ p_parent = base_type::parent(p_nd);
+ }
+
+ if (p_nd->m_p_prev_or_parent == NULL)
+ base_type::m_p_root = p_nd;
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+
+ return;
+ }
+
+ base_type::bubble_to_top(p_nd);
+
+ remove_parentless_node(p_nd);
+
+ insert_node(p_nd);
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..a701937cb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
@@ -0,0 +1,232 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation class for a base of binomial heaps.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+void
+PB_DS_CLASS_C_DEC::
+split(Pred pred, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
+
+ other.clear();
+
+ if (base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
+
+ return;
+ }
+
+ base_type::to_linked_list();
+
+ node_pointer p_out = base_type::prune(pred);
+
+ while (p_out != NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
+ --base_type::m_size;
+
+ ++other.m_size;
+
+ node_pointer p_next = p_out->m_p_next_sibling;
+
+ p_out->m_p_l_child = p_out->m_p_prev_or_parent = NULL;
+
+ p_out->m_metadata = 0;
+
+ p_out->m_p_next_sibling = other.m_p_root;
+
+ if (other.m_p_root != NULL)
+ other.m_p_root->m_p_prev_or_parent = p_out;
+
+ other.m_p_root = p_out;
+
+ other.m_p_root = other.fix(other.m_p_root);
+
+ p_out = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
+
+ node_pointer p_cur = base_type::m_p_root;
+
+ base_type::m_p_root = NULL;
+
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+
+ p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = NULL;
+
+ p_cur->m_metadata = 0;
+
+ p_cur->m_p_next_sibling = base_type::m_p_root;
+
+ if (base_type::m_p_root != NULL)
+ base_type::m_p_root->m_p_prev_or_parent = p_cur;
+
+ base_type::m_p_root = p_cur;
+
+ base_type::m_p_root = fix(base_type::m_p_root);
+
+ p_cur = p_next;
+ }
+
+ m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
+
+ node_pointer p_other = other.m_p_root;
+
+ if (p_other != NULL)
+ do
+ {
+ node_pointer p_next = p_other->m_p_next_sibling;
+
+ std::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent);
+
+ p_other = p_next;
+ }
+ while (p_other != NULL);
+
+ base_type::m_p_root = join(base_type::m_p_root, other.m_p_root);
+ base_type::m_size += other.m_size;
+ m_p_max = NULL;
+
+ other.m_p_root = NULL;
+ other.m_size = 0;
+ other.m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true);)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+join(node_pointer p_lhs, node_pointer p_rhs) const
+{
+ node_pointer p_ret = NULL;
+
+ node_pointer p_cur = NULL;
+
+ while (p_lhs != NULL || p_rhs != NULL)
+ {
+ if (p_rhs == NULL)
+ {
+ if (p_cur == NULL)
+ p_ret = p_cur = p_lhs;
+ else
+ {
+ p_cur->m_p_next_sibling = p_lhs;
+
+ p_lhs->m_p_prev_or_parent = p_cur;
+ }
+
+ p_cur = p_lhs = NULL;
+ }
+ else if (p_lhs == NULL || p_rhs->m_metadata < p_lhs->m_metadata)
+ {
+ if (p_cur == NULL)
+ {
+ p_ret = p_cur = p_rhs;
+
+ p_rhs = p_rhs->m_p_prev_or_parent;
+ }
+ else
+ {
+ p_cur->m_p_next_sibling = p_rhs;
+
+ p_rhs = p_rhs->m_p_prev_or_parent;
+
+ p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur;
+
+ p_cur = p_cur->m_p_next_sibling;
+ }
+ }
+ else if (p_lhs->m_metadata < p_rhs->m_metadata)
+ {
+ if (p_cur == NULL)
+ p_ret = p_cur = p_lhs;
+ else
+ {
+ p_cur->m_p_next_sibling = p_lhs;
+
+ p_lhs->m_p_prev_or_parent = p_cur;
+
+ p_cur = p_cur->m_p_next_sibling;
+ }
+
+ p_lhs = p_cur->m_p_next_sibling;
+ }
+ else
+ {
+ node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent;
+
+ p_rhs->m_p_next_sibling = p_lhs;
+
+ p_lhs = fix(p_rhs);
+
+ p_rhs = p_next_rhs;
+ }
+ }
+
+ if (p_cur != NULL)
+ p_cur->m_p_next_sibling = NULL;
+
+ if (p_ret != NULL)
+ p_ret->m_p_prev_or_parent = NULL;
+
+ return p_ret;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
new file mode 100644
index 000000000..f5efabe08
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
@@ -0,0 +1,636 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cc_ht_map_.hpp
+ * Contains an implementation class for cc_ht_map_.
+ */
+
+#include <utility>
+#include <iterator>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
+#ifdef PB_DS_HT_MAP_TRACE_
+#include <iostream>
+#endif
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Hash_Fn, \
+ typename Eq_Fn, typename Allocator, bool Store_Hash, \
+ typename Comb_Hash_Fn, typename Resize_Policy>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME cc_ht_map_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME cc_ht_map_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator, \
+ Store_Hash, Comb_Hash_Fn, Resize_Policy>
+
+#define PB_DS_HASH_EQ_FN_C_DEC \
+ hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
+
+#define PB_DS_RANGED_HASH_FN_C_DEC \
+ ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, Store_Hash>
+
+#define PB_DS_TYPES_TRAITS_C_DEC \
+ types_traits<Key, Mapped, Allocator, Store_Hash>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#endif
+
+ // <011i$i0|\|-<|-|4i|\|i|\|g |-|4$|-| 74813.
+ template<typename Key,
+ typename Mapped,
+ typename Hash_Fn,
+ typename Eq_Fn,
+ typename Allocator,
+ bool Store_Hash,
+ typename Comb_Hash_Fn,
+ typename Resize_Policy >
+ class PB_DS_CLASS_NAME:
+#ifdef _GLIBCXX_DEBUG
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
+#endif
+ public PB_DS_HASH_EQ_FN_C_DEC,
+ public Resize_Policy,
+ public PB_DS_RANGED_HASH_FN_C_DEC,
+ public PB_DS_TYPES_TRAITS_C_DEC
+ {
+ private:
+ typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+ typedef typename traits_base::comp_hash comp_hash;
+ typedef typename traits_base::value_type value_type_;
+ typedef typename traits_base::pointer pointer_;
+ typedef typename traits_base::const_pointer const_pointer_;
+ typedef typename traits_base::reference reference_;
+ typedef typename traits_base::const_reference const_reference_;
+
+ struct entry : public traits_base::stored_value_type
+ {
+ typename Allocator::template rebind<entry>::other::pointer m_p_next;
+ };
+
+ typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
+
+ typedef typename Allocator::template rebind<entry>::other entry_allocator;
+ typedef typename entry_allocator::pointer entry_pointer;
+ typedef typename entry_allocator::const_pointer const_entry_pointer;
+ typedef typename entry_allocator::reference entry_reference;
+ typedef typename entry_allocator::const_reference const_entry_reference;
+
+ typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;
+ typedef typename entry_pointer_allocator::pointer entry_pointer_array;
+
+ typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base;
+ typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
+ typedef Resize_Policy resize_base;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+#define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type>
+
+#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
+
+#undef PB_DS_GEN_POS
+
+ public:
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef Hash_Fn hash_fn;
+ typedef Eq_Fn eq_fn;
+ typedef Comb_Hash_Fn comb_hash_fn;
+ typedef Resize_Policy resize_policy;
+
+ enum
+ {
+ store_hash = Store_Hash
+ };
+
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef point_iterator_ point_iterator;
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+ typedef const_point_iterator_ point_iterator;
+#endif
+
+ typedef const_point_iterator_ const_point_iterator;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef iterator_ iterator;
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+ typedef const_iterator_ iterator;
+#endif
+
+ typedef const_iterator_ const_iterator;
+
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const Hash_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&,
+ const Resize_Policy&);
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ virtual
+ ~PB_DS_CLASS_NAME();
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ template<typename It>
+ void
+ copy_from_range(It, It);
+
+ void
+ initialize();
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ inline bool
+ empty() const;
+
+ Hash_Fn&
+ get_hash_fn();
+
+ const Hash_Fn&
+ get_hash_fn() const;
+
+ Eq_Fn&
+ get_eq_fn();
+
+ const Eq_Fn&
+ get_eq_fn() const;
+
+ Comb_Hash_Fn&
+ get_comb_hash_fn();
+
+ const Comb_Hash_Fn&
+ get_comb_hash_fn() const;
+
+ Resize_Policy&
+ get_resize_policy();
+
+ const Resize_Policy&
+ get_resize_policy() const;
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference r_val)
+ { return insert_imp(r_val, traits_base::m_store_extra_indicator); }
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ return (subscript_imp(r_key, traits_base::m_store_extra_indicator));
+#else
+ insert(r_key);
+ return traits_base::s_null_mapped;
+#endif
+ }
+
+ inline point_iterator
+ find(const_key_reference);
+
+ inline const_point_iterator
+ find(const_key_reference) const;
+
+ inline point_iterator
+ find_end();
+
+ inline const_point_iterator
+ find_end() const;
+
+ inline bool
+ erase(const_key_reference);
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred);
+
+ void
+ clear();
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_HT_MAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ private:
+ void
+ deallocate_all();
+
+ inline bool
+ do_resize_if_needed();
+
+ inline void
+ do_resize_if_needed_no_throw();
+
+ void
+ resize_imp(size_type new_size);
+
+ void
+ do_resize(size_type new_size);
+
+ void
+ resize_imp_no_exceptions(size_type, entry_pointer_array, size_type);
+
+ inline entry_pointer
+ resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, false_type);
+
+ inline entry_pointer
+ resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, true_type);
+
+ void
+ deallocate_links_in_list(entry_pointer);
+
+ inline entry_pointer
+ get_entry(const_reference, false_type);
+
+ inline entry_pointer
+ get_entry(const_reference, true_type);
+
+ inline void
+ rels_entry(entry_pointer);
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ inline mapped_reference
+ subscript_imp(const_key_reference r_key, false_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const size_type pos = ranged_hash_fn_base::operator()(r_key);
+ entry_pointer p_e = m_entries[pos];
+ resize_base::notify_insert_search_start();
+
+ while (p_e != NULL
+ && !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))
+ {
+ resize_base::notify_insert_search_collision();
+ p_e = p_e->m_p_next;
+ }
+
+ resize_base::notify_insert_search_end();
+ if (p_e != NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return (p_e->m_value.second);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return insert_new_imp(value_type(r_key, mapped_type()), pos)->second;
+ }
+
+ inline mapped_reference
+ subscript_imp(const_key_reference r_key, true_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
+ entry_pointer p_e = m_entries[pos_hash_pair.first];
+ resize_base::notify_insert_search_start();
+ while (p_e != NULL &&
+ !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash, r_key, pos_hash_pair.second))
+ {
+ resize_base::notify_insert_search_collision();
+ p_e = p_e->m_p_next;
+ }
+
+ resize_base::notify_insert_search_end();
+ if (p_e != NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return p_e->m_value.second;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return insert_new_imp(value_type(r_key, mapped_type()),
+ pos_hash_pair)->second;
+ }
+#endif
+
+ inline std::pair<point_iterator, bool>
+ insert_imp(const_reference, false_type);
+
+ inline std::pair<point_iterator, bool>
+ insert_imp(const_reference, true_type);
+
+ inline pointer
+ insert_new_imp(const_reference r_val, size_type pos)
+ {
+ if (do_resize_if_needed())
+ pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
+
+ // Following lines might throw an exception.
+ entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);
+
+ // At this point no exceptions can be thrown.
+ p_e->m_p_next = m_entries[pos];
+ m_entries[pos] = p_e;
+ resize_base::notify_inserted(++m_num_used_e);
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return &p_e->m_value;
+ }
+
+ inline pointer
+ insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)
+ {
+ // Following lines might throw an exception.
+ if (do_resize_if_needed())
+ r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));
+
+ entry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);
+
+ // At this point no exceptions can be thrown.
+ p_e->m_hash = r_pos_hash_pair.second;
+ p_e->m_p_next = m_entries[r_pos_hash_pair.first];
+ m_entries[r_pos_hash_pair.first] = p_e;
+ resize_base::notify_inserted(++m_num_used_e);
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return &p_e->m_value;
+ }
+
+ inline pointer
+ find_key_pointer(const_key_reference r_key, false_type)
+ {
+ entry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];
+ resize_base::notify_find_search_start();
+ while (p_e != NULL &&
+ !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
+ {
+ resize_base::notify_find_search_collision();
+ p_e = p_e->m_p_next;
+ }
+
+ resize_base::notify_find_search_end();
+
+#ifdef _GLIBCXX_DEBUG
+ if (p_e == NULL)
+ debug_base::check_key_does_not_exist(r_key);
+ else
+ debug_base::check_key_exists(r_key);
+#endif
+ return &p_e->m_value;
+ }
+
+ inline pointer
+ find_key_pointer(const_key_reference r_key, true_type)
+ {
+ comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);
+ entry_pointer p_e = m_entries[pos_hash_pair.first];
+ resize_base::notify_find_search_start();
+ while (p_e != NULL &&
+ !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
+ p_e->m_hash,
+ r_key, pos_hash_pair.second))
+ {
+ resize_base::notify_find_search_collision();
+ p_e = p_e->m_p_next;
+ }
+
+ resize_base::notify_find_search_end();
+
+#ifdef _GLIBCXX_DEBUG
+ if (p_e == NULL)
+ debug_base::check_key_does_not_exist(r_key);
+ else
+ debug_base::check_key_exists(r_key);
+#endif
+ return &p_e->m_value;
+ }
+
+ inline bool
+ erase_in_pos_imp(const_key_reference, size_type);
+
+ inline bool
+ erase_in_pos_imp(const_key_reference, const comp_hash&);
+
+ inline void
+ erase_entry_pointer(entry_pointer&);
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ void
+ inc_it_state(pointer& r_p_value,
+ std::pair<entry_pointer, size_type>& r_pos) const
+ {
+ inc_it_state((const_mapped_pointer& )r_p_value, r_pos);
+ }
+#endif
+
+ void
+ inc_it_state(const_pointer& r_p_value,
+ std::pair<entry_pointer, size_type>& r_pos) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);
+ r_pos.first = r_pos.first->m_p_next;
+ if (r_pos.first != NULL)
+ {
+ r_p_value = &r_pos.first->m_value;
+ return;
+ }
+
+ for (++r_pos.second; r_pos.second < m_num_e; ++r_pos.second)
+ if (m_entries[r_pos.second] != NULL)
+ {
+ r_pos.first = m_entries[r_pos.second];
+ r_p_value = &r_pos.first->m_value;
+ return;
+ }
+ r_p_value = NULL;
+ }
+
+ void
+ get_start_it_state(pointer& r_p_value,
+ std::pair<entry_pointer, size_type>& r_pos) const
+ {
+ for (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)
+ if (m_entries[r_pos.second] != NULL)
+ {
+ r_pos.first = m_entries[r_pos.second];
+ r_p_value = &r_pos.first->m_value;
+ return;
+ }
+ r_p_value = NULL;
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_entry_pointer_array_valid(const entry_pointer_array) const;
+
+ void
+ assert_entry_pointer_valid(const entry_pointer, true_type) const;
+
+ void
+ assert_entry_pointer_valid(const entry_pointer, false_type) const;
+#endif
+
+#ifdef PB_DS_HT_MAP_TRACE_
+ void
+ trace_list(const_entry_pointer) const;
+#endif
+
+ private:
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ friend class iterator_;
+#endif
+
+ friend class const_iterator_;
+
+ static entry_allocator s_entry_allocator;
+ static entry_pointer_allocator s_entry_pointer_allocator;
+ static iterator s_end_it;
+ static const_iterator s_const_end_it;
+ static point_iterator s_find_end_it;
+ static const_point_iterator s_const_find_end_it;
+
+ size_type m_num_e;
+ size_type m_num_used_e;
+ entry_pointer_array m_entries;
+
+ enum
+ {
+ store_hash_ok = !Store_Hash
+ || !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
+ };
+
+ PB_DS_STATIC_ASSERT(sth, store_hash_ok);
+ };
+
+#include <ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_HASH_EQ_FN_C_DEC
+#undef PB_DS_RANGED_HASH_FN_C_DEC
+#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_DEBUG_MAP_BASE_C_DEC
+#undef PB_DS_CLASS_NAME
+#undef PB_DS_V2F
+#undef PB_DS_V2S
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
new file mode 100644
index 000000000..1a61893d1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cmp_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s entire container comparison related
+ * functions.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Other_HT_Map_Type>
+bool
+PB_DS_CLASS_C_DEC::
+operator==(const Other_HT_Map_Type& other) const
+{ return cmp_with_other(other); }
+
+PB_DS_CLASS_T_DEC
+template<typename Other_Map_Type>
+bool
+PB_DS_CLASS_C_DEC::
+cmp_with_other(const Other_Map_Type& other) const
+{
+ if (size() != other.size())
+ return false;
+
+ for (typename Other_Map_Type::const_iterator it = other.begin();
+ it != other.end(); ++it)
+ {
+ const_key_reference r_key = const_key_reference(PB_DS_V2F(*it));
+
+ const_mapped_pointer p_mapped_value =
+ const_cast<PB_DS_CLASS_C_DEC& >(*this).
+ find_key_pointer(r_key, traits_base::m_store_extra_indicator);
+
+ if (p_mapped_value == NULL)
+ return false;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ if (p_mapped_value->second != it->second)
+ return false;
+#endif
+ }
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Other_HT_Map_Type>
+bool
+PB_DS_CLASS_C_DEC::
+operator!=(const Other_HT_Map_Type& other) const
+{ return !operator==(other); }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
new file mode 100644
index 000000000..fa3f31df0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cond_key_dtor_entry_dealtor.hpp
+ * Contains a conditional key destructor, used for exception handling.
+ */
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC template<typename HT_Map>
+#define PB_DS_CLASS_C_DEC PB_DS_CKDED_CLASS_NAME<HT_Map>
+
+ /**
+ * A conditional key destructor, used for exception handling.
+ **/
+ template<typename HT_Map>
+ class PB_DS_CKDED_CLASS_NAME
+ {
+ public:
+ typedef typename HT_Map::entry entry;
+ typedef typename HT_Map::entry_allocator entry_allocator;
+ typedef typename HT_Map::key_type key_type;
+
+ inline
+ PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e);
+
+ inline
+ ~PB_DS_CKDED_CLASS_NAME();
+
+ inline void
+ set_key_destruct();
+
+ inline void
+ set_no_action_destructor();
+
+ protected:
+ entry_allocator* const m_p_a;
+ entry* const m_p_e;
+
+ bool m_key_destruct;
+ bool m_no_action_destructor;
+ };
+
+ PB_DS_CLASS_T_DEC
+ inline
+ PB_DS_CLASS_C_DEC::
+ PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e)
+ : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false),
+ m_no_action_destructor(false)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ set_key_destruct()
+ { m_key_destruct = true; }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ set_no_action_destructor()
+ { m_no_action_destructor = true; }
+
+ PB_DS_CLASS_T_DEC
+ inline
+ PB_DS_CLASS_C_DEC::
+ ~PB_DS_CKDED_CLASS_NAME()
+ {
+ if (m_no_action_destructor)
+ return;
+ if (m_key_destruct)
+ m_p_e->m_value.first.~key_type();
+ m_p_a->deallocate(m_p_e, 1);
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
new file mode 100644
index 000000000..571115373
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -0,0 +1,191 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s constructors, destructor,
+ * and related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::entry_allocator
+PB_DS_CLASS_C_DEC::s_entry_allocator;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::entry_pointer_allocator
+PB_DS_CLASS_C_DEC::s_entry_pointer_allocator;
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME() :
+ ranged_hash_fn_base(resize_base::get_nearest_larger_size(1)),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_pointer_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn) :
+ ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_pointer_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :
+ PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
+ ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_pointer_allocator.allocate(m_num_e))
+{
+ std::fill(m_entries, m_entries + m_num_e, (entry_pointer)NULL);
+ Resize_Policy::notify_cleared();
+ ranged_hash_fn_base::notify_resized(m_num_e);
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn) :
+ PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
+ ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),
+ r_hash_fn, r_comb_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_pointer_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn, const Resize_Policy& r_resize_policy) :
+ PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),
+ Resize_Policy(r_resize_policy),
+ ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),
+ r_hash_fn, r_comb_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_pointer_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+#ifdef _GLIBCXX_DEBUG
+ debug_base(other),
+#endif
+ PB_DS_HASH_EQ_FN_C_DEC(other),
+ resize_base(other), ranged_hash_fn_base(other),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(m_entries = s_entry_pointer_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ __try
+ {
+ copy_from_range(other.begin(), other.end());
+ }
+ __catch(...)
+ {
+ deallocate_all();
+ __throw_exception_again;
+ }
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_CLASS_NAME()
+{ deallocate_all(); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+
+ std::swap(m_entries, other.m_entries);
+ std::swap(m_num_e, other.m_num_e);
+ std::swap(m_num_used_e, other.m_num_used_e);
+ ranged_hash_fn_base::swap(other);
+ hash_eq_fn_base::swap(other);
+ resize_base::swap(other);
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+deallocate_all()
+{
+ clear();
+ s_entry_pointer_allocator.deallocate(m_entries, m_num_e);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{
+ std::fill(m_entries, m_entries + m_num_e, entry_pointer(NULL));
+ Resize_Policy::notify_resized(m_num_e);
+ Resize_Policy::notify_cleared();
+ ranged_hash_fn_base::notify_resized(m_num_e);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..4f1cce648
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_no_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s constructors, destructor,
+ * and related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
+ false_type)
+{
+ // Following lines might throw an exception.
+ entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);
+
+ // At this point no exceptions can be thrown.
+ p->m_p_next = m_entries[pos];
+ m_entries[pos] = p;
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..a2b6fa111
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s constructors, destructor,
+ * and related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+constructor_insert_new_imp(const_reference r_val, size_type pos, true_type)
+{
+ // Following lines might throw an exception.
+ entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);
+
+ // At this point no exceptions can be thrown.
+ p->m_p_next = m_entries[pos];
+ p->m_hash = ranged_hash_fn_base::operator()((const_key_reference)(PB_DS_V2F(p->m_value))).second;
+
+ m_entries[pos] = p;
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(r_key);)
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
new file mode 100644
index 000000000..4219eef38
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ debug_base::check_size(m_num_used_e);
+ assert_entry_pointer_array_valid(m_entries);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_entry_pointer_array_valid(const entry_pointer_array a_p_entries) const
+{
+ size_type iterated_num_used_e = 0;
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ {
+ entry_pointer p_e = a_p_entries[pos];
+ while (p_e != NULL)
+ {
+ ++iterated_num_used_e;
+ assert_entry_pointer_valid(p_e, traits_base::m_store_extra_indicator);
+ p_e = p_e->m_p_next;
+ }
+ }
+ _GLIBCXX_DEBUG_ASSERT(iterated_num_used_e == m_num_used_e);
+}
+
+#include <ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..770bed34c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_no_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_entry_pointer_valid(const entry_pointer p, false_type) const
+{ debug_base::check_key_exists(PB_DS_V2F(p->m_value)); }
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..3d17671e9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_entry_pointer_valid(const entry_pointer p_e, true_type) const
+{
+ debug_base::check_key_exists(PB_DS_V2F(p_e->m_value));
+ comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));
+ _GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
new file mode 100644
index 000000000..fa09f7348
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file entry_list_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s entry-list related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+deallocate_links_in_list(entry_pointer p_e)
+{
+ while (p_e != NULL)
+ {
+ entry_pointer p_dealloc_e = p_e;
+ p_e = p_e->m_p_next;
+ s_entry_allocator.deallocate(p_dealloc_e, 1);
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+get_entry(const_reference r_val, true_type)
+{
+ // Following line might throw an exception.
+ entry_pointer p_e = s_entry_allocator.allocate(1);
+
+ // Following lines* cannot* throw an exception.
+ new (&p_e->m_value) value_type(r_val);
+ return p_e;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+get_entry(const_reference r_val, false_type)
+{
+ // Following line might throw an exception.
+ entry_pointer p_e = s_entry_allocator.allocate(1);
+ cond_dealtor_t cond(p_e);
+
+ // Following lines might throw an exception.
+ new (&p_e->m_value) value_type(r_val);
+ cond.set_no_action();
+ return p_e;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rels_entry(entry_pointer p_e)
+{
+ // The following lines cannot throw exceptions (unless if key-data dtors do).
+ p_e->m_value.~value_type();
+ s_entry_allocator.deallocate(p_e, 1);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
new file mode 100644
index 000000000..9f9178bc9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s erase related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+erase_entry_pointer(entry_pointer& r_p_e)
+{
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value)));
+
+ entry_pointer p_e = r_p_e;
+ r_p_e = r_p_e->m_p_next;
+ rels_entry(p_e);
+ _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);
+ resize_base::notify_erased(--m_num_used_e);
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ size_type num_ersd = 0;
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ {
+ while (m_entries[pos] != NULL && pred(m_entries[pos]->m_value))
+ {
+ ++num_ersd;
+ entry_pointer p_next_e = m_entries[pos]->m_p_next;
+ erase_entry_pointer(m_entries[pos]);
+ m_entries[pos] = p_next_e;
+ }
+
+ entry_pointer p_e = m_entries[pos];
+ while (p_e != NULL && p_e->m_p_next != NULL)
+ {
+ if (pred(p_e->m_p_next->m_value))
+ {
+ ++num_ersd;
+ erase_entry_pointer(p_e->m_p_next);
+ }
+ else
+ p_e = p_e->m_p_next;
+ }
+ }
+
+ do_resize_if_needed_no_throw();
+ return num_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ while (m_entries[pos] != NULL)
+ erase_entry_pointer(m_entries[pos]);
+ do_resize_if_needed_no_throw();
+ resize_base::notify_cleared();
+}
+
+#include <ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp>
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..d24fc31f9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_no_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s erase related functions,
+ * when the hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return erase_in_pos_imp(r_key, ranged_hash_fn_base::operator()(r_key));
+}
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase_in_pos_imp(const_key_reference r_key, size_type pos)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ entry_pointer p_e = m_entries[pos];
+ resize_base::notify_erase_search_start();
+ if (p_e == NULL)
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return false;
+ }
+
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base:: check_key_exists(r_key);)
+ erase_entry_pointer(m_entries[pos]);
+ do_resize_if_needed_no_throw();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return true;
+ }
+
+ while (true)
+ {
+ entry_pointer p_next_e = p_e->m_p_next;
+ if (p_next_e == NULL)
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return false;
+ }
+
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ erase_entry_pointer(p_e->m_p_next);
+ do_resize_if_needed_no_throw();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return true;
+ }
+ resize_base::notify_erase_search_collision();
+ p_e = p_next_e;
+ }
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..d72df6962
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s erase related functions,
+ * when the hash value is stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ entry_pointer p_e = m_entries[r_pos_hash_pair.first];
+ resize_base::notify_erase_search_start();
+ if (p_e == NULL)
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base:: check_key_does_not_exist(r_key);)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return false;
+ }
+
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
+ r_key, r_pos_hash_pair.second))
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ erase_entry_pointer(m_entries[r_pos_hash_pair.first]);
+ do_resize_if_needed_no_throw();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return true;
+ }
+
+ while (true)
+ {
+ entry_pointer p_next_e = p_e->m_p_next;
+ if (p_next_e == NULL)
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return false;
+ }
+
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value),
+ p_next_e->m_hash, r_key,
+ r_pos_hash_pair.second))
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ erase_entry_pointer(p_e->m_p_next);
+ do_resize_if_needed_no_throw();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return true;
+ }
+ resize_base::notify_erase_search_collision();
+ p_e = p_next_e;
+ }
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
new file mode 100644
index 000000000..6ca9a03b4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s find related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key) const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key,
+ traits_base::m_store_extra_indicator);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find_end()
+{ return NULL; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find_end() const
+{ return NULL; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..1db51c990
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s find related functions,
+ * when the hash value is stored.
+ */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
new file mode 100644
index 000000000..dc1519df7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s entire container info related
+ * functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{ return m_num_used_e; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{ return m_entry_allocator.max_size(); }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{ return (size() == 0); }
+
+PB_DS_CLASS_T_DEC
+template<typename Other_HT_Map_Type>
+bool
+PB_DS_CLASS_C_DEC::
+operator==(const Other_HT_Map_Type& other) const
+{ return cmp_with_other(other); }
+
+PB_DS_CLASS_T_DEC
+template<typename Other_Map_Type>
+bool
+PB_DS_CLASS_C_DEC::
+cmp_with_other(const Other_Map_Type& other) const
+{
+ if (size() != other.size())
+ return false;
+
+ for (typename Other_Map_Type::const_iterator it = other.begin();
+ it != other.end(); ++it)
+ {
+ const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);
+ const_mapped_pointer p_mapped_value =
+ const_cast<PB_DS_CLASS_C_DEC& >(*this).
+ find_key_pointer(r_key, traits_base::m_store_extra_indicator);
+
+ if (p_mapped_value == NULL)
+ return false;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ if (p_mapped_value->second != it->second)
+ return false;
+#endif
+ }
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Other_HT_Map_Type>
+bool
+PB_DS_CLASS_C_DEC::
+operator!=(const Other_HT_Map_Type& other) const
+{ return !operator==(other); }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
new file mode 100644
index 000000000..0679dbe6e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s insert related functions.
+ */
+
+#include <ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp>
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..7215ccd86
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_no_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s insert related functions,
+ * when the hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert_imp(const_reference r_val, false_type)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const_key_reference r_key = PB_DS_V2F(r_val);
+ const size_type pos = ranged_hash_fn_base::operator()(r_key);
+ entry_pointer p_e = m_entries[pos];
+ resize_base::notify_insert_search_start();
+
+ while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
+ r_key))
+ {
+ resize_base::notify_insert_search_collision();
+ p_e = p_e->m_p_next;
+ }
+
+ resize_base::notify_insert_search_end();
+ if (p_e != NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return std::make_pair(&p_e->m_value, false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return std::make_pair(insert_new_imp(r_val, pos), true);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..fbc284f80
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s insert related functions,
+ * when the hash value is stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert_imp(const_reference r_val, true_type)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const_key_reference key = PB_DS_V2F(r_val);
+ comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key);
+ entry_pointer p_e = m_entries[pos_hash_pair.first];
+ resize_base::notify_insert_search_start();
+
+ while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
+ p_e->m_hash,
+ key, pos_hash_pair.second))
+ {
+ resize_base::notify_insert_search_collision();
+ p_e = p_e->m_p_next;
+ }
+
+ resize_base::notify_insert_search_end();
+ if (p_e != NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
+ return std::make_pair(&p_e->m_value, false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
+ return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..a7592b7f1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s iterators related functions, e.g.,
+ * begin().
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::s_end_it;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::s_const_end_it;
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{
+ pointer p_value;
+ std::pair<entry_pointer, size_type> pos;
+ get_start_it_state(p_value, pos);
+ return iterator(p_value, pos, this);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{ return s_end_it; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{
+ pointer p_value;
+ std::pair<entry_pointer, size_type> pos;
+ get_start_it_state(p_value, pos);
+ return const_iterator(p_value, pos, this);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{ return s_const_end_it; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..9a661b361
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s policy access
+ * functions.
+ */
+
+PB_DS_CLASS_T_DEC
+Hash_Fn&
+PB_DS_CLASS_C_DEC::
+get_hash_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Hash_Fn&
+PB_DS_CLASS_C_DEC::
+get_hash_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Eq_Fn&
+PB_DS_CLASS_C_DEC::
+get_eq_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Eq_Fn&
+PB_DS_CLASS_C_DEC::
+get_eq_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Comb_Hash_Fn&
+PB_DS_CLASS_C_DEC::
+get_comb_hash_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Comb_Hash_Fn&
+PB_DS_CLASS_C_DEC::
+get_comb_hash_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Resize_Policy&
+PB_DS_CLASS_C_DEC::
+get_resize_policy()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Resize_Policy&
+PB_DS_CLASS_C_DEC::
+get_resize_policy() const
+{ return *this; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
new file mode 100644
index 000000000..66333ec85
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
@@ -0,0 +1,133 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s resize related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+do_resize_if_needed()
+{
+ if (!resize_base::is_resize_needed())
+ return false;
+ resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+do_resize(size_type len)
+{ resize_imp(resize_base::get_nearest_larger_size(len)); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+do_resize_if_needed_no_throw()
+{
+ if (!resize_base::is_resize_needed())
+ return;
+
+ __try
+ {
+ resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
+ }
+ __catch(...)
+ { }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+resize_imp(size_type new_size)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (new_size == m_num_e)
+ return;
+
+ const size_type old_size = m_num_e;
+ entry_pointer_array a_p_entries_resized;
+
+ // Following line might throw an exception.
+ ranged_hash_fn_base::notify_resized(new_size);
+
+ __try
+ {
+ // Following line might throw an exception.
+ a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size);
+ m_num_e = new_size;
+ }
+ __catch(...)
+ {
+ ranged_hash_fn_base::notify_resized(old_size);
+ __throw_exception_again;
+ }
+
+ // At this point no exceptions can be thrown.
+ resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size);
+ Resize_Policy::notify_resized(new_size);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+resize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size)
+{
+ std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e,
+ entry_pointer(NULL));
+
+ for (size_type pos = 0; pos < old_size; ++pos)
+ {
+ entry_pointer p_e = m_entries[pos];
+ while (p_e != NULL)
+ p_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized, traits_base::m_store_extra_indicator);
+ }
+
+ m_num_e = new_size;
+ _GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized);)
+ s_entry_pointer_allocator.deallocate(m_entries, old_size);
+ m_entries = a_p_entries_resized;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+#include <ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp>
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..6577630f0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_no_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s resize related functions, when the
+ * hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type)
+{
+ const size_type hash_pos =
+ ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));
+
+ entry_pointer const p_next_e = p_e->m_p_next;
+ p_e->m_p_next = a_p_entries_resized[hash_pos];
+ a_p_entries_resized[hash_pos] = p_e;
+ return p_next_e;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..c1adb61b1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_store_hash_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s resize related functions, when the
+ * hash value is stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+resize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type)
+{
+ const comp_hash pos_hash_pair =
+ ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash);
+
+ entry_pointer const p_next_e = p_e->m_p_next;
+ p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first];
+ a_p_entries_resized[pos_hash_pair.first] = p_e;
+ return p_next_e;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
new file mode 100644
index 000000000..0d5ec85f2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file size_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s entire container size related
+ * functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{ return m_num_used_e; }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{ return (size() == 0); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{ return s_entry_allocator.max_size(); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
new file mode 100644
index 000000000..b9c1ee20e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file standard_policies.hpp
+ * Contains standard policies for cc_ht_map types.
+ */
+
+#ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP
+#define PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP
+
+#include <ext/pb_ds/detail/standard_policies.hpp>
+
+#endif // #ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
new file mode 100644
index 000000000..6fa5676b9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s trace-mode functions.
+ */
+
+#ifdef PB_DS_HT_MAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << static_cast<unsigned long>(m_num_e) << " "
+ << static_cast<unsigned long>(m_num_used_e) << std::endl;
+
+ for (size_type i = 0; i < m_num_e; ++i)
+ {
+ std::cerr << static_cast<unsigned long>(i) << " ";
+ trace_list(m_entries[i]);
+ std::cerr << std::endl;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_list(const_entry_pointer p_l) const
+{
+ size_type iterated_num_used_e = 0;
+ while (p_l != NULL)
+ {
+ std::cerr << PB_DS_V2F(p_l->m_value) << " ";
+ p_l = p_l->m_p_next;
+ }
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp
new file mode 100644
index 000000000..1ee48a2ac
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/cond_dealtor.hpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cond_dealtor.hpp
+ * Contains a conditional deallocator.
+ */
+
+#ifndef PB_DS_COND_DEALTOR_HPP
+#define PB_DS_COND_DEALTOR_HPP
+
+namespace __gnu_pbds
+{
+
+ namespace detail
+ {
+
+#define PB_DS_COND_DEALTOR_CLASS_T_DEC \
+ template<typename Entry, class Allocator>
+
+#define PB_DS_COND_DEALTOR_CLASS_C_DEC \
+ cond_dealtor< \
+ Entry, \
+ Allocator>
+
+ template<typename Entry, class Allocator>
+ class cond_dealtor
+ {
+ public:
+ typedef
+ typename Allocator::template rebind<Entry>::other
+ entry_allocator;
+
+ typedef typename entry_allocator::pointer entry_pointer;
+
+ public:
+ inline
+ cond_dealtor(entry_pointer p_e);
+
+ inline
+ ~cond_dealtor();
+
+ inline void
+ set_no_action();
+
+ private:
+ entry_pointer m_p_e;
+
+ bool m_no_action_destructor;
+
+ static entry_allocator s_alloc;
+ };
+
+ PB_DS_COND_DEALTOR_CLASS_T_DEC
+ typename PB_DS_COND_DEALTOR_CLASS_C_DEC::entry_allocator
+ PB_DS_COND_DEALTOR_CLASS_C_DEC::s_alloc;
+
+ PB_DS_COND_DEALTOR_CLASS_T_DEC
+ inline
+ PB_DS_COND_DEALTOR_CLASS_C_DEC::
+ cond_dealtor(entry_pointer p_e) :
+ m_p_e(p_e),
+ m_no_action_destructor(false)
+ { }
+
+ PB_DS_COND_DEALTOR_CLASS_T_DEC
+ inline void
+ PB_DS_COND_DEALTOR_CLASS_C_DEC::
+ set_no_action()
+ {
+ m_no_action_destructor = true;
+ }
+
+ PB_DS_COND_DEALTOR_CLASS_T_DEC
+ inline
+ PB_DS_COND_DEALTOR_CLASS_C_DEC::
+ ~cond_dealtor()
+ {
+ if (m_no_action_destructor)
+ return;
+
+ s_alloc.deallocate(m_p_e, 1);
+ }
+
+#undef PB_DS_COND_DEALTOR_CLASS_T_DEC
+#undef PB_DS_COND_DEALTOR_CLASS_C_DEC
+
+ } // namespace detail
+
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_COND_DEALTOR_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..20c998868
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains constructors_destructor_fn_imps applicable to different containers.
+ */
+
+inline
+PB_DS_CLASS_NAME()
+{ }
+
+inline
+PB_DS_CLASS_NAME(const PB_DS_CLASS_NAME& other)
+: base_type((const base_type&)other)
+{ }
+
+template<typename T0>
+inline
+PB_DS_CLASS_NAME(T0 t0) : base_type(t0)
+{ }
+
+template<typename T0, typename T1>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1) : base_type(t0, t1)
+{ }
+
+template<typename T0, typename T1, typename T2>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2)
+{ }
+
+template<typename T0, typename T1, typename T2, typename T3>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3)
+: base_type(t0, t1, t2, t3)
+{ }
+
+template<typename T0, typename T1, typename T2, typename T3, typename T4>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4)
+: base_type(t0, t1, t2, t3, t4)
+{ }
+
+template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
+: base_type(t0, t1, t2, t3, t4, t5)
+{ }
+
+template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
+: base_type(t0, t1, t2, t3, t4, t5, t6)
+{ }
+
+template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
+: base_type(t0, t1, t2, t3, t4, t5, t6, t7)
+{ }
+
+template<typename T0, typename T1, typename T2, typename T3, typename T4,
+ typename T5, typename T6, typename T7, typename T8>
+inline
+PB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
+: base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8)
+{ }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp
new file mode 100644
index 000000000..7f8d87a3c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/container_base_dispatch.hpp
@@ -0,0 +1,332 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file container_base_dispatch.hpp
+ * Contains an associative container dispatching base.
+ */
+
+#ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
+#define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP
+
+#include <ext/typelist.h>
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+#define PB_DS_DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
+#undef PB_DS_DATA_TRUE_INDICATOR
+
+#define PB_DS_DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>
+#undef PB_DS_DATA_FALSE_INDICATOR
+
+namespace __gnu_pbds
+{
+namespace detail
+{
+ // Primary template.
+ template<typename Key, typename Mapped, typename Data_Structure_Taq,
+ typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch;
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, list_update_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, list_update_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type;
+ };
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef pat_trie_data_<Key, Mapped, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, splay_tree_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+
+ public:
+ typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;
+ };
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
+ typedef typename at2::type at2t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
+ typedef typename at3::type at3t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
+ typedef typename at4::type at4t;
+
+ public:
+ typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
+ at4t, at2t> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
+ typedef typename at2::type at2t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
+ typedef typename at3::type at3t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
+ typedef typename at4::type at4t;
+
+ public:
+ typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
+ at3t::value, at4t, at2t> type;
+ };
+
+ template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
+ typedef typename at2::type at2t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
+ typedef typename at3::type at3t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
+ typedef typename at4::type at4t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5;
+ typedef typename at5::type at5t;
+
+ public:
+ typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value,
+ at4t, at5t, at2t> type;
+ };
+
+ template<typename Key, typename Policy_Tl, typename Alloc>
+ struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag,
+ Policy_Tl, Alloc>
+ {
+ private:
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0> at0;
+ typedef typename at0::type at0t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> at1;
+ typedef typename at1::type at1t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2> at2;
+ typedef typename at2::type at2t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3> at3;
+ typedef typename at3::type at3t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> at4;
+ typedef typename at4::type at4t;
+ typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> at5;
+ typedef typename at5::type at5t;
+
+ public:
+ typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,
+ at3t::value, at4t, at5t, at2t> type;
+ };
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
new file mode 100644
index 000000000..6f2defb64
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/debug_map_base.hpp
@@ -0,0 +1,360 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_map_base.hpp
+ * Contains a debug-mode base for all maps.
+ */
+
+#ifndef PB_DS_DEBUG_MAP_BASE_HPP
+#define PB_DS_DEBUG_MAP_BASE_HPP
+
+#ifdef _GLIBCXX_DEBUG
+
+#include <list>
+#include <utility>
+#include <cstdlib>
+#include <iostream>
+#include <ext/throw_allocator.h>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ // Need std::pair ostream extractor.
+ template<typename _CharT, typename _Traits, typename _Tp1, typename _Tp2>
+ inline std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __out,
+ const std::pair<_Tp1, _Tp2>& p)
+ { return (__out << '(' << p.first << ',' << p.second << ')'); }
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+
+#define PB_DS_CLASS_C_DEC \
+ debug_map_base<Key, Eq_Fn, Const_Key_Reference>
+
+ template<typename Key, class Eq_Fn, typename Const_Key_Reference>
+ class debug_map_base
+ {
+ private:
+ typedef typename std::allocator< Key> key_allocator;
+
+ typedef typename key_allocator::size_type size_type;
+
+ typedef Const_Key_Reference const_key_reference;
+
+ protected:
+ debug_map_base();
+
+ debug_map_base(const PB_DS_CLASS_C_DEC& other);
+
+ ~debug_map_base();
+
+ inline void
+ insert_new(const_key_reference r_key);
+
+ inline void
+ erase_existing(const_key_reference r_key);
+
+ void
+ clear();
+
+ inline void
+ check_key_exists(const_key_reference r_key) const;
+
+ inline void
+ check_key_does_not_exist(const_key_reference r_key) const;
+
+ inline void
+ check_size(size_type size) const;
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ template<typename Cmp_Fn>
+ void
+ split(const_key_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+ private:
+ typedef std::list< Key> key_set;
+ typedef typename key_set::iterator key_set_iterator;
+ typedef typename key_set::const_iterator const_key_set_iterator;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+ const_key_set_iterator
+ find(const_key_reference r_key) const;
+
+ key_set_iterator
+ find(const_key_reference r_key);
+
+ key_set m_key_set;
+ Eq_Fn m_eq;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ debug_map_base()
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ debug_map_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ~debug_map_base()
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ insert_new(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ __gnu_cxx::throw_allocator<char> alloc;
+ const double orig_throw_prob = alloc.get_throw_prob();
+ alloc.set_throw_prob(0);
+ if (find(r_key) != m_key_set.end())
+ {
+ std::cerr << "insert_new" << r_key << std::endl;
+ std::abort();
+ }
+
+ __try
+ {
+ m_key_set.push_back(r_key);
+ }
+ __catch(...)
+ {
+ std::cerr << "insert_new" << r_key << std::endl;
+ std::abort();
+ }
+ alloc.set_throw_prob(orig_throw_prob);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ erase_existing(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ key_set_iterator it = find(r_key);
+ if (it == m_key_set.end())
+ {
+ std::cerr << "erase_existing" << r_key << std::endl;
+ std::abort();
+ }
+ m_key_set.erase(it);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ clear()
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ m_key_set.clear();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ check_key_exists(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (find(r_key) == m_key_set.end())
+ {
+ std::cerr << "check_key_exists" << r_key << std::endl;
+ std::abort();
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ check_key_does_not_exist(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (find(r_key) != m_key_set.end())
+ {
+ using std::cerr;
+ using std::endl;
+ cerr << "check_key_does_not_exist" << r_key << endl;
+ std::abort();
+ }
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ check_size(size_type size) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const size_type key_set_size = m_key_set.size();
+ if (size != key_set_size)
+ {
+ std::cerr << "check_size " << size
+ << " " << key_set_size << std::endl;
+ std::abort();
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ m_key_set.swap(other.m_key_set);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_key_set_iterator
+ PB_DS_CLASS_C_DEC::
+ find(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ typedef const_key_set_iterator iterator_type;
+ for (iterator_type it = m_key_set.begin(); it != m_key_set.end(); ++it)
+ if (m_eq(*it, r_key))
+ return it;
+ return m_key_set.end();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::key_set_iterator
+ PB_DS_CLASS_C_DEC::
+ find(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ key_set_iterator it = m_key_set.begin();
+ while (it != m_key_set.end())
+ {
+ if (m_eq(*it, r_key))
+ return it;
+ ++it;
+ }
+ return it;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ assert_valid() const
+ {
+ const_key_set_iterator prime_it = m_key_set.begin();
+ while (prime_it != m_key_set.end())
+ {
+ const_key_set_iterator sec_it = prime_it;
+ ++sec_it;
+ while (sec_it != m_key_set.end())
+ {
+ _GLIBCXX_DEBUG_ASSERT(!m_eq(*sec_it, *prime_it));
+ _GLIBCXX_DEBUG_ASSERT(!m_eq(*prime_it, *sec_it));
+ ++sec_it;
+ }
+ ++prime_it;
+ }
+ }
+#endif
+
+ PB_DS_CLASS_T_DEC
+ template<typename Cmp_Fn>
+ void
+ PB_DS_CLASS_C_DEC::
+ split(const_key_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)
+ {
+ __gnu_cxx::throw_allocator<char> alloc;
+ const double orig_throw_prob = alloc.get_throw_prob();
+ alloc.set_throw_prob(0);
+ other.clear();
+ key_set_iterator it = m_key_set.begin();
+ while (it != m_key_set.end())
+ if (cmp_fn(r_key, * it))
+ {
+ other.insert_new(*it);
+ it = m_key_set.erase(it);
+ }
+ else
+ ++it;
+ alloc.set_throw_prob(orig_throw_prob);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ join(PB_DS_CLASS_C_DEC& other)
+ {
+ __gnu_cxx::throw_allocator<char> alloc;
+ const double orig_throw_prob = alloc.get_throw_prob();
+ alloc.set_throw_prob(0);
+ key_set_iterator it = other.m_key_set.begin();
+ while (it != other.m_key_set.end())
+ {
+ insert_new(*it);
+ it = other.m_key_set.erase(it);
+ }
+ _GLIBCXX_DEBUG_ASSERT(other.m_key_set.empty());
+ alloc.set_throw_prob(orig_throw_prob);
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
new file mode 100644
index 000000000..ec95bca64
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file eq_by_less.hpp
+ * Contains an equivalence function.
+ */
+
+#ifndef PB_DS_EQ_BY_LESS_HPP
+#define PB_DS_EQ_BY_LESS_HPP
+
+#include <utility>
+#include <functional>
+#include <vector>
+#include <assert.h>
+#include <ext/pb_ds/detail/types_traits.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, class Cmp_Fn>
+ struct eq_by_less : private Cmp_Fn
+ {
+ bool
+ operator()(const Key& r_lhs, const Key& r_rhs) const
+ {
+ const bool l = Cmp_Fn::operator()(r_lhs, r_rhs);
+ const bool g = Cmp_Fn::operator()(r_rhs, r_lhs);
+ return !(l || g);
+ }
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_EQ_BY_LESS_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
new file mode 100644
index 000000000..b21c252e2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
@@ -0,0 +1,179 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_eq_fn.hpp
+ * Contains 2 eqivalence functions, one employing a hash value,
+ * and one ignoring it.
+ */
+
+#ifndef PB_DS_HASH_EQ_FN_HPP
+#define PB_DS_HASH_EQ_FN_HPP
+
+#include <utility>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, class Eq_Fn, class Allocator, bool Store_Hash>
+ struct hash_eq_fn;
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, class Eq_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ hash_eq_fn<Key, Eq_Fn, Allocator, false>
+
+ /**
+ * Specialization 1- The client requests that hash values not be stored.
+ **/
+ template<typename Key, class Eq_Fn, class Allocator>
+ struct hash_eq_fn<Key, Eq_Fn, Allocator, false> : public Eq_Fn
+ {
+ typedef Eq_Fn eq_fn_base;
+
+ typedef typename Allocator::template rebind<Key>::other key_allocator;
+
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ hash_eq_fn();
+
+ hash_eq_fn(const Eq_Fn& r_eq_fn);
+
+ inline bool
+ operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+
+ inline void
+ swap(const PB_DS_CLASS_C_DEC& other);
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ hash_eq_fn()
+ { }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ swap(const PB_DS_CLASS_C_DEC& other)
+ { std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ hash_eq_fn(const Eq_Fn& r_eq_fn) :
+ Eq_Fn(r_eq_fn)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ inline bool
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+ { return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, class Eq_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ hash_eq_fn<Key, Eq_Fn, Allocator, true>
+
+ /**
+ * Specialization 2- The client requests that hash values be stored.
+ **/
+ template<typename Key, class Eq_Fn, class Allocator>
+ struct hash_eq_fn<Key, Eq_Fn, Allocator, true> :
+ public Eq_Fn
+ {
+ typedef typename Allocator::size_type size_type;
+
+ typedef Eq_Fn eq_fn_base;
+
+ typedef typename Allocator::template rebind<Key>::other key_allocator;
+
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ hash_eq_fn();
+
+ hash_eq_fn(const Eq_Fn& r_eq_fn);
+
+ inline bool
+ operator()(const_key_reference r_lhs_key, size_type lhs_hash,
+ const_key_reference r_rhs_key, size_type rhs_hash) const;
+
+ inline void
+ swap(const PB_DS_CLASS_C_DEC& other);
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ hash_eq_fn()
+ { }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ hash_eq_fn(const Eq_Fn& r_eq_fn) :
+ Eq_Fn(r_eq_fn)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ inline bool
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference r_lhs_key, size_type lhs_hash,
+ const_key_reference r_rhs_key, size_type rhs_hash) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key)
+ || lhs_hash == rhs_hash);
+
+ return (lhs_hash == rhs_hash &&
+ eq_fn_base::operator()(r_lhs_key, r_rhs_key));
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ swap(const PB_DS_CLASS_C_DEC& other)
+ { std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
new file mode 100644
index 000000000..4ac145d3d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
@@ -0,0 +1,223 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s constructors, destructor,
+ * and related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::entry_allocator
+PB_DS_CLASS_C_DEC::s_entry_allocator;
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME()
+: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn)
+: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn)
+: hash_eq_fn_base(r_eq_fn),
+ ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+ const Comb_Probe_Fn& r_comb_hash_fn)
+: hash_eq_fn_base(r_eq_fn),
+ ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
+ r_hash_fn, r_comb_hash_fn),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+ const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober)
+: hash_eq_fn_base(r_eq_fn),
+ ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
+ r_hash_fn, comb_hash_fn, prober),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
+ const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober,
+ const Resize_Policy& r_resize_policy)
+: hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),
+ ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
+ r_hash_fn, comb_hash_fn, prober),
+ m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+#ifdef _GLIBCXX_DEBUG
+ debug_base(other),
+#endif
+ hash_eq_fn_base(other),
+ resize_base(other),
+ ranged_probe_fn_base(other),
+ m_num_e(other.m_num_e),
+ m_num_used_e(other.m_num_used_e),
+ m_entries(s_entry_allocator.allocate(m_num_e))
+{
+ for (size_type i = 0; i < m_num_e; ++i)
+ m_entries[i].m_stat = (entry_status)empty_entry_status;
+
+ __try
+ {
+ for (size_type i = 0; i < m_num_e; ++i)
+ {
+ m_entries[i].m_stat = other.m_entries[i].m_stat;
+ if (m_entries[i].m_stat == valid_entry_status)
+ new (m_entries + i) entry(other.m_entries[i]);
+ }
+ }
+ __catch(...)
+ {
+ deallocate_all();
+ __throw_exception_again;
+ }
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_CLASS_NAME()
+{ deallocate_all(); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+ std::swap(m_num_e, other.m_num_e);
+ std::swap(m_num_used_e, other.m_num_used_e);
+ std::swap(m_entries, other.m_entries);
+ ranged_probe_fn_base::swap(other);
+ hash_eq_fn_base::swap(other);
+ resize_base::swap(other);
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+deallocate_all()
+{
+ clear();
+ erase_all_valid_entries(m_entries, m_num_e);
+ s_entry_allocator.deallocate(m_entries, m_num_e);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_all_valid_entries(entry_array a_entries_resized, size_type len)
+{
+ for (size_type pos = 0; pos < len; ++pos)
+ {
+ entry_pointer p_e = &a_entries_resized[pos];
+ if (p_e->m_stat == valid_entry_status)
+ p_e->m_value.~value_type();
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{
+ Resize_Policy::notify_resized(m_num_e);
+ Resize_Policy::notify_cleared();
+ ranged_probe_fn_base::notify_resized(m_num_e);
+ for (size_type i = 0; i < m_num_e; ++i)
+ m_entries[i].m_stat = empty_entry_status;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..ec8069839
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_no_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s constructors, destructor,
+ * and related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
+ false_type)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status)k;
+ entry* const p_e = m_entries + pos;
+ new (&p_e->m_value) mapped_value_type(r_val);
+ p_e->m_stat = valid_entry_status;
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..5f3048759
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s constructors, destructor,
+ * and related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+constructor_insert_new_imp(const_mapped_reference r_val, size_type pos,
+ true_type)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
+ entry* const p_e = m_entries + pos;
+ new (&p_e->m_value) mapped_value_type(r_val);
+ p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second;
+ p_e->m_stat = valid_entry_status;
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(p_e->m_value.first);)
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
new file mode 100644
index 000000000..d7018c62c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ debug_base::check_size(m_num_used_e);
+ assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator);
+}
+
+#include <ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..86b4d7daf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_no_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_entry_array_valid(const entry_array a_entries, false_type) const
+{
+ size_type iterated_num_used_e = 0;
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ {
+ const_entry_pointer p_e = &a_entries[pos];
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ case erased_entry_status:
+ break;
+ case valid_entry_status:
+ {
+ const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ debug_base::check_key_exists(r_key);
+ ++iterated_num_used_e;
+ break;
+ }
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+ }
+ _GLIBCXX_DEBUG_ASSERT(iterated_num_used_e == m_num_used_e);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..961f14361
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_entry_array_valid(const entry_array a_entries, true_type) const
+{
+ size_type iterated_num_used_e = 0;
+
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ {
+ const_entry_pointer p_e =& a_entries[pos];
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ case erased_entry_status:
+ break;
+ case valid_entry_status:
+ {
+ const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ debug_base::check_key_exists(r_key);
+
+ const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
+
+ _GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second);
+ ++iterated_num_used_e;
+ break;
+ }
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(iterated_num_used_e == m_num_used_e);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
new file mode 100644
index 000000000..68878eb2a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s erase related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+erase_entry(entry_pointer p_e)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status);
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_e->m_value));)
+ p_e->m_value.~value_type();
+ p_e->m_stat = erased_entry_status;
+ _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);
+ resize_base::notify_erased(--m_num_used_e);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ {
+ entry_pointer p_e = &m_entries[pos];
+ if (p_e->m_stat == valid_entry_status)
+ erase_entry(p_e);
+ }
+ do_resize_if_needed_no_throw();
+ resize_base::notify_cleared();
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ size_type num_ersd = 0;
+ for (size_type pos = 0; pos < m_num_e; ++pos)
+ {
+ entry_pointer p_e = &m_entries[pos];
+ if (p_e->m_stat == valid_entry_status)
+ if (pred(p_e->m_value))
+ {
+ ++num_ersd;
+ erase_entry(p_e);
+ }
+ }
+
+ do_resize_if_needed_no_throw();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ return num_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{ return erase_imp(r_key, traits_base::m_store_extra_indicator); }
+
+#include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp>
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..40d578ebe
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_no_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s erase related functions,
+ * when the hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase_imp(const_key_reference r_key, false_type)
+{
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ size_type hash = ranged_probe_fn_base::operator()(r_key);
+ size_type i;
+ resize_base::notify_erase_search_start();
+
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
+ entry* const p_e = m_entries + pos;
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(
+ r_key));
+ return false;
+ }
+ break;
+ case valid_entry_status:
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
+ {
+ resize_base::notify_erase_search_end();
+ erase_entry(p_e);
+ do_resize_if_needed_no_throw();
+ return true;
+ }
+ break;
+ case erased_entry_status:
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+ resize_base::notify_erase_search_collision();
+ }
+ resize_base::notify_erase_search_end();
+ return false;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..8155a5261
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s erase related functions,
+ * when the hash value is stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase_imp(const_key_reference r_key, true_type)
+{
+ const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
+ size_type i;
+ resize_base::notify_erase_search_start();
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);
+
+ entry* const p_e = m_entries + pos;
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ {
+ resize_base::notify_erase_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(
+ r_key));
+ return false;
+ }
+ break;
+ case valid_entry_status:
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
+ r_key, pos_hash_pair.second))
+ {
+ resize_base::notify_erase_search_end();
+ erase_entry(p_e);
+ do_resize_if_needed_no_throw();
+ return true;
+ }
+ break;
+ case erased_entry_status:
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+
+ resize_base::notify_erase_search_collision();
+ }
+ resize_base::notify_erase_search_end();
+ return false;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
new file mode 100644
index 000000000..69d53763a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s find related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return find_key_pointer(r_key, traits_base::m_store_extra_indicator);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key) const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find_end()
+{ return NULL; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find_end() const
+{ return NULL; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..298604c80
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_no_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s find related functions,
+ * when the hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::pointer
+PB_DS_CLASS_C_DEC::
+find_key_pointer(const_key_reference r_key, false_type)
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..a44b8326e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s insert related functions,
+ * when the hash value is stored.
+ */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
new file mode 100644
index 000000000..4741afec0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
@@ -0,0 +1,677 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file gp_ht_map_.hpp
+ * Contains an implementation class for gp_ht_map_.
+ */
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>
+#include <utility>
+#ifdef PB_DS_HT_MAP_TRACE_
+#include <iostream>
+#endif
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \
+ typename Allocator, bool Store_Hash, typename Comb_Probe_Fn, \
+ typename Probe_Fn, typename Resize_Policy>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME gp_ht_map_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME gp_ht_map_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator, \
+ Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>
+
+#define PB_DS_HASH_EQ_FN_C_DEC \
+ hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>
+
+#define PB_DS_RANGED_PROBE_FN_C_DEC \
+ ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, Store_Hash>
+
+#define PB_DS_TYPES_TRAITS_C_DEC \
+ types_traits<Key, Mapped, Allocator, Store_Hash>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped()
+#endif
+
+ template<typename Key,
+ typename Mapped,
+ typename Hash_Fn,
+ typename Eq_Fn,
+ typename Allocator,
+ bool Store_Hash,
+ typename Comb_Probe_Fn,
+ typename Probe_Fn,
+ typename Resize_Policy>
+ class PB_DS_CLASS_NAME :
+#ifdef _GLIBCXX_DEBUG
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
+#endif
+ public PB_DS_HASH_EQ_FN_C_DEC,
+ public Resize_Policy,
+ public PB_DS_RANGED_PROBE_FN_C_DEC,
+ public PB_DS_TYPES_TRAITS_C_DEC
+ {
+ private:
+ typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+ typedef typename traits_base::value_type value_type_;
+ typedef typename traits_base::pointer pointer_;
+ typedef typename traits_base::const_pointer const_pointer_;
+ typedef typename traits_base::reference reference_;
+ typedef typename traits_base::const_reference const_reference_;
+ typedef typename traits_base::comp_hash comp_hash;
+
+ enum entry_status
+ {
+ empty_entry_status,
+ valid_entry_status,
+ erased_entry_status
+ } __attribute__ ((packed));
+
+ struct entry : public traits_base::stored_value_type
+ {
+ entry_status m_stat;
+ };
+
+ typedef typename Allocator::template rebind<entry>::other entry_allocator;
+ typedef typename entry_allocator::pointer entry_pointer;
+ typedef typename entry_allocator::const_pointer const_entry_pointer;
+ typedef typename entry_allocator::reference entry_reference;
+ typedef typename entry_allocator::const_reference const_entry_reference;
+ typedef typename entry_allocator::pointer entry_array;
+
+ typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+ typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;
+ typedef Resize_Policy resize_base;
+
+#define PB_DS_GEN_POS typename Allocator::size_type
+
+#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
+
+#undef PB_DS_GEN_POS
+
+ public:
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef Hash_Fn hash_fn;
+ typedef Eq_Fn eq_fn;
+ typedef Probe_Fn probe_fn;
+ typedef Comb_Probe_Fn comb_probe_fn;
+ typedef Resize_Policy resize_policy;
+
+ enum
+ {
+ store_hash = Store_Hash
+ };
+
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef point_iterator_ point_iterator;
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+ typedef const_point_iterator_ point_iterator;
+#endif
+
+ typedef const_point_iterator_ const_point_iterator;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef iterator_ iterator;
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+ typedef const_iterator_ iterator;
+#endif
+
+ typedef const_iterator_ const_iterator;
+
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
+ const Probe_Fn&);
+
+ PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&,
+ const Probe_Fn&, const Resize_Policy&);
+
+ template<typename It>
+ void
+ copy_from_range(It first_it, It last_it);
+
+ virtual
+ ~PB_DS_CLASS_NAME();
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ inline bool
+ empty() const;
+
+ Hash_Fn&
+ get_hash_fn();
+
+ const Hash_Fn&
+ get_hash_fn() const;
+
+ Eq_Fn&
+ get_eq_fn();
+
+ const Eq_Fn&
+ get_eq_fn() const;
+
+ Probe_Fn&
+ get_probe_fn();
+
+ const Probe_Fn&
+ get_probe_fn() const;
+
+ Comb_Probe_Fn&
+ get_comb_probe_fn();
+
+ const Comb_Probe_Fn&
+ get_comb_probe_fn() const;
+
+ Resize_Policy&
+ get_resize_policy();
+
+ const Resize_Policy&
+ get_resize_policy() const;
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference r_val)
+ {
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ return insert_imp(r_val, traits_base::m_store_extra_indicator);
+ }
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ return subscript_imp(r_key, traits_base::m_store_extra_indicator);
+#else
+ insert(r_key);
+ return traits_base::s_null_mapped;
+#endif
+ }
+
+ inline point_iterator
+ find(const_key_reference r_key);
+
+ inline const_point_iterator
+ find(const_key_reference r_key) const;
+
+ inline point_iterator
+ find_end();
+
+ inline const_point_iterator
+ find_end() const;
+
+ inline bool
+ erase(const_key_reference r_key);
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred prd);
+
+ void
+ clear();
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_HT_MAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ private:
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ friend class iterator_;
+#endif
+
+ friend class const_iterator_;
+
+ void
+ deallocate_all();
+
+ void
+ initialize();
+
+ void
+ erase_all_valid_entries(entry_array, size_type);
+
+ inline bool
+ do_resize_if_needed();
+
+ inline void
+ do_resize_if_needed_no_throw();
+
+ void
+ resize_imp(size_type);
+
+ virtual void
+ do_resize(size_type);
+
+ void
+ resize_imp(entry_array, size_type);
+
+ inline void
+ resize_imp_reassign(entry_pointer, entry_array, false_type);
+
+ inline void
+ resize_imp_reassign(entry_pointer, entry_array, true_type);
+
+ inline size_type
+ find_ins_pos(const_key_reference, false_type);
+
+ inline comp_hash
+ find_ins_pos(const_key_reference, true_type);
+
+ inline std::pair<point_iterator, bool>
+ insert_imp(const_reference, false_type);
+
+ inline std::pair<point_iterator, bool>
+ insert_imp(const_reference, true_type);
+
+ inline pointer
+ insert_new_imp(const_reference r_val, size_type pos)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
+
+ if (do_resize_if_needed())
+ pos = find_ins_pos(PB_DS_V2F(r_val),
+ traits_base::m_store_extra_indicator);
+
+ _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);
+
+ entry* const p_e = m_entries + pos;
+ new (&p_e->m_value) value_type(r_val);
+ p_e->m_stat = valid_entry_status;
+ resize_base::notify_inserted(++m_num_used_e);
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return &p_e->m_value;
+ }
+
+ inline pointer
+ insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
+ valid_entry_status);
+
+ if (do_resize_if_needed())
+ r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val),
+ traits_base::m_store_extra_indicator);
+
+ _GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=
+ valid_entry_status);
+
+ entry* const p_e = m_entries + r_pos_hash_pair.first;
+ new (&p_e->m_value) value_type(r_val);
+ p_e->m_hash = r_pos_hash_pair.second;
+ p_e->m_stat = valid_entry_status;
+
+ resize_base::notify_inserted(++m_num_used_e);
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(p_e->m_value));)
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return &p_e->m_value;
+ }
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ inline mapped_reference
+ subscript_imp(const_key_reference key, false_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ const size_type pos = find_ins_pos(key,
+ traits_base::m_store_extra_indicator);
+
+ entry_pointer p_e = &m_entries[pos];
+ if (p_e->m_stat != valid_entry_status)
+ return insert_new_imp(value_type(key, mapped_type()), pos)->second;
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
+ return p_e->m_value.second;
+ }
+
+ inline mapped_reference
+ subscript_imp(const_key_reference key, true_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ comp_hash pos_hash_pair =
+ find_ins_pos(key, traits_base::m_store_extra_indicator);
+
+ if (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)
+ return insert_new_imp(value_type(key, mapped_type()),
+ pos_hash_pair)->second;
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key));
+ return (m_entries + pos_hash_pair.first)->m_value.second;
+ }
+#endif
+
+ inline pointer
+ find_key_pointer(const_key_reference key, false_type)
+ {
+ const size_type hash = ranged_probe_fn_base::operator()(key);
+ size_type i;
+ resize_base::notify_find_search_start();
+
+ // Loop until entry is found or until all possible entries accessed.
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(key, hash, i);
+
+ entry* const p_e = m_entries + pos;
+ switch (p_e->m_stat)
+ {
+ case empty_entry_status:
+ {
+ resize_base::notify_find_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
+
+ return NULL;
+ }
+ break;
+ case valid_entry_status:
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))
+ {
+ resize_base::notify_find_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
+
+ return pointer(&p_e->m_value);
+ }
+ break;
+ case erased_entry_status:
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+
+ resize_base::notify_find_search_collision();
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
+ resize_base::notify_find_search_end();
+ return NULL;
+ }
+
+ inline pointer
+ find_key_pointer(const_key_reference key, true_type)
+ {
+ comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);
+ size_type i;
+ resize_base::notify_find_search_start();
+
+ // Loop until entry is found or until all possible entries accessed.
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos =
+ ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);
+
+ entry* const p_e = m_entries + pos;
+
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ {
+ resize_base::notify_find_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
+
+ return NULL;
+ }
+ break;
+ case valid_entry_status:
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),
+ p_e->m_hash,
+ key, pos_hash_pair.second))
+ {
+ resize_base::notify_find_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(key);)
+ return pointer(&p_e->m_value);
+ }
+ break;
+ case erased_entry_status:
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+
+ resize_base::notify_find_search_collision();
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(key);)
+ resize_base::notify_find_search_end();
+ return NULL;
+ }
+
+ inline bool
+ erase_imp(const_key_reference, true_type);
+
+ inline bool
+ erase_imp(const_key_reference, false_type);
+
+ inline void
+ erase_entry(entry_pointer p_e);
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ void
+ inc_it_state(pointer& r_p_value, size_type& r_pos) const
+ { inc_it_state((const_mapped_pointer& )r_p_value, r_pos); }
+#endif
+
+ void
+ inc_it_state(const_pointer& r_p_value, size_type& r_pos) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);
+ for (++r_pos; r_pos < m_num_e; ++r_pos)
+ {
+ const_entry_pointer p_e =& m_entries[r_pos];
+ if (p_e->m_stat == valid_entry_status)
+ {
+ r_p_value =& p_e->m_value;
+ return;
+ }
+ }
+ r_p_value = NULL;
+ }
+
+ void
+ get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const
+ {
+ for (r_pos = 0; r_pos < m_num_e; ++r_pos)
+ {
+ const_entry_pointer p_e = &m_entries[r_pos];
+ if (p_e->m_stat == valid_entry_status)
+ {
+ r_p_value = &p_e->m_value;
+ return;
+ }
+ }
+ r_p_value = NULL;
+ }
+
+ void
+ get_start_it_state(pointer& r_p_value, size_type& r_pos)
+ {
+ for (r_pos = 0; r_pos < m_num_e; ++r_pos)
+ {
+ entry_pointer p_e = &m_entries[r_pos];
+ if (p_e->m_stat == valid_entry_status)
+ {
+ r_p_value = &p_e->m_value;
+ return;
+ }
+ }
+ r_p_value = NULL;
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_entry_array_valid(const entry_array, false_type) const;
+
+ void
+ assert_entry_array_valid(const entry_array, true_type) const;
+#endif
+
+ static entry_allocator s_entry_allocator;
+ static iterator s_end_it;
+ static const_iterator s_const_end_it;
+
+ size_type m_num_e;
+ size_type m_num_used_e;
+ entry_pointer m_entries;
+
+ enum
+ {
+ store_hash_ok = !Store_Hash
+ || !is_same<Hash_Fn, __gnu_pbds::null_hash_fn>::value
+ };
+
+ PB_DS_STATIC_ASSERT(sth, store_hash_ok);
+ };
+
+#include <ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_HASH_EQ_FN_C_DEC
+#undef PB_DS_RANGED_PROBE_FN_C_DEC
+#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_DEBUG_MAP_BASE_C_DEC
+#undef PB_DS_CLASS_NAME
+#undef PB_DS_V2F
+#undef PB_DS_V2S
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
new file mode 100644
index 000000000..423a9288e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s entire container info related
+ * functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{ return m_num_used_e; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{ return s_entry_allocator.max_size(); }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{ return (size() == 0); }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
new file mode 100644
index 000000000..101ce8c6b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s insert related functions.
+ */
+
+#include <ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp>
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..3227a4aaa
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_no_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s insert related functions,
+ * when the hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+find_ins_pos(const_key_reference r_key, false_type)
+{
+ size_type hash = ranged_probe_fn_base::operator()(r_key);
+ size_type i;
+
+ /* The insertion position is initted to a non-legal value to indicate
+ * that it has not been initted yet.
+ */
+ size_type ins_pos = m_num_e;
+ resize_base::notify_insert_search_start();
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
+ _GLIBCXX_DEBUG_ASSERT(pos < m_num_e);
+ entry* const p_e = m_entries + pos;
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ {
+ resize_base::notify_insert_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return (ins_pos == m_num_e) ? pos : ins_pos;
+ }
+ break;
+ case erased_entry_status:
+ if (ins_pos == m_num_e)
+ ins_pos = pos;
+ break;
+ case valid_entry_status:
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))
+ {
+ resize_base::notify_insert_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return pos;
+ }
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+
+ resize_base::notify_insert_search_collision();
+ }
+ resize_base::notify_insert_search_end();
+ if (ins_pos == m_num_e)
+ __throw_insert_error();
+ return ins_pos;
+}
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert_imp(const_reference r_val, false_type)
+{
+ const_key_reference r_key = PB_DS_V2F(r_val);
+ const size_type pos = find_ins_pos(r_key,
+ traits_base::m_store_extra_indicator);
+
+ if (m_entries[pos].m_stat == valid_entry_status)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return std::make_pair(&(m_entries + pos)->m_value, false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
+ return std::make_pair(insert_new_imp(r_val, pos), true);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..f4310b629
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s find related functions,
+ * when the hash value is stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::comp_hash
+PB_DS_CLASS_C_DEC::
+find_ins_pos(const_key_reference r_key, true_type)
+{
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);
+
+ size_type i;
+
+ /* The insertion position is initted to a non-legal value to indicate
+ * that it has not been initted yet.
+ */
+ size_type ins_pos = m_num_e;
+ resize_base::notify_insert_search_start();
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);
+
+ entry* const p_e = m_entries + pos;
+ switch(p_e->m_stat)
+ {
+ case empty_entry_status:
+ {
+ resize_base::notify_insert_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+
+ return ((ins_pos == m_num_e) ?
+ std::make_pair(pos, pos_hash_pair.second) :
+ std::make_pair(ins_pos, pos_hash_pair.second));
+ }
+ break;
+ case erased_entry_status:
+ if (ins_pos == m_num_e)
+ ins_pos = pos;
+ break;
+ case valid_entry_status:
+ if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,
+ r_key, pos_hash_pair.second))
+ {
+ resize_base::notify_insert_search_end();
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return std::make_pair(pos, pos_hash_pair.second);
+ }
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+ resize_base::notify_insert_search_collision();
+ }
+ resize_base::notify_insert_search_end();
+ if (ins_pos == m_num_e)
+ __throw_insert_error();
+ return std::make_pair(ins_pos, pos_hash_pair.second);
+}
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert_imp(const_reference r_val, true_type)
+{
+ const_key_reference r_key = PB_DS_V2F(r_val);
+ comp_hash pos_hash_pair = find_ins_pos(r_key,
+ traits_base::m_store_extra_indicator);
+
+ _GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e);
+ entry_pointer p_e =& m_entries[pos_hash_pair.first];
+ if (p_e->m_stat == valid_entry_status)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ return std::make_pair(&p_e->m_value, false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
+ return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
new file mode 100644
index 000000000..ff1f80f28
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterator_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s iterators related functions, e.g.,
+ * begin().
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::s_end_it;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::s_const_end_it;
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{
+ pointer_ p_value;
+ size_type pos;
+ get_start_it_state(p_value, pos);
+ return iterator(p_value, pos, this);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{ return s_end_it; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{
+ const_pointer_ p_value;
+ size_type pos;
+ get_start_it_state(p_value, pos);
+ return const_iterator(p_value, pos, this);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{ return s_const_end_it; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..b1a3f7a7e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s policy agpess
+ * functions.
+ */
+
+PB_DS_CLASS_T_DEC
+Hash_Fn&
+PB_DS_CLASS_C_DEC::
+get_hash_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Hash_Fn&
+PB_DS_CLASS_C_DEC::
+get_hash_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Eq_Fn&
+PB_DS_CLASS_C_DEC::
+get_eq_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Eq_Fn&
+PB_DS_CLASS_C_DEC::
+get_eq_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Probe_Fn&
+PB_DS_CLASS_C_DEC::
+get_probe_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Probe_Fn&
+PB_DS_CLASS_C_DEC::
+get_probe_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Comb_Probe_Fn&
+PB_DS_CLASS_C_DEC::
+get_comb_probe_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Comb_Probe_Fn&
+PB_DS_CLASS_C_DEC::
+get_comb_probe_fn() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Resize_Policy&
+PB_DS_CLASS_C_DEC::
+get_resize_policy()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Resize_Policy&
+PB_DS_CLASS_C_DEC::
+get_resize_policy() const
+{ return *this; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
new file mode 100644
index 000000000..82a8ab0d2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s resize related functions.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+do_resize_if_needed()
+{
+ if (!resize_base::is_resize_needed())
+ return false;
+ resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+do_resize(size_type n)
+{ resize_imp(resize_base::get_nearest_larger_size(n)); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+do_resize_if_needed_no_throw()
+{
+ if (!resize_base::is_resize_needed())
+ return;
+
+ __try
+ {
+ resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));
+ }
+ __catch(...)
+ { }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+resize_imp(size_type new_size)
+{
+#ifdef PB_DS_REGRESSION
+ typename Allocator::group_throw_prob_adjustor adjust(m_num_e);
+#endif
+
+ if (new_size == m_num_e)
+ return;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const size_type old_size = m_num_e;
+ entry_array a_entries_resized = NULL;
+
+ // Following line might throw an exception.
+ a_entries_resized = s_entry_allocator.allocate(new_size);
+
+ ranged_probe_fn_base::notify_resized(new_size);
+ m_num_e = new_size;
+
+ for (size_type i = 0; i < m_num_e; ++i)
+ a_entries_resized[i].m_stat = empty_entry_status;
+
+ __try
+ {
+ resize_imp(a_entries_resized, old_size);
+ }
+ __catch(...)
+ {
+ erase_all_valid_entries(a_entries_resized, new_size);
+ m_num_e = old_size;
+ s_entry_allocator.deallocate(a_entries_resized, new_size);
+ ranged_probe_fn_base::notify_resized(old_size);
+ __throw_exception_again;
+ }
+
+ // At this point no exceptions can be thrown.
+ _GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized, traits_base::m_store_extra_indicator);)
+
+ Resize_Policy::notify_resized(new_size);
+ erase_all_valid_entries(m_entries, old_size);
+ s_entry_allocator.deallocate(m_entries, old_size);
+ m_entries = a_entries_resized;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+resize_imp(entry_array a_entries_resized, size_type old_size)
+{
+ for (size_type pos = 0; pos < old_size; ++pos)
+ if (m_entries[pos].m_stat == valid_entry_status)
+ resize_imp_reassign(m_entries + pos, a_entries_resized,
+ traits_base::m_store_extra_indicator);
+}
+
+#include <ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp>
+#include <ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp>
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..1d2839e0a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_no_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s resize related functions, when the
+ * hash value is not stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
+ false_type)
+{
+ const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ size_type hash = ranged_probe_fn_base::operator()(r_key);
+ size_type i;
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
+ entry_pointer p_new_e = a_entries_resized + pos;
+ switch(p_new_e->m_stat)
+ {
+ case empty_entry_status:
+ new (&p_new_e->m_value) value_type(p_e->m_value);
+ p_new_e->m_stat = valid_entry_status;
+ return;
+ case erased_entry_status:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ break;
+ case valid_entry_status:
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+ }
+ __throw_insert_error();
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
new file mode 100644
index 000000000..765e9624b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file resize_store_hash_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s resize related functions, when the
+ * hash value is stored.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+resize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized,
+ true_type)
+{
+ const_key_reference r_key = PB_DS_V2F(p_e->m_value);
+ size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash);
+
+ size_type i;
+ for (i = 0; i < m_num_e; ++i)
+ {
+ const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);
+ entry_pointer p_new_e = a_entries_resized + pos;
+ switch(p_new_e->m_stat)
+ {
+ case empty_entry_status:
+ new (&p_new_e->m_value) value_type(p_e->m_value);
+ p_new_e->m_hash = hash;
+ p_new_e->m_stat = valid_entry_status;
+ return;
+ case erased_entry_status:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ break;
+ case valid_entry_status:
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+ }
+ __throw_insert_error();
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
new file mode 100644
index 000000000..479725fd5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file standard_policies.hpp
+ * Contains standard policies for gp_ht_map types.
+ */
+
+#ifndef PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP
+#define PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP
+
+#include <ext/pb_ds/detail/standard_policies.hpp>
+#include <ext/pb_ds/ht_load_check_resize_trigger.hpp>
+#include <ext/pb_ds/linear_probe_fn.hpp>
+#include <ext/pb_ds/quadratic_probe_fn.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Comb_Probe_Fn>
+ struct default_probe_fn
+ {
+ private:
+ typedef typename Comb_Probe_Fn::size_type size_type;
+
+ public:
+ typedef
+ typename __conditional_type<
+ is_same<
+ __gnu_pbds::direct_mask_range_hashing<size_t>,
+ Comb_Probe_Fn>::value,
+ __gnu_pbds::linear_probe_fn<size_type>,
+ __gnu_pbds::quadratic_probe_fn<size_type> >::__type
+ type;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
new file mode 100644
index 000000000..c3fe13c00
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains implementations of gp_ht_map_'s trace-mode functions.
+ */
+
+#ifdef PB_DS_HT_MAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << static_cast<unsigned long>(m_num_e) << " " <<
+ static_cast<unsigned long>(m_num_used_e) << std::endl;
+
+ for (size_type i = 0; i < m_num_e; ++i)
+ {
+ std::cerr << static_cast<unsigned long>(i) << " ";
+
+ switch(m_entries[i].m_stat)
+ {
+ case empty_entry_status:
+ std::cerr << "<empty>";
+ break;
+ case erased_entry_status:
+ std::cerr << "<erased>";
+ break;
+ case valid_entry_status:
+ std::cerr << PB_DS_V2F(m_entries[i].m_value);
+ break;
+ default:
+ _GLIBCXX_DEBUG_ASSERT(0);
+ };
+
+ std::cerr << std::endl;
+ }
+}
+
+#endif // #ifdef PB_DS_HT_MAP_TRACE_
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
new file mode 100644
index 000000000..caf78482a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file direct_mask_range_hashing_imp.hpp
+ * Contains a range-hashing policy implementation
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{ mask_based_base::swap(other); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_resized(size_type size)
+{ mask_based_base::notify_resized(size); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+operator()(size_type hash) const
+{ return mask_based_base::range_hash(hash); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
new file mode 100644
index 000000000..17d57b23d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file direct_mod_range_hashing_imp.hpp
+ * Contains a range-hashing policy implementation
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{ mod_based_base::swap(other); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_resized(size_type n)
+{ mod_based_base::notify_resized(n); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+operator()(size_type hash) const
+{ return mod_based_base::range_hash(hash); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
new file mode 100644
index 000000000..e7b264493
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file linear_probe_fn_imp.hpp
+ * Contains a probe policy implementation
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{ }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+operator()(size_type i) const
+{
+ return (i);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
new file mode 100644
index 000000000..936abbee1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file mask_based_range_hashing.hpp
+ * Contains a range hashing policy base.
+ */
+
+#ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP
+#define PB_DS_MASK_BASED_RANGE_HASHING_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+#define PB_DS_CLASS_C_DEC mask_based_range_hashing<Size_Type>
+
+ template<typename Size_Type>
+ class mask_based_range_hashing
+ {
+ protected:
+ typedef Size_Type size_type;
+
+ void
+ swap(mask_based_range_hashing& other)
+ { std::swap(m_mask, other.m_mask); }
+
+ void
+ notify_resized(size_type size);
+
+ inline size_type
+ range_hash(size_type hash) const
+ { return size_type(hash & m_mask); }
+
+ private:
+ size_type m_mask;
+ const static size_type s_num_bits_in_size_type;
+ const static size_type s_highest_bit_1;
+ };
+
+ PB_DS_CLASS_T_DEC
+ const typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::s_num_bits_in_size_type =
+ sizeof(typename PB_DS_CLASS_C_DEC::size_type) << 3;
+
+ PB_DS_CLASS_T_DEC
+ const typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC::s_highest_bit_1 = static_cast<typename PB_DS_CLASS_C_DEC::size_type>(1) << (s_num_bits_in_size_type - 1);
+
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ notify_resized(size_type size)
+ {
+ size_type i = 0;
+ while (size ^ s_highest_bit_1)
+ {
+ size <<= 1;
+ ++i;
+ }
+
+ m_mask = 1;
+ i += 2;
+ while (i++ < s_num_bits_in_size_type)
+ m_mask = (m_mask << 1) ^ 1;
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
new file mode 100644
index 000000000..2610e0457
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file mod_based_range_hashing.hpp
+ * Contains a range hashing policy base.
+ */
+
+#ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP
+#define PB_DS_MOD_BASED_RANGE_HASHING_HPP
+
+namespace __gnu_pbds
+{
+
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Size_Type>
+
+#define PB_DS_CLASS_C_DEC \
+ mod_based_range_hashing< \
+ Size_Type>
+
+ template<typename Size_Type>
+ class mod_based_range_hashing
+ {
+ protected:
+ typedef Size_Type size_type;
+
+ protected:
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ void
+ notify_resized(size_type size);
+
+ inline size_type
+ range_hash(size_type hash) const;
+
+ private:
+ size_type m_size;
+ };
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ std::swap(m_size, other.m_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ notify_resized(size_type size)
+ {
+ m_size = size;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ range_hash(size_type hash) const
+ {
+ return (hash % m_size);
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
new file mode 100644
index 000000000..970cfc1e5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file probe_fn_base.hpp
+ * Contains a probe policy base.
+ */
+
+#ifndef PB_DS_PROBE_FN_BASE_HPP
+#define PB_DS_PROBE_FN_BASE_HPP
+
+#include <functional>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Allocator>
+ class probe_fn_base
+ {
+ protected:
+ ~probe_fn_base() { }
+ };
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
new file mode 100644
index 000000000..4c7a6c465
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file quadratic_probe_fn_imp.hpp
+ * Contains a probe policy implementation
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{ }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+operator()(size_type i) const
+{
+ return (i* i);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
new file mode 100644
index 000000000..24899272f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
@@ -0,0 +1,359 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file ranged_hash_fn.hpp
+ * Contains a unified ranged hash functor, allowing the hash tables
+ * to deal with a single class for ranged hashing.
+ */
+
+#ifndef PB_DS_RANGED_HASH_FN_HPP
+#define PB_DS_RANGED_HASH_FN_HPP
+
+#include <ext/pb_ds/detail/basic_types.hpp>
+#include <utility>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Hash_Fn, bool Store_Hash>
+ class ranged_hash_fn;
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Hash_Fn, typename Allocator, \
+ typename Comb_Hash_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, false>
+
+ /**
+ * Specialization 1
+ * The client supplies a hash function and a ranged hash function,
+ * and requests that hash values not be stored.
+ **/
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Hash_Fn>
+ class ranged_hash_fn< Key, Hash_Fn, Allocator, Comb_Hash_Fn, false>
+ : public Hash_Fn, public Comb_Hash_Fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef Hash_Fn hash_fn_base;
+ typedef Comb_Hash_Fn comb_hash_fn_base;
+ typedef typename Allocator::template rebind< Key>::other key_allocator;
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ ranged_hash_fn(size_type);
+
+ ranged_hash_fn(size_type, const Hash_Fn&);
+
+ ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ void
+ notify_resized(size_type);
+
+ inline size_type
+ operator()(const_key_reference) const;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size)
+ { Comb_Hash_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn)
+ : Hash_Fn(r_hash_fn)
+ { Comb_Hash_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Hash_Fn& r_comb_hash_fn)
+ : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
+ { comb_hash_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ comb_hash_fn_base::swap(other);
+ std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ notify_resized(size_type size)
+ { comb_hash_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference r_key) const
+ { return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Hash_Fn, typename Allocator, \
+ typename Comb_Hash_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_hash_fn<Key,Hash_Fn, Allocator, Comb_Hash_Fn, true>
+
+ /**
+ * Specialization 2
+ * The client supplies a hash function and a ranged hash function,
+ * and requests that hash values be stored.
+ **/
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Hash_Fn>
+ class ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, true>
+ : public Hash_Fn, public Comb_Hash_Fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef std::pair<size_type, size_type> comp_hash;
+ typedef Hash_Fn hash_fn_base;
+ typedef Comb_Hash_Fn comb_hash_fn_base;
+ typedef typename Allocator::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ ranged_hash_fn(size_type);
+
+ ranged_hash_fn(size_type, const Hash_Fn&);
+
+ ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ void
+ notify_resized(size_type);
+
+ inline comp_hash
+ operator()(const_key_reference) const;
+
+ inline comp_hash
+ operator()(const_key_reference, size_type) const;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size)
+ { Comb_Hash_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) :
+ Hash_Fn(r_hash_fn)
+ { Comb_Hash_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Hash_Fn& r_comb_hash_fn)
+ : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)
+ { comb_hash_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ comb_hash_fn_base::swap(other);
+ std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ notify_resized(size_type size)
+ { comb_hash_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::comp_hash
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference r_key) const
+ {
+ const size_type hash = hash_fn_base::operator()(r_key);
+ return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::comp_hash
+ PB_DS_CLASS_C_DEC::
+ operator()
+#ifdef _GLIBCXX_DEBUG
+ (const_key_reference r_key, size_type hash) const
+#else
+ (const_key_reference /*r_key*/, size_type hash) const
+#endif
+ {
+ _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
+ return std::make_pair(comb_hash_fn_base::operator()(hash), hash);
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false>
+
+ /**
+ * Specialization 3
+ * The client does not supply a hash function (by specifying
+ * null_hash_fn as the Hash_Fn parameter), and requests that hash
+ * values not be stored.
+ **/
+ template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+ class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false>
+ : public null_hash_fn, public Comb_Hash_Fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef Comb_Hash_Fn comb_hash_fn_base;
+
+ ranged_hash_fn(size_type);
+
+ ranged_hash_fn(size_type, const Comb_Hash_Fn&);
+
+ ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size)
+ { Comb_Hash_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) :
+ Comb_Hash_Fn(r_comb_hash_fn)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn,
+ const Comb_Hash_Fn& r_comb_hash_fn)
+ : Comb_Hash_Fn(r_comb_hash_fn)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ { comb_hash_fn_base::swap(other); }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true>
+
+ /**
+ * Specialization 4
+ * The client does not supply a hash function (by specifying
+ * null_hash_fn as the Hash_Fn parameter), and requests that hash
+ * values be stored.
+ **/
+ template<typename Key, typename Allocator, typename Comb_Hash_Fn>
+ class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true>
+ : public null_hash_fn, public Comb_Hash_Fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef Comb_Hash_Fn comb_hash_fn_base;
+
+ ranged_hash_fn(size_type);
+
+ ranged_hash_fn(size_type, const Comb_Hash_Fn&);
+
+ ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size)
+ { Comb_Hash_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn)
+ : Comb_Hash_Fn(r_comb_hash_fn)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn,
+ const Comb_Hash_Fn& r_comb_hash_fn)
+ : Comb_Hash_Fn(r_comb_hash_fn)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ { comb_hash_fn_base::swap(other); }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
new file mode 100644
index 000000000..ddfba9de1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
@@ -0,0 +1,327 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file ranged_probe_fn.hpp
+ * Contains a unified ranged probe functor, allowing the probe tables to deal with
+ * a single class for ranged probeing.
+ */
+
+#ifndef PB_DS_RANGED_PROBE_FN_HPP
+#define PB_DS_RANGED_PROBE_FN_HPP
+
+#include <ext/pb_ds/detail/basic_types.hpp>
+#include <utility>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>
+ class ranged_probe_fn;
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Hash_Fn, typename Allocator, \
+ typename Comb_Probe_Fn, typename Probe_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, false>
+
+ /**
+ * Specialization 1
+ * The client supplies a probe function and a ranged probe
+ * function, and requests that hash values not be stored.
+ **/
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Probe_Fn, typename Probe_Fn>
+ class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+ Probe_Fn, false>
+ : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef Comb_Probe_Fn comb_probe_fn_base;
+ typedef Hash_Fn hash_fn_base;
+ typedef Probe_Fn probe_fn_base;
+ typedef typename Allocator::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ ranged_probe_fn(size_type);
+
+ ranged_probe_fn(size_type, const Hash_Fn&);
+
+ ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&);
+
+ ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&,
+ const Probe_Fn&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ void
+ notify_resized(size_type);
+
+ inline size_type
+ operator()(const_key_reference) const;
+
+ inline size_type
+ operator()(const_key_reference, size_type, size_type) const;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size)
+ { Comb_Probe_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn)
+ : Hash_Fn(r_hash_fn)
+ { Comb_Probe_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn)
+ : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
+ { comb_probe_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn,
+ const Probe_Fn& r_probe_fn)
+ : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
+ { comb_probe_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ comb_probe_fn_base::swap(other);
+ std::swap((Hash_Fn& )(*this), (Hash_Fn&)other);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ notify_resized(size_type size)
+ { comb_probe_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference r_key) const
+ { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference, size_type hash, size_type i) const
+ {
+ return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Hash_Fn, typename Allocator, \
+ typename Comb_Probe_Fn, typename Probe_Fn>
+
+#define PB_DS_CLASS_C_DEC \
+ ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, true>
+
+ /**
+ * Specialization 2- The client supplies a probe function and a ranged
+ * probe function, and requests that hash values not be stored.
+ **/
+ template<typename Key, typename Hash_Fn, typename Allocator,
+ typename Comb_Probe_Fn, typename Probe_Fn>
+ class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,
+ Probe_Fn, true>
+ : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef std::pair<size_type, size_type> comp_hash;
+ typedef Comb_Probe_Fn comb_probe_fn_base;
+ typedef Hash_Fn hash_fn_base;
+ typedef Probe_Fn probe_fn_base;
+ typedef typename Allocator::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ ranged_probe_fn(size_type);
+
+ ranged_probe_fn(size_type, const Hash_Fn&);
+
+ ranged_probe_fn(size_type, const Hash_Fn&,
+ const Comb_Probe_Fn&);
+
+ ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&,
+ const Probe_Fn&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ void
+ notify_resized(size_type);
+
+ inline comp_hash
+ operator()(const_key_reference) const;
+
+ inline size_type
+ operator()(const_key_reference, size_type, size_type) const;
+
+ inline size_type
+ operator()(const_key_reference, size_type) const;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size)
+ { Comb_Probe_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn)
+ : Hash_Fn(r_hash_fn)
+ { Comb_Probe_Fn::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn)
+ : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)
+ { comb_probe_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn,
+ const Comb_Probe_Fn& r_comb_probe_fn,
+ const Probe_Fn& r_probe_fn)
+ : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)
+ { comb_probe_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ comb_probe_fn_base::swap(other);
+ std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ notify_resized(size_type size)
+ { comb_probe_fn_base::notify_resized(size); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::comp_hash
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference r_key) const
+ {
+ const size_type hash = hash_fn_base::operator()(r_key);
+ return std::make_pair(comb_probe_fn_base::operator()(hash), hash);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ operator()(const_key_reference, size_type hash, size_type i) const
+ {
+ return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ operator()
+#ifdef _GLIBCXX_DEBUG
+ (const_key_reference r_key, size_type hash) const
+#else
+ (const_key_reference /*r_key*/, size_type hash) const
+#endif
+ {
+ _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));
+ return hash;
+ }
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ /**
+ * Specialization 3 and 4
+ * The client does not supply a hash function or probe function,
+ * and requests that hash values not be stored.
+ **/
+ template<typename Key, typename Allocator, typename Comb_Probe_Fn>
+ class ranged_probe_fn<Key, null_hash_fn, Allocator, Comb_Probe_Fn,
+ null_probe_fn, false>
+ : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn
+ {
+ protected:
+ typedef typename Allocator::size_type size_type;
+ typedef Comb_Probe_Fn comb_probe_fn_base;
+ typedef typename Allocator::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::const_reference const_key_reference;
+
+ ranged_probe_fn(size_type size)
+ { Comb_Probe_Fn::notify_resized(size); }
+
+ ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn)
+ : Comb_Probe_Fn(r_comb_probe_fn)
+ { }
+
+ ranged_probe_fn(size_type, const null_hash_fn&,
+ const Comb_Probe_Fn& r_comb_probe_fn,
+ const null_probe_fn&)
+ : Comb_Probe_Fn(r_comb_probe_fn)
+ { }
+
+ void
+ swap(ranged_probe_fn& other)
+ { comb_probe_fn_base::swap(other); }
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
new file mode 100644
index 000000000..dad6451d0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_probe_fn.hpp
+ * Contains a sample probe policy.
+ */
+
+#ifndef PB_DS_SAMPLE_PROBE_FN_HPP
+#define PB_DS_SAMPLE_PROBE_FN_HPP
+
+// A sample probe policy.
+class sample_probe_fn
+{
+
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+public:
+
+ // Default constructor.
+ sample_probe_fn();
+
+ // Copy constructor.
+ sample_probe_fn(const sample_probe_fn& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_probe_fn& other);
+
+protected:
+
+ // Returns the i-th offset from the hash value of some key r_key.
+ inline size_type
+ operator()(const_key_reference r_key, size_type i) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
new file mode 100644
index 000000000..0912e7f27
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_range_hashing.hpp
+ * Contains a range hashing policy.
+ */
+
+#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
+#define PB_DS_SAMPLE_RANGE_HASHING_HPP
+
+// A sample range-hashing functor.
+class sample_range_hashing
+{
+
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+public:
+
+ // Default constructor.
+ sample_range_hashing();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_range_hashing& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_range_hashing& other);
+
+protected:
+
+ // Notifies the policy object that the container's __size has changed to size.
+ void
+ notify_resized(size_type size);
+
+ // Transforms the __hash value hash into a ranged-hash value.
+ inline size_type
+ operator()(size_type hash) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
new file mode 100644
index 000000000..6120231e2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_ranged_hash_fn.hpp
+ * Contains a ranged hash policy.
+ */
+
+#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
+#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP
+
+// A sample ranged-hash functor.
+class sample_ranged_hash_fn
+{
+
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+public:
+
+ // Default constructor.
+ sample_ranged_hash_fn();
+
+ // Copy constructor.
+ sample_ranged_hash_fn(const sample_ranged_hash_fn& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_ranged_hash_fn& other);
+
+protected:
+
+ // Notifies the policy object that the container's __size has changed to size.
+ void
+ notify_resized(size_type size);
+
+ // Transforms r_key into a position within the table.
+ inline size_type
+ operator()(const_key_reference r_key) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
new file mode 100644
index 000000000..915f108df
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_ranged_probe_fn.hpp
+ * Contains a ranged probe policy.
+ */
+
+#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
+#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
+
+// A sample ranged-probe functor.
+class sample_ranged_probe_fn
+{
+
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+public:
+
+ // Default constructor.
+ sample_ranged_probe_fn();
+
+ // Copy constructor.
+ sample_ranged_probe_fn(const sample_ranged_probe_fn& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_ranged_probe_fn& other);
+
+protected:
+
+ // Notifies the policy object that the container's __size has changed to size.
+ void
+ notify_resized(size_type size);
+
+ // Transforms the const key reference r_key into the i-th position within the table. This method is called for each collision within the probe sequence.
+ inline size_type
+ operator()(const_key_reference r_key, size_t hash, size_type i) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
new file mode 100644
index 000000000..5955df161
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_iterator.hpp
+ * Contains an iterator class returned by the table's const find and insert
+ * methods.
+ */
+
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP
+
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_const_iterator_<Node, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
+
+ // Const point-type iterator.
+ template<typename Node, class Allocator>
+ class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC
+ {
+
+ private:
+ typedef typename PB_DS_BASE_C_DEC::node_pointer node_pointer;
+
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+
+ // Category.
+ typedef std::forward_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef typename Allocator::difference_type difference_type;
+
+ // Iterator's value type.
+ typedef typename base_type::value_type value_type;
+
+ // Iterator's pointer type.
+ typedef typename base_type::pointer pointer;
+
+ // Iterator's const pointer type.
+ typedef typename base_type::const_pointer const_pointer;
+
+ // Iterator's reference type.
+ typedef typename base_type::reference reference;
+
+ // Iterator's const reference type.
+ typedef typename base_type::const_reference const_reference;
+
+ public:
+
+ inline
+ left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd)
+ { }
+
+ // Default constructor.
+ inline
+ left_child_next_sibling_heap_const_iterator_()
+ { }
+
+ // Copy constructor.
+ inline
+ left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)
+ { }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const PB_DS_CLASS_C_DEC& other) const
+ { return (base_type::m_p_nd == other.m_p_nd); }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const PB_DS_CLASS_C_DEC& other) const
+ { return (base_type::m_p_nd != other.m_p_nd); }
+
+ inline PB_DS_CLASS_C_DEC&
+ operator++()
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != NULL);
+ inc();
+ return (*this);
+ }
+
+ inline PB_DS_CLASS_C_DEC
+ operator++(int)
+ {
+ PB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd);
+ operator++();
+ return (ret_it);
+ }
+
+ private:
+ void
+ inc()
+ {
+ if (base_type::m_p_nd->m_p_next_sibling != NULL)
+ {
+ base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;
+ while (base_type::m_p_nd->m_p_l_child != NULL)
+ base_type::m_p_nd = base_type::m_p_nd->m_p_l_child;
+ return;
+ }
+
+ while (true)
+ {
+ node_pointer p_next = base_type::m_p_nd;
+ base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;
+ if (base_type::m_p_nd == NULL || base_type::m_p_nd->m_p_l_child == p_next)
+ return;
+ }
+ }
+ };
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
new file mode 100644
index 000000000..7d682526b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_point_iterator.hpp
+ * Contains an iterator class returned by the table's const find and insert
+ * methods.
+ */
+
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Node, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>
+
+ // Const point-type iterator.
+ template<typename Node, class Allocator>
+ class left_child_next_sibling_heap_node_const_point_iterator_
+ {
+
+ protected:
+ typedef typename Allocator::template rebind<Node>::other::pointer node_pointer;
+
+ public:
+
+ // Category.
+ typedef trivial_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef trivial_iterator_difference_type difference_type;
+
+ // Iterator's value type.
+ typedef typename Node::value_type value_type;
+
+ // Iterator's pointer type.
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::pointer
+ pointer;
+
+ // Iterator's const pointer type.
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_pointer
+ const_pointer;
+
+ // Iterator's reference type.
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::reference
+ reference;
+
+ // Iterator's const reference type.
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_reference
+ const_reference;
+
+ public:
+
+ inline
+ left_child_next_sibling_heap_node_const_point_iterator_(node_pointer p_nd) : m_p_nd(p_nd)
+ { }
+
+ // Default constructor.
+ inline
+ left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(NULL)
+ { }
+
+ // Copy constructor.
+ inline
+ left_child_next_sibling_heap_node_const_point_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)
+ { }
+
+ // Access.
+ inline const_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ return &m_p_nd->m_value;
+ }
+
+ // Access.
+ inline const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);
+ return m_p_nd->m_value;
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const PB_DS_CLASS_C_DEC& other) const
+ { return m_p_nd == other.m_p_nd; }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const PB_DS_CLASS_C_DEC& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ public:
+ node_pointer m_p_nd;
+ };
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..ea0572527
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_allocator
+PB_DS_CLASS_C_DEC::s_node_allocator;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::no_throw_copies_t
+PB_DS_CLASS_C_DEC::s_no_throw_copies_ind;
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+left_child_next_sibling_heap_() :
+ m_p_root(NULL),
+ m_size(0)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :
+ Cmp_Fn(r_cmp_fn),
+ m_p_root(NULL),
+ m_size(0)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other)
+: Cmp_Fn(other), m_p_root(NULL), m_size(0)
+{
+ m_size = other.m_size;
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ m_p_root = recursive_copy_node(other.m_p_root);
+ m_size = other.m_size;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ value_swap(other);
+ std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+value_swap(PB_DS_CLASS_C_DEC& other)
+{
+ std::swap(m_p_root, other.m_p_root);
+ std::swap(m_size, other.m_size);
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~left_child_next_sibling_heap_()
+{
+ clear();
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+recursive_copy_node(const_node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return (NULL);
+
+ node_pointer p_ret = s_node_allocator.allocate(1);
+
+ __try
+ {
+ new (p_ret) node(*p_nd);
+ }
+ __catch(...)
+ {
+ s_node_allocator.deallocate(p_ret, 1);
+ __throw_exception_again;
+ }
+
+ p_ret->m_p_l_child = p_ret->m_p_next_sibling =
+ p_ret->m_p_prev_or_parent = NULL;
+
+ __try
+ {
+ p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child);
+ p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling);
+ }
+ __catch(...)
+ {
+ clear_imp(p_ret);
+ __throw_exception_again;
+ }
+
+ if (p_ret->m_p_l_child != NULL)
+ p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;
+
+ if (p_ret->m_p_next_sibling != NULL)
+ p_ret->m_p_next_sibling->m_p_prev_or_parent =
+ p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : NULL;
+
+ return p_ret;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..86871ac38
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ _GLIBCXX_DEBUG_ASSERT(m_p_root == NULL || m_p_root->m_p_prev_or_parent == NULL);
+
+ if (m_p_root != NULL)
+ assert_node_consistent(m_p_root, Single_Link_Roots);
+ assert_size();
+ assert_iterators();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_node_consistent(const_node_pointer p_nd, bool single_link) const
+{
+ if (p_nd == NULL)
+ return;
+
+ assert_node_consistent(p_nd->m_p_l_child, false);
+ assert_node_consistent(p_nd->m_p_next_sibling, single_link);
+
+ if (single_link)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent == NULL);
+ else if (p_nd->m_p_next_sibling != NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);
+
+ if (p_nd->m_p_l_child == NULL)
+ return;
+
+ const_node_pointer p_child = p_nd->m_p_l_child;
+ while (p_child != NULL)
+ {
+ const_node_pointer p_next_child = p_child->m_p_next_sibling;
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));
+ p_child = p_next_child;
+ }
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_iterators() const
+{
+ const size_type calc_size = std::distance(begin(), end());
+ if (calc_size == size())
+ return;
+ _GLIBCXX_DEBUG_ASSERT(0);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_size() const
+{
+ if (size_from_node(m_p_root) == m_size)
+ return;
+ _GLIBCXX_DEBUG_ASSERT(0);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size_under_node(const_node_pointer p_nd)
+{ return 1 + size_from_node(p_nd->m_p_l_child); }
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size_from_node(const_node_pointer p_nd)
+{
+ size_type ret = 0;
+ while (p_nd != NULL)
+ {
+ ret += 1 + size_from_node(p_nd->m_p_l_child);
+ p_nd = p_nd->m_p_next_sibling;
+ }
+ return ret;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+degree(const_node_pointer p_nd)
+{
+ size_type ret = 0;
+ const_node_pointer p_child = p_nd->m_p_l_child;
+ while (p_child != NULL)
+ {
+ ++ret;
+ p_child = p_child->m_p_next_sibling;
+ }
+ return ret;
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
new file mode 100644
index 000000000..9fa09f49b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ clear_imp(m_p_root);
+ _GLIBCXX_DEBUG_ASSERT(m_size == 0);
+ m_p_root = NULL;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+actual_erase_node(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+ p_nd->~node();
+ s_node_allocator.deallocate(p_nd, 1);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear_imp(node_pointer p_nd)
+{
+ while (p_nd != NULL)
+ {
+ clear_imp(p_nd->m_p_l_child);
+ node_pointer p_next = p_nd->m_p_next_sibling;
+ actual_erase_node(p_nd);
+ p_nd = p_next;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+to_linked_list()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ node_pointer p_cur = m_p_root;
+ while (p_cur != NULL)
+ if (p_cur->m_p_l_child != NULL)
+ {
+ node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;
+ p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;
+ p_cur->m_p_next_sibling = p_cur->m_p_l_child;
+ p_cur->m_p_l_child = p_child_next;
+ }
+ else
+ p_cur = p_cur->m_p_next_sibling;
+
+#ifdef _GLIBCXX_DEBUG
+ const_node_pointer p_counter = m_p_root;
+ size_type count = 0;
+ while (p_counter != NULL)
+ {
+ ++count;
+ _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == NULL);
+ p_counter = p_counter->m_p_next_sibling;
+ }
+ _GLIBCXX_DEBUG_ASSERT(count == m_size);
+#endif
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+prune(Pred pred)
+{
+ node_pointer p_cur = m_p_root;
+ m_p_root = NULL;
+ node_pointer p_out = NULL;
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+ if (pred(p_cur->m_value))
+ {
+ p_cur->m_p_next_sibling = p_out;
+ if (p_out != NULL)
+ p_out->m_p_prev_or_parent = p_cur;
+ p_out = p_cur;
+ }
+ else
+ {
+ p_cur->m_p_next_sibling = m_p_root;
+ if (m_p_root != NULL)
+ m_p_root->m_p_prev_or_parent = p_cur;
+ m_p_root = p_cur;
+ }
+ p_cur = p_next;
+ }
+ return p_out;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+bubble_to_top(node_pointer p_nd)
+{
+ node_pointer p_parent = parent(p_nd);
+ while (p_parent != NULL)
+ {
+ swap_with_parent(p_nd, p_parent);
+ p_parent = parent(p_nd);
+ }
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
new file mode 100644
index 000000000..75e6561c3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{
+ return (m_size == 0);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{
+ return (m_size);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{
+ return (s_node_allocator.max_size());
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
new file mode 100644
index 000000000..926ccd39c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
@@ -0,0 +1,175 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+get_new_node_for_insert(const_reference r_val)
+{
+ return get_new_node_for_insert(r_val, s_no_throw_copies_ind);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+get_new_node_for_insert(const_reference r_val, false_type)
+{
+ node_pointer p_new_nd = s_node_allocator.allocate(1);
+
+ cond_dealtor_t cond(p_new_nd);
+
+ new (const_cast<void* >(
+ static_cast<const void* >(&p_new_nd->m_value)))
+ typename node::value_type(r_val);
+
+ cond.set_no_action();
+
+ ++m_size;
+
+ return (p_new_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+get_new_node_for_insert(const_reference r_val, true_type)
+{
+ node_pointer p_new_nd = s_node_allocator.allocate(1);
+
+ new (const_cast<void* >(
+ static_cast<const void* >(&p_new_nd->m_value)))
+ typename node::value_type(r_val);
+
+ ++m_size;
+
+ return (p_new_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+make_child_of(node_pointer p_nd, node_pointer p_new_parent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_new_parent != NULL);
+
+ p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;
+
+ if (p_new_parent->m_p_l_child != NULL)
+ p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd;
+
+ p_nd->m_p_prev_or_parent = p_new_parent;
+
+ p_new_parent->m_p_l_child = p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+parent(node_pointer p_nd)
+{
+ while (true)
+ {
+ node_pointer p_pot = p_nd->m_p_prev_or_parent;
+
+ if (p_pot == NULL || p_pot->m_p_l_child == p_nd)
+ return p_pot;
+
+ p_nd = p_pot;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+swap_with_parent(node_pointer p_nd, node_pointer p_parent)
+{
+ if (p_parent == m_p_root)
+ m_p_root = p_nd;
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent);
+
+ const bool nd_direct_child = p_parent->m_p_l_child == p_nd;
+ const bool parent_root = p_parent->m_p_prev_or_parent == NULL;
+ const bool parent_direct_child =
+ !parent_root&& p_parent->m_p_prev_or_parent->m_p_l_child == p_parent;
+
+ std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent);
+ std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling);
+ std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child);
+ std::swap(p_parent->m_metadata, p_nd->m_metadata);
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != NULL);
+
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
+
+ if (p_parent->m_p_next_sibling != NULL)
+ p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;
+
+ if (p_parent->m_p_l_child != NULL)
+ p_parent->m_p_l_child->m_p_prev_or_parent = p_parent;
+
+ if (parent_direct_child)
+ p_nd->m_p_prev_or_parent->m_p_l_child = p_nd;
+ else if (!parent_root)
+ p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd;
+
+ if (!nd_direct_child)
+ {
+ p_nd->m_p_l_child->m_p_prev_or_parent = p_nd;
+
+ p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent;
+ }
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent);
+
+ p_nd->m_p_l_child = p_parent;
+ p_parent->m_p_prev_or_parent = p_nd;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..dca70fdd5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{
+ node_pointer p_nd = m_p_root;
+
+ if (p_nd == NULL)
+ return (iterator(NULL));
+
+ while (p_nd->m_p_l_child != NULL)
+ p_nd = p_nd->m_p_l_child;
+
+ return (iterator(p_nd));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{
+ node_pointer p_nd = m_p_root;
+
+ if (p_nd == NULL)
+ return (const_iterator(NULL));
+
+ while (p_nd->m_p_l_child != NULL)
+ p_nd = p_nd->m_p_l_child;
+
+ return (const_iterator(p_nd));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{
+ return (iterator(NULL));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{
+ return (const_iterator(NULL));
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
new file mode 100644
index 000000000..34ad4bee0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
@@ -0,0 +1,349 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file left_child_next_sibling_heap_.hpp
+ * Contains an implementation class for a basic heap.
+ */
+
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP
+
+/*
+ * Based on CLRS.
+ */
+
+#include <iterator>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>
+#ifdef PB_DS_LC_NS_HEAP_TRACE_
+#include <iostream>
+#endif
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ typename Value_Type, \
+ class Cmp_Fn, \
+ typename Node_Metadata, \
+ class Allocator, \
+ bool Single_Link_Roots>
+#else
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ typename Value_Type, \
+ class Cmp_Fn, \
+ typename Node_Metadata, \
+ class Allocator>
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_< \
+ Value_Type, \
+ Cmp_Fn, \
+ Node_Metadata, \
+ Allocator, \
+ Single_Link_Roots>
+#else
+#define PB_DS_CLASS_C_DEC \
+ left_child_next_sibling_heap_< \
+ Value_Type, \
+ Cmp_Fn, \
+ Node_Metadata, \
+ Allocator>
+#endif
+
+ /**
+ * class description = "Base class for some types of h3ap$">
+ **/
+#ifdef _GLIBCXX_DEBUG
+ template<typename Value_Type,
+ class Cmp_Fn,
+ typename Node_Metadata,
+ class Allocator,
+ bool Single_Link_Roots>
+#else
+ template<typename Value_Type,
+ class Cmp_Fn,
+ typename Node_Metadata,
+ class Allocator>
+#endif
+ class left_child_next_sibling_heap_ : public Cmp_Fn
+ {
+
+ protected:
+ typedef
+ typename Allocator::template rebind<
+ left_child_next_sibling_heap_node_<
+ Value_Type,
+ Node_Metadata,
+ Allocator> >::other
+ node_allocator;
+
+ typedef typename node_allocator::value_type node;
+
+ typedef typename node_allocator::pointer node_pointer;
+
+ typedef typename node_allocator::const_pointer const_node_pointer;
+
+ typedef Node_Metadata node_metadata;
+
+ typedef std::pair< node_pointer, node_pointer> node_pointer_pair;
+
+ private:
+ typedef cond_dealtor< node, Allocator> cond_dealtor_t;
+
+ enum
+ {
+ simple_value = is_simple<Value_Type>::value
+ };
+
+ typedef integral_constant<int, simple_value> no_throw_copies_t;
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::pointer
+ pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_pointer
+ const_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_reference
+ const_reference;
+
+ typedef
+ left_child_next_sibling_heap_node_const_point_iterator_<
+ node,
+ Allocator>
+ const_point_iterator;
+
+ typedef const_point_iterator point_iterator;
+
+ typedef
+ left_child_next_sibling_heap_const_iterator_<
+ node,
+ Allocator>
+ const_iterator;
+
+ typedef const_iterator iterator;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef Allocator allocator_type;
+
+ public:
+
+ left_child_next_sibling_heap_();
+
+ left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn);
+
+ left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ ~left_child_next_sibling_heap_();
+
+ inline bool
+ empty() const;
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ Cmp_Fn&
+ get_cmp_fn();
+
+ const Cmp_Fn&
+ get_cmp_fn() const;
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+ void
+ clear();
+
+#ifdef PB_DS_LC_NS_HEAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ protected:
+
+ inline node_pointer
+ get_new_node_for_insert(const_reference r_val);
+
+ inline static void
+ make_child_of(node_pointer p_nd, node_pointer p_new_parent);
+
+ void
+ value_swap(PB_DS_CLASS_C_DEC& other);
+
+ inline static node_pointer
+ parent(node_pointer p_nd);
+
+ inline void
+ swap_with_parent(node_pointer p_nd, node_pointer p_parent);
+
+ void
+ bubble_to_top(node_pointer p_nd);
+
+ inline void
+ actual_erase_node(node_pointer p_nd);
+
+ void
+ clear_imp(node_pointer p_nd);
+
+ void
+ to_linked_list();
+
+ template<typename Pred>
+ node_pointer
+ prune(Pred pred);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ void
+ assert_node_consistent(const_node_pointer p_nd, bool single_link) const;
+
+ static size_type
+ size_under_node(const_node_pointer p_nd);
+
+ static size_type
+ degree(const_node_pointer p_nd);
+#endif
+
+#ifdef PB_DS_LC_NS_HEAP_TRACE_
+ static void
+ trace_node(const_node_pointer, size_type level);
+#endif
+
+ protected:
+ node_pointer m_p_root;
+
+ size_type m_size;
+
+ private:
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_iterators() const;
+
+ void
+ assert_size() const;
+
+ static size_type
+ size_from_node(const_node_pointer p_nd);
+#endif
+
+ node_pointer
+ recursive_copy_node(const_node_pointer p_nd);
+
+ inline node_pointer
+ get_new_node_for_insert(const_reference r_val, false_type);
+
+ inline node_pointer
+ get_new_node_for_insert(const_reference r_val, true_type);
+
+#ifdef PB_DS_LC_NS_HEAP_TRACE_
+ template<typename Metadata_>
+ static void
+ trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>);
+
+ static void
+ trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>);
+#endif
+
+ private:
+ static node_allocator s_node_allocator;
+
+ static no_throw_copies_t s_no_throw_copies_ind;
+ };
+
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
new file mode 100644
index 000000000..1cdfe2883
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
@@ -0,0 +1,123 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node.hpp
+ * Contains an implementation struct for this type of heap's node.
+ */
+
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
+
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Value_Type, typename Metadata_Type, class Allocator>
+ struct left_child_next_sibling_heap_node_
+ {
+ private:
+ typedef
+ left_child_next_sibling_heap_node_<
+ Value_Type,
+ Metadata_Type,
+ Allocator>
+ this_type;
+
+ public:
+ typedef typename Allocator::size_type size_type;
+
+ typedef
+ typename Allocator::template rebind<
+ this_type>::other::pointer
+ node_pointer;
+
+ typedef Value_Type value_type;
+
+ typedef Metadata_Type metadata_type;
+
+ public:
+ value_type m_value;
+
+ metadata_type m_metadata;
+
+ node_pointer m_p_l_child;
+
+ node_pointer m_p_next_sibling;
+
+ node_pointer m_p_prev_or_parent;
+ };
+
+ template<typename Value_Type, class Allocator>
+ struct left_child_next_sibling_heap_node_<
+ Value_Type,
+ null_left_child_next_sibling_heap_node_metadata,
+ Allocator>
+ {
+ private:
+ typedef
+ left_child_next_sibling_heap_node_<
+ Value_Type,
+ null_left_child_next_sibling_heap_node_metadata,
+ Allocator>
+ this_type;
+
+ public:
+ typedef typename Allocator::size_type size_type;
+
+ typedef
+ typename Allocator::template rebind<
+ this_type>::other::pointer
+ node_pointer;
+
+ typedef Value_Type value_type;
+
+ public:
+ value_type m_value;
+
+ node_pointer m_p_l_child;
+
+ node_pointer m_p_next_sibling;
+
+ node_pointer m_p_prev_or_parent;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
new file mode 100644
index 000000000..040466e8e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file null_metadata.hpp
+ * Contains an implementation struct for this type of heap's node.
+ */
+
+#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP
+#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ struct null_left_child_next_sibling_heap_node_metadata
+ { };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..350b4d08a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
@@ -0,0 +1,52 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn() const
+{ return *this; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
new file mode 100644
index 000000000..2b90cfa1d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+#ifdef PB_DS_LC_NS_HEAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << std::endl;
+
+ trace_node(m_p_root, 0);
+
+ std::cerr << std::endl;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_node(const_node_pointer p_nd, size_type level)
+{
+ while (p_nd != NULL)
+ {
+ for (size_type i = 0; i < level; ++i)
+ std::cerr << ' ';
+
+ std::cerr << p_nd <<
+ " prev = " << p_nd->m_p_prev_or_parent <<
+ " next " << p_nd->m_p_next_sibling <<
+ " left = " << p_nd->m_p_l_child << " ";
+
+ trace_node_metadata(p_nd, type_to_type<node_metadata>());
+
+ std::cerr << p_nd->m_value << std::endl;
+
+ trace_node(p_nd->m_p_l_child, level + 1);
+
+ p_nd = p_nd->m_p_next_sibling;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Metadata_>
+void
+PB_DS_CLASS_C_DEC::
+trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+{
+ std::cerr << "(" << p_nd->m_metadata << ") ";
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>)
+{ }
+
+#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
new file mode 100644
index 000000000..c998c3e67
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructor_destructor_fn_imps.hpp
+ * Contains implementations of PB_DS_CLASS_NAME.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::entry_allocator
+PB_DS_CLASS_C_DEC::s_entry_allocator;
+
+PB_DS_CLASS_T_DEC
+Eq_Fn PB_DS_CLASS_C_DEC::s_eq_fn;
+
+PB_DS_CLASS_T_DEC
+null_lu_metadata PB_DS_CLASS_C_DEC::s_null_lu_metadata;
+
+PB_DS_CLASS_T_DEC
+Update_Policy PB_DS_CLASS_C_DEC::s_update_policy;
+
+PB_DS_CLASS_T_DEC
+type_to_type<
+ typename PB_DS_CLASS_C_DEC::update_metadata> PB_DS_CLASS_C_DEC::s_metadata_type_indicator;
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME() : m_p_l(NULL)
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(NULL)
+{
+ copy_from_range(first_it, last_it);
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+#ifdef _GLIBCXX_DEBUG
+ debug_base(),
+#endif
+m_p_l(NULL)
+{
+ __try
+ {
+ for (const_iterator it = other.begin(); it != other.end(); ++it)
+ {
+ entry_pointer p_l = allocate_new_entry(*it,
+ PB_DS_TYPES_TRAITS_C_DEC::m_no_throw_copies_indicator);
+
+ p_l->m_p_next = m_p_l;
+ m_p_l = p_l;
+ }
+ }
+ __catch(...)
+ {
+ deallocate_all();
+ __throw_exception_again;
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
+ std::swap(m_p_l, other.m_p_l);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+deallocate_all()
+{
+ entry_pointer p_l = m_p_l;
+ while (p_l != NULL)
+ {
+ entry_pointer p_next_l = p_l->m_p_next;
+ actual_erase_entry(p_l);
+ p_l = p_next_l;
+ }
+ m_p_l = NULL;
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_CLASS_NAME()
+{ deallocate_all(); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
new file mode 100644
index 000000000..95e9e22b1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains implementations of cc_ht_map_'s debug-mode functions.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ size_type calc_size = 0;
+ for (const_iterator it = begin(); it != end(); ++it)
+ {
+ debug_base::check_key_exists(PB_DS_V2F(*it));
+ ++calc_size;
+ }
+ debug_base::check_size(calc_size);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
new file mode 100644
index 000000000..021ef50d8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file entry_metadata_base.hpp
+ * Contains an implementation for a list update map.
+ */
+
+#ifndef PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP
+#define PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Metadata>
+ struct lu_map_entry_metadata_base
+ {
+ Metadata m_update_metadata;
+ };
+
+ template<>
+ struct lu_map_entry_metadata_base<null_lu_metadata>
+ { };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
new file mode 100644
index 000000000..cdc59208f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains implementations of lu_map_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ if (m_p_l == NULL)
+ return false;
+
+ if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
+ {
+ entry_pointer p_next = m_p_l->m_p_next;
+ actual_erase_entry(m_p_l);
+ m_p_l = p_next;
+ return true;
+ }
+
+ entry_pointer p_l = m_p_l;
+ while (p_l->m_p_next != NULL)
+ if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value)))
+ {
+ erase_next(p_l);
+ return true;
+ }
+ else
+ p_l = p_l->m_p_next;
+ return false;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ deallocate_all();
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ size_type num_ersd = 0;
+ while (m_p_l != NULL && pred(m_p_l->m_value))
+ {
+ entry_pointer p_next = m_p_l->m_p_next;
+ ++num_ersd;
+ actual_erase_entry(m_p_l);
+ m_p_l = p_next;
+ }
+
+ if (m_p_l == NULL)
+ return num_ersd;
+
+ entry_pointer p_l = m_p_l;
+ while (p_l->m_p_next != NULL)
+ {
+ if (pred(p_l->m_p_next->m_value))
+ {
+ ++num_ersd;
+ erase_next(p_l);
+ }
+ else
+ p_l = p_l->m_p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ return num_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_next(entry_pointer p_l)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_l != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_l != m_p_l);
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != NULL);
+ entry_pointer p_next_l = p_l->m_p_next->m_p_next;
+ actual_erase_entry(p_l->m_p_next);
+ p_l->m_p_next = p_next_l;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+actual_erase_entry(entry_pointer p_l)
+{
+ _GLIBCXX_DEBUG_ONLY(debug_base::erase_existing(PB_DS_V2F(p_l->m_value));)
+ p_l->~entry();
+ s_entry_allocator.deallocate(p_l, 1);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
new file mode 100644
index 000000000..50347ac5f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains implementations of lu_map_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+find_imp(const_key_reference r_key) const
+{
+ if (m_p_l == NULL)
+ return NULL;
+ if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))
+ {
+ apply_update(m_p_l, s_metadata_type_indicator);
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key);)
+ return m_p_l;
+ }
+
+ entry_pointer p_l = m_p_l;
+ while (p_l->m_p_next != NULL)
+ {
+ entry_pointer p_next = p_l->m_p_next;
+ if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value)))
+ {
+ if (apply_update(p_next, s_metadata_type_indicator))
+ {
+ p_l->m_p_next = p_next->m_p_next;
+ p_next->m_p_next = m_p_l;
+ m_p_l = p_next;
+ return m_p_l;
+ }
+ return p_next;
+ }
+ else
+ p_l = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return NULL;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Metadata>
+inline bool
+PB_DS_CLASS_C_DEC::
+apply_update(entry_pointer p_l, type_to_type<Metadata>)
+{ return s_update_policy(p_l->m_update_metadata); }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+apply_update(entry_pointer, type_to_type<null_lu_metadata>)
+{ return s_update_policy(s_null_lu_metadata); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
new file mode 100644
index 000000000..5ad39709d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains implementations of lu_map_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{ return std::distance(begin(), end()); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{ return s_entry_allocator.max_size(); }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{ return (m_p_l == NULL); }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
new file mode 100644
index 000000000..5efe2a13a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains implementations of lu_map_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline std::pair<
+ typename PB_DS_CLASS_C_DEC::point_iterator,
+ bool>
+PB_DS_CLASS_C_DEC::
+insert(const_reference r_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ entry_pointer p_l = find_imp(PB_DS_V2F(r_val));
+
+ if (p_l != NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val));)
+ return std::make_pair(point_iterator(&p_l->m_value), false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_val));)
+
+ p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator);
+ p_l->m_p_next = m_p_l;
+ m_p_l = p_l;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return std::make_pair(point_iterator(&p_l->m_value), true);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+allocate_new_entry(const_reference r_val, false_type)
+{
+ entry_pointer p_l = s_entry_allocator.allocate(1);
+ cond_dealtor_t cond(p_l);
+ new (const_cast<void* >(static_cast<const void* >(&p_l->m_value)))
+ value_type(r_val);
+
+ cond.set_no_action();
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
+ init_entry_metadata(p_l, s_metadata_type_indicator);
+ return p_l;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::entry_pointer
+PB_DS_CLASS_C_DEC::
+allocate_new_entry(const_reference r_val, true_type)
+{
+ entry_pointer p_l = s_entry_allocator.allocate(1);
+ new (&p_l->m_value) value_type(r_val);
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
+ init_entry_metadata(p_l, s_metadata_type_indicator);
+ return p_l;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Metadata>
+inline void
+PB_DS_CLASS_C_DEC::
+init_entry_metadata(entry_pointer p_l, type_to_type<Metadata>)
+{ new (&p_l->m_update_metadata) Metadata(s_update_policy()); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>)
+{ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..e3247c5b0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains implementations of lu_map_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{
+ if (m_p_l == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(empty());
+ return end();
+ }
+ return iterator(&m_p_l->m_value, m_p_l, this);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{
+ if (m_p_l == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(empty());
+ return end();
+ }
+ return iterator(&m_p_l->m_value, m_p_l, const_cast<PB_DS_CLASS_C_DEC* >(this));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{ return iterator(NULL, NULL, this); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{
+ return const_iterator(NULL, NULL, const_cast<PB_DS_CLASS_C_DEC* const>(this));
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
new file mode 100644
index 000000000..0e9336b57
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
@@ -0,0 +1,359 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file lu_map_.hpp
+ * Contains a list update map.
+ */
+
+#include <utility>
+#include <iterator>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp>
+#include <ext/pb_ds/exception.hpp>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
+#ifdef PB_DS_LU_MAP_TRACE_
+#include <iostream>
+#endif
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, class Eq_Fn, \
+ class Allocator, class Update_Policy>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME lu_map_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME lu_map_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME<Key, Mapped, Eq_Fn, Allocator, Update_Policy>
+
+#define PB_DS_TYPES_TRAITS_C_DEC \
+ types_traits<Key, Mapped, Allocator, false>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, Eq_Fn, \
+ typename Allocator::template rebind<Key>::other::const_reference>
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#endif
+
+ /* Skip to the lu, my darling. */
+ // list-based (with updates) associative container.
+ template<typename Key,
+ typename Mapped,
+ class Eq_Fn,
+ class Allocator,
+ class Update_Policy>
+ class PB_DS_CLASS_NAME :
+#ifdef _GLIBCXX_DEBUG
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
+#endif
+ public PB_DS_TYPES_TRAITS_C_DEC
+ {
+ private:
+ typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+
+ struct entry
+ : public lu_map_entry_metadata_base<typename Update_Policy::metadata_type>
+ {
+ typename traits_base::value_type m_value;
+ typename Allocator::template rebind<entry>::other::pointer m_p_next;
+ };
+
+ typedef typename Allocator::template rebind<entry>::other entry_allocator;
+ typedef typename entry_allocator::pointer entry_pointer;
+ typedef typename entry_allocator::const_pointer const_entry_pointer;
+ typedef typename entry_allocator::reference entry_reference;
+ typedef typename entry_allocator::const_reference const_entry_reference;
+
+ typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;
+ typedef typename entry_pointer_allocator::pointer entry_pointer_array;
+
+ typedef typename traits_base::value_type value_type_;
+ typedef typename traits_base::pointer pointer_;
+ typedef typename traits_base::const_pointer const_pointer_;
+ typedef typename traits_base::reference reference_;
+ typedef typename traits_base::const_reference const_reference_;
+
+#define PB_DS_GEN_POS entry_pointer
+
+#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>
+#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>
+
+#undef PB_DS_GEN_POS
+
+
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+ typedef cond_dealtor<entry, Allocator> cond_dealtor_t;
+
+ public:
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef Eq_Fn eq_fn;
+ typedef Update_Policy update_policy;
+ typedef typename Update_Policy::metadata_type update_metadata;
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef point_iterator_ point_iterator;
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+ typedef const_point_iterator_ point_iterator;
+#endif
+
+ typedef const_point_iterator_ const_point_iterator;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef iterator_ iterator;
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+ typedef const_iterator_ iterator;
+#endif
+
+ typedef const_iterator_ const_iterator;
+
+ public:
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ virtual
+ ~PB_DS_CLASS_NAME();
+
+ template<typename It>
+ PB_DS_CLASS_NAME(It first_it, It last_it);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ inline bool
+ empty() const;
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return insert(std::make_pair(r_key, mapped_type())).first->second;
+#else
+ insert(r_key);
+ return traits_base::s_null_mapped;
+#endif
+ }
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference);
+
+ inline point_iterator
+ find(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ entry_pointer p_e = find_imp(r_key);
+ return point_iterator(p_e == NULL ? NULL: &p_e->m_value);
+ }
+
+ inline const_point_iterator
+ find(const_key_reference r_key) const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ entry_pointer p_e = find_imp(r_key);
+ return const_point_iterator(p_e == NULL ? NULL: &p_e->m_value);
+ }
+
+ inline bool
+ erase(const_key_reference);
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred);
+
+ void
+ clear();
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_LU_MAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ protected:
+
+ template<typename It>
+ void
+ copy_from_range(It, It);
+
+ private:
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ friend class iterator_;
+#endif
+
+ friend class const_iterator_;
+
+ inline entry_pointer
+ allocate_new_entry(const_reference, false_type);
+
+ inline entry_pointer
+ allocate_new_entry(const_reference, true_type);
+
+ template<typename Metadata>
+ inline static void
+ init_entry_metadata(entry_pointer, type_to_type<Metadata>);
+
+ inline static void
+ init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>);
+
+ void
+ deallocate_all();
+
+ void
+ erase_next(entry_pointer);
+
+ void
+ actual_erase_entry(entry_pointer);
+
+ void
+ inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const
+ {
+ r_pos = r_pos->m_p_next;
+ r_p_value = (r_pos == NULL) ? NULL : &r_pos->m_value;
+ }
+
+ template<typename Metadata>
+ inline static bool
+ apply_update(entry_pointer, type_to_type<Metadata>);
+
+ inline static bool
+ apply_update(entry_pointer, type_to_type<null_lu_metadata>);
+
+ inline entry_pointer
+ find_imp(const_key_reference) const;
+
+ static entry_allocator s_entry_allocator;
+ static Eq_Fn s_eq_fn;
+ static Update_Policy s_update_policy;
+ static type_to_type<update_metadata> s_metadata_type_indicator;
+ static null_lu_metadata s_null_lu_metadata;
+
+ mutable entry_pointer m_p_l;
+ };
+
+#include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_DEBUG_MAP_BASE_C_DEC
+#undef PB_DS_CLASS_NAME
+#undef PB_DS_V2F
+#undef PB_DS_EP2VP
+#undef PB_DS_V2S
+
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
new file mode 100644
index 000000000..908aacc19
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains implementations of lu_map_.
+ */
+
+#ifdef PB_DS_LU_MAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << m_p_l << std::endl << std::endl;
+ const_entry_pointer p_l = m_p_l;
+ while (p_l != NULL)
+ {
+ std::cerr << PB_DS_V2F(p_l->m_value) << std::endl;
+ p_l = p_l->m_p_next;
+ }
+ std::cerr << std::endl;
+}
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
new file mode 100644
index 000000000..4ef7fe48a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file counter_lu_metadata.hpp
+ * Contains implementation of a lu counter policy's metadata.
+ */
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Size_Type>
+ class counter_lu_policy_base;
+
+ // A list-update metadata type that moves elements to the front of
+ // the list based on the counter algorithm.
+ template<typename Size_Type = size_t>
+ class counter_lu_metadata
+ {
+ public:
+ typedef Size_Type size_type;
+
+ private:
+ counter_lu_metadata(size_type init_count) : m_count(init_count)
+ { }
+
+ friend class counter_lu_policy_base<size_type>;
+
+ mutable size_type m_count;
+ };
+
+ template<typename Size_Type>
+ class counter_lu_policy_base
+ {
+ protected:
+ typedef Size_Type size_type;
+
+ counter_lu_metadata<size_type>
+ operator()(size_type max_size) const
+ { return counter_lu_metadata<Size_Type>(std::rand() % max_size); }
+
+ template<typename Metadata_Reference>
+ bool
+ operator()(Metadata_Reference r_data, size_type m_max_count) const
+ {
+ if (++r_data.m_count != m_max_count)
+ return false;
+ r_data.m_count = 0;
+ return true;
+ }
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
new file mode 100644
index 000000000..f74a9fb54
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file counter_lu_policy_imp.hpp
+ * Contains a lu counter policy implementation.
+ */
+
+PB_DS_CLASS_T_DEC
+detail::counter_lu_metadata<typename Allocator::size_type>
+PB_DS_CLASS_C_DEC::
+operator()() const
+{ return (base_type::operator()(max_count)); }
+
+PB_DS_CLASS_T_DEC
+bool
+PB_DS_CLASS_C_DEC::
+operator()(metadata_reference r_data) const
+{ return (base_type::operator()(r_data, max_count)); }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
new file mode 100644
index 000000000..34426c538
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file mtf_lu_policy_imp.hpp
+ * Contains a move-to-front policy implementation.
+ */
+
+PB_DS_CLASS_T_DEC
+null_lu_metadata PB_DS_CLASS_C_DEC::s_metadata;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::metadata_type
+PB_DS_CLASS_C_DEC::
+operator()() const
+{ return s_metadata; }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+operator()(metadata_reference /*r_data*/) const
+{ return true; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
new file mode 100644
index 000000000..c5da1e9d0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_update_policy.hpp
+ * Contains a sample policy for list update containers.
+ */
+
+#ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP
+#define PB_DS_SAMPLE_UPDATE_POLICY_HPP
+
+// A sample list-update policy.
+struct sample_update_policy
+{
+ // Default constructor.
+ sample_update_policy();
+
+ // Copy constructor.
+ sample_update_policy(const sample_update_policy&);
+
+ // Swaps content.
+ inline void
+ swap(sample_update_policy& other);
+
+protected:
+ // Metadata on which this functor operates.
+ typedef some_metadata_type metadata_type;
+
+ // Creates a metadata object.
+ metadata_type
+ operator()() const;
+
+ // Decides whether a metadata object should be moved to the front of
+ // the list. A list-update based containers object will call this
+ // method to decide whether to move a node to the front of the
+ // list. The method shoule return true if the node should be moved
+ // to the front of the list.
+ bool
+ operator()(metadata_reference) const;
+};
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
new file mode 100644
index 000000000..e2c4b9ae9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cond_dtor.hpp
+ * Contains a conditional destructor
+ */
+
+template<typename Size_Type>
+class cond_dtor
+{
+public:
+ cond_dtor(value_vector a_vec, iterator& r_last_it, Size_Type total_size)
+ : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),
+ m_no_action(false)
+ { }
+
+ ~cond_dtor()
+ {
+ if (m_no_action)
+ return;
+ iterator it = m_a_vec;
+ while (it != m_r_last_it)
+ {
+ it->~value_type();
+ ++it;
+ }
+
+ if (m_max_size > 0)
+ value_allocator().deallocate(m_a_vec, m_max_size);
+ }
+
+ inline void
+ set_no_action()
+ { m_no_action = true; }
+
+protected:
+ value_vector m_a_vec;
+ iterator& m_r_last_it;
+ const Size_Type m_max_size;
+ bool m_no_action;
+};
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..545b98162
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,273 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::value_allocator
+PB_DS_CLASS_C_DEC::s_value_alloc;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::metadata_allocator
+PB_DS_CLASS_C_DEC::s_metadata_alloc;
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_OV_TREE_CLASS_NAME() :
+ m_a_values(NULL),
+ m_a_metadata(NULL),
+ m_end_it(NULL),
+ m_size(0)
+{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+ cmp_fn_base(r_cmp_fn),
+ m_a_values(NULL),
+ m_a_metadata(NULL),
+ m_end_it(NULL),
+ m_size(0)
+{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+ cmp_fn_base(r_cmp_fn),
+ node_update(r_node_update),
+ m_a_values(NULL),
+ m_a_metadata(NULL),
+ m_end_it(NULL),
+ m_size(0)
+{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+#ifdef _GLIBCXX_DEBUG
+ debug_base(other),
+#endif
+#ifdef PB_DS_TREE_TRACE
+ PB_DS_TREE_TRACE_BASE_C_DEC(other),
+#endif
+ cmp_fn_base(other),
+ node_update(other),
+ m_a_values(NULL),
+ m_a_metadata(NULL),
+ m_end_it(NULL),
+ m_size(0)
+{
+ copy_from_ordered_range(other.begin(), other.end());
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+inline void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef
+ std::map<
+ key_type,
+ mapped_type,
+ Cmp_Fn,
+ typename Allocator::template rebind<
+ value_type>::other>
+ map_type;
+#else
+ typedef
+ std::set<
+ key_type,
+ Cmp_Fn,
+ typename Allocator::template rebind<
+ Key>::other>
+ map_type;
+#endif
+
+ map_type m(first_it, last_it);
+ copy_from_ordered_range(m.begin(), m.end());
+}
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_ordered_range(It first_it, It last_it)
+{
+ const size_type len = std::distance(first_it, last_it);
+ if (len == 0)
+ return;
+
+ value_vector a_values = s_value_alloc.allocate(len);
+ iterator target_it = a_values;
+ It source_it = first_it;
+ It source_end_it = last_it;
+
+ cond_dtor<size_type> cd(a_values, target_it, len);
+ while (source_it != source_end_it)
+ {
+ new (const_cast<void* >(static_cast<const void* >(target_it)))
+ value_type(*source_it++);
+
+ ++target_it;
+ }
+
+ reallocate_metadata((node_update* )this, len);
+ cd.set_no_action();
+ m_a_values = a_values;
+ m_size = len;
+ m_end_it = m_a_values + m_size;
+ update(PB_DS_node_begin_imp(), (node_update* )this);
+
+#ifdef _GLIBCXX_DEBUG
+ const_iterator dbg_it = m_a_values;
+ while (dbg_it != m_end_it)
+ {
+ debug_base::insert_new(PB_DS_V2F(*dbg_it));
+ dbg_it++;
+ }
+ PB_DS_CLASS_C_DEC::assert_valid();
+#endif
+}
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_ordered_range(It first_it, It last_it, It other_first_it,
+ It other_last_it)
+{
+ clear();
+ const size_type len = std::distance(first_it, last_it)
+ + std::distance(other_first_it, other_last_it);
+
+ value_vector a_values = s_value_alloc.allocate(len);
+
+ iterator target_it = a_values;
+ It source_it = first_it;
+ It source_end_it = last_it;
+
+ cond_dtor<size_type> cd(a_values, target_it, len);
+ while (source_it != source_end_it)
+ {
+ new (const_cast<void* >(static_cast<const void* >(target_it)))
+ value_type(*source_it++);
+ ++target_it;
+ }
+
+ source_it = other_first_it;
+ source_end_it = other_last_it;
+
+ while (source_it != source_end_it)
+ {
+ new (const_cast<void* >(static_cast<const void* >(target_it)))
+ value_type(*source_it++);
+ ++target_it;
+ }
+
+ reallocate_metadata((node_update* )this, len);
+ cd.set_no_action();
+ m_a_values = a_values;
+ m_size = len;
+ m_end_it = m_a_values + m_size;
+ update(PB_DS_node_begin_imp(), (node_update* )this);
+
+#ifdef _GLIBCXX_DEBUG
+ const_iterator dbg_it = m_a_values;
+ while (dbg_it != m_end_it)
+ {
+ debug_base::insert_new(PB_DS_V2F(*dbg_it));
+ dbg_it++;
+ }
+ PB_DS_CLASS_C_DEC::assert_valid();
+#endif
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ value_swap(other);
+ std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+value_swap(PB_DS_CLASS_C_DEC& other)
+{
+ std::swap(m_a_values, other.m_a_values);
+ std::swap(m_a_metadata, other.m_a_metadata);
+ std::swap(m_size, other.m_size);
+ std::swap(m_end_it, other.m_end_it);
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_OV_TREE_CLASS_NAME()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
+ reallocate_metadata((node_update* )this, 0);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update(node_iterator /*it*/, null_node_update_pointer)
+{ }
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update>
+void
+PB_DS_CLASS_C_DEC::
+update(node_iterator nd_it, Node_Update* p_update)
+{
+ const_node_iterator end_it = PB_DS_node_end_imp();
+ if (nd_it == end_it)
+ return;
+ update(nd_it.get_l_child(), p_update);
+ update(nd_it.get_r_child(), p_update);
+ node_update::operator()(nd_it, end_it);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
new file mode 100644
index 000000000..c32a8af48
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
@@ -0,0 +1,84 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ std::cout << "av1" << std::endl;
+
+ if (m_a_values == NULL || m_end_it == NULL || m_size == 0)
+ _GLIBCXX_DEBUG_ASSERT(m_a_values == NULL && m_end_it == NULL && m_size == 0);
+
+ std::cout << "av2" << std::endl;
+ assert_iterators();
+ std::cout << "av3" << std::endl;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_iterators() const
+{
+ debug_base::check_size(m_size);
+ size_type iterated_num = 0;
+ const_iterator prev_it = end();
+ _GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size);
+ for (const_iterator it = begin(); it != end(); ++it)
+ {
+ ++iterated_num;
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(*it));)
+ _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);
+ const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
+ --upper_bound_it;
+ _GLIBCXX_DEBUG_ASSERT(upper_bound_it == it);
+ if (prev_it != end())
+ _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),
+ PB_DS_V2F(*it)));
+ prev_it = it;
+ }
+ _GLIBCXX_DEBUG_ASSERT(iterated_num == m_size);
+}
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
new file mode 100644
index 000000000..618306dce
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
@@ -0,0 +1,193 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (m_size == 0)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return;
+ }
+ else
+ {
+ reallocate_metadata((node_update* )this, 0);
+ cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+ m_a_values = NULL;
+ m_size = 0;
+ m_end_it = m_a_values;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+#ifdef PB_DS_REGRESSION
+ typename Allocator::group_throw_prob_adjustor adjust(m_size);
+#endif
+
+ size_type new_size = 0;
+ size_type num_val_ersd = 0;
+ iterator source_it = m_a_values;
+ for (source_it = begin(); source_it != m_end_it; ++source_it)
+ if (!pred(*source_it))
+ ++new_size;
+ else
+ ++num_val_ersd;
+
+ if (new_size == 0)
+ {
+ clear();
+ return num_val_ersd;
+ }
+
+ value_vector a_new_values = s_value_alloc.allocate(new_size);
+ iterator target_it = a_new_values;
+ cond_dtor<size_type> cd(a_new_values, target_it, new_size);
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear());
+ for (source_it = begin(); source_it != m_end_it; ++source_it)
+ {
+ if (!pred(*source_it))
+ {
+ new (const_cast<void*>(static_cast<const void* >(target_it)))
+ value_type(*source_it);
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(*source_it)));
+ ++target_it;
+ }
+ }
+
+ reallocate_metadata((node_update* )this, new_size);
+ cd.set_no_action();
+
+ {
+ cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
+ }
+
+ m_a_values = a_new_values;
+ m_size = new_size;
+ m_end_it = target_it;
+ update(node_begin(), (node_update* )this);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return num_val_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+It
+PB_DS_CLASS_C_DEC::
+erase_imp(It it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (it == end())
+ return end();
+
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::check_key_exists(PB_DS_V2F(*it));)
+
+#ifdef PB_DS_REGRESSION
+ typename Allocator::group_throw_prob_adjustor adjust(m_size);
+#endif
+
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ value_vector a_values = s_value_alloc.allocate(m_size - 1);
+ iterator source_it = begin();
+ iterator source_end_it = end();
+ iterator target_it = a_values;
+ iterator ret_it = end();
+
+ cond_dtor<size_type> cd(a_values, target_it, m_size - 1);
+
+ _GLIBCXX_DEBUG_ONLY(size_type cnt = 0;)
+
+ while (source_it != source_end_it)
+ {
+ if (source_it != it)
+ {
+ _GLIBCXX_DEBUG_ONLY(++cnt;)
+ _GLIBCXX_DEBUG_ASSERT(cnt != m_size);
+ new (const_cast<void* >(static_cast<const void* >(target_it)))
+ value_type(*source_it);
+
+ ++target_it;
+ }
+ else
+ ret_it = target_it;
+ ++source_it;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ reallocate_metadata((node_update* )this, m_size - 1);
+ cd.set_no_action();
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::erase_existing(PB_DS_V2F(*it));)
+ {
+ cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
+ }
+
+ m_a_values = a_values;
+ --m_size;
+ m_end_it = m_a_values + m_size;
+ update(node_begin(), (node_update* )this);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return It(ret_it);
+}
+
+PB_DS_CLASS_T_DEC
+bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ point_iterator it = find(r_key);
+ if (it == end())
+ return false;
+ erase(it);
+ return true;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
new file mode 100644
index 000000000..c9421af39
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return m_size;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{ return s_value_alloc.max_size(); }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{ return size() == 0; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
new file mode 100644
index 000000000..91d277b0c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+reallocate_metadata(null_node_update_pointer, size_type)
+{ }
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update_>
+void
+PB_DS_CLASS_C_DEC::
+reallocate_metadata(Node_Update_* , size_type new_size)
+{
+ metadata_pointer a_new_metadata_vec =(new_size == 0) ? NULL : s_metadata_alloc.allocate(new_size);
+
+ if (m_a_metadata != NULL)
+ {
+ for (size_type i = 0; i < m_size; ++i)
+ m_a_metadata[i].~metadata_type();
+ s_metadata_alloc.deallocate(m_a_metadata, m_size);
+ }
+ std::swap(m_a_metadata, a_new_metadata_vec);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..7652c4c2e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+node_begin() const
+{ return PB_DS_node_begin_imp(); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+node_end() const
+{ return PB_DS_node_end_imp(); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_begin()
+{ return PB_DS_node_begin_imp(); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_end()
+{ return PB_DS_node_end_imp(); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+PB_DS_node_begin_imp() const
+{
+ return const_node_iterator(const_cast<pointer>(mid_pointer(begin(), end())),
+ const_cast<pointer>(begin()),
+ const_cast<pointer>(end()),(m_a_metadata == NULL)?
+ NULL :
+ mid_pointer(m_a_metadata, m_a_metadata + m_size));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+PB_DS_node_end_imp() const
+{
+ return const_node_iterator(end(), end(), end(),
+ (m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+PB_DS_node_begin_imp()
+{
+ return node_iterator(mid_pointer(begin(), end()), begin(), end(),
+ (m_a_metadata == NULL) ? NULL : mid_pointer(m_a_metadata, m_a_metadata + m_size));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+PB_DS_node_end_imp()
+{
+ return node_iterator(end(), end(),
+ end(),(m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
new file mode 100644
index 000000000..68fedc0eb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
@@ -0,0 +1,292 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_iterators.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+#ifndef PB_DS_OV_TREE_NODE_ITERATORS_HPP
+#define PB_DS_OV_TREE_NODE_ITERATORS_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC \
+ ov_tree_node_const_it_<Value_Type, Metadata_Type, Allocator>
+
+ // Const node reference.
+ template<typename Value_Type, typename Metadata_Type, class Allocator>
+ class ov_tree_node_const_it_
+ {
+
+ protected:
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other::pointer
+ pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other::const_pointer
+ const_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Metadata_Type>::other::const_pointer
+ const_metadata_pointer;
+
+ typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC this_type;
+
+ protected:
+
+ template<typename Ptr>
+ inline static Ptr
+ mid_pointer(Ptr p_begin, Ptr p_end)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);
+ return (p_begin + (p_end - p_begin) / 2);
+ }
+
+ public:
+
+ typedef trivial_iterator_tag iterator_category;
+
+ typedef trivial_iterator_difference_type difference_type;
+
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other::const_pointer
+ value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ Value_Type>::type>::other::const_pointer
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ Value_Type>::type>::other::const_pointer
+ const_reference;
+
+ typedef Metadata_Type metadata_type;
+
+ typedef
+ typename Allocator::template rebind<
+ metadata_type>::other::const_reference
+ const_metadata_reference;
+
+ public:
+ inline
+ ov_tree_node_const_it_(const_pointer p_nd = NULL, const_pointer p_begin_nd = NULL, const_pointer p_end_nd = NULL, const_metadata_pointer p_metadata = NULL) : m_p_value(const_cast<pointer>(p_nd)), m_p_begin_value(const_cast<pointer>(p_begin_nd)), m_p_end_value(const_cast<pointer>(p_end_nd)), m_p_metadata(p_metadata)
+ { }
+
+ inline const_reference
+ operator*() const
+ { return m_p_value; }
+
+ inline const_metadata_reference
+ get_metadata() const
+ {
+ enum
+ {
+ has_metadata = !is_same<Metadata_Type, null_node_metadata>::value
+ };
+
+ PB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);
+ _GLIBCXX_DEBUG_ASSERT(m_p_metadata != NULL);
+ return *m_p_metadata;
+ }
+
+ inline this_type
+ get_l_child() const
+ {
+ if (m_p_begin_value == m_p_value)
+ return (this_type(m_p_begin_value, m_p_begin_value, m_p_begin_value));
+
+ const_metadata_pointer p_begin_metadata =
+ m_p_metadata - (m_p_value - m_p_begin_value);
+
+ return (this_type(mid_pointer(m_p_begin_value, m_p_value),
+ m_p_begin_value,
+ m_p_value,
+ mid_pointer(p_begin_metadata, m_p_metadata)));
+ }
+
+ inline this_type
+ get_r_child() const
+ {
+ if (m_p_value == m_p_end_value)
+ return (this_type(m_p_end_value, m_p_end_value, m_p_end_value));
+
+ const_metadata_pointer p_end_metadata =
+ m_p_metadata + (m_p_end_value - m_p_value);
+
+ return (this_type(mid_pointer(m_p_value + 1, m_p_end_value),
+ m_p_value + 1,
+ m_p_end_value,(m_p_metadata == NULL) ?
+ NULL : mid_pointer(m_p_metadata + 1, p_end_metadata)));
+ }
+
+ inline bool
+ operator==(const this_type& other) const
+ {
+ const bool is_end = m_p_begin_value == m_p_end_value;
+ const bool is_other_end = other.m_p_begin_value == other.m_p_end_value;
+
+ if (is_end)
+ return (is_other_end);
+
+ if (is_other_end)
+ return (is_end);
+
+ return m_p_value == other.m_p_value;
+ }
+
+ inline bool
+ operator!=(const this_type& other) const
+ { return !operator==(other); }
+
+ public:
+ pointer m_p_value;
+ pointer m_p_begin_value;
+ pointer m_p_end_value;
+
+ const_metadata_pointer m_p_metadata;
+ };
+
+#define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC \
+ ov_tree_node_it_<Value_Type, Metadata_Type, Allocator>
+
+ // Node reference.
+ template<typename Value_Type, typename Metadata_Type, class Allocator>
+ class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
+ {
+
+ private:
+ typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type;
+
+ typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC base_type;
+
+ typedef typename base_type::pointer pointer;
+
+ typedef typename base_type::const_pointer const_pointer;
+
+ typedef
+ typename base_type::const_metadata_pointer
+ const_metadata_pointer;
+
+ public:
+
+ typedef trivial_iterator_tag iterator_category;
+
+ typedef trivial_iterator_difference_type difference_type;
+
+ typedef
+ typename Allocator::template rebind<
+ Value_Type>::other::pointer
+ value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ Value_Type>::type>::other::pointer
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ typename remove_const<
+ Value_Type>::type>::other::pointer
+ const_reference;
+
+ public:
+ inline
+ ov_tree_node_it_(const_pointer p_nd = NULL, const_pointer p_begin_nd = NULL, const_pointer p_end_nd = NULL, const_metadata_pointer p_metadata = NULL) : base_type(p_nd, p_begin_nd, p_end_nd, p_metadata)
+ { }
+
+ // Access.
+ inline reference
+ operator*() const
+ { return reference(base_type::m_p_value); }
+
+ // Returns the node reference associated with the left node.
+ inline ov_tree_node_it_
+ get_l_child() const
+ {
+ if (base_type::m_p_begin_value == base_type::m_p_value)
+ return (this_type(base_type::m_p_begin_value, base_type::m_p_begin_value, base_type::m_p_begin_value));
+
+ const_metadata_pointer p_begin_metadata =
+ base_type::m_p_metadata - (base_type::m_p_value - base_type::m_p_begin_value);
+
+ return (this_type(base_type::mid_pointer(base_type::m_p_begin_value, base_type::m_p_value),
+ base_type::m_p_begin_value,
+ base_type::m_p_value,
+ base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata)));
+ }
+
+ // Returns the node reference associated with the right node.
+ inline ov_tree_node_it_
+ get_r_child() const
+ {
+ if (base_type::m_p_value == base_type::m_p_end_value)
+ return (this_type(base_type::m_p_end_value, base_type::m_p_end_value, base_type::m_p_end_value));
+
+ const_metadata_pointer p_end_metadata =
+ base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value);
+
+ return (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value),
+ base_type::m_p_value + 1,
+ base_type::m_p_end_value,(base_type::m_p_metadata == NULL)?
+ NULL : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata)));
+ }
+
+ };
+
+#undef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC
+#undef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC
+
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
new file mode 100644
index 000000000..f331f0fb1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
@@ -0,0 +1,522 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file ov_tree_map_.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+#include <map>
+#include <set>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/detail/tree_trace_base.hpp>
+#include <utility>
+#include <functional>
+#include <algorithm>
+#include <vector>
+#include <assert.h>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, class Cmp_Fn, \
+ class Node_And_It_Traits, class Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_OV_TREE_CLASS_NAME ov_tree_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_OV_TREE_CLASS_NAME ov_tree_no_data_
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_data_
+#else
+#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_OV_TREE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+
+#define PB_DS_TYPES_TRAITS_C_DEC \
+ types_traits<Key, Mapped, Allocator, false>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
+ typename Allocator::template rebind<Key>::other::const_reference>
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#endif
+
+#ifdef PB_DS_TREE_TRACE
+#define PB_DS_TREE_TRACE_BASE_C_DEC \
+ tree_trace_base<typename Node_And_It_Traits::const_node_iterator, \
+ typename Node_And_It_Traits::node_iterator, \
+ Cmp_Fn, false, Allocator>
+#endif
+
+ // Ordered-vector tree associative-container.
+ template<typename Key, typename Mapped, class Cmp_Fn,
+ class Node_And_It_Traits, class Allocator>
+ class PB_DS_OV_TREE_CLASS_NAME :
+#ifdef _GLIBCXX_DEBUG
+ protected PB_DS_DEBUG_MAP_BASE_C_DEC,
+#endif
+#ifdef PB_DS_TREE_TRACE
+ public PB_DS_TREE_TRACE_BASE_C_DEC,
+#endif
+ public Cmp_Fn,
+ public Node_And_It_Traits::node_update,
+ public PB_DS_TYPES_TRAITS_C_DEC
+ {
+ private:
+ typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+
+ typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type;
+
+ typedef typename Allocator::template rebind<non_const_value_type>::other value_allocator;
+ typedef typename value_allocator::pointer value_vector;
+
+
+ typedef Cmp_Fn cmp_fn_base;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+ typedef typename traits_base::pointer mapped_pointer_;
+ typedef typename traits_base::const_pointer const_mapped_pointer_;
+
+ typedef typename Node_And_It_Traits::metadata_type metadata_type;
+
+ typedef typename Allocator::template rebind<metadata_type>::other metadata_allocator;
+ typedef typename metadata_allocator::pointer metadata_pointer;
+ typedef typename metadata_allocator::const_reference const_metadata_reference;
+ typedef typename metadata_allocator::reference metadata_reference;
+
+ typedef
+ typename Node_And_It_Traits::null_node_update_pointer
+ null_node_update_pointer;
+
+ public:
+
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef typename Node_And_It_Traits::node_update node_update;
+
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+ typedef const_pointer const_point_iterator;
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ typedef pointer point_iterator;
+#else
+ typedef const_point_iterator point_iterator;
+#endif
+
+ typedef const_point_iterator const_iterator;
+
+ typedef point_iterator iterator;
+
+#include <ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp>
+
+ typedef
+ typename Node_And_It_Traits::const_node_iterator
+ const_node_iterator;
+
+ typedef typename Node_And_It_Traits::node_iterator node_iterator;
+
+ public:
+
+ PB_DS_OV_TREE_CLASS_NAME();
+
+ PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&);
+
+ PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&, const node_update&);
+
+ PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ ~PB_DS_OV_TREE_CLASS_NAME();
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ template<typename It>
+ void
+ copy_from_range(It, It);
+
+ inline size_type
+ max_size() const;
+
+ inline bool
+ empty() const;
+
+ inline size_type
+ size() const;
+
+ Cmp_Fn&
+ get_cmp_fn();
+
+ const Cmp_Fn&
+ get_cmp_fn() const;
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ point_iterator it = lower_bound(r_key);
+ if (it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return it->second;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return (insert_new_val(it, std::make_pair(r_key, mapped_type()))->second);
+#else
+ insert(r_key);
+ return traits_base::s_null_mapped;
+#endif
+ }
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference r_value)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ const_key_reference r_key = PB_DS_V2F(r_value);
+ point_iterator it = lower_bound(r_key);
+
+ if (it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ return std::make_pair(it, false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return std::make_pair(insert_new_val(it, r_value), true);
+ }
+
+ inline point_iterator
+ lower_bound(const_key_reference r_key)
+ {
+ pointer it = m_a_values;
+ pointer e_it = m_a_values + m_size;
+ while (it != e_it)
+ {
+ pointer mid_it = it + ((e_it - it) >> 1);
+ if (cmp_fn_base::operator()(PB_DS_V2F(*mid_it), r_key))
+ it = ++mid_it;
+ else
+ e_it = mid_it;
+ }
+ return it;
+ }
+
+ inline const_point_iterator
+ lower_bound(const_key_reference r_key) const
+ { return const_cast<PB_DS_CLASS_C_DEC& >(*this).lower_bound(r_key); }
+
+ inline point_iterator
+ upper_bound(const_key_reference r_key)
+ {
+ iterator pot_it = lower_bound(r_key);
+ if (pot_it != end()&& !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ return ++pot_it;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
+ return pot_it;
+ }
+
+ inline const_point_iterator
+ upper_bound(const_key_reference r_key) const
+ { return const_cast<PB_DS_CLASS_C_DEC&>(*this).upper_bound(r_key); }
+
+ inline point_iterator
+ find(const_key_reference r_key)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ iterator pot_it = lower_bound(r_key);
+ if (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ return pot_it;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
+ return end();
+ }
+
+ inline const_point_iterator
+ find(const_key_reference r_key) const
+ { return (const_cast<PB_DS_CLASS_C_DEC& >(*this).find(r_key)); }
+
+ bool
+ erase(const_key_reference);
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred);
+
+ inline iterator
+ erase(iterator it)
+ { return erase_imp<iterator>(it); }
+
+ void
+ clear();
+
+ void
+ join(PB_DS_CLASS_C_DEC&);
+
+ void
+ split(const_key_reference, PB_DS_CLASS_C_DEC&);
+
+ inline iterator
+ begin()
+ { return m_a_values; }
+
+ inline const_iterator
+ begin() const
+ { return m_a_values; }
+
+ inline iterator
+ end()
+ { return m_end_it; }
+
+ inline const_iterator
+ end() const
+ { return m_end_it; }
+
+ inline const_node_iterator
+ node_begin() const;
+
+ inline const_node_iterator
+ node_end() const;
+
+ inline node_iterator
+ node_begin();
+
+ inline node_iterator
+ node_end();
+
+ private:
+
+ inline void
+ update(node_iterator /*it*/, null_node_update_pointer);
+
+ template<typename Node_Update>
+ void
+ update(node_iterator, Node_Update*);
+
+ void
+ reallocate_metadata(null_node_update_pointer, size_type);
+
+ template<typename Node_Update_>
+ void
+ reallocate_metadata(Node_Update_*, size_type);
+
+ template<typename It>
+ void
+ copy_from_ordered_range(It, It);
+
+ void
+ value_swap(PB_DS_CLASS_C_DEC&);
+
+ template<typename It>
+ void
+ copy_from_ordered_range(It, It, It, It);
+
+ template<typename Ptr>
+ inline static Ptr
+ mid_pointer(Ptr p_begin, Ptr p_end)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);
+ return (p_begin + (p_end - p_begin) / 2);
+ }
+
+ inline iterator
+ insert_new_val(iterator it, const_reference r_value)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+#ifdef PB_DS_REGRESSION
+ typename Allocator::group_throw_prob_adjustor adjust(m_size);
+#endif
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_value)));
+
+ value_vector a_values = s_value_alloc.allocate(m_size + 1);
+
+ iterator source_it = begin();
+ iterator source_end_it = end();
+ iterator target_it = a_values;
+ iterator ret_it;
+
+ cond_dtor<size_type> cd(a_values, target_it, m_size + 1);
+ while (source_it != it)
+ {
+ new (const_cast<void* >(static_cast<const void* >(target_it)))
+ value_type(*source_it++);
+ ++target_it;
+ }
+
+ new (const_cast<void* >(static_cast<const void* >(ret_it = target_it)))
+ value_type(r_value);
+ ++target_it;
+
+ while (source_it != source_end_it)
+ {
+ new (const_cast<void* >(static_cast<const void* >(target_it)))
+ value_type(*source_it++);
+ ++target_it;
+ }
+
+ reallocate_metadata((node_update* )this, m_size + 1);
+ cd.set_no_action();
+ if (m_size != 0)
+ {
+ cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);
+ }
+
+ ++m_size;
+ m_a_values = a_values;
+ m_end_it = m_a_values + m_size;
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_value)));
+ update(node_begin(), (node_update* )this);
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ return ret_it;
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ void
+ assert_iterators() const;
+#endif
+
+ template<typename It>
+ It
+ erase_imp(It it);
+
+ inline const_node_iterator
+ PB_DS_node_begin_imp() const;
+
+ inline const_node_iterator
+ PB_DS_node_end_imp() const;
+
+ inline node_iterator
+ PB_DS_node_begin_imp();
+
+ inline node_iterator
+ PB_DS_node_end_imp();
+
+ private:
+ static value_allocator s_value_alloc;
+ static metadata_allocator s_metadata_alloc;
+
+ value_vector m_a_values;
+ metadata_pointer m_a_metadata;
+ iterator m_end_it;
+ size_type m_size;
+ };
+
+#include <ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp>
+#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_OV_TREE_CLASS_NAME
+#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_DEBUG_MAP_BASE_C_DEC
+#ifdef PB_DS_TREE_TRACE
+#undef PB_DS_TREE_TRACE_BASE_C_DEC
+#endif
+
+#undef PB_DS_V2F
+#undef PB_DS_EP2VP
+#undef PB_DS_V2S
+#undef PB_DS_CONST_NODE_ITERATOR_NAME
+
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..c06d6f851
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Cmp_Fn&
+PB_DS_CLASS_C_DEC::
+get_cmp_fn() const
+{ return *this; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..76bb6fafd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ if (m_size == 0)
+ {
+ other.clear();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ if (Cmp_Fn::operator()(r_key, PB_DS_V2F(*begin())))
+ {
+ value_swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(*(end() - 1))))
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ if (m_size == 1)
+ {
+ value_swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
+ iterator it = upper_bound(r_key);
+ PB_DS_CLASS_C_DEC new_other(other, other);
+ new_other.copy_from_ordered_range(it, end());
+ PB_DS_CLASS_C_DEC new_this(*this, * this);
+ new_this.copy_from_ordered_range(begin(), it);
+
+ // No exceptions from this point.
+ _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(Cmp_Fn& )(*this), other);)
+ other.update(other.node_begin(), (node_update* )(&other));
+ update(node_begin(), (node_update* )this);
+ other.value_swap(new_other);
+ value_swap(new_this);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ if (other.m_size == 0)
+ return;
+
+ if (m_size == 0)
+ {
+ value_swap(other);
+ return;
+ }
+
+ const bool greater = Cmp_Fn::operator()(PB_DS_V2F(*(end() - 1)),
+ PB_DS_V2F(*other.begin()));
+
+ const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(*(other.end() - 1)),
+ PB_DS_V2F(*begin()));
+
+ if (!greater && !lesser)
+ __throw_join_error();
+
+ PB_DS_CLASS_C_DEC new_this(*this, *this);
+
+ if (greater)
+ new_this.copy_from_ordered_range(begin(), end(),
+ other.begin(), other.end());
+ else
+ new_this.copy_from_ordered_range(other.begin(), other.end(),
+ begin(), end());
+
+ // No exceptions from this point.
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
+ value_swap(new_this);
+ other.clear();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
new file mode 100644
index 000000000..63cb0f7fb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/traits.hpp
@@ -0,0 +1,183 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file traits.hpp
+ * Contains an implementation class for ov_tree_.
+ */
+
+#ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP
+
+#include <ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Key,
+ typename Mapped,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct tree_traits<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ ov_tree_tag,
+ Allocator>
+ {
+ private:
+ typedef
+ typename types_traits<
+ Key,
+ Mapped,
+ Allocator,
+ false>::value_type
+ value_type;
+
+ public:
+ typedef
+ typename tree_node_metadata_selector<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ Allocator>::type
+ metadata_type;
+
+ typedef
+ ov_tree_node_const_it_<
+ value_type,
+ metadata_type,
+ Allocator>
+ const_node_iterator;
+
+ typedef
+ ov_tree_node_it_<
+ value_type,
+ metadata_type,
+ Allocator>
+ node_iterator;
+
+ typedef
+ Node_Update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>
+ node_update;
+
+ typedef
+ __gnu_pbds::null_tree_node_update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>*
+ null_node_update_pointer;
+ };
+
+ template<typename Key,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct tree_traits<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ ov_tree_tag,
+ Allocator>
+ {
+ private:
+ typedef
+ typename types_traits<
+ Key,
+ null_mapped_type,
+ Allocator,
+ false>::value_type
+ value_type;
+
+ public:
+ typedef
+ typename tree_node_metadata_selector<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ Allocator>::type
+ metadata_type;
+
+ typedef
+ ov_tree_node_const_it_<
+ value_type,
+ metadata_type,
+ Allocator>
+ const_node_iterator;
+
+ typedef const_node_iterator node_iterator;
+
+ typedef
+ Node_Update<
+ const_node_iterator,
+ const_node_iterator,
+ Cmp_Fn,
+ Allocator>
+ node_update;
+
+ typedef
+ __gnu_pbds::null_tree_node_update<
+ const_node_iterator,
+ node_iterator,
+ Cmp_Fn,
+ Allocator>*
+ null_node_update_pointer;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..e292ed5d9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ push(*(first_it++));
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+pairing_heap_()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+pairing_heap_(const Cmp_Fn& r_cmp_fn) :
+ PB_DS_BASE_C_DEC(r_cmp_fn)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+pairing_heap_(const PB_DS_CLASS_C_DEC& other) :
+ PB_DS_BASE_C_DEC(other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ PB_DS_BASE_C_DEC::swap(other);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~pairing_heap_()
+{ }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..7c9fc1345
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root == NULL
+ || base_type::m_p_root->m_p_next_sibling == NULL);
+ base_type::assert_valid();
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
new file mode 100644
index 000000000..905be1098
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
@@ -0,0 +1,236 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+pop()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ node_pointer p_new_root = join_node_children(base_type::m_p_root);
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_new_root, false);)
+ if (p_new_root != NULL)
+ p_new_root->m_p_prev_or_parent = NULL;
+
+ base_type::actual_erase_node(base_type::m_p_root);
+ base_type::m_p_root = p_new_root;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase(point_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+ remove_node(it.m_p_nd);
+ base_type::actual_erase_node(it.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+remove_node(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+ node_pointer p_new_child = join_node_children(p_nd);
+
+#ifdef _GLIBCXX_DEBUG
+ if (p_new_child != NULL)
+ base_type::assert_node_consistent(p_new_child, false);
+#endif
+
+ if (p_nd == base_type::m_p_root)
+ {
+ if (p_new_child != NULL)
+ p_new_child->m_p_prev_or_parent = NULL;
+ base_type::m_p_root = p_new_child;
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false);)
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != NULL);
+ if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd)
+ {
+ if (p_new_child != NULL)
+ {
+ p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+ p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;
+ if (p_new_child->m_p_next_sibling != NULL)
+ p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;
+ p_nd->m_p_prev_or_parent->m_p_l_child = p_new_child;
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
+ return;
+ }
+
+ p_nd->m_p_prev_or_parent->m_p_l_child = p_nd->m_p_next_sibling;
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
+ return;
+ }
+
+ if (p_new_child != NULL)
+ {
+ p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+ p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;
+ if (p_new_child->m_p_next_sibling != NULL)
+ p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;
+ p_new_child->m_p_prev_or_parent->m_p_next_sibling = p_new_child;
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
+ return;
+ }
+
+ p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+join_node_children(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ node_pointer p_ret = p_nd->m_p_l_child;
+ if (p_ret == NULL)
+ return NULL;
+ while (p_ret->m_p_next_sibling != NULL)
+ p_ret = forward_join(p_ret, p_ret->m_p_next_sibling);
+ while (p_ret->m_p_prev_or_parent != p_nd)
+ p_ret = back_join(p_ret->m_p_prev_or_parent, p_ret);
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_ret, false);)
+ return p_ret;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+forward_join(node_pointer p_nd, node_pointer p_next)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == p_next);
+ if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
+ {
+ p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+ base_type::make_child_of(p_nd, p_next);
+ return p_next->m_p_next_sibling == NULL
+ ? p_next : p_next->m_p_next_sibling;
+ }
+
+ if (p_next->m_p_next_sibling != NULL)
+ {
+ p_next->m_p_next_sibling->m_p_prev_or_parent = p_nd;
+ p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
+ base_type::make_child_of(p_next, p_nd);
+ return p_nd->m_p_next_sibling;
+ }
+
+ p_nd->m_p_next_sibling = NULL;
+ base_type::make_child_of(p_next, p_nd);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));
+ return p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+back_join(node_pointer p_nd, node_pointer p_next)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == NULL);
+
+ if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
+ {
+ p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+ base_type::make_child_of(p_nd, p_next);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_next, false));
+ return p_next;
+ }
+
+ p_nd->m_p_next_sibling = NULL;
+ base_type::make_child_of(p_next, p_nd);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));
+ return p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return 0;
+ }
+ base_type::to_linked_list();
+ node_pointer p_out = base_type::prune(pred);
+ size_type ersd = 0;
+ while (p_out != NULL)
+ {
+ ++ersd;
+ node_pointer p_next = p_out->m_p_next_sibling;
+ base_type::actual_erase_node(p_out);
+ p_out = p_next;
+ }
+
+ node_pointer p_cur = base_type::m_p_root;
+ base_type::m_p_root = NULL;
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+ p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = NULL;
+
+ push_imp(p_cur);
+ p_cur = p_next;
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return ersd;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
new file mode 100644
index 000000000..85efd70dc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reference
+PB_DS_CLASS_C_DEC::
+top() const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ return base_type::m_p_root->m_value;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
new file mode 100644
index 000000000..b00e9d13c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+push(const_reference r_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ node_pointer p_new_nd = base_type::get_new_node_for_insert(r_val);
+
+ push_imp(p_new_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return point_iterator(p_new_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+push_imp(node_pointer p_nd)
+{
+ p_nd->m_p_l_child = NULL;
+
+ if (base_type::m_p_root == NULL)
+ {
+ p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = NULL;
+
+ base_type::m_p_root = p_nd;
+ }
+ else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))
+ {
+ p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = NULL;
+
+ base_type::make_child_of(base_type::m_p_root, p_nd);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));
+
+ base_type::m_p_root = p_nd;
+ }
+ else
+ {
+ base_type::make_child_of(p_nd, base_type::m_p_root);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false));
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+modify(point_iterator it, const_reference r_new_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ remove_node(it.m_p_nd);
+
+ it.m_p_nd->m_value = r_new_val;
+
+ push_imp(it.m_p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
new file mode 100644
index 000000000..e19bcb695
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
@@ -0,0 +1,216 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file pairing_heap_.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+/*
+ * Pairing heap:
+ * Michael L. Fredman, Robert Sedgewick, Daniel Dominic Sleator,
+ * and Robert Endre Tarjan, The Pairing Heap:
+ * A New Form of Self-Adjusting Heap, Algorithmica, 1(1):111-129, 1986.
+ */
+
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ pairing_heap_<Value_Type, Cmp_Fn, Allocator>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_< \
+ Value_Type, \
+ Cmp_Fn, \
+ null_left_child_next_sibling_heap_node_metadata, \
+ Allocator, \
+ false>
+#else
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_< \
+ Value_Type, \
+ Cmp_Fn, \
+ null_left_child_next_sibling_heap_node_metadata, \
+ Allocator>
+#endif
+
+ /**
+ * class description = "P4ri|\|g h3ap$">
+ **/
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ class pairing_heap_ : public PB_DS_BASE_C_DEC
+ {
+
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ typedef typename base_type::node_pointer node_pointer;
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::pointer
+ pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_pointer
+ const_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_reference
+ const_reference;
+
+ typedef
+ typename PB_DS_BASE_C_DEC::const_point_iterator
+ const_point_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::iterator iterator;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef Allocator allocator_type;
+
+
+ pairing_heap_();
+
+ pairing_heap_(const Cmp_Fn& r_cmp_fn);
+
+ pairing_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ ~pairing_heap_();
+
+ inline point_iterator
+ push(const_reference r_val);
+
+ void
+ modify(point_iterator it, const_reference r_new_val);
+
+ inline const_reference
+ top() const;
+
+ void
+ pop();
+
+ void
+ erase(point_iterator it);
+
+ template<typename Pred>
+ size_type
+ erase_if(Pred pred);
+
+ template<typename Pred>
+ void
+ split(Pred pred, PB_DS_CLASS_C_DEC& other);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+
+ template<typename It>
+ void
+ copy_from_range(It first_it, It last_it);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+ private:
+
+ inline void
+ push_imp(node_pointer p_nd);
+
+ node_pointer
+ join_node_children(node_pointer p_nd);
+
+ node_pointer
+ forward_join(node_pointer p_nd, node_pointer p_next);
+
+ node_pointer
+ back_join(node_pointer p_nd, node_pointer p_next);
+
+ void
+ remove_node(node_pointer p_nd);
+
+ };
+
+#include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_BASE_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..85d4ddf07
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,140 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation class for a pairing heap.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+void
+PB_DS_CLASS_C_DEC::
+split(Pred pred, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ other.clear();
+
+ if (base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ return;
+ }
+
+ base_type::to_linked_list();
+
+ node_pointer p_out = base_type::prune(pred);
+
+ while (p_out != NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
+ --base_type::m_size;
+
+ ++other.m_size;
+
+ node_pointer p_next = p_out->m_p_next_sibling;
+
+ p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = NULL;
+
+ other.push_imp(p_out);
+
+ p_out = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ node_pointer p_cur = base_type::m_p_root;
+
+ base_type::m_p_root = NULL;
+
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+
+ p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = NULL;
+
+ push_imp(p_cur);
+
+ p_cur = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ if (other.m_p_root == NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ return;
+ }
+
+ if (base_type::m_p_root == NULL)
+ base_type::m_p_root = other.m_p_root;
+ else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, other.m_p_root->m_value))
+ {
+ base_type::make_child_of(base_type::m_p_root, other.m_p_root);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(other.m_p_root, false));
+
+ base_type::m_p_root = other.m_p_root;
+ }
+ else
+ {
+ base_type::make_child_of(other.m_p_root, base_type::m_p_root);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false));
+ }
+
+ base_type::m_size += other.m_size;
+
+ other.m_p_root = NULL;
+ other.m_size = 0;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
new file mode 100644
index 000000000..15f349efb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file child_iterator.hpp
+ * Contains a iterator for a patricia tree.
+ */
+
+struct iterator : public const_iterator
+{
+public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename Allocator::difference_type difference_type;
+ typedef node_pointer value_type;
+ typedef node_pointer_pointer pointer;
+ typedef node_pointer_reference reference;
+
+ inline
+ iterator(node_pointer_pointer p_p_cur = NULL,
+ node_pointer_pointer p_p_end = NULL)
+ : const_iterator(p_p_cur, p_p_end)
+ { }
+
+ inline bool
+ operator==(const iterator& other) const
+ { return const_iterator::m_p_p_cur == other.m_p_p_cur; }
+
+ inline bool
+ operator!=(const iterator& other) const
+ { return const_iterator::m_p_p_cur != other.m_p_p_cur; }
+
+ inline iterator&
+ operator++()
+ {
+ const_iterator::operator++();
+ return *this;
+ }
+
+ inline iterator
+ operator++(int)
+ {
+ iterator ret_it(*this);
+ operator++();
+ return ret_it;
+ }
+
+ node_pointer_pointer
+ operator->()
+ {
+ _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
+ return const_iterator::m_p_p_cur;
+ }
+
+ node_pointer
+ operator*()
+ {
+ _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)
+ return *const_iterator::m_p_p_cur;
+ }
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
new file mode 100644
index 000000000..184b98652
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cond_dtor_entry_dealtor.hpp
+ * Contains a binary tree container conditional deallocator
+ */
+
+class cond_dealtor
+{
+public:
+ inline
+ cond_dealtor(leaf_pointer p_nd) : m_p_nd(p_nd),
+ m_no_action_dtor(false),
+ m_call_destructor(false)
+ { }
+
+ inline void
+ set_no_action_dtor()
+ {
+ m_no_action_dtor = true;
+ }
+
+ inline void
+ set_call_destructor()
+ {
+ m_call_destructor = true;
+ }
+
+ inline
+ ~cond_dealtor()
+ {
+ if (m_no_action_dtor)
+ return;
+
+ if (m_call_destructor)
+ m_p_nd->~leaf();
+
+ s_leaf_allocator.deallocate(m_p_nd, 1);
+ }
+
+protected:
+ leaf_pointer m_p_nd;
+ bool m_no_action_dtor;
+ bool m_call_destructor;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
new file mode 100644
index 000000000..bc349cf2d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_child_iterator.hpp
+ * Contains a const_iterator for a patricia tree.
+ */
+
+struct const_iterator
+{
+public:
+ typedef std::forward_iterator_tag iterator_category;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef node_pointer value_type;
+
+ typedef node_pointer_pointer pointer;
+
+ typedef node_pointer_reference reference;
+
+public:
+ inline
+ const_iterator(node_pointer_pointer p_p_cur = NULL,
+ node_pointer_pointer p_p_end = NULL)
+ : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)
+ { }
+
+ inline bool
+ operator==(const const_iterator& other) const
+ { return m_p_p_cur == other.m_p_p_cur; }
+
+ inline bool
+ operator!=(const const_iterator& other) const
+ { return m_p_p_cur != other.m_p_p_cur; }
+
+ inline const_iterator&
+ operator++()
+ {
+ do
+ ++m_p_p_cur;
+ while (m_p_p_cur != m_p_p_end&& * m_p_p_cur == NULL);
+ return *this;
+ }
+
+ inline const_iterator
+ operator++(int)
+ {
+ const_iterator ret_it(*this);
+ operator++();
+ return ret_it;
+ }
+
+ const node_pointer_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_referencible();)
+ return (m_p_p_cur);
+ }
+
+ const_node_pointer
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_referencible();)
+ return (*m_p_p_cur);
+ }
+
+protected:
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_referencible() const
+ { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end&& * m_p_p_cur != NULL); }
+#endif
+
+public:
+ node_pointer_pointer m_p_p_cur;
+ node_pointer_pointer m_p_p_end;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..ca38f932a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,214 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::head_allocator
+PB_DS_CLASS_C_DEC::s_head_allocator;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::internal_node_allocator
+PB_DS_CLASS_C_DEC::s_internal_node_allocator;
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::leaf_allocator
+PB_DS_CLASS_C_DEC::s_leaf_allocator;
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME() :
+ m_p_head(s_head_allocator.allocate(1)),
+ m_size(0)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const e_access_traits& r_e_access_traits) :
+ synth_e_access_traits(r_e_access_traits),
+ m_p_head(s_head_allocator.allocate(1)),
+ m_size(0)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+#ifdef _GLIBCXX_DEBUG
+ debug_base(other),
+#endif
+ synth_e_access_traits(other),
+ node_update(other),
+ m_p_head(s_head_allocator.allocate(1)),
+ m_size(0)
+{
+ initialize();
+ m_size = other.m_size;
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ if (other.m_p_head->m_p_parent == NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return;
+ }
+ __try
+ {
+ m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
+ }
+ __catch(...)
+ {
+ s_head_allocator.deallocate(m_p_head, 1);
+ __throw_exception_again;
+ }
+
+ m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);
+ m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
+ m_p_head->m_p_parent->m_p_parent = m_p_head;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ value_swap(other);
+ std::swap((e_access_traits& )(*this), (e_access_traits& )other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+value_swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
+ std::swap(m_p_head, other.m_p_head);
+ std::swap(m_size, other.m_size);
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~PB_DS_CLASS_NAME()
+{
+ clear();
+ s_head_allocator.deallocate(m_p_head, 1);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{
+ new (m_p_head) head();
+ m_p_head->m_p_parent = NULL;
+ m_p_head->m_p_min = m_p_head;
+ m_p_head->m_p_max = m_p_head;
+ m_size = 0;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+recursive_copy_node(const_node_pointer p_other_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_other_nd != NULL);
+ if (p_other_nd->m_type == pat_trie_leaf_node_type)
+ {
+ const_leaf_pointer p_other_leaf = static_cast<const_leaf_pointer>(p_other_nd);
+
+ leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
+ cond_dealtor cond(p_new_lf);
+ new (p_new_lf) leaf(p_other_leaf->value());
+ apply_update(p_new_lf, (node_update* )this);
+ cond.set_no_action_dtor();
+ return (p_new_lf);
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_other_nd->m_type == pat_trie_internal_node_type);
+ node_pointer a_p_children[internal_node::arr_size];
+ size_type child_i = 0;
+ const_internal_node_pointer p_other_internal_nd =
+ static_cast<const_internal_node_pointer>(p_other_nd);
+
+ typename internal_node::const_iterator child_it =
+ p_other_internal_nd->begin();
+
+ internal_node_pointer p_ret;
+ __try
+ {
+ while (child_it != p_other_internal_nd->end())
+ a_p_children[child_i++] = recursive_copy_node(*(child_it++));
+ p_ret = s_internal_node_allocator.allocate(1);
+ }
+ __catch(...)
+ {
+ while (child_i-- > 0)
+ clear_imp(a_p_children[child_i]);
+ __throw_exception_again;
+ }
+
+ new (p_ret) internal_node(p_other_internal_nd->get_e_ind(),
+ pref_begin(a_p_children[0]));
+
+ --child_i;
+ _GLIBCXX_DEBUG_ASSERT(child_i > 1);
+ do
+ p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),
+ pref_end(a_p_children[child_i]), this);
+ while (child_i-- > 0);
+ apply_update(p_ret, (node_update* )this);
+ return p_ret;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
new file mode 100644
index 000000000..de7565788
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for pat_trie_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ if (m_p_head->m_p_parent != NULL)
+ m_p_head->m_p_parent->assert_valid(this);
+ assert_iterators();
+ assert_reverse_iterators();
+ if (m_p_head->m_p_parent == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_min == m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_max == m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(empty());
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_min->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_max->m_type == pat_trie_leaf_node_type);
+ _GLIBCXX_DEBUG_ASSERT(!empty());
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_iterators() const
+{
+ size_type calc_size = 0;
+ for (const_iterator it = begin(); it != end(); ++it)
+ {
+ ++calc_size;
+ debug_base::check_key_exists(PB_DS_V2F(*it));
+ _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);
+ _GLIBCXX_DEBUG_ASSERT(--upper_bound(PB_DS_V2F(*it)) == it);
+ }
+ _GLIBCXX_DEBUG_ASSERT(calc_size == m_size);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_reverse_iterators() const
+{
+ size_type calc_size = 0;
+ for (const_reverse_iterator it = rbegin(); it != rend(); ++it)
+ {
+ ++calc_size;
+ const_node_pointer p_nd =
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(PB_DS_V2F(*it));
+ _GLIBCXX_DEBUG_ASSERT(p_nd == it.m_p_nd);
+ }
+ _GLIBCXX_DEBUG_ASSERT(calc_size == m_size);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+recursive_count_leafs(const_node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return (0);
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return (1);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ size_type ret = 0;
+ for (typename internal_node::const_iterator it =
+ static_cast<const_internal_node_pointer>(p_nd)->begin();
+ it != static_cast<const_internal_node_pointer>(p_nd)->end();
+ ++it)
+ ret += recursive_count_leafs(*it);
+ return ret;
+}
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
new file mode 100644
index 000000000..90988184a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
@@ -0,0 +1,319 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ node_pointer p_nd = find_imp(r_key);
+ if (p_nd == NULL || p_nd->m_type == pat_trie_internal_node_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
+ return false;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+ if (!synth_e_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key));
+ return false;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ erase_leaf(static_cast<leaf_pointer>(p_nd));
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_fixup(internal_node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1);
+ if (std::distance(p_nd->begin(), p_nd->end()) == 1)
+ {
+ node_pointer p_parent = p_nd->m_p_parent;
+ if (p_parent == m_p_head)
+ m_p_head->m_p_parent =* p_nd->begin();
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);
+ node_pointer p_new_child =* p_nd->begin();
+ static_cast<internal_node_pointer>(p_parent)->replace_child(
+ p_new_child,
+ pref_begin(p_new_child),
+ pref_end(p_new_child),
+ this);
+ }
+ (*p_nd->begin())->m_p_parent = p_nd->m_p_parent;
+ p_nd->~internal_node();
+ s_internal_node_allocator.deallocate(p_nd, 1);
+
+ if (p_parent == m_p_head)
+ return;
+
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);
+ p_nd = static_cast<internal_node_pointer>(p_parent);
+ }
+
+ while (true)
+ {
+ _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1);
+ p_nd->update_prefixes(this);
+ apply_update(p_nd, (node_update* )this);
+ _GLIBCXX_DEBUG_ONLY(p_nd->assert_valid(this);)
+ if (p_nd->m_p_parent->m_type == pat_trie_head_node_type)
+ return;
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type ==
+ pat_trie_internal_node_type);
+
+ p_nd = static_cast<internal_node_pointer>(p_nd->m_p_parent);
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+actual_erase_leaf(leaf_pointer p_l)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+ _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_l->value())));
+ p_l->~leaf();
+ s_leaf_allocator.deallocate(p_l, 1);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (empty())
+ return;
+
+ clear_imp(m_p_head->m_p_parent);
+ m_size = 0;
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear_imp(node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_internal_node_type)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ for (typename internal_node::iterator it =
+ static_cast<internal_node_pointer>(p_nd)->begin();
+ it != static_cast<internal_node_pointer>(p_nd)->end();
+ ++it)
+ {
+ node_pointer p_child =* it;
+ clear_imp(p_child);
+ }
+ s_internal_node_allocator.deallocate(static_cast<internal_node_pointer>(p_nd), 1);
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+ static_cast<leaf_pointer>(p_nd)->~leaf();
+ s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+erase(const_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+
+ if (it == end())
+ return it;
+
+ const_iterator ret_it = it;
+ ++ret_it;
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+erase(iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+
+ if (it == end())
+ return it;
+ iterator ret_it = it;
+ ++ret_it;
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
+PB_DS_CLASS_C_DEC::
+erase(const_reverse_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+
+ if (it.m_p_nd == m_p_head)
+ return it;
+ const_reverse_iterator ret_it = it;
+ ++ret_it;
+
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+erase(reverse_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+
+ if (it.m_p_nd == m_p_head)
+ return it;
+ reverse_iterator ret_it = it;
+ ++ret_it;
+
+ _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);
+ erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ size_type num_ersd = 0;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ iterator it = begin();
+ while (it != end())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ if (pred(*it))
+ {
+ ++num_ersd;
+ it = erase(it);
+ }
+ else
+ ++it;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return num_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_leaf(leaf_pointer p_l)
+{
+ update_min_max_for_erased_leaf(p_l);
+ if (p_l->m_p_parent->m_type == pat_trie_head_node_type)
+ {
+ _GLIBCXX_DEBUG_ASSERT(size() == 1);
+ clear();
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(size() > 1);
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type ==
+ pat_trie_internal_node_type);
+
+ internal_node_pointer p_parent =
+ static_cast<internal_node_pointer>(p_l->m_p_parent);
+
+ p_parent->remove_child(p_l);
+ erase_fixup(p_parent);
+ actual_erase_leaf(p_l);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+update_min_max_for_erased_leaf(leaf_pointer p_l)
+{
+ if (m_size == 1)
+ {
+ m_p_head->m_p_min = m_p_head;
+ m_p_head->m_p_max = m_p_head;
+ return;
+ }
+
+ if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_min))
+ {
+ iterator it(p_l);
+ ++it;
+ m_p_head->m_p_min = it.m_p_nd;
+ return;
+ }
+
+ if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_max))
+ {
+ iterator it(p_l);
+ --it;
+ m_p_head->m_p_max = it.m_p_nd;
+ }
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
new file mode 100644
index 000000000..2552ead8b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
@@ -0,0 +1,269 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ node_pointer p_nd = find_imp(r_key);
+
+ if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return end();
+ }
+
+ if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ return iterator(p_nd);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return end();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key) const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ const_node_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
+
+ if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return end();
+ }
+
+ if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(r_key));
+ return const_iterator(const_cast<node_pointer>(p_nd));
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(r_key);)
+ return end();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+find_imp(const_key_reference r_key)
+{
+ if (empty())
+ return (NULL);
+
+ typename synth_e_access_traits::const_iterator b_it =
+ synth_e_access_traits::begin(r_key);
+ typename synth_e_access_traits::const_iterator e_it =
+ synth_e_access_traits::end(r_key);
+
+ node_pointer p_nd = m_p_head->m_p_parent;
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+
+ while (p_nd->m_type != pat_trie_leaf_node_type)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ node_pointer p_next_nd = static_cast<internal_node_pointer>(p_nd)->get_child_node(b_it, e_it, this);
+
+ if (p_next_nd == NULL)
+ return p_nd;
+ p_nd = p_next_nd;
+ }
+ return p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+lower_bound_imp(const_key_reference r_key)
+{
+ if (empty())
+ return (m_p_head);
+
+ node_pointer p_nd = m_p_head->m_p_parent;
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+
+ typename PB_DS_CLASS_C_DEC::const_e_iterator b_it =
+ synth_e_access_traits::begin(r_key);
+
+ typename PB_DS_CLASS_C_DEC::const_e_iterator e_it =
+ synth_e_access_traits::end(r_key);
+
+ size_type checked_ind = 0;
+ while (true)
+ {
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ {
+ if (!synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))
+ return p_nd;
+ iterator it(p_nd);
+ ++it;
+ return it.m_p_nd;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ const size_type new_checked_ind =
+ static_cast<internal_node_pointer>(p_nd)->get_e_ind();
+
+ p_nd =
+ static_cast<internal_node_pointer>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind, this);
+ checked_ind = new_checked_ind;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+lower_bound(const_key_reference r_key)
+{ return point_iterator(lower_bound_imp(r_key)); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+lower_bound(const_key_reference r_key) const
+{
+ return const_point_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+upper_bound(const_key_reference r_key)
+{
+ point_iterator l_bound_it = lower_bound(r_key);
+
+ _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
+ !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
+ r_key));
+
+ if (l_bound_it == end() ||
+ synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
+ return l_bound_it;
+
+ return ++l_bound_it;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+upper_bound(const_key_reference r_key) const
+{
+ const_point_iterator l_bound_it = lower_bound(r_key);
+
+ _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||
+ !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
+ r_key));
+
+ if (l_bound_it == end() ||
+ synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
+ return l_bound_it;
+ return ++l_bound_it;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+PB_DS_CLASS_C_DEC::
+pref_begin(const_node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return (synth_e_access_traits::begin(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ return static_cast<const_internal_node_pointer>(p_nd)->pref_b_it();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+PB_DS_CLASS_C_DEC::
+pref_end(const_node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return (synth_e_access_traits::end(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ return static_cast<const_internal_node_pointer>(p_nd)->pref_e_it();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+PB_DS_CLASS_C_DEC::
+leftmost_descendant(const_node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return static_cast<const_leaf_pointer>(p_nd);
+ return static_cast<const_internal_node_pointer>(p_nd)->leftmost_descendant();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::leaf_pointer
+PB_DS_CLASS_C_DEC::
+leftmost_descendant(node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return static_cast<leaf_pointer>(p_nd);
+ return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+PB_DS_CLASS_C_DEC::
+rightmost_descendant(const_node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return static_cast<const_leaf_pointer>(p_nd);
+ return static_cast<const_internal_node_pointer>(p_nd)->rightmost_descendant();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::leaf_pointer
+PB_DS_CLASS_C_DEC::
+rightmost_descendant(node_pointer p_nd)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return static_cast<leaf_pointer>(p_nd);
+ return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp
new file mode 100644
index 000000000..0c7381294
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/head.hpp
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file head.hpp
+ * Contains a leaf for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_IHEAD_HPP
+#define PB_DS_PAT_TRIE_IHEAD_HPP
+
+#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Type_Traits, typename E_Access_Traits, \
+ typename Metadata, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ pat_trie_head<Type_Traits, E_Access_Traits, Metadata, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
+
+ template<typename Type_Traits,
+ typename E_Access_Traits,
+ typename Metadata,
+ typename Allocator>
+ struct pat_trie_head : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef E_Access_Traits e_access_traits;
+
+ typedef
+ typename Allocator::template rebind<
+ e_access_traits>::other::const_pointer
+ const_e_access_traits_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ PB_DS_BASE_C_DEC>::other::pointer
+ node_pointer;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef
+ typename PB_DS_BASE_C_DEC::subtree_debug_info
+ subtree_debug_info;
+#endif
+
+ public:
+ pat_trie_head();
+
+#ifdef _GLIBCXX_DEBUG
+ virtual subtree_debug_info
+ assert_valid_imp(const_e_access_traits_pointer p_traits) const;
+#endif
+
+ public:
+ node_pointer m_p_min;
+
+ node_pointer m_p_max;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ pat_trie_head() : PB_DS_BASE_C_DEC(pat_trie_head_node_type)
+ { }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::subtree_debug_info
+ PB_DS_CLASS_C_DEC::
+ assert_valid_imp(const_e_access_traits_pointer /*p_traits*/) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(false);
+ return subtree_debug_info();
+ }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
new file mode 100644
index 000000000..81d7096a9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+empty() const
+{ return (m_size == 0); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+size() const
+{ return m_size; }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+max_size() const
+{ return s_internal_node_allocator.max_size(); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
new file mode 100644
index 000000000..e6049743f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
@@ -0,0 +1,465 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_join_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ split_join_branch_bag bag;
+ if (!join_prep(other, bag))
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ return;
+ }
+
+ m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent,
+ other.m_p_head->m_p_parent, 0, bag);
+
+ m_p_head->m_p_parent->m_p_parent = m_p_head;
+ m_size += other.m_size;
+ other.initialize();
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);
+ m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+}
+
+PB_DS_CLASS_T_DEC
+bool
+PB_DS_CLASS_C_DEC::
+join_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ if (other.m_size == 0)
+ return false;
+
+ if (m_size == 0)
+ {
+ value_swap(other);
+ return false;
+ }
+
+ const bool greater = synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(
+ m_p_head->m_p_max)->value()),PB_DS_V2F(static_cast<const_leaf_pointer>(
+ other.m_p_head->m_p_min)->value()));
+
+ const bool lesser = synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(
+ other.m_p_head->m_p_max)->value()),PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value()));
+
+ if (!greater && !lesser)
+ __throw_join_error();
+
+ rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag);
+ _GLIBCXX_DEBUG_ONLY(debug_base::join(other);)
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+rec_join_prep(const_node_pointer p_l, const_node_pointer p_r, split_join_branch_bag& r_bag)
+{
+ if (p_l->m_type == pat_trie_leaf_node_type)
+ {
+ if (p_r->m_type == pat_trie_leaf_node_type)
+ {
+ rec_join_prep(static_cast<const_leaf_pointer>(p_l),
+ static_cast<const_leaf_pointer>(p_r), r_bag);
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+ rec_join_prep(static_cast<const_leaf_pointer>(p_l),
+ static_cast<const_internal_node_pointer>(p_r), r_bag);
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);
+ if (p_r->m_type == pat_trie_leaf_node_type)
+ {
+ rec_join_prep(static_cast<const_internal_node_pointer>(p_l),
+ static_cast<const_leaf_pointer>(p_r), r_bag);
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+
+ rec_join_prep(static_cast<const_internal_node_pointer>(p_l),
+ static_cast<const_internal_node_pointer>(p_r), r_bag);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+rec_join_prep(const_leaf_pointer /*p_l*/, const_leaf_pointer /*p_r*/,
+ split_join_branch_bag& r_bag)
+{ r_bag.add_branch(); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+rec_join_prep(const_leaf_pointer /*p_l*/, const_internal_node_pointer /*p_r*/,
+ split_join_branch_bag& r_bag)
+{ r_bag.add_branch(); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+rec_join_prep(const_internal_node_pointer /*p_l*/, const_leaf_pointer /*p_r*/,
+ split_join_branch_bag& r_bag)
+{ r_bag.add_branch(); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+rec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,
+ split_join_branch_bag& r_bag)
+{
+ if (p_l->get_e_ind() == p_r->get_e_ind() &&
+ synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
+ p_r->pref_b_it(), p_r->pref_e_it()))
+ {
+ for (typename internal_node::const_iterator it = p_r->begin();
+ it != p_r->end(); ++ it)
+ {
+ const_node_pointer p_l_join_child = p_l->get_join_child(*it, this);
+ if (p_l_join_child != NULL)
+ rec_join_prep(p_l_join_child, * it, r_bag);
+ }
+ return;
+ }
+
+ if (p_r->get_e_ind() < p_l->get_e_ind() &&
+ p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
+ {
+ const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
+ if (p_r_join_child != NULL)
+ rec_join_prep(p_r_join_child, p_l, r_bag);
+ return;
+ }
+
+ if (p_r->get_e_ind() < p_l->get_e_ind() &&
+ p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
+ {
+ const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);
+ if (p_r_join_child != NULL)
+ rec_join_prep(p_r_join_child, p_l, r_bag);
+ return;
+ }
+ r_bag.add_branch();
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+rec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+ if (p_l == NULL)
+ {
+ apply_update(p_r, (node_update* )this);
+ return (p_r);
+ }
+
+ if (p_l->m_type == pat_trie_leaf_node_type)
+ {
+ if (p_r->m_type == pat_trie_leaf_node_type)
+ {
+ node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
+ static_cast<leaf_pointer>(p_r), r_bag);
+ apply_update(p_ret, (node_update* )this);
+ return p_ret;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+ node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),
+ static_cast<internal_node_pointer>(p_r),
+ checked_ind, r_bag);
+ apply_update(p_ret, (node_update* )this);
+ return p_ret;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);
+ if (p_r->m_type == pat_trie_leaf_node_type)
+ {
+ node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),
+ static_cast<leaf_pointer>(p_r),
+ checked_ind, r_bag);
+ apply_update(p_ret, (node_update* )this);
+ return p_ret;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);
+ node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),
+ static_cast<internal_node_pointer>(p_r),
+ r_bag);
+
+ apply_update(p_ret, (node_update* )this);
+ return p_ret;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+rec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+ if (p_l == NULL)
+ return (p_r);
+ node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == 2);
+ return p_ret;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+rec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind,
+ split_join_branch_bag& r_bag)
+{
+#ifdef _GLIBCXX_DEBUG
+ const size_type lhs_leafs = recursive_count_leafs(p_l);
+ const size_type rhs_leafs = recursive_count_leafs(p_r);
+#endif
+
+ _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+ node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == lhs_leafs + rhs_leafs);
+ return p_ret;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+rec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_l != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+
+#ifdef _GLIBCXX_DEBUG
+ const size_type lhs_leafs = recursive_count_leafs(p_l);
+ const size_type rhs_leafs = recursive_count_leafs(p_r);
+#endif
+
+ if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this))
+ {
+ node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
+ _GLIBCXX_DEBUG_ONLY(p_ret->assert_valid(this);)
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) ==
+ lhs_leafs + rhs_leafs);
+ return p_ret;
+ }
+
+ node_pointer p_pot_child = p_l->add_child(p_r, pref_begin(p_r),
+ pref_end(p_r), this);
+ if (p_pot_child != p_r)
+ {
+ node_pointer p_new_child = rec_join(p_pot_child, p_r, p_l->get_e_ind(),
+ r_bag);
+
+ p_l->replace_child(p_new_child, pref_begin(p_new_child),
+ pref_end(p_new_child), this);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(p_l->assert_valid(this));
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_l) == lhs_leafs + rhs_leafs);
+ return p_l;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+rec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch_bag& r_bag)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_l != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_r != NULL);
+
+#ifdef _GLIBCXX_DEBUG
+ const size_type lhs_leafs = recursive_count_leafs(p_l);
+ const size_type rhs_leafs = recursive_count_leafs(p_r);
+#endif
+
+ if (p_l->get_e_ind() == p_r->get_e_ind() &&
+ synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),
+ p_r->pref_b_it(), p_r->pref_e_it()))
+ {
+ for (typename internal_node::iterator it = p_r->begin();
+ it != p_r->end(); ++ it)
+ {
+ node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this),
+ * it, 0, r_bag);
+ p_l->replace_child(p_new_child, pref_begin(p_new_child),
+ pref_end(p_new_child), this);
+ }
+
+ p_r->~internal_node();
+ s_internal_node_allocator.deallocate(p_r, 1);
+ _GLIBCXX_DEBUG_ONLY(p_l->assert_valid(this);)
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_l) == lhs_leafs + rhs_leafs);
+ return p_l;
+ }
+
+ if (p_l->get_e_ind() < p_r->get_e_ind() &&
+ p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this))
+ {
+ node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this),
+ p_r, 0, r_bag);
+ p_l->replace_child(p_new_child, pref_begin(p_new_child),
+ pref_end(p_new_child), this);
+ _GLIBCXX_DEBUG_ONLY(p_l->assert_valid(this);)
+ return p_l;
+ }
+
+ if (p_r->get_e_ind() < p_l->get_e_ind() &&
+ p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))
+ {
+ node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l,
+ 0, r_bag);
+
+ p_r->replace_child(p_new_child, pref_begin(p_new_child),
+ pref_end(p_new_child), this);
+
+ _GLIBCXX_DEBUG_ONLY(p_r->assert_valid(this);)
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_r) == lhs_leafs + rhs_leafs);
+ return p_r;
+ }
+
+ node_pointer p_ret = insert_branch(p_l, p_r, r_bag);
+ _GLIBCXX_DEBUG_ONLY(p_ret->assert_valid(this);)
+ _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == lhs_leafs + rhs_leafs);
+ return p_ret;
+}
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert(const_reference r_val)
+{
+ node_pointer p_lf = find_imp(PB_DS_V2F(r_val));
+ if (p_lf != NULL && p_lf->m_type == pat_trie_leaf_node_type &&
+ synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))
+ {
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_exists(PB_DS_V2F(r_val)));
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return std::make_pair(iterator(p_lf), false);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(debug_base::check_key_does_not_exist(PB_DS_V2F(r_val)));
+
+ leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
+ cond_dealtor cond(p_new_lf);
+
+ new (p_new_lf) leaf(r_val);
+ apply_update(p_new_lf, (node_update* )this);
+ cond.set_call_destructor();
+ split_join_branch_bag bag;
+ bag.add_branch();
+ m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag);
+ m_p_head->m_p_parent->m_p_parent = m_p_head;
+ cond.set_no_action_dtor();
+ ++m_size;
+ update_min_max_for_inserted_leaf(p_new_lf);
+ _GLIBCXX_DEBUG_ONLY(debug_base::insert_new(PB_DS_V2F(r_val));)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return std::make_pair(point_iterator(p_new_lf), true);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+keys_diff_ind(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r)
+{
+ size_type diff_pos = 0;
+ while (b_l != e_l)
+ {
+ if (b_r == e_r)
+ return (diff_pos);
+ if (e_access_traits::e_pos(*b_l) != e_access_traits::e_pos(*b_r))
+ return (diff_pos);
+ ++b_l;
+ ++b_r;
+ ++diff_pos;
+ }
+ _GLIBCXX_DEBUG_ASSERT(b_r != e_r);
+ return diff_pos;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::internal_node_pointer
+PB_DS_CLASS_C_DEC::
+insert_branch(node_pointer p_l, node_pointer p_r, split_join_branch_bag& r_bag)
+{
+ typename synth_e_access_traits::const_iterator left_b_it = pref_begin(p_l);
+ typename synth_e_access_traits::const_iterator left_e_it = pref_end(p_l);
+ typename synth_e_access_traits::const_iterator right_b_it = pref_begin(p_r);
+ typename synth_e_access_traits::const_iterator right_e_it = pref_end(p_r);
+
+ const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it,
+ right_b_it, right_e_it);
+
+ internal_node_pointer p_new_nd = r_bag.get_branch();
+ new (p_new_nd) internal_node(diff_ind, left_b_it);
+ p_new_nd->add_child(p_l, left_b_it, left_e_it, this);
+ p_new_nd->add_child(p_r, right_b_it, right_e_it, this);
+ p_l->m_p_parent = p_new_nd;
+ p_r->m_p_parent = p_new_nd;
+ _GLIBCXX_DEBUG_ONLY(p_new_nd->assert_valid(this);)
+ return (p_new_nd);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+update_min_max_for_inserted_leaf(leaf_pointer p_new_lf)
+{
+ if (m_p_head->m_p_min == m_p_head ||
+ synth_e_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),
+ PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))
+ m_p_head->m_p_min = p_new_lf;
+
+ if (m_p_head->m_p_max == m_p_head ||
+ synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))
+ m_p_head->m_p_max = p_new_lf;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
new file mode 100644
index 000000000..bf2f42916
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/internal_node.hpp
@@ -0,0 +1,599 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file internal_node.hpp
+ * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_INTERNAL_NODE_HPP
+#define PB_DS_PAT_TRIE_INTERNAL_NODE_HPP
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Type_Traits, typename E_Access_Traits, \
+ typename Metadata, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ pat_trie_internal_node<Type_Traits, E_Access_Traits, Metadata, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
+
+#define PB_DS_LEAF_C_DEC \
+ pat_trie_leaf<Type_Traits, E_Access_Traits, Metadata, Allocator>
+
+ template<typename Type_Traits,
+ typename E_Access_Traits,
+ typename Metadata,
+ typename Allocator>
+ struct pat_trie_internal_node : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+ typedef Type_Traits type_traits;
+ typedef typename type_traits::value_type value_type;
+ typedef typename Allocator::size_type size_type;
+
+ typedef E_Access_Traits e_access_traits;
+ typedef typename e_access_traits::const_iterator const_e_iterator;
+ typedef typename Allocator::template rebind<e_access_traits>::other access_rebind;
+ typedef typename access_rebind::const_pointer const_e_access_traits_pointer;
+
+ typedef typename Allocator::template rebind<base_type>::other base_rebind;
+ typedef typename base_rebind::pointer node_pointer;
+ typedef typename base_rebind::const_pointer const_node_pointer;
+
+ typedef PB_DS_LEAF_C_DEC leaf;
+ typedef typename Allocator::template rebind<leaf>::other leaf_rebind;
+ typedef typename leaf_rebind::pointer leaf_pointer;
+ typedef typename leaf_rebind::const_pointer const_leaf_pointer;
+
+ typedef typename Allocator::template rebind<pat_trie_internal_node>::other internal_node_rebind;
+ typedef typename internal_node_rebind::pointer internal_node_pointer;
+ typedef typename internal_node_rebind::const_pointer const_internal_node_pointer;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef typename base_type::subtree_debug_info subtree_debug_info;
+
+ virtual subtree_debug_info
+ assert_valid_imp(const_e_access_traits_pointer) const;
+#endif
+
+ inline size_type
+ get_pref_pos(const_e_iterator, const_e_iterator,
+ const_e_access_traits_pointer) const;
+
+ public:
+ typedef typename Allocator::template rebind<node_pointer>::other node_pointer_rebind;
+ typedef typename node_pointer_rebind::pointer node_pointer_pointer;
+ typedef typename node_pointer_rebind::reference node_pointer_reference;
+
+ enum
+ {
+ arr_size = E_Access_Traits::max_size + 1
+ };
+ PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);
+
+#include <ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp>
+#include <ext/pb_ds/detail/pat_trie_/child_iterator.hpp>
+
+ pat_trie_internal_node(size_type, const const_e_iterator);
+
+ void
+ update_prefixes(const_e_access_traits_pointer);
+
+ const_iterator
+ begin() const;
+
+ iterator
+ begin();
+
+ const_iterator
+ end() const;
+
+ iterator
+ end();
+
+ inline node_pointer
+ get_child_node(const_e_iterator, const_e_iterator,
+ const_e_access_traits_pointer);
+
+ inline const_node_pointer
+ get_child_node(const_e_iterator, const_e_iterator,
+ const_e_access_traits_pointer) const;
+
+ inline iterator
+ get_child_it(const_e_iterator, const_e_iterator,
+ const_e_access_traits_pointer);
+
+ inline node_pointer
+ get_lower_bound_child_node(const_e_iterator, const_e_iterator,
+ size_type, const_e_access_traits_pointer);
+
+ inline node_pointer
+ add_child(node_pointer, const_e_iterator, const_e_iterator,
+ const_e_access_traits_pointer);
+
+ inline const_node_pointer
+ get_join_child(const_node_pointer, const_e_access_traits_pointer) const;
+
+ inline node_pointer
+ get_join_child(node_pointer, const_e_access_traits_pointer);
+
+ void
+ remove_child(node_pointer p_nd);
+
+ iterator
+ remove_child(iterator it);
+
+ void
+ replace_child(node_pointer, const_e_iterator, const_e_iterator,
+ const_e_access_traits_pointer);
+
+ inline const_e_iterator
+ pref_b_it() const;
+
+ inline const_e_iterator
+ pref_e_it() const;
+
+ inline size_type
+ get_e_ind() const;
+
+ bool
+ should_be_mine(const_e_iterator, const_e_iterator, size_type,
+ const_e_access_traits_pointer) const;
+
+ leaf_pointer
+ leftmost_descendant();
+
+ const_leaf_pointer
+ leftmost_descendant() const;
+
+ leaf_pointer
+ rightmost_descendant();
+
+ const_leaf_pointer
+ rightmost_descendant() const;
+
+#ifdef _GLIBCXX_DEBUG
+ size_type
+ e_ind() const;
+#endif
+
+ private:
+ pat_trie_internal_node(const pat_trie_internal_node&);
+
+ size_type
+ get_begin_pos() const;
+
+ const size_type m_e_ind;
+ const_e_iterator m_pref_b_it;
+ const_e_iterator m_pref_e_it;
+ node_pointer m_a_p_children[arr_size];
+ static leaf_rebind s_leaf_alloc;
+ static internal_node_rebind s_internal_node_alloc;
+ };
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_rebind
+ PB_DS_CLASS_C_DEC::s_leaf_alloc;
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::internal_node_rebind
+ PB_DS_CLASS_C_DEC::s_internal_node_alloc;
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_pref_pos(const_e_iterator b_it, const_e_iterator e_it,
+ const_e_access_traits_pointer p_traits) const
+ {
+ if (static_cast<size_t>(std::distance(b_it, e_it)) <= m_e_ind)
+ return 0;
+ std::advance(b_it, m_e_ind);
+ return 1 + p_traits->e_pos(*b_it);
+ }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ pat_trie_internal_node(size_type len, const const_e_iterator it) :
+ PB_DS_BASE_C_DEC(pat_trie_internal_node_type),
+ m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
+ {
+ std::advance(m_pref_e_it, m_e_ind);
+ std::fill(m_a_p_children, m_a_p_children + arr_size,
+ static_cast<node_pointer>(NULL));
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ update_prefixes(const_e_access_traits_pointer p_traits)
+ {
+ node_pointer p_first = *begin();
+ if (p_first->m_type == pat_trie_leaf_node_type)
+ {
+ const_leaf_pointer p = static_cast<const_leaf_pointer>(p_first);
+ m_pref_b_it = p_traits->begin(e_access_traits::extract_key(p->value()));
+ }
+ else
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_first->m_type == pat_trie_internal_node_type);
+ m_pref_b_it = static_cast<internal_node_pointer>(p_first)->pref_b_it();
+ }
+ m_pref_e_it = m_pref_b_it;
+ std::advance(m_pref_e_it, m_e_ind);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_iterator
+ PB_DS_CLASS_C_DEC::
+ begin() const
+ {
+ typedef node_pointer_pointer pointer_type;
+ pointer_type p = const_cast<pointer_type>(m_a_p_children);
+ return const_iterator(p + get_begin_pos(), p + arr_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ begin()
+ {
+ return iterator(m_a_p_children + get_begin_pos(),
+ m_a_p_children + arr_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_iterator
+ PB_DS_CLASS_C_DEC::
+ end() const
+ {
+ typedef node_pointer_pointer pointer_type;
+ pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;
+ return const_iterator(p, p);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ end()
+ { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_child_node(const_e_iterator b_it, const_e_iterator e_it,
+ const_e_access_traits_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ return m_a_p_children[i];
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ get_child_it(const_e_iterator b_it, const_e_iterator e_it,
+ const_e_access_traits_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != NULL);
+ return iterator(m_a_p_children + i, m_a_p_children + i);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::const_node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_child_node(const_e_iterator b_it, const_e_iterator e_it,
+ const_e_access_traits_pointer p_traits) const
+ { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_lower_bound_child_node(const_e_iterator b_it, const_e_iterator e_it,
+ size_type checked_ind,
+ const_e_access_traits_pointer p_traits)
+ {
+ if (!should_be_mine(b_it, e_it, checked_ind, p_traits))
+ {
+ if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it, m_pref_e_it, true))
+ return leftmost_descendant();
+ return rightmost_descendant();
+ }
+
+ size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+
+ if (m_a_p_children[i] != NULL)
+ return m_a_p_children[i];
+
+ while (++i < arr_size)
+ if (m_a_p_children[i] != NULL)
+ {
+ if (m_a_p_children[i]->m_type == pat_trie_leaf_node_type)
+ return m_a_p_children[i];
+
+ _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i]->m_type == pat_trie_internal_node_type);
+
+ return static_cast<internal_node_pointer>(m_a_p_children[i])->leftmost_descendant();
+ }
+
+ return rightmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ add_child(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it,
+ const_e_access_traits_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ if (m_a_p_children[i] == NULL)
+ {
+ m_a_p_children[i] = p_nd;
+ p_nd->m_p_parent = this;
+ return p_nd;
+ }
+ return m_a_p_children[i];
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_join_child(const_node_pointer p_nd, const_e_access_traits_pointer p_traits) const
+ {
+ node_pointer p = const_cast<node_pointer>(p_nd);
+ return const_cast<internal_node_pointer>(this)->get_join_child(p, p_traits);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ get_join_child(node_pointer p_nd, const_e_access_traits_pointer p_traits)
+ {
+ size_type i;
+ const_e_iterator b_it;
+ const_e_iterator e_it;
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ {
+ typename Type_Traits::const_key_reference r_key =
+ e_access_traits::extract_key(static_cast<const_leaf_pointer>(p_nd)->value());
+
+ b_it = p_traits->begin(r_key);
+ e_it = p_traits->end(r_key);
+ }
+ else
+ {
+ b_it = static_cast<internal_node_pointer>(p_nd)->pref_b_it();
+ e_it = static_cast<internal_node_pointer>(p_nd)->pref_e_it();
+ }
+ i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ return m_a_p_children[i];
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ remove_child(node_pointer p_nd)
+ {
+ size_type i = 0;
+ for (; i < arr_size; ++i)
+ if (m_a_p_children[i] == p_nd)
+ {
+ m_a_p_children[i] = NULL;
+ return;
+ }
+ _GLIBCXX_DEBUG_ASSERT(i != arr_size);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ remove_child(iterator it)
+ {
+ iterator ret = it;
+ ++ret;
+ * it.m_p_p_cur = NULL;
+ return ret;
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ replace_child(node_pointer p_nd, const_e_iterator b_it,
+ const_e_iterator e_it,
+ const_e_access_traits_pointer p_traits)
+ {
+ const size_type i = get_pref_pos(b_it, e_it, p_traits);
+ _GLIBCXX_DEBUG_ASSERT(i < arr_size);
+ m_a_p_children[i] = p_nd;
+ p_nd->m_p_parent = this;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+ PB_DS_CLASS_C_DEC::
+ pref_b_it() const
+ { return m_pref_b_it; }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::const_e_iterator
+ PB_DS_CLASS_C_DEC::
+ pref_e_it() const
+ { return m_pref_e_it; }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_e_ind() const
+ { return m_e_ind; }
+
+ PB_DS_CLASS_T_DEC
+ bool
+ PB_DS_CLASS_C_DEC::
+ should_be_mine(const_e_iterator b_it, const_e_iterator e_it,
+ size_type checked_ind,
+ const_e_access_traits_pointer p_traits) const
+ {
+ if (m_e_ind == 0)
+ return true;
+
+ const size_type num_es = std::distance(b_it, e_it);
+ if (num_es < m_e_ind)
+ return false;
+
+ const_e_iterator key_b_it = b_it;
+ std::advance(key_b_it, checked_ind);
+ const_e_iterator key_e_it = b_it;
+ std::advance(key_e_it, m_e_ind);
+
+ const_e_iterator value_b_it = m_pref_b_it;
+ std::advance(value_b_it, checked_ind);
+ const_e_iterator value_e_it = m_pref_b_it;
+ std::advance(value_e_it, m_e_ind);
+
+ return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it,
+ value_e_it);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_pointer
+ PB_DS_CLASS_C_DEC::
+ leftmost_descendant()
+ {
+ node_pointer p_pot =* begin();
+ if (p_pot->m_type == pat_trie_leaf_node_type)
+ return (static_cast<leaf_pointer>(p_pot));
+ _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);
+ return static_cast<internal_node_pointer>(p_pot)->leftmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+ PB_DS_CLASS_C_DEC::
+ leftmost_descendant() const
+ {
+ return const_cast<internal_node_pointer>(this)->leftmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::leaf_pointer
+ PB_DS_CLASS_C_DEC::
+ rightmost_descendant()
+ {
+ const size_type num_children = std::distance(begin(), end());
+ _GLIBCXX_DEBUG_ASSERT(num_children >= 2);
+
+ iterator it = begin();
+ std::advance(it, num_children - 1);
+ node_pointer p_pot =* it;
+ if (p_pot->m_type == pat_trie_leaf_node_type)
+ return static_cast<leaf_pointer>(p_pot);
+ _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);
+ return static_cast<internal_node_pointer>(p_pot)->rightmost_descendant();
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::const_leaf_pointer
+ PB_DS_CLASS_C_DEC::
+ rightmost_descendant() const
+ {
+ return const_cast<internal_node_pointer>(this)->rightmost_descendant();
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ e_ind() const
+ { return m_e_ind; }
+#endif
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ get_begin_pos() const
+ {
+ size_type i;
+ for (i = 0; i < arr_size && m_a_p_children[i] == NULL; ++i)
+ ;
+ return i;
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::subtree_debug_info
+ PB_DS_CLASS_C_DEC::
+ assert_valid_imp(const_e_access_traits_pointer p_traits) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_type == pat_trie_internal_node_type);
+ _GLIBCXX_DEBUG_ASSERT(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);
+ _GLIBCXX_DEBUG_ASSERT(std::distance(begin(), end()) >= 2);
+
+ for (typename pat_trie_internal_node::const_iterator it = begin();
+ it != end(); ++it)
+ {
+ const_node_pointer p_nd =* it;
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent == this);
+ subtree_debug_info child_ret = p_nd->assert_valid_imp(p_traits);
+
+ _GLIBCXX_DEBUG_ASSERT(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);
+ _GLIBCXX_DEBUG_ASSERT(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));
+ _GLIBCXX_DEBUG_ASSERT(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));
+ }
+ return std::make_pair(pref_b_it(), pref_e_it());
+ }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+#undef PB_DS_LEAF_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
new file mode 100644
index 000000000..9902d96db
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterators_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+begin()
+{ return iterator(m_p_head->m_p_min); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin() const
+{ return const_iterator(m_p_head->m_p_min); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+end()
+{ return iterator(m_p_head); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end() const
+{ return const_iterator(m_p_head); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
+PB_DS_CLASS_C_DEC::
+rbegin() const
+{
+ if (empty())
+ return rend();
+ return --end();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+rbegin()
+{
+ if (empty())
+ return rend();
+ return --end();
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+rend()
+{ return reverse_iterator(m_p_head); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reverse_iterator
+PB_DS_CLASS_C_DEC::
+rend() const
+{ return const_reverse_iterator(m_p_head); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+node_begin() const
+{ return const_node_iterator(m_p_head->m_p_parent, this); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_begin()
+{ return node_iterator(m_p_head->m_p_parent, this); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_node_iterator
+PB_DS_CLASS_C_DEC::
+node_end() const
+{ return const_node_iterator(NULL, this); }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+node_end()
+{ return node_iterator(NULL, this); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
new file mode 100644
index 000000000..91cf14faa
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/leaf.hpp
@@ -0,0 +1,171 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file leaf.hpp
+ * Contains a pat_trie_leaf for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_LEAF_HPP
+#define PB_DS_PAT_TRIE_LEAF_HPP
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ class Type_Traits, \
+ class E_Access_Traits, \
+ class Metadata, \
+ class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ pat_trie_leaf< \
+ Type_Traits, \
+ E_Access_Traits, \
+ Metadata, \
+ Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ pat_trie_node_base< \
+ Type_Traits, \
+ E_Access_Traits, \
+ Metadata, \
+ Allocator>
+
+#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC \
+ pat_trie_subtree_debug_info< \
+ Type_Traits, \
+ E_Access_Traits, \
+ Allocator>
+
+ template<typename Type_Traits,
+ class E_Access_Traits,
+ class Metadata,
+ class Allocator>
+ struct pat_trie_leaf : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef typename Type_Traits::value_type value_type;
+
+ typedef typename Type_Traits::const_reference const_reference;
+
+ typedef typename Type_Traits::reference reference;
+
+ typedef
+ typename Allocator::template rebind<
+ E_Access_Traits>::other::const_pointer
+ const_e_access_traits_pointer;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef
+ typename PB_DS_BASE_C_DEC::subtree_debug_info
+ subtree_debug_info;
+#endif
+
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ pat_trie_leaf(const_reference r_val);
+
+ inline reference
+ value();
+
+ inline const_reference
+ value() const;
+
+#ifdef _GLIBCXX_DEBUG
+ virtual subtree_debug_info
+ assert_valid_imp(const_e_access_traits_pointer p_traits) const;
+
+ virtual
+ ~pat_trie_leaf();
+#endif
+
+ private:
+ pat_trie_leaf(const PB_DS_CLASS_C_DEC& other);
+
+ value_type m_value;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ pat_trie_leaf(const_reference r_val) :
+ PB_DS_BASE_C_DEC(pat_trie_leaf_node_type), m_value(r_val)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::reference
+ PB_DS_CLASS_C_DEC::
+ value()
+ { return m_value; }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::const_reference
+ PB_DS_CLASS_C_DEC::
+ value() const
+ { return m_value; }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::subtree_debug_info
+ PB_DS_CLASS_C_DEC::
+ assert_valid_imp(const_e_access_traits_pointer p_traits) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_type == pat_trie_leaf_node_type);
+ subtree_debug_info ret;
+ const_reference r_val = value();
+ return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),
+ p_traits->end(p_traits->extract_key(r_val)));
+ }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ ~pat_trie_leaf() { }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
new file mode 100644
index 000000000..bb13068bc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_base.hpp
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_base.hpp
+ * Contains a pat_trie_node_base base for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP
+#define PB_DS_PAT_TRIE_NODE_BASE_HPP
+
+#include <ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Type_Traits, typename E_Access_Traits, \
+ typename Metadata, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>
+
+#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC \
+ pat_trie_subtree_debug_info<Type_Traits, E_Access_Traits, Allocator>
+
+ enum pat_trie_node_type
+ {
+ pat_trie_internal_node_type,
+ pat_trie_leaf_node_type,
+ pat_trie_head_node_type
+ };
+
+ template<typename Type_Traits,
+ typename E_Access_Traits,
+ typename Metadata,
+ typename Allocator>
+ struct pat_trie_node_base : public pat_trie_node_metadata_base<
+ Metadata,
+ Allocator>
+ {
+ public:
+ typedef
+ typename Allocator::template rebind<
+ pat_trie_node_base>::other::pointer
+ node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ E_Access_Traits>::other::const_pointer
+ const_e_access_traits_pointer;
+
+#ifdef _GLIBCXX_DEBUG
+ typedef
+ std::pair<
+ typename E_Access_Traits::const_iterator,
+ typename E_Access_Traits::const_iterator>
+ subtree_debug_info;
+#endif
+
+ pat_trie_node_base(pat_trie_node_type type);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid(const_e_access_traits_pointer p_traits) const;
+
+ virtual subtree_debug_info
+ assert_valid_imp(const_e_access_traits_pointer p_traits) const = 0;
+#endif
+
+ node_pointer m_p_parent;
+ const pat_trie_node_type m_type;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ pat_trie_node_base(pat_trie_node_type type) : m_type(type)
+ { }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ assert_valid(const_e_access_traits_pointer p_traits) const
+ { assert_valid_imp(p_traits); }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
new file mode 100644
index 000000000..37250091d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
@@ -0,0 +1,338 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_iterators.hpp
+ * Contains an implementation class for pat_trie_.
+ */
+
+#ifndef PB_DS_PAT_TRIE_NODE_ITERATORS_HPP
+#define PB_DS_PAT_TRIE_NODE_ITERATORS_HPP
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC \
+ pat_trie_const_node_it_< \
+ Node, \
+ Leaf, \
+ Head, \
+ Internal_Node, \
+ Const_Iterator, \
+ Iterator, \
+ E_Access_Traits, \
+ Allocator>
+
+#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC \
+ pat_trie_node_it_< \
+ Node, \
+ Leaf, \
+ Head, \
+ Internal_Node, \
+ Const_Iterator, \
+ Iterator, \
+ E_Access_Traits, \
+ Allocator>
+
+ // Const node iterator.
+ template<typename Node,
+ class Leaf,
+ class Head,
+ class Internal_Node,
+ class Const_Iterator,
+ class Iterator,
+ class E_Access_Traits,
+ class Allocator>
+ class pat_trie_const_node_it_
+ {
+ protected:
+ typedef
+ typename Allocator::template rebind<
+ Node>::other::pointer
+ node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Leaf>::other::const_pointer
+ const_leaf_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Leaf>::other::pointer
+ leaf_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Internal_Node>::other::pointer
+ internal_node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Internal_Node>::other::const_pointer
+ const_internal_node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ E_Access_Traits>::other::const_pointer
+ const_e_access_traits_pointer;
+
+ private:
+ inline typename E_Access_Traits::const_iterator
+ pref_begin() const
+ {
+ if (m_p_nd->m_type == pat_trie_leaf_node_type)
+ return (m_p_traits->begin(
+ m_p_traits->extract_key(
+ static_cast<const_leaf_pointer>(m_p_nd)->value())));
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
+
+ return (static_cast<const_internal_node_pointer>(m_p_nd)->pref_b_it());
+ }
+
+ inline typename E_Access_Traits::const_iterator
+ pref_end() const
+ {
+ if (m_p_nd->m_type == pat_trie_leaf_node_type)
+ return (m_p_traits->end(
+ m_p_traits->extract_key(
+ static_cast<const_leaf_pointer>(m_p_nd)->value())));
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
+
+ return (static_cast<const_internal_node_pointer>(m_p_nd)->pref_e_it());
+ }
+
+ public:
+
+ // Size type.
+ typedef typename Allocator::size_type size_type;
+
+ // Category.
+ typedef trivial_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef trivial_iterator_difference_type difference_type;
+
+ // __Iterator's value type.
+ typedef Const_Iterator value_type;
+
+ // __Iterator's reference type.
+ typedef value_type reference;
+
+ // __Iterator's __const reference type.
+ typedef value_type const_reference;
+
+ // Element access traits.
+ typedef E_Access_Traits e_access_traits;
+
+ // A key's element __const iterator.
+ typedef typename e_access_traits::const_iterator const_e_iterator;
+
+ // Metadata type.
+ typedef typename Node::metadata_type metadata_type;
+
+ // Const metadata reference type.
+ typedef
+ typename Allocator::template rebind<
+ metadata_type>::other::const_reference
+ const_metadata_reference;
+
+ // Default constructor.
+ /*
+ inline
+ pat_trie_const_node_it_()
+ */
+ inline
+ pat_trie_const_node_it_(node_pointer p_nd = NULL,
+ const_e_access_traits_pointer p_traits = NULL)
+ : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)
+ { }
+
+ // Subtree valid prefix.
+ inline std::pair<const_e_iterator, const_e_iterator>
+ valid_prefix() const
+ { return std::make_pair(pref_begin(), pref_end()); }
+
+ // Const access; returns the __const iterator* associated with
+ // the current leaf.
+ inline const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(num_children() == 0);
+ return Const_Iterator(m_p_nd);
+ }
+
+ // Metadata access.
+ inline const_metadata_reference
+ get_metadata() const
+ { return m_p_nd->get_metadata(); }
+
+ // Returns the number of children in the corresponding node.
+ inline size_type
+ num_children() const
+ {
+ if (m_p_nd->m_type == pat_trie_leaf_node_type)
+ return 0;
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
+ return std::distance(static_cast<internal_node_pointer>(m_p_nd)->begin(), static_cast<internal_node_pointer>(m_p_nd)->end());
+ }
+
+ // Returns a __const node __iterator to the corresponding node's
+ // i-th child.
+ PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
+ get_child(size_type i) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);
+ typename Internal_Node::iterator it =
+ static_cast<internal_node_pointer>(m_p_nd)->begin();
+
+ std::advance(it, i);
+ return PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC(*it, m_p_traits);
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const
+ { return (m_p_nd == other.m_p_nd); }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const
+ { return m_p_nd != other.m_p_nd; }
+
+ private:
+
+ friend class PB_DS_CLASS_C_DEC;
+
+ public:
+ node_pointer m_p_nd;
+
+ const_e_access_traits_pointer m_p_traits;
+ };
+
+ // Node iterator.
+ template<typename Node,
+ class Leaf,
+ class Head,
+ class Internal_Node,
+ class Const_Iterator,
+ class Iterator,
+ class E_Access_Traits,
+ class Allocator>
+ class pat_trie_node_it_ :
+ public PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
+
+ {
+ private:
+ typedef
+ typename Allocator::template rebind<
+ Node>::other::pointer
+ node_pointer;
+
+ typedef Iterator iterator;
+
+ typedef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC base_type;
+
+ typedef
+ typename base_type::const_e_access_traits_pointer
+ const_e_access_traits_pointer;
+
+ typedef typename base_type::internal_node_pointer internal_node_pointer;
+
+ public:
+
+ // Size type.
+ typedef
+ typename PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC::size_type
+ size_type;
+
+ // __Iterator's value type.
+ typedef Iterator value_type;
+
+ // __Iterator's reference type.
+ typedef value_type reference;
+
+ // __Iterator's __const reference type.
+ typedef value_type const_reference;
+
+ // Default constructor.
+ /*
+ inline
+ pat_trie_node_it_() ;
+ */
+
+ inline
+ pat_trie_node_it_(node_pointer p_nd = NULL, const_e_access_traits_pointer p_traits = NULL) : base_type(p_nd, p_traits)
+ { }
+
+ // Access; returns the iterator* associated with the current leaf.
+ inline reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);
+ return Iterator(base_type::m_p_nd);
+
+ }
+
+ // Returns a node __iterator to the corresponding node's i-th child.
+ PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC
+ get_child(size_type i) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == pat_trie_internal_node_type);
+
+ typename Internal_Node::iterator it =
+ static_cast<internal_node_pointer>(base_type::m_p_nd)->begin();
+
+ std::advance(it, i);
+ return PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC(*it, base_type::m_p_traits);
+ }
+
+ private:
+ friend class PB_DS_CLASS_C_DEC;
+ };
+
+#undef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC
+#undef PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
new file mode 100644
index 000000000..36272eda8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
@@ -0,0 +1,86 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_metadata_base.hpp
+ * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.
+ */
+
+#ifndef PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP
+#define PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP
+
+#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Metadata, class Allocator>
+ struct pat_trie_node_metadata_base
+ {
+ public:
+ typedef Metadata metadata_type;
+
+ typedef
+ typename Allocator::template rebind<
+ metadata_type>::other::const_reference
+ const_metadata_reference;
+
+ public:
+ inline const_metadata_reference
+ get_metadata() const
+ {
+ return (m_metadata);
+ }
+
+ public:
+ metadata_type m_metadata;
+ };
+
+ template<typename Allocator>
+ struct pat_trie_node_metadata_base<
+ null_node_metadata,
+ Allocator>
+ {
+ public:
+ typedef null_node_metadata metadata_type;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
new file mode 100644
index 000000000..f6f420986
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
@@ -0,0 +1,515 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file pat_trie_.hpp
+ * Contains an implementation class for a patricia tree.
+ */
+
+/**
+ * This implementation loosely borrows ideas from:
+ * 1) "Fast Mergeable Integer Maps", Okasaki, Gill 1998
+ * 2) "Ptset: Sets of integers implemented as Patricia trees",
+ * Jean-Christophe Filliatr, 2000
+ **/
+
+#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
+#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <iterator>
+#include <utility>
+#include <algorithm>
+#include <functional>
+#include <assert.h>
+#include <list>
+#ifdef _GLIBCXX_DEBUG
+#include <ext/pb_ds/detail/debug_map_base.hpp>
+#endif
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Node_And_It_Traits, \
+ typename Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME pat_trie_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME pat_trie_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME<Key, Mapped, Node_And_It_Traits, Allocator>
+
+#define PB_DS_TYPES_TRAITS_C_DEC \
+ types_traits<Key, Mapped, Allocator, false>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_DEBUG_MAP_BASE_C_DEC \
+ debug_map_base<Key, eq_by_less<Key, \
+ std::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference>
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#endif
+
+ /**
+ * class description = PATRICIA trie implementation.">
+ **/
+ template<typename Key,
+ typename Mapped,
+ typename Node_And_It_Traits,
+ typename Allocator>
+ class PB_DS_CLASS_NAME :
+#ifdef _GLIBCXX_DEBUG
+ public PB_DS_DEBUG_MAP_BASE_C_DEC,
+#endif
+ public Node_And_It_Traits::synth_e_access_traits,
+ public Node_And_It_Traits::node_update,
+ public PB_DS_TYPES_TRAITS_C_DEC
+ {
+ private:
+ typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;
+
+ typedef typename Node_And_It_Traits::synth_e_access_traits synth_e_access_traits;
+ typedef typename Allocator::template rebind<synth_e_access_traits>::other::const_pointer const_e_access_traits_pointer;
+ typedef typename synth_e_access_traits::const_iterator const_e_iterator;
+
+ typedef typename Node_And_It_Traits::node node;
+ typedef typename Allocator::template rebind<node>::other::const_pointer const_node_pointer;
+
+ typedef typename Allocator::template rebind<node>::other::pointer node_pointer;
+
+ typedef typename Node_And_It_Traits::head head;
+ typedef typename Allocator::template rebind<head>::other head_allocator;
+ typedef typename head_allocator::pointer head_pointer;
+
+ typedef typename Node_And_It_Traits::leaf leaf;
+ typedef typename Allocator::template rebind<leaf>::other leaf_allocator;
+ typedef typename leaf_allocator::const_pointer const_leaf_pointer;
+ typedef typename leaf_allocator::pointer leaf_pointer;
+
+ typedef typename Node_And_It_Traits::internal_node internal_node;
+ typedef typename Allocator::template rebind<internal_node>::other internal_node_allocator;
+ typedef typename internal_node_allocator::const_pointer const_internal_node_pointer;
+ typedef typename internal_node_allocator::pointer internal_node_pointer;
+
+#include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp>
+
+#ifdef _GLIBCXX_DEBUG
+ typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
+#endif
+
+#include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp>
+
+ typedef typename Node_And_It_Traits::null_node_update_pointer null_node_update_pointer;
+
+ public:
+ typedef pat_trie_tag container_category;
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef typename traits_base::key_type key_type;
+ typedef typename traits_base::key_pointer key_pointer;
+ typedef typename traits_base::const_key_pointer const_key_pointer;
+ typedef typename traits_base::key_reference key_reference;
+ typedef typename traits_base::const_key_reference const_key_reference;
+ typedef typename traits_base::mapped_type mapped_type;
+ typedef typename traits_base::mapped_pointer mapped_pointer;
+ typedef typename traits_base::const_mapped_pointer const_mapped_pointer;
+ typedef typename traits_base::mapped_reference mapped_reference;
+ typedef typename traits_base::const_mapped_reference const_mapped_reference;
+ typedef typename traits_base::value_type value_type;
+ typedef typename traits_base::pointer pointer;
+ typedef typename traits_base::const_pointer const_pointer;
+ typedef typename traits_base::reference reference;
+ typedef typename traits_base::const_reference const_reference;
+
+ typedef typename Node_And_It_Traits::const_iterator const_point_iterator;
+ typedef typename Node_And_It_Traits::iterator point_iterator;
+ typedef const_point_iterator const_iterator;
+ typedef point_iterator iterator;
+
+ typedef typename Node_And_It_Traits::const_reverse_iterator const_reverse_iterator;
+ typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;
+ typedef typename Node_And_It_Traits::const_node_iterator const_node_iterator;
+ typedef typename Node_And_It_Traits::node_iterator node_iterator;
+ typedef typename Node_And_It_Traits::e_access_traits e_access_traits;
+ typedef typename Node_And_It_Traits::node_update node_update;
+
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const e_access_traits&);
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ ~PB_DS_CLASS_NAME();
+
+ inline bool
+ empty() const;
+
+ inline size_type
+ size() const;
+
+ inline size_type
+ max_size() const;
+
+ e_access_traits&
+ get_e_access_traits();
+
+ const e_access_traits&
+ get_e_access_traits() const;
+
+ node_update&
+ get_node_update();
+
+ const node_update&
+ get_node_update() const;
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference);
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ return insert(std::make_pair(r_key, mapped_type())).first->second;
+#else
+ insert(r_key);
+ return traits_base::s_null_mapped;
+#endif
+ }
+
+ inline point_iterator
+ find(const_key_reference);
+
+ inline const_point_iterator
+ find(const_key_reference) const;
+
+ inline point_iterator
+ lower_bound(const_key_reference);
+
+ inline const_point_iterator
+ lower_bound(const_key_reference) const;
+
+ inline point_iterator
+ upper_bound(const_key_reference);
+
+ inline const_point_iterator
+ upper_bound(const_key_reference) const;
+
+ void
+ clear();
+
+ inline bool
+ erase(const_key_reference);
+
+ inline const_iterator
+ erase(const_iterator);
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ inline iterator
+ erase(iterator);
+#endif
+
+ inline const_reverse_iterator
+ erase(const_reverse_iterator);
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ inline reverse_iterator
+ erase(reverse_iterator);
+#endif
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred);
+
+ void
+ join(PB_DS_CLASS_C_DEC&);
+
+ void
+ split(const_key_reference, PB_DS_CLASS_C_DEC&);
+
+ inline iterator
+ begin();
+
+ inline const_iterator
+ begin() const;
+
+ inline iterator
+ end();
+
+ inline const_iterator
+ end() const;
+
+ inline reverse_iterator
+ rbegin();
+
+ inline const_reverse_iterator
+ rbegin() const;
+
+ inline reverse_iterator
+ rend();
+
+ inline const_reverse_iterator
+ rend() const;
+
+ inline const_node_iterator
+ node_begin() const;
+
+ inline node_iterator
+ node_begin();
+
+ inline const_node_iterator
+ node_end() const;
+
+ inline node_iterator
+ node_end();
+
+#ifdef PB_DS_PAT_TRIE_TRACE_
+ void
+ trace() const;
+#endif
+
+ protected:
+
+ template<typename It>
+ void
+ copy_from_range(It, It);
+
+ void
+ value_swap(PB_DS_CLASS_C_DEC&);
+
+ node_pointer
+ recursive_copy_node(const_node_pointer);
+
+ private:
+
+ void
+ initialize();
+
+ inline void
+ apply_update(node_pointer, null_node_update_pointer);
+
+ template<typename Node_Update_>
+ inline void
+ apply_update(node_pointer, Node_Update_*);
+
+ bool
+ join_prep(PB_DS_CLASS_C_DEC&, split_join_branch_bag&);
+
+ void
+ rec_join_prep(const_node_pointer, const_node_pointer,
+ split_join_branch_bag&);
+
+ void
+ rec_join_prep(const_leaf_pointer, const_leaf_pointer,
+ split_join_branch_bag&);
+
+ void
+ rec_join_prep(const_leaf_pointer, const_internal_node_pointer,
+ split_join_branch_bag&);
+
+ void
+ rec_join_prep(const_internal_node_pointer, const_leaf_pointer,
+ split_join_branch_bag&);
+
+ void
+ rec_join_prep(const_internal_node_pointer, const_internal_node_pointer,
+ split_join_branch_bag&);
+
+ node_pointer
+ rec_join(node_pointer, node_pointer, size_type, split_join_branch_bag&);
+
+ node_pointer
+ rec_join(leaf_pointer, leaf_pointer, split_join_branch_bag&);
+
+ node_pointer
+ rec_join(leaf_pointer, internal_node_pointer, size_type,
+ split_join_branch_bag&);
+
+ node_pointer
+ rec_join(internal_node_pointer, leaf_pointer, size_type,
+ split_join_branch_bag&);
+
+ node_pointer
+ rec_join(internal_node_pointer, internal_node_pointer,
+ split_join_branch_bag&);
+
+ size_type
+ keys_diff_ind(typename e_access_traits::const_iterator, typename e_access_traits::const_iterator, typename e_access_traits::const_iterator, typename e_access_traits::const_iterator);
+
+ internal_node_pointer
+ insert_branch(node_pointer, node_pointer, split_join_branch_bag&);
+
+ void
+ update_min_max_for_inserted_leaf(leaf_pointer);
+
+ void
+ erase_leaf(leaf_pointer);
+
+ inline void
+ actual_erase_leaf(leaf_pointer);
+
+ void
+ clear_imp(node_pointer);
+
+ void
+ erase_fixup(internal_node_pointer);
+
+ void
+ update_min_max_for_erased_leaf(leaf_pointer);
+
+ static inline const_e_iterator
+ pref_begin(const_node_pointer);
+
+ static inline const_e_iterator
+ pref_end(const_node_pointer);
+
+ inline node_pointer
+ find_imp(const_key_reference);
+
+ inline node_pointer
+ lower_bound_imp(const_key_reference);
+
+ inline node_pointer
+ upper_bound_imp(const_key_reference);
+
+ inline static const_leaf_pointer
+ leftmost_descendant(const_node_pointer);
+
+ inline static leaf_pointer
+ leftmost_descendant(node_pointer);
+
+ inline static const_leaf_pointer
+ rightmost_descendant(const_node_pointer);
+
+ inline static leaf_pointer
+ rightmost_descendant(node_pointer);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ void
+ assert_iterators() const;
+
+ void
+ assert_reverse_iterators() const;
+
+ static size_type
+ recursive_count_leafs(const_node_pointer);
+#endif
+
+#ifdef PB_DS_PAT_TRIE_TRACE_
+ static void
+ trace_node(const_node_pointer, size_type);
+
+ template<typename Metadata_>
+ static void
+ trace_node_metadata(const_node_pointer, type_to_type<Metadata_>);
+
+ static void
+ trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>);
+#endif
+
+ leaf_pointer
+ split_prep(const_key_reference, PB_DS_CLASS_C_DEC&,
+ split_join_branch_bag&);
+
+ node_pointer
+ rec_split(node_pointer, const_e_iterator, const_e_iterator,
+ PB_DS_CLASS_C_DEC&, split_join_branch_bag&);
+
+ void
+ split_insert_branch(size_type, const_e_iterator,
+ typename internal_node::iterator,
+ size_type, split_join_branch_bag&);
+
+ static head_allocator s_head_allocator;
+ static internal_node_allocator s_internal_node_allocator;
+ static leaf_allocator s_leaf_allocator;
+
+ head_pointer m_p_head;
+ size_type m_size;
+ };
+
+#include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp>
+#include <ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_NAME
+#undef PB_DS_TYPES_TRAITS_C_DEC
+#undef PB_DS_DEBUG_MAP_BASE_C_DEC
+#undef PB_DS_V2F
+#undef PB_DS_EP2VP
+#undef PB_DS_V2S
+
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
new file mode 100644
index 000000000..cada9071c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
@@ -0,0 +1,484 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file point_iterators.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+#ifndef PB_DS_PAT_TRIE_FIND_ITERATORS_HPP
+#define PB_DS_PAT_TRIE_FIND_ITERATORS_HPP
+
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CONST_IT_C_DEC \
+ pat_trie_const_it_< \
+ Type_Traits, \
+ Node, \
+ Leaf, \
+ Head, \
+ Internal_Node, \
+ Is_Forward_Iterator, \
+ Allocator>
+
+#define PB_DS_CONST_ODIR_IT_C_DEC \
+ pat_trie_const_it_< \
+ Type_Traits, \
+ Node, \
+ Leaf, \
+ Head, \
+ Internal_Node, \
+ !Is_Forward_Iterator, \
+ Allocator>
+
+#define PB_DS_IT_C_DEC \
+ pat_trie_it_< \
+ Type_Traits, \
+ Node, \
+ Leaf, \
+ Head, \
+ Internal_Node, \
+ Is_Forward_Iterator, \
+ Allocator>
+
+#define PB_DS_ODIR_IT_C_DEC \
+ pat_trie_it_< \
+ Type_Traits, \
+ Node, \
+ Leaf, \
+ Head, \
+ Internal_Node, \
+ !Is_Forward_Iterator, \
+ Allocator>
+
+
+ // Const iterator.
+ template<typename Type_Traits,
+ class Node,
+ class Leaf,
+ class Head,
+ class Internal_Node,
+ bool Is_Forward_Iterator,
+ class Allocator>
+ class pat_trie_const_it_
+ {
+
+ private:
+ typedef
+ typename Allocator::template rebind<
+ Node>::other::pointer
+ node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Leaf>::other::const_pointer
+ const_leaf_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Leaf>::other::pointer
+ leaf_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Head>::other::pointer
+ head_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Internal_Node>::other::pointer
+ internal_node_pointer;
+
+ public:
+
+ typedef std::bidirectional_iterator_tag iterator_category;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef typename Type_Traits::value_type value_type;
+
+ typedef typename Type_Traits::pointer pointer;
+
+ typedef typename Type_Traits::const_pointer const_pointer;
+
+ typedef typename Type_Traits::reference reference;
+
+ typedef typename Type_Traits::const_reference const_reference;
+
+ public:
+
+ inline
+ pat_trie_const_it_(node_pointer p_nd = NULL) : m_p_nd(p_nd)
+ { }
+
+ inline
+ pat_trie_const_it_(const PB_DS_CONST_ODIR_IT_C_DEC& other)
+ : m_p_nd(other.m_p_nd)
+ { }
+
+ inline
+ PB_DS_CONST_IT_C_DEC&
+ operator=(const PB_DS_CONST_IT_C_DEC& other)
+ {
+ m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline
+ PB_DS_CONST_IT_C_DEC&
+ operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)
+ {
+ m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline const_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);
+ return &static_cast<leaf_pointer>(m_p_nd)->value();
+ }
+
+ inline const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);
+ return static_cast<leaf_pointer>(m_p_nd)->value();
+ }
+
+ inline bool
+ operator==(const PB_DS_CONST_IT_C_DEC& other) const
+ { return (m_p_nd == other.m_p_nd); }
+
+ inline bool
+ operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
+ { return (m_p_nd == other.m_p_nd); }
+
+ inline bool
+ operator!=(const PB_DS_CONST_IT_C_DEC& other) const
+ { return (m_p_nd != other.m_p_nd); }
+
+ inline bool
+ operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const
+ { return (m_p_nd != other.m_p_nd); }
+
+ inline PB_DS_CONST_IT_C_DEC&
+ operator++()
+ {
+ inc(integral_constant<int,Is_Forward_Iterator>());
+ return *this;
+ }
+
+ inline PB_DS_CONST_IT_C_DEC
+ operator++(int)
+ {
+ PB_DS_CONST_IT_C_DEC ret_it(m_p_nd);
+ operator++();
+ return ret_it;
+ }
+
+ inline PB_DS_CONST_IT_C_DEC&
+ operator--()
+ {
+ dec(integral_constant<int,Is_Forward_Iterator>());
+ return *this;
+ }
+
+ inline PB_DS_CONST_IT_C_DEC
+ operator--(int)
+ {
+ PB_DS_CONST_IT_C_DEC ret_it(m_p_nd);
+ operator--();
+ return ret_it;
+ }
+
+ protected:
+ inline void
+ inc(false_type)
+ { dec(true_type()); }
+
+ void
+ inc(true_type)
+ {
+ if (m_p_nd->m_type == pat_trie_head_node_type)
+ {
+ m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;
+ return;
+ }
+
+ node_pointer p_y = m_p_nd->m_p_parent;
+ while (p_y->m_type != pat_trie_head_node_type &&
+ get_larger_sibling(m_p_nd) == NULL)
+ {
+ m_p_nd = p_y;
+ p_y = p_y->m_p_parent;
+ }
+
+ if (p_y->m_type == pat_trie_head_node_type)
+ {
+ m_p_nd = p_y;
+ return;
+ }
+ m_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));
+ }
+
+ inline void
+ dec(false_type)
+ { inc(true_type()); }
+
+ void
+ dec(true_type)
+ {
+ if (m_p_nd->m_type == pat_trie_head_node_type)
+ {
+ m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;
+ return;
+ }
+
+ node_pointer p_y = m_p_nd->m_p_parent;
+ while (p_y->m_type != pat_trie_head_node_type &&
+ get_smaller_sibling(m_p_nd) == NULL)
+ {
+ m_p_nd = p_y;
+ p_y = p_y->m_p_parent;
+ }
+
+ if (p_y->m_type == pat_trie_head_node_type)
+ {
+ m_p_nd = p_y;
+ return;
+ }
+ m_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));
+ }
+
+ inline static node_pointer
+ get_larger_sibling(node_pointer p_nd)
+ {
+ internal_node_pointer p_parent =
+ static_cast<internal_node_pointer>(p_nd->m_p_parent);
+
+ typename Internal_Node::iterator it = p_parent->begin();
+ while (*it != p_nd)
+ ++it;
+
+ typename Internal_Node::iterator next_it = it;
+ ++next_it;
+ return ((next_it == p_parent->end())? NULL :* next_it);
+ }
+
+ inline static node_pointer
+ get_smaller_sibling(node_pointer p_nd)
+ {
+ internal_node_pointer p_parent =
+ static_cast<internal_node_pointer>(p_nd->m_p_parent);
+
+ typename Internal_Node::iterator it = p_parent->begin();
+
+ if (*it == p_nd)
+ return (NULL);
+ typename Internal_Node::iterator prev_it;
+ do
+ {
+ prev_it = it;
+ ++it;
+ if (*it == p_nd)
+ return (*prev_it);
+ }
+ while (true);
+
+ _GLIBCXX_DEBUG_ASSERT(false);
+ return (NULL);
+ }
+
+ inline static leaf_pointer
+ leftmost_descendant(node_pointer p_nd)
+ {
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return static_cast<leaf_pointer>(p_nd);
+ return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();
+ }
+
+ inline static leaf_pointer
+ rightmost_descendant(node_pointer p_nd)
+ {
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ return static_cast<leaf_pointer>(p_nd);
+ return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();
+ }
+
+ public:
+ node_pointer m_p_nd;
+ };
+
+ // Iterator.
+ template<typename Type_Traits,
+ class Node,
+ class Leaf,
+ class Head,
+ class Internal_Node,
+ bool Is_Forward_Iterator,
+ class Allocator>
+ class pat_trie_it_ :
+ public PB_DS_CONST_IT_C_DEC
+
+ {
+ private:
+ typedef
+ typename Allocator::template rebind<
+ Node>::other::pointer
+ node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Leaf>::other::const_pointer
+ const_leaf_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Leaf>::other::pointer
+ leaf_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Head>::other::pointer
+ head_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ Internal_Node>::other::pointer
+ internal_node_pointer;
+
+ public:
+ typedef typename Type_Traits::value_type value_type;
+
+ typedef typename Type_Traits::const_pointer const_pointer;
+
+ typedef typename Type_Traits::pointer pointer;
+
+ typedef typename Type_Traits::const_reference const_reference;
+
+ typedef typename Type_Traits::reference reference;
+
+ inline
+ pat_trie_it_(node_pointer p_nd = NULL) : PB_DS_CONST_IT_C_DEC((node_pointer)p_nd)
+ { }
+
+ inline
+ pat_trie_it_(const PB_DS_ODIR_IT_C_DEC& other) : PB_DS_CONST_IT_C_DEC(other.m_p_nd)
+ { }
+
+ inline
+ PB_DS_IT_C_DEC&
+ operator=(const PB_DS_IT_C_DEC& other)
+ {
+ base_it_type::m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline
+ PB_DS_IT_C_DEC&
+ operator=(const PB_DS_ODIR_IT_C_DEC& other)
+ {
+ base_it_type::m_p_nd = other.m_p_nd;
+ return *this;
+ }
+
+ inline pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);
+
+ return &static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();
+ }
+
+ inline reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);
+ return static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();
+ }
+
+ inline PB_DS_IT_C_DEC&
+ operator++()
+ {
+ PB_DS_CONST_IT_C_DEC::
+ operator++();
+ return *this;
+ }
+
+ inline PB_DS_IT_C_DEC
+ operator++(int)
+ {
+ PB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);
+ operator++();
+ return ret_it;
+ }
+
+ inline PB_DS_IT_C_DEC&
+ operator--()
+ {
+ PB_DS_CONST_IT_C_DEC::operator--();
+ return *this;
+ }
+
+ inline PB_DS_IT_C_DEC
+ operator--(int)
+ {
+ PB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);
+ operator--();
+ return ret_it;
+ }
+
+ protected:
+ typedef PB_DS_CONST_IT_C_DEC base_it_type;
+
+ friend class PB_DS_CLASS_C_DEC;
+ };
+
+#undef PB_DS_CONST_IT_C_DEC
+#undef PB_DS_CONST_ODIR_IT_C_DEC
+#undef PB_DS_IT_C_DEC
+#undef PB_DS_ODIR_IT_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
new file mode 100644
index 000000000..79bfe4283
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file policy_access_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::e_access_traits&
+PB_DS_CLASS_C_DEC::
+get_e_access_traits()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const typename PB_DS_CLASS_C_DEC::e_access_traits&
+PB_DS_CLASS_C_DEC::
+get_e_access_traits() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_update&
+PB_DS_CLASS_C_DEC::
+get_node_update()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const typename PB_DS_CLASS_C_DEC::node_update&
+PB_DS_CLASS_C_DEC::
+get_node_update() const
+{ return *this; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
new file mode 100644
index 000000000..52edf2506
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file r_erase_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+actual_erase_node(node_pointer p_z)
+{
+ _GLIBCXX_DEBUG_ASSERT(m_size > 0);
+ --m_size;
+ _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));
+ p_z->~node();
+ s_node_allocator.deallocate(p_z, 1);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update_min_max_for_erased_node(node_pointer p_z)
+{
+ if (m_size == 1)
+ {
+ m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
+ return;
+ }
+
+ if (m_p_head->m_p_left == p_z)
+ {
+ iterator it(p_z);
+ ++it;
+ m_p_head->m_p_left = it.m_p_nd;
+ }
+ else if (m_p_head->m_p_right == p_z)
+ {
+ iterator it(p_z);
+ --it;
+ m_p_head->m_p_right = it.m_p_nd;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)
+ clear_imp(m_p_head->m_p_parent);
+ m_size = 0;
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
+ _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear_imp(node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return;
+ clear_imp(p_nd->m_p_left);
+ clear_imp(p_nd->m_p_right);
+ p_nd->~Node();
+ s_node_allocator.deallocate(p_nd, 1);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
new file mode 100644
index 000000000..c0809fa48
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file rotate_fn_imps.hpp
+ * Contains imps for rotating nodes.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rotate_left(node_pointer p_x)
+{
+ node_pointer p_y = p_x->m_p_right;
+ p_x->m_p_right = p_y->m_p_left;
+
+ if (p_y->m_p_left != NULL)
+ p_y->m_p_left->m_p_parent = p_x;
+
+ p_y->m_p_parent = p_x->m_p_parent;
+ if (p_x == m_p_head->m_p_parent)
+ m_p_head->m_p_parent = p_y;
+ else if (p_x == p_x->m_p_parent->m_p_left)
+ p_x->m_p_parent->m_p_left = p_y;
+ else
+ p_x->m_p_parent->m_p_right = p_y;
+
+ p_y->m_p_left = p_x;
+ p_x->m_p_parent = p_y;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
+
+ apply_update(p_x, (Node_Update* )this);
+ apply_update(p_x->m_p_parent, (Node_Update* )this);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rotate_right(node_pointer p_x)
+{
+ node_pointer p_y = p_x->m_p_left;
+ p_x->m_p_left = p_y->m_p_right;
+
+ if (p_y->m_p_right != NULL)
+ p_y->m_p_right->m_p_parent = p_x;
+
+ p_y->m_p_parent = p_x->m_p_parent;
+ if (p_x == m_p_head->m_p_parent)
+ m_p_head->m_p_parent = p_y;
+ else if (p_x == p_x->m_p_parent->m_p_right)
+ p_x->m_p_parent->m_p_right = p_y;
+ else
+ p_x->m_p_parent->m_p_left = p_y;
+
+ p_y->m_p_right = p_x;
+ p_x->m_p_parent = p_y;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)
+
+ apply_update(p_x, (Node_Update* )this);
+ apply_update(p_x->m_p_parent, (Node_Update* )this);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+rotate_parent(node_pointer p_nd)
+{
+ node_pointer p_parent = p_nd->m_p_parent;
+ if (p_nd == p_parent->m_p_left)
+ rotate_right(p_parent);
+ else
+ rotate_left(p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent || p_nd->m_p_right == p_parent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+apply_update(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/)
+{ }
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update_>
+inline void
+PB_DS_CLASS_C_DEC::
+apply_update(node_pointer p_nd, Node_Update_* p_update)
+{
+ p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == NULL) ?
+ NULL :
+ & PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == NULL) ?
+ NULL :
+ & PB_DS_V2F(p_nd->m_p_right->m_value));
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update_>
+inline void
+PB_DS_CLASS_C_DEC::
+update_to_top(node_pointer p_nd, Node_Update_* p_update)
+{
+ while (p_nd != m_p_head)
+ {
+ apply_update(p_nd, p_update);
+ p_nd = p_nd->m_p_parent;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update_to_top(node_pointer /*p_nd*/, __gnu_pbds::null_node_update* /*p_update*/)
+{ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
new file mode 100644
index 000000000..9779a4bcd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
@@ -0,0 +1,254 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_fn_imps.hpp
+ * Contains an implementation class for bin_search_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ split_join_branch_bag bag;
+ leaf_pointer p_split_lf = split_prep(r_key, other, bag);
+ if (p_split_lf == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(bag.empty());
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(!bag.empty());
+ other.clear();
+ m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent,
+ pref_begin(p_split_lf),
+ pref_end(p_split_lf),
+ other,
+ bag);
+
+ m_p_head->m_p_parent->m_p_parent = m_p_head;
+
+ other.m_p_head->m_p_max = m_p_head->m_p_max;
+ m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
+ other.m_p_head->m_p_min =
+ other.leftmost_descendant(other.m_p_head->m_p_parent);
+
+ other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(),
+ other.PB_DS_CLASS_C_DEC::end());
+ m_size -= other.m_size;
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::leaf_pointer
+PB_DS_CLASS_C_DEC::
+split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+{
+ _GLIBCXX_DEBUG_ASSERT(r_bag.empty());
+ if (m_size == 0)
+ {
+ other.clear();
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ return (NULL);
+ }
+
+ if (synth_e_access_traits::cmp_keys(r_key,
+ PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))
+ {
+ other.clear();
+ value_swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ return (NULL);
+ }
+
+ if (!synth_e_access_traits::cmp_keys(r_key,
+ PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value())))
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid(););
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid(););
+ return (NULL);
+ }
+
+ iterator it = lower_bound(r_key);
+
+ if (!synth_e_access_traits::equal_keys(PB_DS_V2F(*it), r_key))
+ --it;
+
+ node_pointer p_nd = it.m_p_nd;
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);
+ leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd);
+ while (p_nd->m_type != pat_trie_head_node_type)
+ {
+ r_bag.add_branch();
+ p_nd = p_nd->m_p_parent;
+ }
+ _GLIBCXX_DEBUG_ONLY(debug_base::split(r_key,(synth_e_access_traits& )(*this), other);)
+
+ return (p_ret_l);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+rec_split(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)
+{
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ {
+ _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == NULL);
+ return (p_nd);
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);
+ internal_node_pointer p_internal_nd = static_cast<internal_node_pointer>(p_nd);
+
+ node_pointer p_child_ret = rec_split(p_internal_nd->get_child_node(b_it, e_it, this), b_it, e_it, other, r_bag);
+
+ _GLIBCXX_DEBUG_ONLY(p_child_ret->assert_valid(this);)
+ p_internal_nd->replace_child(p_child_ret, b_it, e_it, this);
+ apply_update(p_internal_nd, (node_update* )this);
+
+ typename internal_node::iterator child_it =
+ p_internal_nd->get_child_it(b_it, e_it, this);
+
+ const size_type lhs_num_children =
+ std::distance(p_internal_nd->begin(), child_it) + 1;
+
+ _GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0);
+
+ size_type rhs_num_children =
+ std::distance(p_internal_nd->begin(), p_internal_nd->end()) -
+ lhs_num_children;
+
+ if (rhs_num_children == 0)
+ {
+ apply_update(p_internal_nd, (node_update* )this);
+ return (p_internal_nd);
+ }
+
+ ++child_it;
+ other.split_insert_branch(p_internal_nd->get_e_ind(),
+ b_it, child_it, rhs_num_children, r_bag);
+
+ child_it = p_internal_nd->get_child_it(b_it, e_it, this);
+ ++child_it;
+ while (rhs_num_children != 0)
+ {
+ child_it = p_internal_nd->remove_child(child_it);
+ --rhs_num_children;
+ }
+
+ apply_update(p_internal_nd, (node_update* )this);
+ _GLIBCXX_DEBUG_ASSERT(std::distance(p_internal_nd->begin(),
+ p_internal_nd->end()) >= 1);
+
+ if (std::distance(p_internal_nd->begin(), p_internal_nd->end()) > 1)
+ {
+ p_internal_nd->update_prefixes(this);
+ _GLIBCXX_DEBUG_ONLY(p_internal_nd->assert_valid(this);)
+ apply_update(p_internal_nd, (node_update* )this);
+ return (p_internal_nd);
+ }
+
+ node_pointer p_ret =* p_internal_nd->begin();
+ p_internal_nd->~internal_node();
+ s_internal_node_allocator.deallocate(p_internal_nd, 1);
+ apply_update(p_ret, (node_update* )this);
+ return (p_ret);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_node::iterator child_b_it, size_type num_children, split_join_branch_bag& r_bag)
+{
+#ifdef _GLIBCXX_DEBUG
+ if (m_p_head->m_p_parent != NULL)
+ m_p_head->m_p_parent->assert_valid(this);
+#endif
+
+ const size_type total_num_children =((m_p_head->m_p_parent == NULL)? 0 : 1) + num_children;
+
+ if (total_num_children == 0)
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == NULL);
+ return;
+ }
+
+ if (total_num_children == 1)
+ {
+ if (m_p_head->m_p_parent != NULL)
+ {
+ _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == NULL);
+ m_p_head->m_p_parent =* child_b_it;
+ m_p_head->m_p_parent->m_p_parent = m_p_head;
+ apply_update(m_p_head->m_p_parent, (node_update* )this);
+ _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(total_num_children > 1);
+ internal_node_pointer p_new_root = r_bag.get_branch();
+ new (p_new_root) internal_node(e_ind, b_it);
+ size_type num_inserted = 0;
+ while (num_inserted++ < num_children)
+ {
+ _GLIBCXX_DEBUG_ONLY((*child_b_it)->assert_valid(this);)
+ p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),
+ pref_end(*child_b_it), this);
+ ++child_b_it;
+ }
+
+ if (m_p_head->m_p_parent != NULL)
+ p_new_root->add_child(m_p_head->m_p_parent,
+ pref_begin(m_p_head->m_p_parent),
+ pref_end(m_p_head->m_p_parent), this);
+
+ m_p_head->m_p_parent = p_new_root;
+ p_new_root->m_p_parent = m_p_head;
+ apply_update(m_p_head->m_p_parent, (node_update* )this);
+ _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
new file mode 100644
index 000000000..9cecae517
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_branch_bag.hpp
+ * Contains an implementation class for pat_trie_.
+ */
+
+class split_join_branch_bag
+{
+private:
+ typedef
+ std::list<
+ internal_node_pointer,
+ typename Allocator::template rebind<
+ internal_node_pointer>::other>
+ bag_t;
+
+public:
+
+ void
+ add_branch()
+ {
+ internal_node_pointer p_nd = s_internal_node_allocator.allocate(1);
+ __try
+ {
+ m_bag.push_back(p_nd);
+ }
+ __catch(...)
+ {
+ s_internal_node_allocator.deallocate(p_nd, 1);
+ __throw_exception_again;
+ }
+ }
+
+ internal_node_pointer
+ get_branch()
+ {
+ _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());
+ internal_node_pointer p_nd =* m_bag.begin();
+ m_bag.pop_front();
+ return p_nd;
+ }
+
+ ~split_join_branch_bag()
+ {
+ while (!m_bag.empty())
+ {
+ internal_node_pointer p_nd =* m_bag.begin();
+ s_internal_node_allocator.deallocate(p_nd, 1);
+ m_bag.pop_front();
+ }
+ }
+
+ inline bool
+ empty() const
+ { return m_bag.empty(); }
+
+private:
+ bag_t m_bag;
+};
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
new file mode 100644
index 000000000..abf5f1185
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
@@ -0,0 +1,229 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file synth_e_access_traits.hpp
+ * Contains an implementation class for a patricia tree.
+ */
+
+#ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP
+
+#include <ext/pb_ds/detail/type_utils.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC \
+ template<typename Type_Traits, bool Set, class E_Access_Traits>
+
+#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC \
+ synth_e_access_traits< \
+ Type_Traits, \
+ Set, \
+ E_Access_Traits>
+
+ template<typename Type_Traits, bool Set, class E_Access_Traits>
+ struct synth_e_access_traits : public E_Access_Traits
+ {
+
+ private:
+ typedef E_Access_Traits base_type;
+
+ typedef Type_Traits type_traits;
+
+ typedef typename type_traits::const_key_reference const_key_reference;
+
+ typedef typename type_traits::const_reference const_reference;
+
+ public:
+ synth_e_access_traits();
+
+ synth_e_access_traits(const E_Access_Traits& r_traits);
+
+ inline bool
+ equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = true) const;
+
+ bool
+ equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+
+ bool
+ cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = false) const;
+
+ bool
+ cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;
+
+ inline static const_key_reference
+ extract_key(const_reference r_val);
+
+#ifdef _GLIBCXX_DEBUG
+ bool
+ operator()(const_key_reference r_lhs, const_key_reference r_rhs);
+#endif
+
+ private:
+ inline static const_key_reference
+ extract_key(const_reference r_val, true_type);
+
+ inline static const_key_reference
+ extract_key(const_reference r_val, false_type);
+
+ private:
+ static integral_constant<int,Set> s_set_ind;
+ };
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ integral_constant<int,Set>
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind;
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ synth_e_access_traits()
+ { }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ synth_e_access_traits(const E_Access_Traits& r_traits) :
+ E_Access_Traits(r_traits)
+ { }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ inline bool
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /*= false */) const
+ {
+ while (b_l != e_l)
+ {
+ if (b_r == e_r)
+ return (false);
+ if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))
+ return (false);
+ ++b_l;
+ ++b_r;
+ }
+ return (!compare_after || b_r == e_r);
+ }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ bool
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+ {
+ return (equal_prefixes(base_type::begin(r_lhs_key),
+ base_type::end(r_lhs_key),
+ base_type::begin(r_rhs_key),
+ base_type::end(r_rhs_key),
+ true));
+ }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ bool
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /* = false*/) const
+ {
+ while (b_l != e_l)
+ {
+ if (b_r == e_r)
+ return (false);
+ const typename base_type::size_type l_pos =
+ base_type::e_pos(*b_l);
+ const typename base_type::size_type r_pos =
+ base_type::e_pos(*b_r);
+ if (l_pos != r_pos)
+ return (l_pos < r_pos);
+ ++b_l;
+ ++b_r;
+ }
+
+ if (!compare_after)
+ return (false);
+ return (b_r != e_r);
+ }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ bool
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const
+ {
+ return (cmp_prefixes(base_type::begin(r_lhs_key),
+ base_type::end(r_lhs_key),
+ base_type::begin(r_rhs_key),
+ base_type::end(r_rhs_key),
+ true));
+ }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ extract_key(const_reference r_val)
+ {
+ return (extract_key(r_val, s_set_ind));
+ }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ extract_key(const_reference r_val, true_type)
+ {
+ return (r_val);
+ }
+
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ extract_key(const_reference r_val, false_type)
+ {
+ return (r_val.first);
+ }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+ bool
+ PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::
+ operator()(const_key_reference r_lhs, const_key_reference r_rhs)
+ {
+ return (cmp_keys(r_lhs, r_rhs));
+ }
+#endif
+
+#undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC
+#undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
new file mode 100644
index 000000000..e4b20943b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains an implementation class for pat_trie_.
+ */
+
+#ifdef PB_DS_PAT_TRIE_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << std::endl;
+ if (m_p_head->m_p_parent == NULL)
+ return;
+ trace_node(m_p_head->m_p_parent, 0);
+ std::cerr << std::endl;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_node(const_node_pointer p_nd, size_type level)
+{
+ for (size_type i = 0; i < level; ++i)
+ std::cerr << ' ';
+ std::cerr << p_nd << " ";
+ std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? "l " : "i ");
+
+ trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>());
+ typename e_access_traits::const_iterator el_it = pref_begin(p_nd);
+ while (el_it != pref_end(p_nd))
+ {
+ std::cerr <<* el_it;
+ ++el_it;
+ }
+
+ if (p_nd->m_type == pat_trie_leaf_node_type)
+ {
+ std::cerr << std::endl;
+ return;
+ }
+
+ const_internal_node_pointer p_internal =
+ static_cast<const_internal_node_pointer>(p_nd);
+
+ std::cerr << " " <<
+ static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl;
+
+ const size_type num_children = std::distance(p_internal->begin(),
+ p_internal->end());
+
+ for (size_type child_i = 0; child_i < num_children; ++child_i)
+ {
+ typename internal_node::const_iterator child_it =
+ p_internal->begin();
+ std::advance(child_it, num_children - child_i - 1);
+ trace_node(*child_it, level + 1);
+ }
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Metadata_>
+void
+PB_DS_CLASS_C_DEC::
+trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)
+{
+ std::cerr << "(" << static_cast<unsigned long>(p_nd->get_metadata()) << ") ";
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>)
+{ }
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
new file mode 100644
index 000000000..c8e7f587b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/traits.hpp
@@ -0,0 +1,350 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file traits.hpp
+ * Contains an implementation class for pat_trie_.
+ */
+
+#ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
+
+#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>
+#include <ext/pb_ds/detail/pat_trie_/head.hpp>
+#include <ext/pb_ds/detail/pat_trie_/leaf.hpp>
+#include <ext/pb_ds/detail/pat_trie_/internal_node.hpp>
+#include <ext/pb_ds/detail/pat_trie_/point_iterators.hpp>
+#include <ext/pb_ds/detail/pat_trie_/node_iterators.hpp>
+#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Key,
+ typename Mapped,
+ class E_Access_Traits,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct trie_traits<
+ Key,
+ Mapped,
+ E_Access_Traits,
+ Node_Update,
+ pat_trie_tag,
+ Allocator>
+ {
+ private:
+ typedef types_traits< Key, Mapped, Allocator, false> type_traits;
+
+ public:
+ typedef
+ typename trie_node_metadata_selector<
+ Key,
+ Mapped,
+ E_Access_Traits,
+ Node_Update,
+ Allocator>::type
+ metadata_type;
+
+ typedef E_Access_Traits e_access_traits;
+
+ typedef
+ __gnu_pbds::detail::synth_e_access_traits<
+ type_traits,
+ false,
+ e_access_traits>
+ synth_e_access_traits;
+
+ typedef
+ pat_trie_node_base<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ node;
+
+ typedef
+ pat_trie_leaf<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ leaf;
+
+ typedef
+ pat_trie_head<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ head;
+
+ typedef
+ pat_trie_internal_node<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ internal_node;
+
+ typedef
+ pat_trie_const_it_<
+ type_traits,
+ node,
+ leaf,
+ head,
+ internal_node,
+ true,
+ Allocator>
+ const_iterator;
+
+ typedef
+ pat_trie_it_<
+ type_traits,
+ node,
+ leaf,
+ head,
+ internal_node,
+ true,
+ Allocator>
+ iterator;
+
+ typedef
+ pat_trie_const_it_<
+ type_traits,
+ node,
+ leaf,
+ head,
+ internal_node,
+ false,
+ Allocator>
+ const_reverse_iterator;
+
+ typedef
+ pat_trie_it_<
+ type_traits,
+ node,
+ leaf,
+ head,
+ internal_node,
+ false,
+ Allocator>
+ reverse_iterator;
+
+ typedef
+ pat_trie_const_node_it_<
+ node,
+ leaf,
+ head,
+ internal_node,
+ const_iterator,
+ iterator,
+ synth_e_access_traits,
+ Allocator>
+ const_node_iterator;
+
+ typedef
+ pat_trie_node_it_<
+ node,
+ leaf,
+ head,
+ internal_node,
+ const_iterator,
+ iterator,
+ synth_e_access_traits,
+ Allocator>
+ node_iterator;
+
+ typedef
+ Node_Update<
+ const_node_iterator,
+ node_iterator,
+ E_Access_Traits,
+ Allocator>
+ node_update;
+
+ typedef
+ __gnu_pbds::null_trie_node_update<
+ const_node_iterator,
+ node_iterator,
+ E_Access_Traits,
+ Allocator>*
+ null_node_update_pointer;
+ };
+
+ template<typename Key,
+ class E_Access_Traits,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct trie_traits<
+ Key,
+ null_mapped_type,
+ E_Access_Traits,
+ Node_Update,
+ pat_trie_tag,
+ Allocator>
+ {
+ private:
+ typedef
+ types_traits<
+ Key,
+ null_mapped_type,
+ Allocator,
+ false>
+ type_traits;
+
+ public:
+ typedef
+ typename trie_node_metadata_selector<
+ Key,
+ null_mapped_type,
+ E_Access_Traits,
+ Node_Update,
+ Allocator>::type
+ metadata_type;
+
+ typedef E_Access_Traits e_access_traits;
+
+ typedef
+ __gnu_pbds::detail::synth_e_access_traits<
+ type_traits,
+ true,
+ e_access_traits>
+ synth_e_access_traits;
+
+ typedef
+ pat_trie_node_base<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ node;
+
+ typedef
+ pat_trie_leaf<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ leaf;
+
+ typedef
+ pat_trie_head<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ head;
+
+ typedef
+ pat_trie_internal_node<
+ type_traits,
+ synth_e_access_traits,
+ metadata_type,
+ Allocator>
+ internal_node;
+
+ typedef
+ pat_trie_const_it_<
+ type_traits,
+ node,
+ leaf,
+ head,
+ internal_node,
+ true,
+ Allocator>
+ const_iterator;
+
+ typedef const_iterator iterator;
+
+ typedef
+ pat_trie_const_it_<
+ type_traits,
+ node,
+ leaf,
+ head,
+ internal_node,
+ false,
+ Allocator>
+ const_reverse_iterator;
+
+ typedef const_reverse_iterator reverse_iterator;
+
+ typedef
+ pat_trie_const_node_it_<
+ node,
+ leaf,
+ head,
+ internal_node,
+ const_iterator,
+ iterator,
+ synth_e_access_traits,
+ Allocator>
+ const_node_iterator;
+
+ typedef const_node_iterator node_iterator;
+
+ typedef
+ Node_Update<
+ const_node_iterator,
+ node_iterator,
+ E_Access_Traits,
+ Allocator>
+ node_update;
+
+ typedef
+ __gnu_pbds::null_trie_node_update<
+ const_node_iterator,
+ const_node_iterator,
+ E_Access_Traits,
+ Allocator>*
+ null_node_update_pointer;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
new file mode 100644
index 000000000..6d275e731
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file update_fn_imps.hpp
+ * Contains an implementation class for pat_trie_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+apply_update(node_pointer /*p_nd*/, null_node_update_pointer)
+{ }
+
+PB_DS_CLASS_T_DEC
+template<typename Node_Update_>
+inline void
+PB_DS_CLASS_C_DEC::
+apply_update(node_pointer p_nd, Node_Update_* /*p_update*/)
+{
+ Node_Update_::operator()(node_iterator(p_nd, this),
+ const_node_iterator(NULL, this));
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
new file mode 100644
index 000000000..ad05c4f57
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file priority_queue_base_dispatch.hpp
+ * Contains an pqiative container dispatching base.
+ */
+
+#ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
+#define PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
+
+#include <ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp>
+#include <ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp>
+#include <ext/pb_ds/detail/binary_heap_/binary_heap_.hpp>
+#include <ext/pb_ds/detail/thin_heap_/thin_heap_.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Value_Type, typename Cmp_Fn, typename Tag, typename Allocator>
+ struct priority_queue_base_dispatch;
+
+ template<typename Value_Type, typename Cmp_Fn, typename Allocator>
+ struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, pairing_heap_tag, Allocator>
+ {
+ typedef pairing_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ };
+
+ template<typename Value_Type, typename Cmp_Fn, typename Allocator>
+ struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binomial_heap_tag, Allocator>
+ {
+ typedef binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ };
+
+ template<typename Value_Type, typename Cmp_Fn, typename Allocator>
+ struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, rc_binomial_heap_tag, Allocator>
+ {
+ typedef rc_binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ };
+
+ template<typename Value_Type, typename Cmp_Fn, typename Allocator>
+ struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binary_heap_tag, Allocator>
+ {
+ typedef binary_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ };
+
+ template<typename Value_Type, typename Cmp_Fn, typename Allocator>
+ struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, thin_heap_tag, Allocator>
+ {
+ typedef thin_heap_< Value_Type, Cmp_Fn, Allocator> type;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..1abfe21de
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME()
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+ base_type(r_cmp_fn)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+ base_type(r_cmp_fn, r_node_update)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+ base_type(other)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ base_type::swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{ base_type::m_p_head->m_red = true; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
new file mode 100644
index 000000000..18ecc4230
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
@@ -0,0 +1,78 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+assert_node_consistent(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ return 1;
+
+ const size_type l_height = assert_node_consistent(p_nd->m_p_left);
+ const size_type r_height = assert_node_consistent(p_nd->m_p_right);
+ if (p_nd->m_red)
+ {
+ _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_nd->m_p_left));
+ _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_nd->m_p_right));
+ }
+ _GLIBCXX_DEBUG_ASSERT(l_height == r_height);
+ return (p_nd->m_red ? 0 : 1) + l_height;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ base_type::assert_valid();
+ const node_pointer p_head = base_type::m_p_head;
+ _GLIBCXX_DEBUG_ASSERT(p_head->m_red);
+ if (p_head->m_p_parent != NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(!p_head->m_p_parent->m_red);
+ assert_node_consistent(p_head->m_p_parent);
+ }
+}
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
new file mode 100644
index 000000000..685b8a51b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
@@ -0,0 +1,289 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ point_iterator it = find(r_key);
+ if (it == base_type::end())
+ return false;
+ erase(it);
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+erase(iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ if (it == base_type::end())
+ return it;
+
+ iterator ret_it = it;
+ ++ret_it;
+ erase_node(it.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+erase(reverse_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ if (it.m_p_nd == base_type::m_p_head)
+ return it;
+
+ reverse_iterator ret_it = it;
+ ++ret_it;
+ erase_node(it.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ size_type num_ersd = 0;
+ iterator it = base_type::begin();
+ while (it != base_type::end())
+ {
+ if (pred(*it))
+ {
+ ++num_ersd;
+ it = erase(it);
+ }
+ else
+ ++it;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return num_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_node(node_pointer p_nd)
+{
+ remove_node(p_nd);
+ base_type::actual_erase_node(p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+remove_node(node_pointer p_z)
+{
+ update_min_max_for_erased_node(p_z);
+ node_pointer p_y = p_z;
+ node_pointer p_x = NULL;
+ node_pointer p_new_x_parent = NULL;
+
+ if (p_y->m_p_left == NULL)
+ p_x = p_y->m_p_right;
+ else if (p_y->m_p_right == NULL)
+ p_x = p_y->m_p_left;
+ else
+ {
+ p_y = p_y->m_p_right;
+ while (p_y->m_p_left != NULL)
+ p_y = p_y->m_p_left;
+ p_x = p_y->m_p_right;
+ }
+
+ if (p_y == p_z)
+ {
+ p_new_x_parent = p_y->m_p_parent;
+ if (p_x != NULL)
+ p_x->m_p_parent = p_y->m_p_parent;
+
+ if (base_type::m_p_head->m_p_parent == p_z)
+ base_type::m_p_head->m_p_parent = p_x;
+ else if (p_z->m_p_parent->m_p_left == p_z)
+ {
+ p_y->m_p_left = p_z->m_p_parent;
+ p_z->m_p_parent->m_p_left = p_x;
+ }
+ else
+ {
+ p_y->m_p_left = NULL;
+ p_z->m_p_parent->m_p_right = p_x;
+ }
+ }
+ else
+ {
+ p_z->m_p_left->m_p_parent = p_y;
+ p_y->m_p_left = p_z->m_p_left;
+ if (p_y != p_z->m_p_right)
+ {
+ p_new_x_parent = p_y->m_p_parent;
+ if (p_x != NULL)
+ p_x->m_p_parent = p_y->m_p_parent;
+ p_y->m_p_parent->m_p_left = p_x;
+ p_y->m_p_right = p_z->m_p_right;
+ p_z->m_p_right->m_p_parent = p_y;
+ }
+ else
+ p_new_x_parent = p_y;
+
+ if (base_type::m_p_head->m_p_parent == p_z)
+ base_type::m_p_head->m_p_parent = p_y;
+ else if (p_z->m_p_parent->m_p_left == p_z)
+ p_z->m_p_parent->m_p_left = p_y;
+ else
+ p_z->m_p_parent->m_p_right = p_y;
+
+ p_y->m_p_parent = p_z->m_p_parent;
+ std::swap(p_y->m_red, p_z->m_red);
+ p_y = p_z;
+ }
+
+ update_to_top(p_new_x_parent, (node_update* )this);
+
+ if (p_y->m_red)
+ return;
+
+ remove_fixup(p_x, p_new_x_parent);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+remove_fixup(node_pointer p_x, node_pointer p_new_x_parent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_x == NULL || p_x->m_p_parent == p_new_x_parent);
+
+ while (p_x != base_type::m_p_head->m_p_parent && is_effectively_black(p_x))
+ if (p_x == p_new_x_parent->m_p_left)
+ {
+ node_pointer p_w = p_new_x_parent->m_p_right;
+ if (p_w->m_red)
+ {
+ p_w->m_red = false;
+ p_new_x_parent->m_red = true;
+ base_type::rotate_left(p_new_x_parent);
+ p_w = p_new_x_parent->m_p_right;
+ }
+
+ if (is_effectively_black(p_w->m_p_left)
+ && is_effectively_black(p_w->m_p_right))
+ {
+ p_w->m_red = true;
+ p_x = p_new_x_parent;
+ p_new_x_parent = p_new_x_parent->m_p_parent;
+ }
+ else
+ {
+ if (is_effectively_black(p_w->m_p_right))
+ {
+ if (p_w->m_p_left != NULL)
+ p_w->m_p_left->m_red = false;
+
+ p_w->m_red = true;
+ base_type::rotate_right(p_w);
+ p_w = p_new_x_parent->m_p_right;
+ }
+
+ p_w->m_red = p_new_x_parent->m_red;
+ p_new_x_parent->m_red = false;
+
+ if (p_w->m_p_right != NULL)
+ p_w->m_p_right->m_red = false;
+
+ base_type::rotate_left(p_new_x_parent);
+ update_to_top(p_new_x_parent, (node_update* )this);
+ break;
+ }
+ }
+ else
+ {
+ node_pointer p_w = p_new_x_parent->m_p_left;
+ if (p_w->m_red == true)
+ {
+ p_w->m_red = false;
+ p_new_x_parent->m_red = true;
+ base_type::rotate_right(p_new_x_parent);
+ p_w = p_new_x_parent->m_p_left;
+ }
+
+ if (is_effectively_black(p_w->m_p_right)
+ && is_effectively_black(p_w->m_p_left))
+ {
+ p_w->m_red = true;
+ p_x = p_new_x_parent;
+ p_new_x_parent = p_new_x_parent->m_p_parent;
+ }
+ else
+ {
+ if (is_effectively_black(p_w->m_p_left))
+ {
+ if (p_w->m_p_right != NULL)
+ p_w->m_p_right->m_red = false;
+
+ p_w->m_red = true;
+ base_type::rotate_left(p_w);
+ p_w = p_new_x_parent->m_p_left;
+ }
+
+ p_w->m_red = p_new_x_parent->m_red;
+ p_new_x_parent->m_red = false;
+
+ if (p_w->m_p_left != NULL)
+ p_w->m_p_left->m_red = false;
+
+ base_type::rotate_right(p_new_x_parent);
+ update_to_top(p_new_x_parent, (node_update* )this);
+ break;
+ }
+ }
+
+ if (p_x != NULL)
+ p_x->m_red = false;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
new file mode 100644
index 000000000..9378e1565
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
new file mode 100644
index 000000000..6b43b1a99
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+is_effectively_black(const node_pointer p_nd)
+{ return (p_nd == NULL || !p_nd->m_red); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
new file mode 100644
index 000000000..16a5d1edb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert(const_reference r_value)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ std::pair<point_iterator, bool> ins_pair = base_type::insert_leaf(r_value);
+ if (ins_pair.second == true)
+ {
+ ins_pair.first.m_p_nd->m_red = true;
+ _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid();)
+ insert_fixup(ins_pair.first.m_p_nd);
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return ins_pair;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+insert_fixup(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_red == true);
+ while (p_nd != base_type::m_p_head->m_p_parent && p_nd->m_p_parent->m_red)
+ {
+ if (p_nd->m_p_parent == p_nd->m_p_parent->m_p_parent->m_p_left)
+ {
+ node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_right;
+ if (p_y != NULL && p_y->m_red)
+ {
+ p_nd->m_p_parent->m_red = false;
+ p_y->m_red = false;
+ p_nd->m_p_parent->m_p_parent->m_red = true;
+ p_nd = p_nd->m_p_parent->m_p_parent;
+ }
+ else
+ {
+ if (p_nd == p_nd->m_p_parent->m_p_right)
+ {
+ p_nd = p_nd->m_p_parent;
+ base_type::rotate_left(p_nd);
+ }
+ p_nd->m_p_parent->m_red = false;
+ p_nd->m_p_parent->m_p_parent->m_red = true;
+ base_type::rotate_right(p_nd->m_p_parent->m_p_parent);
+ }
+ }
+ else
+ {
+ node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_left;
+ if (p_y != NULL && p_y->m_red)
+ {
+ p_nd->m_p_parent->m_red = false;
+ p_y->m_red = false;
+ p_nd->m_p_parent->m_p_parent->m_red = true;
+ p_nd = p_nd->m_p_parent->m_p_parent;
+ }
+ else
+ {
+ if (p_nd == p_nd->m_p_parent->m_p_left)
+ {
+ p_nd = p_nd->m_p_parent;
+ base_type::rotate_right(p_nd);
+ }
+ p_nd->m_p_parent->m_red = false;
+ p_nd->m_p_parent->m_p_parent->m_red = true;
+ base_type::rotate_left(p_nd->m_p_parent->m_p_parent);
+ }
+ }
+ }
+
+ base_type::update_to_top(p_nd, (node_update* )this);
+ base_type::m_p_head->m_p_parent->m_red = false;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
new file mode 100644
index 000000000..3f24c762c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/node.hpp
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+#ifndef PB_DS_RB_TREE_NODE_HPP
+#define PB_DS_RB_TREE_NODE_HPP
+
+#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Value_Type, class Metadata, class Allocator>
+ struct rb_tree_node_
+ {
+ public:
+ typedef Value_Type value_type;
+ typedef Metadata metadata_type;
+
+ typedef
+ typename Allocator::template rebind<
+ rb_tree_node_<
+ Value_Type,
+ Metadata,
+ Allocator> >::other::pointer
+ node_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ metadata_type>::other::reference
+ metadata_reference;
+
+ typedef
+ typename Allocator::template rebind<
+ metadata_type>::other::const_reference
+ const_metadata_reference;
+
+ inline bool
+ special() const
+ { return m_red; }
+
+ inline const_metadata_reference
+ get_metadata() const
+ { return m_metadata; }
+
+ inline metadata_reference
+ get_metadata()
+ { return m_metadata; }
+
+#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
+ void
+ trace() const
+ {
+ std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> ")
+ << "(" << m_metadata << ")";
+ }
+#endif
+
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+ node_pointer m_p_parent;
+ value_type m_value;
+ bool m_red;
+ metadata_type m_metadata;
+ };
+
+ template<typename Value_Type, class Allocator>
+ struct rb_tree_node_<Value_Type, null_node_metadata, Allocator>
+ {
+ public:
+ typedef Value_Type value_type;
+ typedef null_node_metadata metadata_type;
+
+ typedef
+ typename Allocator::template rebind<
+ rb_tree_node_<
+ Value_Type,
+ null_node_metadata,
+ Allocator> >::other::pointer
+ node_pointer;
+
+ inline bool
+ special() const
+ { return m_red; }
+
+#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
+ void
+ trace() const
+ { std::cout << PB_DS_V2F(m_value) <<(m_red? " <r> " : " <b> "); }
+#endif
+
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+ node_pointer m_p_parent;
+ value_type m_value;
+ bool m_red;
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
new file mode 100644
index 000000000..9010def74
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
@@ -0,0 +1,280 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file rb_tree_.hpp
+ * Contains an implementation for rb_tree_.
+ */
+/*
+ * This implementation uses an idea from the SGI STL (using a "header" node
+ * which is needed for efficient iteration).
+ */
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
+#endif
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
+#endif
+#endif
+
+#include <ext/pb_ds/detail/standard_policies.hpp>
+#include <ext/pb_ds/detail/basic_types.hpp>
+#include <utility>
+#include <vector>
+#include <assert.h>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Cmp_Fn, \
+ typename Node_And_It_Traits, typename Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME rb_tree_data_
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME rb_tree_no_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#endif
+
+ template<typename Key,
+ typename Mapped,
+ typename Cmp_Fn,
+ typename Node_And_It_Traits,
+ typename Allocator>
+ class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+ typedef typename base_type::node_pointer node_pointer;
+
+ public:
+ typedef Cmp_Fn cmp_fn;
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::key_pointer key_pointer;
+ typedef typename base_type::const_key_pointer const_key_pointer;
+ typedef typename base_type::key_reference key_reference;
+ typedef typename base_type::const_key_reference const_key_reference;
+ typedef typename base_type::mapped_type mapped_type;
+ typedef typename base_type::mapped_pointer mapped_pointer;
+ typedef typename base_type::const_mapped_pointer const_mapped_pointer;
+ typedef typename base_type::mapped_reference mapped_reference;
+ typedef typename base_type::const_mapped_reference const_mapped_reference;
+ typedef typename base_type::value_type value_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_point_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::reverse_iterator reverse_iterator;
+ typedef typename base_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename base_type::node_update node_update;
+
+
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const Cmp_Fn&);
+
+ PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ template<typename It>
+ void
+ copy_from_range(It, It);
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference);
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ std::pair<point_iterator, bool> ins_pair =
+ base_type::insert_leaf(value_type(r_key, mapped_type()));
+
+ if (ins_pair.second == true)
+ {
+ ins_pair.first.m_p_nd->m_red = true;
+ _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid();)
+ insert_fixup(ins_pair.first.m_p_nd);
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return ins_pair.first.m_p_nd->m_value.second;
+#else
+ insert(r_key);
+ return base_type::s_null_mapped;
+#endif
+ }
+
+ inline bool
+ erase(const_key_reference);
+
+ inline iterator
+ erase(iterator);
+
+ inline reverse_iterator
+ erase(reverse_iterator);
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred);
+
+ void
+ join(PB_DS_CLASS_C_DEC&);
+
+ void
+ split(const_key_reference, PB_DS_CLASS_C_DEC&);
+
+ protected:
+
+ private:
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ size_type
+ assert_node_consistent(const node_pointer) const;
+#endif
+
+ inline static bool
+ is_effectively_black(const node_pointer);
+
+ void
+ initialize();
+
+ void
+ insert_fixup(node_pointer);
+
+ void
+ erase_node(node_pointer);
+
+ void
+ remove_node(node_pointer);
+
+ void
+ remove_fixup(node_pointer, node_pointer);
+
+ void
+ split_imp(node_pointer, PB_DS_CLASS_C_DEC&);
+
+ inline node_pointer
+ split_min();
+
+ std::pair<node_pointer, node_pointer>
+ split_min_imp();
+
+ void
+ join_imp(node_pointer, node_pointer);
+
+ std::pair<node_pointer, node_pointer>
+ find_join_pos_right(node_pointer, size_type, size_type);
+
+ std::pair<node_pointer, node_pointer>
+ find_join_pos_left(node_pointer, size_type, size_type);
+
+ inline size_type
+ black_height(node_pointer);
+
+ void
+ split_at_node(node_pointer, PB_DS_CLASS_C_DEC&);
+ };
+
+#include <ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp>
+#include <ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_NAME
+#undef PB_DS_BASE_CLASS_NAME
+#undef PB_DS_BASE_C_DEC
+#undef PB_DS_V2F
+#undef PB_DS_EP2VP
+#undef PB_DS_V2S
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..9776a8d9a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
@@ -0,0 +1,313 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.base_type::assert_valid();)
+ if (base_type::join_prep(other) == false)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ const node_pointer p_x = other.split_min();
+ join_imp(p_x, other.m_p_head->m_p_parent);
+ base_type::join_finish(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.base_type::assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+join_imp(node_pointer p_x, node_pointer p_r)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_x != NULL);
+ if (p_r != NULL)
+ p_r->m_red = false;
+
+ const size_type h = black_height(base_type::m_p_head->m_p_parent);
+ const size_type other_h = black_height(p_r);
+ node_pointer p_x_l;
+ node_pointer p_x_r;
+ std::pair<node_pointer, node_pointer> join_pos;
+ const bool right_join = h >= other_h;
+ if (right_join)
+ {
+ join_pos = find_join_pos_right(base_type::m_p_head->m_p_parent,
+ h, other_h);
+ p_x_l = join_pos.first;
+ p_x_r = p_r;
+ }
+ else
+ {
+ p_x_l = base_type::m_p_head->m_p_parent;
+ base_type::m_p_head->m_p_parent = p_r;
+ if (p_r != NULL)
+ p_r->m_p_parent = base_type::m_p_head;
+
+ join_pos = find_join_pos_left(base_type::m_p_head->m_p_parent,
+ h, other_h);
+ p_x_r = join_pos.first;
+ }
+
+ node_pointer p_parent = join_pos.second;
+ if (p_parent == base_type::m_p_head)
+ {
+ base_type::m_p_head->m_p_parent = p_x;
+ p_x->m_p_parent = base_type::m_p_head;
+ }
+ else
+ {
+ p_x->m_p_parent = p_parent;
+ if (right_join)
+ p_x->m_p_parent->m_p_right = p_x;
+ else
+ p_x->m_p_parent->m_p_left = p_x;
+ }
+
+ p_x->m_p_left = p_x_l;
+ if (p_x_l != NULL)
+ p_x_l->m_p_parent = p_x;
+
+ p_x->m_p_right = p_x_r;
+ if (p_x_r != NULL)
+ p_x_r->m_p_parent = p_x;
+
+ p_x->m_red = true;
+
+ base_type::initialize_min_max();
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)
+ base_type::update_to_top(p_x, (node_update* )this);
+ insert_fixup(p_x);
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid());
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+split_min()
+{
+ node_pointer p_min = base_type::m_p_head->m_p_left;
+
+#ifdef _GLIBCXX_DEBUG
+ const node_pointer p_head = base_type::m_p_head;
+ _GLIBCXX_DEBUG_ASSERT(p_min != p_head);
+#endif
+
+ remove_node(p_min);
+ return p_min;
+}
+
+PB_DS_CLASS_T_DEC
+std::pair<
+ typename PB_DS_CLASS_C_DEC::node_pointer,
+ typename PB_DS_CLASS_C_DEC::node_pointer>
+PB_DS_CLASS_C_DEC::
+find_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r)
+{
+ _GLIBCXX_DEBUG_ASSERT(h_l >= h_r);
+
+ if (base_type::m_p_head->m_p_parent == NULL)
+ return (std::make_pair((node_pointer)NULL, base_type::m_p_head));
+
+ node_pointer p_l_parent = base_type::m_p_head;
+ while (h_l > h_r)
+ {
+ if (p_l->m_red == false)
+ {
+ _GLIBCXX_DEBUG_ASSERT(h_l > 0);
+ --h_l;
+ }
+
+ p_l_parent = p_l;
+ p_l = p_l->m_p_right;
+ }
+
+ if (!is_effectively_black(p_l))
+ {
+ p_l_parent = p_l;
+ p_l = p_l->m_p_right;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_l));
+ _GLIBCXX_DEBUG_ASSERT(black_height(p_l) == h_r);
+ _GLIBCXX_DEBUG_ASSERT(p_l == NULL || p_l->m_p_parent == p_l_parent);
+ return std::make_pair(p_l, p_l_parent);
+}
+
+PB_DS_CLASS_T_DEC
+std::pair<
+ typename PB_DS_CLASS_C_DEC::node_pointer,
+ typename PB_DS_CLASS_C_DEC::node_pointer>
+PB_DS_CLASS_C_DEC::
+find_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r)
+{
+ _GLIBCXX_DEBUG_ASSERT(h_r > h_l);
+ if (base_type::m_p_head->m_p_parent == NULL)
+ return (std::make_pair((node_pointer)NULL,
+ base_type::m_p_head));
+ node_pointer p_r_parent = base_type::m_p_head;
+ while (h_r > h_l)
+ {
+ if (p_r->m_red == false)
+ {
+ _GLIBCXX_DEBUG_ASSERT(h_r > 0);
+ --h_r;
+ }
+
+ p_r_parent = p_r;
+ p_r = p_r->m_p_left;
+ }
+
+ if (!is_effectively_black(p_r))
+ {
+ p_r_parent = p_r;
+ p_r = p_r->m_p_left;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_r));
+ _GLIBCXX_DEBUG_ASSERT(black_height(p_r) == h_l);
+ _GLIBCXX_DEBUG_ASSERT(p_r == NULL || p_r->m_p_parent == p_r_parent);
+ return std::make_pair(p_r, p_r_parent);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+black_height(node_pointer p_nd)
+{
+ size_type h = 1;
+ while (p_nd != NULL)
+ {
+ if (p_nd->m_red == false)
+ ++h;
+ p_nd = p_nd->m_p_left;
+ }
+ return h;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_valid();)
+
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.base_type::assert_valid();)
+
+ if (base_type::split_prep(r_key, other) == false)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.base_type::structure_only_assert_valid();)
+ node_pointer p_nd = upper_bound(r_key).m_p_nd;
+ do
+ {
+ node_pointer p_next_nd = p_nd->m_p_parent;
+ if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
+ split_at_node(p_nd, other);
+
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.base_type::structure_only_assert_valid();)
+ p_nd = p_next_nd;
+ }
+ while (p_nd != base_type::m_p_head);
+
+ base_type::split_finish(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+
+ node_pointer p_l = p_nd->m_p_left;
+ node_pointer p_r = p_nd->m_p_right;
+ node_pointer p_parent = p_nd->m_p_parent;
+ if (p_parent == base_type::m_p_head)
+ {
+ base_type::m_p_head->m_p_parent = p_l;
+ if (p_l != NULL)
+ {
+ p_l->m_p_parent = base_type::m_p_head;
+ p_l->m_red = false;
+ }
+ }
+ else
+ {
+ if (p_parent->m_p_left == p_nd)
+ p_parent->m_p_left = p_l;
+ else
+ p_parent->m_p_right = p_l;
+
+ if (p_l != NULL)
+ p_l->m_p_parent = p_parent;
+
+ update_to_top(p_parent, (node_update* )this);
+
+ if (!p_nd->m_red)
+ remove_fixup(p_l, p_parent);
+ }
+
+ base_type::initialize_min_max();
+ other.join_imp(p_nd, p_r);
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.base_type::structure_only_assert_valid());
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
new file mode 100644
index 000000000..531d8e46e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rb_tree_map_/traits.hpp
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file traits.hpp
+ * Contains an implementation for rb_tree_.
+ */
+
+#ifndef PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP
+
+#include <ext/pb_ds/detail/rb_tree_map_/node.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key,
+ typename Mapped,
+ typename Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ typename Allocator>
+ struct tree_traits<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ rb_tree_tag,
+ Allocator> : public bin_search_tree_traits<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ rb_tree_node_<
+ typename types_traits<
+ Key,
+ Mapped,
+ Allocator,
+ false>::value_type,
+ typename tree_node_metadata_selector<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ Allocator>::type,
+ Allocator>,
+ Allocator>
+ { };
+
+ template<typename Key,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct tree_traits<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ rb_tree_tag,
+ Allocator> : public bin_search_tree_traits<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ rb_tree_node_<
+ typename types_traits<
+ Key,
+ null_mapped_type,
+ Allocator,
+ false>::value_type,
+ typename tree_node_metadata_selector<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ Allocator>::type,
+ Allocator>,
+ Allocator>
+ { };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..bf4dcfefd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+rc_binomial_heap_()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+rc_binomial_heap_(const Cmp_Fn& r_cmp_fn) :
+ PB_DS_BASE_C_DEC(r_cmp_fn)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+rc_binomial_heap_(const PB_DS_CLASS_C_DEC& other) :
+ PB_DS_BASE_C_DEC(other)
+{
+ make_binomial_heap();
+
+ base_type::find_max();
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~rc_binomial_heap_()
+{ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ base_type::swap(other);
+
+ m_rc.swap(other.m_rc);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..0194905c4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
@@ -0,0 +1,121 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ base_type::assert_valid(false);
+ if (!base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_max != NULL);
+ base_type::assert_max();
+ }
+
+ m_rc.assert_valid();
+
+ if (m_rc.empty())
+ {
+ base_type::assert_valid(true);
+ _GLIBCXX_DEBUG_ASSERT(next_2_pointer(base_type::m_p_root) == NULL);
+ return;
+ }
+
+ const_node_pointer p_nd = next_2_pointer(base_type::m_p_root);
+ typename rc_t::const_iterator it = m_rc.end();
+ --it;
+
+ while (p_nd != NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(*it == p_nd);
+ const_node_pointer p_next = p_nd->m_p_next_sibling;
+ _GLIBCXX_DEBUG_ASSERT(p_next != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_next->m_metadata);
+ _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == NULL ||
+ p_next->m_metadata < p_next->m_p_next_sibling->m_metadata);
+
+ --it;
+ p_nd = next_2_pointer(next_after_0_pointer(p_nd));
+ }
+ _GLIBCXX_DEBUG_ASSERT(it + 1 == m_rc.begin());
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::const_node_pointer
+PB_DS_CLASS_C_DEC::
+next_2_pointer(const_node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return NULL;
+
+ node_pointer p_next = p_nd->m_p_next_sibling;
+
+ if (p_next == NULL)
+ return NULL;
+
+ if (p_nd->m_metadata == p_next->m_metadata)
+ return p_nd;
+
+ return next_2_pointer(p_next);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::const_node_pointer
+PB_DS_CLASS_C_DEC::
+next_after_0_pointer(const_node_pointer p_nd)
+{
+ if (p_nd == NULL)
+ return NULL;
+
+ node_pointer p_next = p_nd->m_p_next_sibling;
+
+ if (p_next == NULL)
+ return NULL;
+
+ if (p_nd->m_metadata < p_next->m_metadata)
+ return p_next;
+
+ return next_after_0_pointer(p_next);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
new file mode 100644
index 000000000..1113ffa66
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
@@ -0,0 +1,107 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+pop()
+{
+ make_binomial_heap();
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+ base_type::pop();
+ base_type::find_max();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ base_type::clear();
+ m_rc.clear();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+make_binomial_heap()
+{
+ node_pointer p_nd = base_type::m_p_root;
+ while (p_nd != NULL)
+ {
+ node_pointer p_next = p_nd->m_p_next_sibling;
+ if (p_next == NULL)
+ p_nd = p_next;
+ else if (p_nd->m_metadata == p_next->m_metadata)
+ p_nd = link_with_next_sibling(p_nd);
+ else if (p_nd->m_metadata < p_next->m_metadata)
+ p_nd = p_next;
+#ifdef _GLIBCXX_DEBUG
+ else
+ _GLIBCXX_DEBUG_ASSERT(0);
+#endif
+ }
+
+ m_rc.clear();
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ make_binomial_heap();
+ const size_type ersd = base_type::erase_if(pred);
+ base_type::find_max();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return ersd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase(point_iterator it)
+{
+ make_binomial_heap();
+ base_type::erase(it);
+ base_type::find_max();
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
new file mode 100644
index 000000000..aef4b928e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+push(const_reference r_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ make_0_exposed();
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
+
+ p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = NULL;
+ p_nd->m_metadata = 0;
+
+ if (base_type::m_p_max == NULL || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val))
+ base_type::m_p_max = p_nd;
+
+ p_nd->m_p_next_sibling = base_type::m_p_root;
+
+ if (base_type::m_p_root != NULL)
+ base_type::m_p_root->m_p_prev_or_parent = p_nd;
+
+ base_type::m_p_root = p_nd;
+
+ if (p_nd->m_p_next_sibling != NULL&& p_nd->m_p_next_sibling->m_metadata == 0)
+ m_rc.push(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return point_iterator(p_nd);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+modify(point_iterator it, const_reference r_new_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ make_binomial_heap();
+
+ base_type::modify(it, r_new_val);
+
+ base_type::find_max();
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+link_with_next_sibling(node_pointer p_nd)
+{
+ node_pointer p_next = p_nd->m_p_next_sibling;
+
+ _GLIBCXX_DEBUG_ASSERT(p_next != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_next->m_p_prev_or_parent == p_nd);
+
+ if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))
+ {
+ p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;
+
+ if (p_next->m_p_prev_or_parent == NULL)
+ base_type::m_p_root = p_next;
+ else
+ p_next->m_p_prev_or_parent->m_p_next_sibling = p_next;
+
+ if (base_type::m_p_max == p_nd)
+ base_type::m_p_max = p_next;
+
+ base_type::make_child_of(p_nd, p_next);
+
+ ++p_next->m_metadata;
+
+ return p_next;
+ }
+
+ p_nd->m_p_next_sibling = p_next->m_p_next_sibling;
+
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;
+
+ if (base_type::m_p_max == p_next)
+ base_type::m_p_max = p_nd;
+
+ base_type::make_child_of(p_next, p_nd);
+
+ ++p_nd->m_metadata;
+
+ return p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+make_0_exposed()
+{
+ if (m_rc.empty())
+ return;
+
+ node_pointer p_nd = m_rc.top();
+
+ m_rc.pop();
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata);
+
+ node_pointer p_res = link_with_next_sibling(p_nd);
+
+ if (p_res->m_p_next_sibling != NULL&& p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)
+ m_rc.push(p_res);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
new file mode 100644
index 000000000..9b70accd9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
@@ -0,0 +1,262 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file rc.hpp
+ * Contains a redundant (binary counter).
+ */
+
+#ifndef PB_DS_RC_HPP
+#define PB_DS_RC_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Node, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ rc<Node, Allocator>
+
+ template<typename Node, class Allocator>
+ class rc
+ {
+ private:
+ typedef Allocator allocator_type;
+
+ typedef typename allocator_type::size_type size_type;
+
+ typedef Node node;
+
+ typedef
+ typename allocator_type::template rebind<
+ node>::other::pointer
+ node_pointer;
+
+ typedef
+ typename allocator_type::template rebind<
+ node_pointer>::other::pointer
+ entry_pointer;
+
+ typedef
+ typename allocator_type::template rebind<
+ node_pointer>::other::const_pointer
+ const_entry_pointer;
+
+ enum
+ {
+ max_entries = sizeof(size_type) << 3
+ };
+
+ public:
+ typedef node_pointer entry;
+
+ typedef const_entry_pointer const_iterator;
+
+ public:
+ rc();
+
+ rc(const PB_DS_CLASS_C_DEC& other);
+
+ inline void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ inline void
+ push(entry p_nd);
+
+ inline node_pointer
+ top() const;
+
+ inline void
+ pop();
+
+ inline bool
+ empty() const;
+
+ inline size_type
+ size() const;
+
+ void
+ clear();
+
+ const const_iterator
+ begin() const;
+
+ const const_iterator
+ end() const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ private:
+ node_pointer m_a_entries[max_entries];
+
+ size_type m_over_top;
+ };
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ rc() : m_over_top(0)
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ PB_DS_CLASS_C_DEC::
+ rc(const PB_DS_CLASS_C_DEC& other) : m_over_top(0)
+ { _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ swap(PB_DS_CLASS_C_DEC& other)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ const size_type over_top = std::max(m_over_top, other.m_over_top);
+
+ for (size_type i = 0; i < over_top; ++i)
+ std::swap(m_a_entries[i], other.m_a_entries[i]);
+
+ std::swap(m_over_top, other.m_over_top);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ push(entry p_nd)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries);
+ m_a_entries[m_over_top++] = p_nd;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline void
+ PB_DS_CLASS_C_DEC::
+ pop()
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!empty());
+ --m_over_top;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::node_pointer
+ PB_DS_CLASS_C_DEC::
+ top() const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!empty());
+ return *(m_a_entries + m_over_top - 1);
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline bool
+ PB_DS_CLASS_C_DEC::
+ empty() const
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return m_over_top == 0;
+ }
+
+ PB_DS_CLASS_T_DEC
+ inline typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ size() const
+ { return m_over_top; }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ clear()
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ m_over_top = 0;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+ PB_DS_CLASS_T_DEC
+ const typename PB_DS_CLASS_C_DEC::const_iterator
+ PB_DS_CLASS_C_DEC::
+ begin() const
+ { return& m_a_entries[0]; }
+
+ PB_DS_CLASS_T_DEC
+ const typename PB_DS_CLASS_C_DEC::const_iterator
+ PB_DS_CLASS_C_DEC::
+ end() const
+ { return& m_a_entries[m_over_top]; }
+
+#ifdef _GLIBCXX_DEBUG
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ assert_valid() const
+ { _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries); }
+#endif
+
+#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ trace() const
+ {
+ std::cout << "rc" << std::endl;
+ for (size_type i = 0; i < m_over_top; ++i)
+ std::cerr << m_a_entries[i] << std::endl;
+ std::cout << std::endl;
+ }
+#endif
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
new file mode 100644
index 000000000..762e29b39
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
@@ -0,0 +1,198 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file rc_binomial_heap_.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+/*
+ * Redundant-counter binomial heap.
+ */
+
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/rc.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ rc_binomial_heap_<Value_Type, Cmp_Fn, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>
+
+#define PB_DS_RC_C_DEC \
+ rc<typename PB_DS_BASE_C_DEC::node, Allocator>
+
+ /**
+ * class description = "8y|\|0|\/|i41 h34p 74813">
+ **/
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ class rc_binomial_heap_ : public PB_DS_BASE_C_DEC
+ {
+
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ typedef typename base_type::node_pointer node_pointer;
+
+ typedef typename base_type::const_node_pointer const_node_pointer;
+
+ typedef PB_DS_RC_C_DEC rc_t;
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef typename base_type::pointer pointer;
+
+ typedef typename base_type::const_pointer const_pointer;
+
+ typedef typename base_type::reference reference;
+
+ typedef typename base_type::const_reference const_reference;
+
+ typedef typename base_type::const_point_iterator const_point_iterator;
+
+ typedef typename base_type::point_iterator point_iterator;
+
+ typedef typename base_type::const_iterator const_iterator;
+
+ typedef typename base_type::iterator iterator;
+
+ typedef typename base_type::cmp_fn cmp_fn;
+
+ typedef typename base_type::allocator_type allocator_type;
+
+ public:
+
+ rc_binomial_heap_();
+
+ rc_binomial_heap_(const Cmp_Fn& r_cmp_fn);
+
+ rc_binomial_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ ~rc_binomial_heap_();
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ inline point_iterator
+ push(const_reference r_val);
+
+ void
+ modify(point_iterator it, const_reference r_new_val);
+
+ inline void
+ pop();
+
+ void
+ erase(point_iterator it);
+
+ inline void
+ clear();
+
+ template<typename Pred>
+ size_type
+ erase_if(Pred pred);
+
+ template<typename Pred>
+ void
+ split(Pred pred, PB_DS_CLASS_C_DEC& other);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ private:
+
+ inline node_pointer
+ link_with_next_sibling(node_pointer p_nd);
+
+ void
+ make_0_exposed();
+
+ void
+ make_binomial_heap();
+
+#ifdef _GLIBCXX_DEBUG
+ static const_node_pointer
+ next_2_pointer(const_node_pointer p_nd);
+
+ static const_node_pointer
+ next_after_0_pointer(const_node_pointer p_nd);
+#endif
+
+ private:
+ rc_t m_rc;
+ };
+
+#include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+
+#undef PB_DS_CLASS_T_DEC
+
+#undef PB_DS_BASE_C_DEC
+
+#undef PB_DS_RC_C_DEC
+ } // namespace detail
+} // namespace __gnu_pbds
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..26965aec8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+void
+PB_DS_CLASS_C_DEC::
+split(Pred pred, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ make_binomial_heap();
+ other.make_binomial_heap();
+
+ base_type::split(pred, other);
+
+ base_type::find_max();
+ other.find_max();
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ make_binomial_heap();
+ other.make_binomial_heap();
+
+ base_type::join(other);
+
+ base_type::find_max();
+ other.find_max();
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
new file mode 100644
index 000000000..1fb3b8bd4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains an implementation for rc_binomial_heap_.
+ */
+
+#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ base_type::trace();
+
+ m_rc.trace();
+}
+
+#endif // #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
new file mode 100644
index 000000000..94cd515e3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
@@ -0,0 +1,211 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file cc_hash_max_collision_check_resize_trigger_imp.hpp
+ * Contains a resize trigger implementation.
+ */
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+cc_hash_max_collision_check_resize_trigger(float load) :
+ m_load(load),
+ m_size(0),
+ m_num_col(0),
+ m_max_col(0),
+ m_resize_needed(false)
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_start()
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_collision()
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_end()
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_start()
+{ m_num_col = 0; }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_collision()
+{ ++m_num_col; }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_end()
+{ calc_resize_needed(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_start()
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_collision()
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_end()
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_inserted(size_type)
+{ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erased(size_type)
+{ m_resize_needed = true; }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_cleared()
+{ m_resize_needed = false; }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+is_resize_needed() const
+{ return m_resize_needed; }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+is_grow_needed(size_type /*size*/, size_type /*num_used_e*/) const
+{ return m_num_col >= m_max_col; }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_resized(size_type new_size)
+{
+ m_size = new_size;
+
+#ifdef PB_DS_HT_MAP_RESIZE_TRACE_
+ std::cerr << "chmccrt::notify_resized "
+ << static_cast<unsigned long>(new_size) << std::endl;
+#endif
+
+ calc_max_num_coll();
+ calc_resize_needed();
+ m_num_col = 0;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+calc_max_num_coll()
+{
+ // max_col <-- \sqrt{2 load \ln( 2 m \ln( m ) ) }
+ const double ln_arg = 2 * m_size * std::log(double(m_size));
+ m_max_col = size_type(std::ceil(std::sqrt(2 * m_load * std::log(ln_arg))));
+
+#ifdef PB_DS_HT_MAP_RESIZE_TRACE_
+ std::cerr << "chmccrt::calc_max_num_coll "
+ << static_cast<unsigned long>(m_size) << " "
+ << static_cast<unsigned long>(m_max_col) << std::endl;
+#endif
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_externally_resized(size_type new_size)
+{ notify_resized(new_size); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ std::swap(m_load, other.m_load);
+ std::swap(m_size, other.m_size);
+ std::swap(m_num_col, other.m_num_col);
+ std::swap(m_max_col, other.m_max_col);
+ std::swap(m_resize_needed, other.m_resize_needed);
+}
+
+PB_DS_CLASS_T_DEC
+inline float
+PB_DS_CLASS_C_DEC::
+get_load() const
+{
+ PB_DS_STATIC_ASSERT(access, external_load_access);
+ return m_load;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+calc_resize_needed()
+{ m_resize_needed = m_resize_needed || m_num_col >= m_max_col; }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+set_load(float load)
+{
+ PB_DS_STATIC_ASSERT(access, external_load_access);
+ m_load = load;
+ calc_max_num_coll();
+ calc_resize_needed();
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
new file mode 100644
index 000000000..b58f2ec9d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_exponential_size_policy_imp.hpp
+ * Contains a resize size policy implementation.
+ */
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+hash_exponential_size_policy(size_type start_size, size_type grow_factor) :
+ m_start_size(start_size),
+ m_grow_factor(grow_factor)
+{ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ std::swap(m_start_size, other.m_start_size);
+ std::swap(m_grow_factor, other.m_grow_factor);
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+get_nearest_larger_size(size_type size) const
+{
+ size_type ret = m_start_size;
+ while (ret <= size)
+ {
+ const size_type next_ret = ret* m_grow_factor;
+ if (next_ret < ret)
+ __throw_insert_error();
+ ret = next_ret;
+ }
+ return ret;
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+get_nearest_smaller_size(size_type size) const
+{
+ size_type ret = m_start_size;
+ while (true)
+ {
+ const size_type next_ret = ret* m_grow_factor;
+ if (next_ret < ret)
+ __throw_resize_error();
+ if (next_ret >= size)
+ return (ret);
+ ret = next_ret;
+ }
+ return ret;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
new file mode 100644
index 000000000..3403b0976
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
@@ -0,0 +1,289 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_load_check_resize_trigger_imp.hpp
+ * Contains a resize trigger implementation.
+ */
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+hash_load_check_resize_trigger(float load_min, float load_max)
+: m_load_min(load_min), m_load_max(load_max), m_next_shrink_size(0),
+ m_next_grow_size(0), m_resize_needed(false)
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_start()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_collision()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_end()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_start()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_collision()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_end()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_start()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_collision()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_end()
+{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_inserted(size_type num_entries)
+{
+ m_resize_needed = (num_entries >= m_next_grow_size);
+ size_base::set_size(num_entries);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erased(size_type num_entries)
+{
+ size_base::set_size(num_entries);
+ m_resize_needed = num_entries <= m_next_shrink_size;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+is_resize_needed() const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return m_resize_needed;
+}
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+is_grow_needed(size_type /*size*/, size_type num_entries) const
+{
+ _GLIBCXX_DEBUG_ASSERT(m_resize_needed);
+ return num_entries >= m_next_grow_size;
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~hash_load_check_resize_trigger() { }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_resized(size_type new_size)
+{
+ m_resize_needed = false;
+ m_next_grow_size = size_type(m_load_max * new_size - 1);
+ m_next_shrink_size = size_type(m_load_min * new_size);
+
+#ifdef PB_DS_HT_MAP_RESIZE_TRACE_
+ std::cerr << "hlcrt::notify_resized " <<
+ static_cast<unsigned long>(new_size) << " " <<
+ static_cast<unsigned long>(m_load_min) << " " <<
+ static_cast<unsigned long>(m_load_max) << " " <<
+ static_cast<unsigned long>(m_next_shrink_size) << " " <<
+ static_cast<unsigned long>(m_next_grow_size) << " " << std::endl;
+#endif
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_externally_resized(size_type new_size)
+{
+ m_resize_needed = false;
+ size_type new_grow_size = size_type(m_load_max * new_size - 1);
+ size_type new_shrink_size = size_type(m_load_min * new_size);
+ if (new_grow_size >= m_next_grow_size)
+ {
+ _GLIBCXX_DEBUG_ASSERT(new_shrink_size > m_next_shrink_size);
+ m_next_grow_size = new_grow_size;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+#ifdef PB_DS_HT_MAP_RESIZE_TRACE_
+ std::cerr << "hlcrt::notify_externally_resized1 " <<
+ static_cast<unsigned long>(new_size) << " " <<
+ static_cast<unsigned long>(m_load_min) << " " <<
+ static_cast<unsigned long>(m_load_max) << " " <<
+ static_cast<unsigned long>(m_next_shrink_size) << " " <<
+ static_cast<unsigned long>(m_next_grow_size) << " " << std::endl;
+#endif
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(new_shrink_size <= m_next_shrink_size);
+ m_next_shrink_size = new_shrink_size;
+
+#ifdef PB_DS_HT_MAP_RESIZE_TRACE_
+ std::cerr << "hlcrt::notify_externally_resized2 " <<
+ static_cast<unsigned long>(new_size) << " " <<
+ static_cast<unsigned long>(m_load_min) << " " <<
+ static_cast<unsigned long>(m_load_max) << " " <<
+ static_cast<unsigned long>(m_next_shrink_size) << " " <<
+ static_cast<unsigned long>(m_next_grow_size) << " " << std::endl;
+#endif
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_cleared()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ size_base::set_size(0);
+ m_resize_needed = (0 < m_next_shrink_size);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ size_base::swap(other);
+ std::swap(m_load_min, other.m_load_min);
+ std::swap(m_load_max, other.m_load_max);
+ std::swap(m_resize_needed, other.m_resize_needed);
+ std::swap(m_next_grow_size, other.m_next_grow_size);
+ std::swap(m_next_shrink_size, other.m_next_shrink_size);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+inline std::pair<float, float>
+PB_DS_CLASS_C_DEC::
+get_loads() const
+{
+ PB_DS_STATIC_ASSERT(access, external_load_access);
+ return std::make_pair(m_load_min, m_load_max);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+set_loads(std::pair<float, float> load_pair)
+{
+ PB_DS_STATIC_ASSERT(access, external_load_access);
+ const float old_load_min = m_load_min;
+ const float old_load_max = m_load_max;
+ const size_type old_next_shrink_size = m_next_shrink_size;
+ const size_type old_next_grow_size = m_next_grow_size;
+ const bool old_resize_needed = m_resize_needed;
+
+ __try
+ {
+ m_load_min = load_pair.first;
+ m_load_max = load_pair.second;
+ do_resize(static_cast<size_type>(size_base::get_size() / ((m_load_min + m_load_max) / 2)));
+ }
+ __catch(...)
+ {
+ m_load_min = old_load_min;
+ m_load_max = old_load_max;
+ m_next_shrink_size = old_next_shrink_size;
+ m_next_grow_size = old_next_grow_size;
+ m_resize_needed = old_resize_needed;
+ __throw_exception_again;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+do_resize(size_type)
+{ std::abort(); }
+
+#ifdef _GLIBCXX_DEBUG
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ _GLIBCXX_DEBUG_ASSERT(m_load_max > m_load_min);
+ _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= m_next_shrink_size);
+}
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
new file mode 100644
index 000000000..c29b3d5be
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_load_check_resize_trigger_size_base.hpp
+ * Contains an base holding size for some resize policies.
+ */
+
+#ifndef PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP
+#define PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ // Primary template.
+ template<typename Size_Type, bool Hold_Size>
+ class hash_load_check_resize_trigger_size_base;
+
+ // Specializations.
+ template<typename Size_Type>
+ class hash_load_check_resize_trigger_size_base<Size_Type, true>
+ {
+ protected:
+ typedef Size_Type size_type;
+
+ hash_load_check_resize_trigger_size_base(): m_size(0)
+ { }
+
+ inline void
+ swap(hash_load_check_resize_trigger_size_base& other)
+ { std::swap(m_size, other.m_size); }
+
+ inline void
+ set_size(size_type size)
+ { m_size = size; }
+
+ inline size_type
+ get_size() const
+ { return m_size; }
+
+ private:
+ size_type m_size;
+ };
+
+ template<typename Size_Type>
+ class hash_load_check_resize_trigger_size_base<Size_Type, false>
+ {
+ protected:
+ typedef Size_Type size_type;
+
+ protected:
+ inline void
+ swap(hash_load_check_resize_trigger_size_base& other) { }
+
+ inline void
+ set_size(size_type size) { }
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
new file mode 100644
index 000000000..a28f5ede5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
@@ -0,0 +1,161 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_prime_size_policy_imp.hpp
+ * Contains a resize size policy implementation.
+ */
+
+#pragma GCC system_header
+
+namespace detail
+{
+ enum
+ {
+ num_distinct_sizes_32_bit = 30,
+ num_distinct_sizes_64_bit = 62,
+ num_distinct_sizes = sizeof(std::size_t) != 8 ?
+ num_distinct_sizes_32_bit : num_distinct_sizes_64_bit,
+ };
+
+ // Originally taken from the SGI implementation; acknowledged in the docs.
+ // Further modified (for 64 bits) from tr1's hashtable.
+ static const std::size_t g_a_sizes[num_distinct_sizes_64_bit] =
+ {
+ /* 0 */ 5ul,
+ /* 1 */ 11ul,
+ /* 2 */ 23ul,
+ /* 3 */ 47ul,
+ /* 4 */ 97ul,
+ /* 5 */ 199ul,
+ /* 6 */ 409ul,
+ /* 7 */ 823ul,
+ /* 8 */ 1741ul,
+ /* 9 */ 3469ul,
+ /* 10 */ 6949ul,
+ /* 11 */ 14033ul,
+ /* 12 */ 28411ul,
+ /* 13 */ 57557ul,
+ /* 14 */ 116731ul,
+ /* 15 */ 236897ul,
+ /* 16 */ 480881ul,
+ /* 17 */ 976369ul,
+ /* 18 */ 1982627ul,
+ /* 19 */ 4026031ul,
+ /* 20 */ 8175383ul,
+ /* 21 */ 16601593ul,
+ /* 22 */ 33712729ul,
+ /* 23 */ 68460391ul,
+ /* 24 */ 139022417ul,
+ /* 25 */ 282312799ul,
+ /* 26 */ 573292817ul,
+ /* 27 */ 1164186217ul,
+ /* 28 */ 2364114217ul,
+ /* 29 */ 4294967291ul,
+ /* 30 */ (std::size_t)8589934583ull,
+ /* 31 */ (std::size_t)17179869143ull,
+ /* 32 */ (std::size_t)34359738337ull,
+ /* 33 */ (std::size_t)68719476731ull,
+ /* 34 */ (std::size_t)137438953447ull,
+ /* 35 */ (std::size_t)274877906899ull,
+ /* 36 */ (std::size_t)549755813881ull,
+ /* 37 */ (std::size_t)1099511627689ull,
+ /* 38 */ (std::size_t)2199023255531ull,
+ /* 39 */ (std::size_t)4398046511093ull,
+ /* 40 */ (std::size_t)8796093022151ull,
+ /* 41 */ (std::size_t)17592186044399ull,
+ /* 42 */ (std::size_t)35184372088777ull,
+ /* 43 */ (std::size_t)70368744177643ull,
+ /* 44 */ (std::size_t)140737488355213ull,
+ /* 45 */ (std::size_t)281474976710597ull,
+ /* 46 */ (std::size_t)562949953421231ull,
+ /* 47 */ (std::size_t)1125899906842597ull,
+ /* 48 */ (std::size_t)2251799813685119ull,
+ /* 49 */ (std::size_t)4503599627370449ull,
+ /* 50 */ (std::size_t)9007199254740881ull,
+ /* 51 */ (std::size_t)18014398509481951ull,
+ /* 52 */ (std::size_t)36028797018963913ull,
+ /* 53 */ (std::size_t)72057594037927931ull,
+ /* 54 */ (std::size_t)144115188075855859ull,
+ /* 55 */ (std::size_t)288230376151711717ull,
+ /* 56 */ (std::size_t)576460752303423433ull,
+ /* 57 */ (std::size_t)1152921504606846883ull,
+ /* 58 */ (std::size_t)2305843009213693951ull,
+ /* 59 */ (std::size_t)4611686018427387847ull,
+ /* 60 */ (std::size_t)9223372036854775783ull,
+ /* 61 */ (std::size_t)18446744073709551557ull,
+ };
+
+} // namespace detail
+
+PB_DS_CLASS_T_DEC
+inline
+PB_DS_CLASS_C_DEC::
+hash_prime_size_policy(size_type n) : m_start_size(n)
+{ m_start_size = get_nearest_larger_size(n); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{ std::swap(m_start_size, other.m_start_size); }
+
+PB_DS_CLASS_T_DEC
+inline PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+get_nearest_larger_size(size_type n) const
+{
+ const std::size_t* const p_upper = std::upper_bound(detail::g_a_sizes,
+ detail::g_a_sizes + detail::num_distinct_sizes, n);
+
+ if (p_upper == detail::g_a_sizes + detail::num_distinct_sizes)
+ __throw_resize_error();
+ return *p_upper;
+}
+
+PB_DS_CLASS_T_DEC
+inline PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+get_nearest_smaller_size(size_type n) const
+{
+ const size_t* p_lower = std::lower_bound(detail::g_a_sizes,
+ detail::g_a_sizes + detail::num_distinct_sizes, n);
+
+ if (*p_lower >= n && p_lower != detail::g_a_sizes)
+ --p_lower;
+ if (*p_lower < m_start_size)
+ return m_start_size;
+ return *p_lower;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
new file mode 100644
index 000000000..39cf7dc9e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
@@ -0,0 +1,249 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_standard_resize_policy_imp.hpp
+ * Contains a resize policy implementation.
+ */
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+hash_standard_resize_policy()
+: m_size(Size_Policy::get_nearest_larger_size(1))
+{ trigger_policy_base::notify_externally_resized(m_size); }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+hash_standard_resize_policy(const Size_Policy& r_size_policy)
+: Size_Policy(r_size_policy), m_size(Size_Policy::get_nearest_larger_size(1))
+{ trigger_policy_base::notify_externally_resized(m_size); }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+hash_standard_resize_policy(const Size_Policy& r_size_policy,
+ const Trigger_Policy& r_trigger_policy)
+: Size_Policy(r_size_policy), Trigger_Policy(r_trigger_policy),
+ m_size(Size_Policy::get_nearest_larger_size(1))
+{ trigger_policy_base::notify_externally_resized(m_size); }
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~hash_standard_resize_policy()
+{ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ trigger_policy_base::swap(other);
+ size_policy_base::swap(other);
+ std::swap(m_size, other.m_size);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_start()
+{ trigger_policy_base::notify_find_search_start(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_collision()
+{ trigger_policy_base::notify_find_search_collision(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_find_search_end()
+{ trigger_policy_base::notify_find_search_end(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_start()
+{ trigger_policy_base::notify_insert_search_start(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_collision()
+{ trigger_policy_base::notify_insert_search_collision(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_insert_search_end()
+{ trigger_policy_base::notify_insert_search_end(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_start()
+{ trigger_policy_base::notify_erase_search_start(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_collision()
+{ trigger_policy_base::notify_erase_search_collision(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erase_search_end()
+{ trigger_policy_base::notify_erase_search_end(); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_inserted(size_type num_e)
+{ trigger_policy_base::notify_inserted(num_e); }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+notify_erased(size_type num_e)
+{ trigger_policy_base::notify_erased(num_e); }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_cleared()
+{ trigger_policy_base::notify_cleared(); }
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+is_resize_needed() const
+{ return trigger_policy_base::is_resize_needed(); }
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+get_new_size(size_type size, size_type num_used_e) const
+{
+ if (trigger_policy_base::is_grow_needed(size, num_used_e))
+ return size_policy_base::get_nearest_larger_size(size);
+ return size_policy_base::get_nearest_smaller_size(size);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+notify_resized(size_type new_size)
+{
+ trigger_policy_base::notify_resized(new_size);
+ m_size = new_size;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+get_actual_size() const
+{
+ PB_DS_STATIC_ASSERT(access, external_size_access);
+ return m_size;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+resize(size_type new_size)
+{
+ PB_DS_STATIC_ASSERT(access, external_size_access);
+ size_type actual_size = size_policy_base::get_nearest_larger_size(1);
+ while (actual_size < new_size)
+ {
+ const size_type pot = size_policy_base::get_nearest_larger_size(actual_size);
+
+ if (pot == actual_size && pot < new_size)
+ __throw_resize_error();
+ actual_size = pot;
+ }
+
+ if (actual_size > 0)
+ --actual_size;
+
+ const size_type old_size = m_size;
+ __try
+ {
+ do_resize(actual_size - 1);
+ }
+ __catch(insert_error& )
+ {
+ m_size = old_size;
+ __throw_resize_error();
+ }
+ __catch(...)
+ {
+ m_size = old_size;
+ __throw_exception_again;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+do_resize(size_type)
+{
+ // Do nothing
+}
+
+PB_DS_CLASS_T_DEC
+Trigger_Policy&
+PB_DS_CLASS_C_DEC::
+get_trigger_policy()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Trigger_Policy&
+PB_DS_CLASS_C_DEC::
+get_trigger_policy() const
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+Size_Policy&
+PB_DS_CLASS_C_DEC::
+get_size_policy()
+{ return *this; }
+
+PB_DS_CLASS_T_DEC
+const Size_Policy&
+PB_DS_CLASS_C_DEC::
+get_size_policy() const
+{ return *this; }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
new file mode 100644
index 000000000..ed70b9511
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_resize_policy.hpp
+ * Contains a sample resize policy for hash tables.
+ */
+
+#ifndef PB_DS_SAMPLE_RESIZE_POLICY_HPP
+#define PB_DS_SAMPLE_RESIZE_POLICY_HPP
+
+// A sample resize policy.
+class sample_resize_policy
+{
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+ // Default constructor.
+ sample_resize_policy();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_resize_policy& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_resize_policy& other);
+
+protected:
+
+ // Notifies a search started.
+ inline void
+ notify_insert_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_insert_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_insert_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_find_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_find_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_find_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_erase_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_erase_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_erase_search_end();
+
+ // Notifies an element was inserted.
+ inline void
+ notify_inserted(size_type num_e);
+
+ // Notifies an element was erased.
+ inline void
+ notify_erased(size_type num_e);
+
+ // Notifies the table was cleared.
+ void
+ notify_cleared();
+
+ // Notifies the table was resized to new_size.
+ void
+ notify_resized(size_type new_size);
+
+ // Queries whether a resize is needed.
+ inline bool
+ is_resize_needed() const;
+
+ // Queries what the new size should be.
+ size_type
+ get_new_size(size_type size, size_type num_used_e) const;
+};
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
new file mode 100644
index 000000000..a27dd9427
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_resize_trigger.hpp
+ * Contains a sample resize trigger policy class.
+ */
+
+#ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP
+#define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP
+
+// A sample resize trigger policy.
+class sample_resize_trigger
+{
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+ // Default constructor.
+ sample_resize_trigger();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_resize_trigger& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_resize_trigger& other);
+
+protected:
+
+ // Notifies a search started.
+ inline void
+ notify_insert_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_insert_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_insert_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_find_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_find_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_find_search_end();
+
+ // Notifies a search started.
+ inline void
+ notify_erase_search_start();
+
+ // Notifies a search encountered a collision.
+ inline void
+ notify_erase_search_collision();
+
+ // Notifies a search ended.
+ inline void
+ notify_erase_search_end();
+
+ // Notifies an element was inserted. the total number of entries in
+ // the table is num_entries.
+ inline void
+ notify_inserted(size_type num_entries);
+
+ // Notifies an element was erased.
+ inline void
+ notify_erased(size_type num_entries);
+
+ // Notifies the table was cleared.
+ void
+ notify_cleared();
+
+ // Notifies the table was resized as a result of this object's
+ // signifying that a resize is needed.
+ void
+ notify_resized(size_type new_size);
+
+ // Notifies the table was resized externally.
+ void
+ notify_externally_resized(size_type new_size);
+
+ // Queries whether a resize is needed.
+ inline bool
+ is_resize_needed() const;
+
+ // Queries whether a grow is needed.
+ inline bool
+ is_grow_needed(size_type size, size_type num_entries) const;
+
+private:
+
+ // Resizes to new_size.
+ virtual void
+ do_resize(size_type new_size);
+};
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
new file mode 100644
index 000000000..1f2d3a9c1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_size_policy.hpp
+ * Contains a sample size resize-policy.
+ */
+
+#ifndef PB_DS_SAMPLE_SIZE_POLICY_HPP
+#define PB_DS_SAMPLE_SIZE_POLICY_HPP
+
+// A sample size policy.
+class sample_size_policy
+{
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+ // Default constructor.
+ sample_size_policy();
+
+ // Copy constructor.
+ sample_range_hashing(const sample_size_policy& other);
+
+ // Swaps content.
+ inline void
+ swap(sample_size_policy& other);
+
+protected:
+
+ // Given a __size size, returns a __size that is larger.
+ inline size_type
+ get_nearest_larger_size(size_type size) const;
+
+ // Given a __size size, returns a __size that is smaller.
+ inline size_type
+ get_nearest_smaller_size(size_type size) const;
+};
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..222589532
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ insert(*(first_it++));
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME()
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :
+ base_type(r_cmp_fn)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :
+ base_type(r_cmp_fn, r_node_update)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :
+ base_type(other)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ base_type::swap(other);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{ base_type::m_p_head->m_special = true; }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
new file mode 100644
index 000000000..084e25d26
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ base_type::assert_valid();
+ const node_pointer p_head = base_type::m_p_head;
+ assert_special_imp(p_head);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_special_imp(const node_pointer p_nd) const
+{
+ if (p_nd == NULL)
+ return;
+
+ if (p_nd == base_type::m_p_head)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_special);
+ assert_special_imp(p_nd->m_p_parent);
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(!p_nd->m_special);
+ assert_special_imp(p_nd->m_p_left);
+ assert_special_imp(p_nd->m_p_right);
+}
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
new file mode 100644
index 000000000..508f586d7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline bool
+PB_DS_CLASS_C_DEC::
+erase(const_key_reference r_key)
+{
+ point_iterator it = find(r_key);
+ if (it == base_type::end())
+ return false;
+ erase(it);
+ return true;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+erase(iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ if (it == base_type::end())
+ return it;
+ iterator ret_it = it;
+ ++ret_it;
+ erase_node(it.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::reverse_iterator
+PB_DS_CLASS_C_DEC::
+erase(reverse_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ if (it.m_p_nd == base_type::m_p_head)
+ return (it);
+ reverse_iterator ret_it = it;
+ ++ret_it;
+ erase_node(it.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ret_it;
+}
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ size_type num_ersd = 0;
+ iterator it = base_type::begin();
+ while (it != base_type::end())
+ {
+ if (pred(*it))
+ {
+ ++num_ersd;
+ it = erase(it);
+ }
+ else
+ ++it;
+ }
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return num_ersd;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase_node(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ splay(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);
+
+ node_pointer p_l = p_nd->m_p_left;
+ node_pointer p_r = p_nd->m_p_right;
+
+ base_type::update_min_max_for_erased_node(p_nd);
+ base_type::actual_erase_node(p_nd);
+ if (p_r == NULL)
+ {
+ base_type::m_p_head->m_p_parent = p_l;
+ if (p_l != NULL)
+ p_l->m_p_parent = base_type::m_p_head;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ return;
+ }
+
+ node_pointer p_target_r = leftmost(p_r);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r != NULL);
+ p_r->m_p_parent = base_type::m_p_head;
+ base_type::m_p_head->m_p_parent = p_r;
+ splay(p_target_r);
+
+ _GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_parent == this->m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(this->m_p_head->m_p_parent == p_target_r);
+
+ p_target_r->m_p_left = p_l;
+ if (p_l != NULL)
+ p_l->m_p_parent = p_target_r;
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ apply_update(p_target_r, (node_update* )this);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+leftmost(node_pointer p_nd)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ while (p_nd->m_p_left != NULL)
+ p_nd = p_nd->m_p_left;
+ return p_nd;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
new file mode 100644
index 000000000..182425a8f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key)
+{
+ node_pointer p_found = find_imp(r_key);
+ if (p_found != base_type::m_p_head)
+ splay(p_found);
+ return point_iterator(p_found);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_point_iterator
+PB_DS_CLASS_C_DEC::
+find(const_key_reference r_key) const
+{
+ const node_pointer p_found = find_imp(r_key);
+ if (p_found != base_type::m_p_head)
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->splay(p_found);
+ return point_iterator(p_found);
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+find_imp(const_key_reference r_key)
+{
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)
+ node_pointer p_nd = base_type::m_p_head->m_p_parent;
+ while (p_nd != NULL)
+ if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
+ {
+ if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
+ return p_nd;
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+ return base_type::m_p_head;
+}
+
+PB_DS_CLASS_T_DEC
+inline const typename PB_DS_CLASS_C_DEC::node_pointer
+PB_DS_CLASS_C_DEC::
+find_imp(const_key_reference r_key) const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ node_pointer p_nd = base_type::m_p_head->m_p_parent;
+ while (p_nd != NULL)
+ if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))
+ {
+ if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))
+ return p_nd;
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+ return base_type::m_p_head;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
new file mode 100644
index 000000000..636b9ab25
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file info_fn_imps.hpp
+ * Contains an implementation.
+ */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
new file mode 100644
index 000000000..e9ae987b0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert(const_reference r_value)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ std::pair<point_iterator, bool> ins_pair = insert_leaf_imp(r_value);
+ ins_pair.first.m_p_nd->m_special = false;
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ splay(ins_pair.first.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ return ins_pair;
+}
+
+PB_DS_CLASS_T_DEC
+inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>
+PB_DS_CLASS_C_DEC::
+insert_leaf_imp(const_reference r_value)
+{
+ _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)
+ if (base_type::m_size == 0)
+ return std::make_pair(base_type::insert_imp_empty(r_value), true);
+
+ node_pointer p_nd = base_type::m_p_head->m_p_parent;
+ node_pointer p_pot = base_type::m_p_head;
+
+ while (p_nd != NULL)
+ if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value)))
+ {
+ if (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value)))
+ {
+ return std::make_pair(point_iterator(p_nd), false);
+ }
+ p_pot = p_nd;
+ p_nd = p_nd->m_p_left;
+ }
+ else
+ p_nd = p_nd->m_p_right;
+
+ if (p_pot == base_type::m_p_head)
+ return std::make_pair(base_type::insert_leaf_new(r_value, base_type::m_p_head->m_p_right, false), true);
+
+ _GLIBCXX_DEBUG_ONLY(base_type::check_key_does_not_exist(PB_DS_V2F(r_value)));
+
+ p_nd = p_pot->m_p_left;
+ if (p_nd == NULL)
+ return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));
+
+ while (p_nd->m_p_right != NULL)
+ p_nd = p_nd->m_p_right;
+
+ return std::make_pair(insert_leaf_new(r_value, p_nd, false), true);
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp
new file mode 100644
index 000000000..fbf398d04
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/node.hpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node.hpp
+ * Contains an implementation struct for splay_tree_'s node.
+ */
+
+#ifndef PB_DS_SPLAY_TREE_NODE_HPP
+#define PB_DS_SPLAY_TREE_NODE_HPP
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Value_Type, class Metadata, class Allocator>
+ struct splay_tree_node_
+ {
+ public:
+ typedef Value_Type value_type;
+ typedef Metadata metadata_type;
+
+ typedef
+ typename Allocator::template rebind<
+ splay_tree_node_<Value_Type, Metadata, Allocator> >::other::pointer
+ node_pointer;
+
+ typedef
+ typename Allocator::template rebind<metadata_type>::other::reference
+ metadata_reference;
+
+ typedef
+ typename Allocator::template rebind<metadata_type>::other::const_reference
+ const_metadata_reference;
+
+#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
+ void
+ trace() const
+ { std::cout << PB_DS_V2F(m_value) << "(" << m_metadata << ")"; }
+#endif
+
+ inline bool
+ special() const
+ { return m_special; }
+
+ inline const_metadata_reference
+ get_metadata() const
+ { return m_metadata; }
+
+ inline metadata_reference
+ get_metadata()
+ { return m_metadata; }
+
+ value_type m_value;
+ bool m_special;
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+ node_pointer m_p_parent;
+ metadata_type m_metadata;
+ };
+
+ template<typename Value_Type, typename Allocator>
+ struct splay_tree_node_<Value_Type, null_node_metadata, Allocator>
+ {
+ public:
+ typedef Value_Type value_type;
+ typedef null_node_metadata metadata_type;
+
+ typedef
+ typename Allocator::template rebind<
+ splay_tree_node_<Value_Type, null_node_metadata, Allocator> >::other::pointer
+ node_pointer;
+
+ inline bool
+ special() const
+ { return m_special; }
+
+#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_
+ void
+ trace() const
+ { std::cout << PB_DS_V2F(m_value); }
+#endif
+
+ node_pointer m_p_left;
+ node_pointer m_p_right;
+ node_pointer m_p_parent;
+ value_type m_value;
+ bool m_special;
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
new file mode 100644
index 000000000..e4f3556a5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
@@ -0,0 +1,283 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file splay_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+splay(node_pointer p_nd)
+{
+ while (p_nd->m_p_parent != base_type::m_p_head)
+ {
+#ifdef _GLIBCXX_DEBUG
+ {
+ node_pointer p_head = base_type::m_p_head;
+ assert_special_imp(p_head);
+ }
+#endif
+
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd);)
+
+ if (p_nd->m_p_parent->m_p_parent == base_type::m_p_head)
+ {
+ base_type::rotate_parent(p_nd);
+ _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);
+ }
+ else
+ {
+ const node_pointer p_parent = p_nd->m_p_parent;
+ const node_pointer p_grandparent = p_parent->m_p_parent;
+
+#ifdef _GLIBCXX_DEBUG
+ const size_type total =
+ base_type::recursive_count(p_grandparent);
+ _GLIBCXX_DEBUG_ASSERT(total >= 3);
+#endif
+
+ if (p_parent->m_p_left == p_nd &&
+ p_grandparent->m_p_right == p_parent)
+ splay_zig_zag_left(p_nd, p_parent, p_grandparent);
+ else if (p_parent->m_p_right == p_nd &&
+ p_grandparent->m_p_left == p_parent)
+ splay_zig_zag_right(p_nd, p_parent, p_grandparent);
+ else if (p_parent->m_p_left == p_nd &&
+ p_grandparent->m_p_left == p_parent)
+ splay_zig_zig_left(p_nd, p_parent, p_grandparent);
+ else
+ splay_zig_zig_right(p_nd, p_parent, p_grandparent);
+ _GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd));
+ }
+
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd);)
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+splay_zig_zag_left(node_pointer p_nd, node_pointer p_parent,
+ node_pointer p_grandparent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)
+
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
+ p_grandparent->m_p_right == p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_right;
+ node_pointer p_c = p_nd->m_p_left;
+
+ p_nd->m_p_right = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_nd->m_p_left = p_grandparent;
+ p_grandparent->m_p_parent = p_nd;
+
+ p_parent->m_p_left = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_right = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+splay_zig_zag_right(node_pointer p_nd, node_pointer p_parent,
+ node_pointer p_grandparent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)
+
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
+ p_grandparent->m_p_left == p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_left;
+ node_pointer p_c = p_nd->m_p_right;
+
+ p_nd->m_p_left = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_nd->m_p_right = p_grandparent;
+ p_grandparent->m_p_parent = p_nd;
+
+ p_parent->m_p_right = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_left = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+splay_zig_zig_left(node_pointer p_nd, node_pointer p_parent,
+ node_pointer p_grandparent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
+
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)
+
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd &&
+ p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_right;
+ node_pointer p_c = p_parent->m_p_right;
+
+ p_nd->m_p_right = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_parent->m_p_right = p_grandparent;
+ p_grandparent->m_p_parent = p_parent;
+
+ p_parent->m_p_left = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_left = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+splay_zig_zig_right(node_pointer p_nd, node_pointer p_parent,
+ node_pointer p_grandparent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)
+ _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd &&
+ p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);
+
+ splay_zz_start(p_nd, p_parent, p_grandparent);
+
+ node_pointer p_b = p_nd->m_p_left;
+ node_pointer p_c = p_parent->m_p_left;
+
+ p_nd->m_p_left = p_parent;
+ p_parent->m_p_parent = p_nd;
+
+ p_parent->m_p_left = p_grandparent;
+ p_grandparent->m_p_parent = p_parent;
+
+ p_parent->m_p_right = p_b;
+ if (p_b != NULL)
+ p_b->m_p_parent = p_parent;
+
+ p_grandparent->m_p_right = p_c;
+ if (p_c != NULL)
+ p_c->m_p_parent = p_grandparent;
+
+ base_type::update_to_top(p_grandparent, (node_update* )this);
+ splay_zz_end(p_nd, p_parent, p_grandparent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+splay_zz_start(node_pointer p_nd,
+#ifdef _GLIBCXX_DEBUG
+ node_pointer p_parent,
+#else
+ node_pointer /*p_parent*/,
+#endif
+ node_pointer p_grandparent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_grandparent != NULL);
+
+ const bool grandparent_head = p_grandparent->m_p_parent == base_type::m_p_head;
+
+ if (grandparent_head)
+ {
+ base_type::m_p_head->m_p_parent = base_type::m_p_head->m_p_parent;
+ p_nd->m_p_parent = base_type::m_p_head;
+ return;
+ }
+
+ node_pointer p_greatgrandparent = p_grandparent->m_p_parent;
+
+ p_nd->m_p_parent = p_greatgrandparent;
+
+ if (p_grandparent == p_greatgrandparent->m_p_left)
+ p_greatgrandparent->m_p_left = p_nd;
+ else
+ p_greatgrandparent->m_p_right = p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+splay_zz_end(node_pointer p_nd, node_pointer p_parent,
+ node_pointer p_grandparent)
+{
+ if (p_nd->m_p_parent == base_type::m_p_head)
+ base_type::m_p_head->m_p_parent = p_nd;
+
+ apply_update(p_grandparent, (node_update* )this);
+ apply_update(p_parent, (node_update* )this);
+ apply_update(p_nd, (node_update* )this);
+
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd);)
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
new file mode 100644
index 000000000..959893ec7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
@@ -0,0 +1,298 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file splay_tree_.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+/*
+ * This implementation uses an idea from the SGI STL (using a "header" node
+ * which is needed for efficient iteration). Following is the SGI STL
+ * copyright.
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ */
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
+#endif
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR
+#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>
+#endif
+#endif
+
+#include <utility>
+#include <vector>
+#include <assert.h>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+#define PB_DS_CLASS_T_DEC \
+ template<typename Key, typename Mapped, typename Cmp_Fn, \
+ typename Node_And_It_Traits, typename Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_CLASS_NAME splay_tree_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_CLASS_NAME splay_tree_no_data_
+#endif
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_
+#endif
+
+#define PB_DS_CLASS_C_DEC \
+ PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>
+
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+#define PB_DS_V2F(X) (X).first
+#define PB_DS_V2S(X) (X).second
+#define PB_DS_EP2VP(X)& ((X)->m_value)
+#endif
+
+#ifdef PB_DS_DATA_FALSE_INDICATOR
+#define PB_DS_V2F(X) (X)
+#define PB_DS_V2S(X) Mapped_Data()
+#define PB_DS_EP2VP(X)& ((X)->m_value.first)
+#endif
+
+ // $p14y 7r33 7481.
+ template<typename Key, typename Mapped, typename Cmp_Fn,
+ typename Node_And_It_Traits, typename Allocator>
+ class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+ typedef typename base_type::node_pointer node_pointer;
+
+ public:
+ typedef Allocator allocator_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::key_pointer key_pointer;
+ typedef typename base_type::const_key_pointer const_key_pointer;
+ typedef typename base_type::key_reference key_reference;
+ typedef typename base_type::const_key_reference const_key_reference;
+ typedef typename base_type::mapped_type mapped_type;
+ typedef typename base_type::mapped_pointer mapped_pointer;
+ typedef typename base_type::const_mapped_pointer const_mapped_pointer;
+ typedef typename base_type::mapped_reference mapped_reference;
+ typedef typename base_type::const_mapped_reference const_mapped_reference;
+ typedef typename base_type::value_type value_type;
+ typedef typename base_type::pointer pointer;
+ typedef typename base_type::const_pointer const_pointer;
+ typedef typename base_type::reference reference;
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_point_iterator;
+ typedef typename base_type::iterator iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::reverse_iterator reverse_iterator;
+ typedef typename base_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename base_type::node_update node_update;
+
+ PB_DS_CLASS_NAME();
+
+ PB_DS_CLASS_NAME(const Cmp_Fn&);
+
+ PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);
+
+ PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);
+
+ void
+ swap(PB_DS_CLASS_C_DEC&);
+
+ template<typename It>
+ void
+ copy_from_range(It, It);
+
+ void
+ initialize();
+
+ inline std::pair<point_iterator, bool>
+ insert(const_reference r_value);
+
+ inline mapped_reference
+ operator[](const_key_reference r_key)
+ {
+#ifdef PB_DS_DATA_TRUE_INDICATOR
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ std::pair<point_iterator, bool> ins_pair =
+ insert_leaf_imp(value_type(r_key, mapped_type()));
+
+ ins_pair.first.m_p_nd->m_special = false;
+ _GLIBCXX_DEBUG_ONLY(base_type::assert_valid());
+ splay(ins_pair.first.m_p_nd);
+ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)
+ return ins_pair.first.m_p_nd->m_value.second;
+#else
+ insert(r_key);
+ return base_type::s_null_mapped;
+#endif
+ }
+
+ inline point_iterator
+ find(const_key_reference);
+
+ inline const_point_iterator
+ find(const_key_reference) const;
+
+ inline bool
+ erase(const_key_reference);
+
+ inline iterator
+ erase(iterator it);
+
+ inline reverse_iterator
+ erase(reverse_iterator);
+
+ template<typename Pred>
+ inline size_type
+ erase_if(Pred);
+
+ void
+ join(PB_DS_CLASS_C_DEC&);
+
+ void
+ split(const_key_reference, PB_DS_CLASS_C_DEC&);
+
+ private:
+ inline std::pair<point_iterator, bool>
+ insert_leaf_imp(const_reference);
+
+ inline node_pointer
+ find_imp(const_key_reference);
+
+ inline const node_pointer
+ find_imp(const_key_reference) const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ void
+ assert_special_imp(const node_pointer) const;
+#endif
+
+ void
+ splay(node_pointer);
+
+ inline void
+ splay_zig_zag_left(node_pointer, node_pointer, node_pointer);
+
+ inline void
+ splay_zig_zag_right(node_pointer, node_pointer, node_pointer);
+
+ inline void
+ splay_zig_zig_left(node_pointer, node_pointer, node_pointer);
+
+ inline void
+ splay_zig_zig_right(node_pointer, node_pointer, node_pointer);
+
+ inline void
+ splay_zz_start(node_pointer, node_pointer, node_pointer);
+
+ inline void
+ splay_zz_end(node_pointer, node_pointer, node_pointer);
+
+ inline node_pointer
+ leftmost(node_pointer);
+
+ void
+ erase_node(node_pointer);
+ };
+
+#include <ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp>
+#include <ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_NAME
+#undef PB_DS_BASE_CLASS_NAME
+#undef PB_DS_BASE_C_DEC
+#undef PB_DS_V2F
+#undef PB_DS_EP2VP
+#undef PB_DS_V2S
+ } // namespace detail
+} // namespace __gnu_pbds
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..7f0b2cb20
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation class for splay_tree_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ if (base_type::join_prep(other) == false)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ return;
+ }
+
+ node_pointer p_target_r = other.leftmost(other.m_p_head);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r != NULL);
+ other.splay(p_target_r);
+
+ _GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent);
+ _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == NULL);
+
+ p_target_r->m_p_left = base_type::m_p_head->m_p_parent;
+
+ _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != NULL);
+ p_target_r->m_p_left->m_p_parent = p_target_r;
+
+ base_type::m_p_head->m_p_parent = p_target_r;
+ p_target_r->m_p_parent = base_type::m_p_head;
+ apply_update(p_target_r, (node_update* )this);
+
+ base_type::join_finish(other);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+split(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+
+ if (base_type::split_prep(r_key, other) == false)
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+ return;
+ }
+
+ node_pointer p_upper_bound = upper_bound(r_key).m_p_nd;
+ _GLIBCXX_DEBUG_ASSERT(p_upper_bound != NULL);
+
+ splay(p_upper_bound);
+ _GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head);
+
+ node_pointer p_new_root = p_upper_bound->m_p_left;
+ _GLIBCXX_DEBUG_ASSERT(p_new_root != NULL);
+
+ base_type::m_p_head->m_p_parent = p_new_root;
+ p_new_root->m_p_parent = base_type::m_p_head;
+ other.m_p_head->m_p_parent = p_upper_bound;
+ p_upper_bound->m_p_parent = other.m_p_head;
+ p_upper_bound->m_p_left = NULL;
+ apply_update(p_upper_bound, (node_update* )this);
+ base_type::split_finish(other);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid());
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid());
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
new file mode 100644
index 000000000..cfedc35c8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/splay_tree_/traits.hpp
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file traits.hpp
+ * Contains an implementation for splay_tree_.
+ */
+
+#ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP
+#define PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP
+
+#include <ext/pb_ds/detail/splay_tree_/node.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Key,
+ typename Mapped,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct tree_traits<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ splay_tree_tag,
+ Allocator> : public bin_search_tree_traits<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ splay_tree_node_<
+ typename types_traits<
+ Key,
+ Mapped,
+ Allocator,
+ false>::value_type,
+ typename tree_node_metadata_selector<
+ Key,
+ Mapped,
+ Cmp_Fn,
+ Node_Update,
+ Allocator>::type,
+ Allocator>,
+ Allocator>
+ { };
+
+ template<typename Key,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct tree_traits<Key, null_mapped_type, Cmp_Fn, Node_Update,
+ splay_tree_tag, Allocator>
+ : public bin_search_tree_traits<Key, null_mapped_type, Cmp_Fn,
+ Node_Update,
+ splay_tree_node_<typename types_traits<Key, null_mapped_type, Allocator, false>::value_type,
+ typename tree_node_metadata_selector<
+ Key,
+ null_mapped_type,
+ Cmp_Fn,
+ Node_Update,
+ Allocator>::type,
+ Allocator>,
+ Allocator>
+ { };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp
new file mode 100644
index 000000000..cfbfbb072
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file standard_policies.hpp
+ * Contains standard policies for containers.
+ */
+
+#ifndef PB_DS_STANDARD_POLICIES_HPP
+#define PB_DS_STANDARD_POLICIES_HPP
+
+#include <memory>
+#include <ext/pb_ds/hash_policy.hpp>
+#include <ext/pb_ds/list_update_policy.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/trie_policy.hpp>
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <tr1/functional>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key>
+ struct default_hash_fn
+ {
+ typedef std::tr1::hash<Key> type;
+ };
+
+ template<typename Key>
+ struct default_eq_fn
+ {
+ typedef std::equal_to<Key> type;
+ };
+
+ enum
+ {
+ default_store_hash = false
+ };
+
+ struct default_comb_hash_fn
+ {
+ typedef __gnu_pbds::direct_mask_range_hashing<> type;
+ };
+
+ template<typename Comb_Hash_Fn>
+ struct default_resize_policy
+ {
+ private:
+ typedef typename Comb_Hash_Fn::size_type size_type;
+
+ typedef __gnu_pbds::direct_mask_range_hashing<size_type> default_fn;
+ typedef is_same<default_fn, Comb_Hash_Fn> same_type;
+ typedef __gnu_pbds::hash_exponential_size_policy<size_type> iftrue;
+ typedef __gnu_pbds::hash_prime_size_policy iffalse;
+ typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;
+ typedef typename cond_type::__type size_policy_type;
+
+ typedef __gnu_pbds::hash_load_check_resize_trigger<false, size_type> trigger;
+
+ public:
+ typedef __gnu_pbds::hash_standard_resize_policy<size_policy_type, trigger, false, size_type> type;
+ };
+
+ struct default_update_policy
+ {
+ typedef __gnu_pbds::move_to_front_lu_policy<> type;
+ };
+
+ template<typename Comb_Probe_Fn>
+ struct default_probe_fn
+ {
+ private:
+ typedef typename Comb_Probe_Fn::size_type size_type;
+
+ typedef __gnu_pbds::direct_mask_range_hashing<size_type> default_fn;
+ typedef is_same<default_fn, Comb_Probe_Fn> same_type;
+ typedef __gnu_pbds::linear_probe_fn<size_type> iftrue;
+ typedef __gnu_pbds::quadratic_probe_fn<size_type> iffalse;
+ typedef __conditional_type<same_type::value, iftrue, iffalse> cond_type;
+
+ public:
+ typedef typename cond_type::__type type;
+ };
+
+ template<typename Key>
+ struct default_trie_e_access_traits;
+
+ template<typename Char, class Char_Traits>
+ struct default_trie_e_access_traits<std::basic_string<Char, Char_Traits, std::allocator<char> > >
+ {
+ private:
+ typedef std::basic_string<Char, Char_Traits, std::allocator<char> > string_type;
+
+ public:
+ typedef __gnu_pbds::string_trie_e_access_traits<string_type> type;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_STANDARD_POLICIES_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
new file mode 100644
index 000000000..4d2c45ce0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
@@ -0,0 +1,106 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file constructors_destructor_fn_imps.hpp
+ * Contains an implementation for thin_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename It>
+void
+PB_DS_CLASS_C_DEC::
+copy_from_range(It first_it, It last_it)
+{
+ while (first_it != last_it)
+ push(*(first_it++));
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+thin_heap_() :
+ m_p_max(NULL)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+thin_heap_(const Cmp_Fn& r_cmp_fn) :
+ PB_DS_BASE_C_DEC(r_cmp_fn),
+ m_p_max(NULL)
+{
+ initialize();
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+thin_heap_(const PB_DS_CLASS_C_DEC& other) :
+ PB_DS_BASE_C_DEC(other)
+{
+ initialize();
+ m_p_max = base_type::m_p_root;
+ for (node_pointer p_nd = base_type::m_p_root; p_nd != NULL; p_nd = p_nd->m_p_next_sibling)
+ if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
+ m_p_max = p_nd;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+swap(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ base_type::swap(other);
+ std::swap(m_p_max, other.m_p_max);
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~thin_heap_()
+{ }
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+initialize()
+{ std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(NULL)); }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
new file mode 100644
index 000000000..f7abe3527
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file debug_fn_imps.hpp
+ * Contains an implementation for thin_heap_.
+ */
+
+#ifdef _GLIBCXX_DEBUG
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_valid() const
+{
+ base_type::assert_valid();
+ assert_node_consistent(base_type::m_p_root, true);
+ assert_max();
+ assert_aux_null();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_aux_null() const
+{
+ for (size_type i = 0; i < max_rank; ++i)
+ _GLIBCXX_DEBUG_ASSERT(m_a_aux[i] == NULL);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_max() const
+{
+ if (m_p_max == NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::empty());
+ return;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+ _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);
+ _GLIBCXX_DEBUG_ASSERT(m_p_max->m_p_prev_or_parent == NULL);
+ for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)
+ _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+assert_node_consistent(const_node_pointer p_nd, bool root) const
+{
+ base_type::assert_node_consistent(p_nd, root);
+ if (p_nd == NULL)
+ return;
+
+ assert_node_consistent(p_nd->m_p_next_sibling, root);
+ assert_node_consistent(p_nd->m_p_l_child, false);
+ if (!root)
+ {
+ if (p_nd->m_metadata == 0)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == NULL);
+ else
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1);
+ }
+
+ if (p_nd->m_p_l_child != NULL)
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_metadata + 1 == base_type::degree(p_nd));
+
+ const bool unmarked_valid =(p_nd->m_p_l_child == NULL&& p_nd->m_metadata == 0) ||(p_nd->m_p_l_child != NULL&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);
+
+ const bool marked_valid =(p_nd->m_p_l_child == NULL&& p_nd->m_metadata == 1) ||(p_nd->m_p_l_child != NULL&& p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2);
+
+ _GLIBCXX_DEBUG_ASSERT(unmarked_valid || marked_valid);
+ if (root)
+ _GLIBCXX_DEBUG_ASSERT(unmarked_valid);
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
new file mode 100644
index 000000000..69afcd39f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
@@ -0,0 +1,296 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file erase_fn_imps.hpp
+ * Contains an implementation for thin_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+pop()
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+
+ node_pointer p_nd = m_p_max;
+
+ remove_max_node();
+
+ base_type::actual_erase_node(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+remove_max_node()
+{
+ to_aux_except_max();
+
+ make_from_aux();
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+to_aux_except_max()
+{
+ node_pointer p_add = base_type::m_p_root;
+
+ while (p_add != m_p_max)
+ {
+ node_pointer p_next_add = p_add->m_p_next_sibling;
+
+ add_to_aux(p_add);
+
+ p_add = p_next_add;
+ }
+
+ p_add = m_p_max->m_p_l_child;
+
+ while (p_add != NULL)
+ {
+ node_pointer p_next_add = p_add->m_p_next_sibling;
+
+ p_add->m_metadata = p_add->m_p_l_child == NULL?
+ 0 :
+ p_add->m_p_l_child->m_metadata + 1;
+
+ add_to_aux(p_add);
+
+ p_add = p_next_add;
+ }
+
+ p_add = m_p_max->m_p_next_sibling;
+
+ while (p_add != NULL)
+ {
+ node_pointer p_next_add = p_add->m_p_next_sibling;
+
+ add_to_aux(p_add);
+
+ p_add = p_next_add;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+add_to_aux(node_pointer p_nd)
+{
+ size_type r = p_nd->m_metadata;
+
+ while (m_a_aux[r] != NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
+
+ if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value))
+ make_child_of(m_a_aux[r], p_nd);
+ else
+ {
+ make_child_of(p_nd, m_a_aux[r]);
+
+ p_nd = m_a_aux[r];
+ }
+
+ m_a_aux[r] = NULL;
+
+ ++r;
+ }
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
+
+ m_a_aux[r] = p_nd;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+make_child_of(node_pointer p_nd, node_pointer p_new_parent)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_new_parent->m_metadata);
+ _GLIBCXX_DEBUG_ASSERT(m_a_aux[p_nd->m_metadata] == p_nd ||
+ m_a_aux[p_nd->m_metadata] == p_new_parent);
+
+ ++p_new_parent->m_metadata;
+
+ base_type::make_child_of(p_nd, p_new_parent);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+make_from_aux()
+{
+ base_type::m_p_root = m_p_max = NULL;
+
+ const size_type rnk_bnd = rank_bound();
+
+ size_type i = 0;
+
+ while (i < rnk_bnd)
+ {
+ if (m_a_aux[i] != NULL)
+ {
+ make_root_and_link(m_a_aux[i]);
+
+ m_a_aux[i] = NULL;
+ }
+
+ ++i;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_aux_null();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+remove_node(node_pointer p_nd)
+{
+ node_pointer p_parent = p_nd;
+ while (base_type::parent(p_parent) != NULL)
+ p_parent = base_type::parent(p_parent);
+
+ base_type::bubble_to_top(p_nd);
+
+ m_p_max = p_nd;
+
+ node_pointer p_fix = base_type::m_p_root;
+ while (p_fix != NULL&& p_fix->m_p_next_sibling != p_parent)
+ p_fix = p_fix->m_p_next_sibling;
+
+ if (p_fix != NULL)
+ p_fix->m_p_next_sibling = p_nd;
+
+ remove_max_node();
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+clear()
+{
+ base_type::clear();
+
+ m_p_max = NULL;
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+erase(point_iterator it)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ node_pointer p_nd = it.m_p_nd;
+
+ remove_node(p_nd);
+
+ base_type::actual_erase_node(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+erase_if(Pred pred)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ if (base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return 0;
+ }
+
+ base_type::to_linked_list();
+
+ node_pointer p_out = base_type::prune(pred);
+
+ size_type ersd = 0;
+
+ while (p_out != NULL)
+ {
+ ++ersd;
+
+ node_pointer p_next = p_out->m_p_next_sibling;
+
+ base_type::actual_erase_node(p_out);
+
+ p_out = p_next;
+ }
+
+ node_pointer p_cur = base_type::m_p_root;
+
+ m_p_max = base_type::m_p_root = NULL;
+
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+
+ make_root_and_link(p_cur);
+
+ p_cur = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return ersd;
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+rank_bound()
+{
+ const std::size_t* const p_upper =
+ std::upper_bound( g_a_rank_bounds, g_a_rank_bounds + num_distinct_rank_bounds, base_type::m_size);
+
+ if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds)
+ return max_rank;
+
+ return (p_upper - g_a_rank_bounds);
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
new file mode 100644
index 000000000..52407e6d0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file find_fn_imps.hpp
+ * Contains an implementation for thin_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_reference
+PB_DS_CLASS_C_DEC::
+top() const
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
+
+ _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);
+ return m_p_max->m_value;
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
new file mode 100644
index 000000000..7a6952fda
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
@@ -0,0 +1,326 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file insert_fn_imps.hpp
+ * Contains an implementation for thin_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::point_iterator
+PB_DS_CLASS_C_DEC::
+push(const_reference r_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ node_pointer p_nd = base_type::get_new_node_for_insert(r_val);
+
+ p_nd->m_metadata = 0;
+
+ p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL;
+
+ if (base_type::m_p_root == NULL)
+ {
+ p_nd->m_p_next_sibling = NULL;
+
+ m_p_max = base_type::m_p_root = p_nd;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return point_iterator(p_nd);
+ }
+
+ p_nd->m_p_next_sibling = base_type::m_p_root;
+
+ base_type::m_p_root->m_p_prev_or_parent = NULL;
+
+ base_type::m_p_root = p_nd;
+
+ update_max(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return point_iterator(p_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+make_root(node_pointer p_nd)
+{
+ p_nd->m_metadata =
+ p_nd->m_p_l_child == NULL?
+ 0 :
+ 1 + p_nd->m_p_l_child->m_metadata;
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+make_root_and_link(node_pointer p_nd)
+{
+ make_root(p_nd);
+
+ p_nd->m_p_prev_or_parent = NULL;
+
+ p_nd->m_p_next_sibling = base_type::m_p_root;
+
+ if (base_type::m_p_root != NULL)
+ base_type::m_p_root->m_p_prev_or_parent = NULL;
+
+ base_type::m_p_root = p_nd;
+
+ update_max(p_nd);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix(node_pointer p_y)
+{
+ while (true)
+ {
+ if (p_y->m_p_prev_or_parent == NULL)
+ {
+ fix_root(p_y);
+
+ return;
+ }
+ else if (p_y->m_metadata == 1&& p_y->m_p_next_sibling == NULL)
+ {
+ if (p_y->m_p_l_child != NULL)
+ {
+ fix_sibling_rank_1_unmarked(p_y);
+
+ return;
+ }
+
+ fix_sibling_rank_1_marked(p_y);
+
+ p_y = p_y->m_p_prev_or_parent;
+ }
+ else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1)
+ {
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != NULL);
+
+ if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2)
+ {
+ fix_sibling_general_unmarked(p_y);
+
+ return;
+ }
+
+ fix_sibling_general_marked(p_y);
+
+ p_y = p_y->m_p_prev_or_parent;
+ }
+ else if ((p_y->m_p_l_child == NULL&&
+ p_y->m_metadata == 2) ||(p_y->m_p_l_child != NULL&&
+ p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3))
+ {
+ node_pointer p_z = p_y->m_p_prev_or_parent;
+
+ fix_child(p_y);
+
+ p_y = p_z;
+ }
+ else
+ return;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix_root(node_pointer p_y)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == NULL);
+
+ make_root(p_y);
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, true);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix_sibling_rank_1_unmarked(node_pointer p_y)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+
+ _GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;)
+ _GLIBCXX_DEBUG_ASSERT(p_w != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == NULL);
+
+ p_y->m_p_next_sibling = p_y->m_p_l_child;
+
+ p_y->m_p_next_sibling->m_p_prev_or_parent = p_y;
+
+ p_y->m_p_l_child = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix_sibling_rank_1_marked(node_pointer p_y)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == NULL);
+
+ p_y->m_metadata = 0;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix_sibling_general_unmarked(node_pointer p_y)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+
+ node_pointer p_w = p_y->m_p_l_child;
+ _GLIBCXX_DEBUG_ASSERT(p_w != NULL);
+ _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL);
+
+ p_y->m_p_l_child = p_w->m_p_next_sibling;
+ p_w->m_p_next_sibling->m_p_prev_or_parent = p_y;
+
+ p_w->m_p_next_sibling = p_y->m_p_next_sibling;
+ _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL);
+ p_w->m_p_next_sibling->m_p_prev_or_parent = p_w;
+
+ p_y->m_p_next_sibling = p_w;
+ p_w->m_p_prev_or_parent = p_y;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix_sibling_general_marked(node_pointer p_y)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+
+ --p_y->m_metadata;
+
+ _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+fix_child(node_pointer p_y)
+{
+ _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);
+
+ if (p_y->m_p_next_sibling != NULL)
+ p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent;
+
+ if (p_y->m_p_prev_or_parent->m_p_l_child == p_y)
+ p_y->m_p_prev_or_parent->m_p_l_child = p_y->m_p_next_sibling;
+ else
+ p_y->m_p_prev_or_parent->m_p_next_sibling = p_y->m_p_next_sibling;
+
+ make_root_and_link(p_y);
+}
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+modify(point_iterator it, const_reference r_new_val)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ node_pointer p_nd = it.m_p_nd;
+
+ _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);
+
+ const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value);
+
+ p_nd->m_value = r_new_val;
+
+ if (smaller)
+ {
+ remove_node(p_nd);
+
+ p_nd->m_p_l_child = NULL;
+
+ make_root_and_link(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return;
+ }
+
+ if (p_nd->m_p_prev_or_parent == NULL)
+ {
+ update_max(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+
+ return;
+ }
+
+ node_pointer p_y = p_nd->m_p_prev_or_parent;
+ _GLIBCXX_DEBUG_ASSERT(p_y != NULL);
+
+ if (p_nd->m_p_next_sibling != NULL)
+ p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y;
+
+ if (p_y->m_p_l_child == p_nd)
+ p_y->m_p_l_child = p_nd->m_p_next_sibling;
+ else
+ p_y->m_p_next_sibling = p_nd->m_p_next_sibling;
+
+ fix(p_y);
+
+ make_root_and_link(p_nd);
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+update_max(node_pointer p_nd)
+{
+ if (m_p_max == NULL || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))
+ m_p_max = p_nd;
+}
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
new file mode 100644
index 000000000..6acb7bd75
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file split_join_fn_imps.hpp
+ * Contains an implementation for thin_heap_.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Pred>
+void
+PB_DS_CLASS_C_DEC::
+split(Pred pred, PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ other.clear();
+
+ if (base_type::empty())
+ {
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ return;
+ }
+
+ base_type::to_linked_list();
+
+ node_pointer p_out = base_type::prune(pred);
+
+ while (p_out != NULL)
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);
+ --base_type::m_size;
+
+ ++other.m_size;
+
+ node_pointer p_next = p_out->m_p_next_sibling;
+
+ other.make_root_and_link(p_out);
+
+ p_out = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ node_pointer p_cur = base_type::m_p_root;
+
+ m_p_max = NULL;
+
+ base_type::m_p_root = NULL;
+
+ while (p_cur != NULL)
+ {
+ node_pointer p_next = p_cur->m_p_next_sibling;
+
+ make_root_and_link(p_cur);
+
+ p_cur = p_next;
+ }
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+join(PB_DS_CLASS_C_DEC& other)
+{
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+
+ node_pointer p_other = other.m_p_root;
+
+ while (p_other != NULL)
+ {
+ node_pointer p_next = p_other->m_p_next_sibling;
+
+ make_root_and_link(p_other);
+
+ p_other = p_next;
+ }
+
+ base_type::m_size += other.m_size;
+
+ other.m_p_root = NULL;
+ other.m_size = 0;
+ other.m_p_max = NULL;
+
+ _GLIBCXX_DEBUG_ONLY(assert_valid();)
+ _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
+ }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
new file mode 100644
index 000000000..88fa04b3c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
@@ -0,0 +1,351 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file thin_heap_.hpp
+ * Contains an implementation class for a thin heap.
+ */
+
+#ifndef PB_DS_THIN_HEAP_HPP
+#define PB_DS_THIN_HEAP_HPP
+
+/*
+ * Thin heaps.
+ * Tarjan and Kaplan.
+ */
+
+#include <algorithm>
+#include <ext/pb_ds/detail/cond_dealtor.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>
+#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>
+#include <debug/debug.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ thin_heap_<Value_Type, Cmp_Fn, Allocator>
+
+#ifdef _GLIBCXX_DEBUG
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
+ typename Allocator::size_type, Allocator, true>
+#else
+#define PB_DS_BASE_C_DEC \
+ left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \
+ typename Allocator::size_type, Allocator>
+#endif
+
+ /**
+ * class description = "t|-|i|\| h34p">
+ **/
+ template<typename Value_Type, class Cmp_Fn, class Allocator>
+ class thin_heap_ : public PB_DS_BASE_C_DEC
+ {
+
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ protected:
+ typedef typename base_type::node node;
+
+ typedef typename base_type::node_pointer node_pointer;
+
+ typedef typename base_type::const_node_pointer const_node_pointer;
+
+ public:
+
+ typedef typename Allocator::size_type size_type;
+
+ typedef typename Allocator::difference_type difference_type;
+
+ typedef Value_Type value_type;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::pointer
+ pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_pointer
+ const_pointer;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::reference
+ reference;
+
+ typedef
+ typename Allocator::template rebind<
+ value_type>::other::const_reference
+ const_reference;
+
+ typedef
+ typename PB_DS_BASE_C_DEC::const_point_iterator
+ const_point_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;
+
+ typedef typename PB_DS_BASE_C_DEC::iterator iterator;
+
+ typedef Cmp_Fn cmp_fn;
+
+ typedef Allocator allocator_type;
+
+ public:
+
+ inline point_iterator
+ push(const_reference r_val);
+
+ void
+ modify(point_iterator it, const_reference r_new_val);
+
+ inline const_reference
+ top() const;
+
+ void
+ pop();
+
+ void
+ erase(point_iterator it);
+
+ inline void
+ clear();
+
+ template<typename Pred>
+ size_type
+ erase_if(Pred pred);
+
+ template<typename Pred>
+ void
+ split(Pred pred, PB_DS_CLASS_C_DEC& other);
+
+ void
+ join(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+
+ thin_heap_();
+
+ thin_heap_(const Cmp_Fn& r_cmp_fn);
+
+ thin_heap_(const PB_DS_CLASS_C_DEC& other);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ ~thin_heap_();
+
+ template<typename It>
+ void
+ copy_from_range(It first_it, It last_it);
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+
+ void
+ assert_max() const;
+#endif
+
+#ifdef PB_DS_THIN_HEAP_TRACE_
+ void
+ trace() const;
+#endif
+
+ private:
+ enum
+ {
+ max_rank = (sizeof(size_type) << 4) + 2
+ };
+
+ private:
+
+ void
+ initialize();
+
+ inline void
+ update_max(node_pointer p_nd);
+
+ inline void
+ fix(node_pointer p_nd);
+
+ inline void
+ fix_root(node_pointer p_y);
+
+ inline void
+ fix_sibling_rank_1_unmarked(node_pointer p_y);
+
+ inline void
+ fix_sibling_rank_1_marked(node_pointer p_y);
+
+ inline void
+ fix_sibling_general_unmarked(node_pointer p_y);
+
+ inline void
+ fix_sibling_general_marked(node_pointer p_y);
+
+ inline void
+ fix_child(node_pointer p_y);
+
+ inline static void
+ make_root(node_pointer p_nd);
+
+ inline void
+ make_root_and_link(node_pointer p_nd);
+
+ inline void
+ remove_max_node();
+
+ void
+ to_aux_except_max();
+
+ inline void
+ add_to_aux(node_pointer p_nd);
+
+ inline void
+ make_from_aux();
+
+ inline size_type
+ rank_bound();
+
+ inline void
+ make_child_of(node_pointer p_nd, node_pointer p_new_parent);
+
+ inline void
+ remove_node(node_pointer p_nd);
+
+ inline node_pointer
+ join(node_pointer p_lhs, node_pointer p_rhs) const;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_node_consistent(const_node_pointer p_nd, bool root) const;
+
+ void
+ assert_aux_null() const;
+#endif
+
+ private:
+ node_pointer m_p_max;
+
+ node_pointer m_a_aux[max_rank];
+ };
+
+ enum
+ {
+ num_distinct_rank_bounds = 48
+ };
+
+ // Taken from the SGI implementation; acknowledged in the docs.
+ static const std::size_t g_a_rank_bounds[num_distinct_rank_bounds] =
+ {
+ /* Dealing cards... */
+ /* 0 */ 0ul,
+ /* 1 */ 1ul,
+ /* 2 */ 1ul,
+ /* 3 */ 2ul,
+ /* 4 */ 4ul,
+ /* 5 */ 6ul,
+ /* 6 */ 11ul,
+ /* 7 */ 17ul,
+ /* 8 */ 29ul,
+ /* 9 */ 46ul,
+ /* 10 */ 76ul,
+ /* 11 */ 122ul,
+ /* 12 */ 199ul,
+ /* 13 */ 321ul,
+ /* 14 */ 521ul,
+ /* 15 */ 842ul,
+ /* 16 */ 1364ul,
+ /* 17 */ 2206ul,
+ /* 18 */ 3571ul,
+ /* 19 */ 5777ul,
+ /* 20 */ 9349ul,
+ /* 21 */ 15126ul,
+ /* 22 */ 24476ul,
+ /* 23 */ 39602ul,
+ /* 24 */ 64079ul,
+ /* 25 */ 103681ul,
+ /* 26 */ 167761ul,
+ /* 27 */ 271442ul,
+ /* 28 */ 439204ul,
+ /* 29 */ 710646ul,
+ /* 30 */ 1149851ul,
+ /* 31 */ 1860497ul,
+ /* 32 */ 3010349ul,
+ /* 33 */ 4870846ul,
+ /* 34 */ 7881196ul,
+ /* 35 */ 12752042ul,
+ /* 36 */ 20633239ul,
+ /* 37 */ 33385282ul,
+ /* 38 */ 54018521ul,
+ /* 39 */ 87403803ul,
+ /* 40 */ 141422324ul,
+ /* 41 */ 228826127ul,
+ /* 42 */ 370248451ul,
+ /* 43 */ 599074578ul,
+ /* 44 */ 969323029ul,
+ /* 45 */ 1568397607ul,
+ /* 46 */ 2537720636ul,
+ /* 47 */ 4106118243ul
+ /* Pot's good, let's play */
+ };
+
+#include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp>
+#include <ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp>
+#include <ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp>
+#include <ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp>
+#include <ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp>
+#include <ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp>
+#include <ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_BASE_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
new file mode 100644
index 000000000..fc309d5c1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trace_fn_imps.hpp
+ * Contains an implementation class for left_child_next_sibling_heap_.
+ */
+
+#ifdef PB_DS_THIN_HEAP_TRACE_
+
+PB_DS_CLASS_T_DEC
+void
+PB_DS_CLASS_C_DEC::
+trace() const
+{
+ std::cerr << std::endl;
+
+ std::cerr << "m_p_max " << m_p_max << std::endl;
+
+ base_type::trace();
+}
+
+#endif // #ifdef PB_DS_THIN_HEAP_TRACE_
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
new file mode 100644
index 000000000..c182886ee
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_metadata_selector.hpp
+ * Contains an implementation class for trees.
+ */
+
+#ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
+#define PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
+
+#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Node_Update, bool Null>
+ struct tree_metadata_helper
+ {
+ typedef typename Node_Update::metadata_type type;
+ };
+
+ template<typename Node_Update>
+ struct tree_metadata_helper<
+ Node_Update,
+ true>
+ {
+ typedef null_node_metadata type;
+ };
+
+ template<typename Key,
+ typename Data,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Const_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct tree_node_metadata_selector
+ {
+ private:
+ typedef
+ dumconst_node_iterator<
+ Key,
+ Data,
+ Allocator>
+ dumconst_node_it;
+
+ enum
+ {
+ null_update =
+ is_same<
+ Node_Update<
+ dumconst_node_it,
+ dumconst_node_it,
+ Cmp_Fn,
+ Allocator>,
+ null_tree_node_update<
+ dumconst_node_it,
+ dumconst_node_it,
+ Cmp_Fn,
+ Allocator> >::value
+ };
+
+ public:
+ typedef
+ typename tree_metadata_helper<
+ Node_Update<
+ dumconst_node_it,
+ dumconst_node_it,
+ Cmp_Fn,
+ Allocator>,
+ null_update>::type
+ type;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
new file mode 100644
index 000000000..006a3eb04
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file null_node_update_imp.hpp
+ * Contains an implementation of null_node_update.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Const_Node_Iterator_,
+ typename Node_Iterator_,
+ class Cmp_Fn_,
+ typename Allocator_>
+inline void
+PB_DS_CLASS_C_DEC::
+swap(null_tree_node_update< Const_Node_Iterator_, Node_Iterator_, Cmp_Fn_, Allocator_>& /*other*/)
+{ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
new file mode 100644
index 000000000..1d33767a2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file order_statistics_imp.hpp
+ * Contains forward declarations for order_statistics_key
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+find_by_order(size_type order)
+{
+ node_iterator it = node_begin();
+
+ node_iterator end_it = node_end();
+
+ while (it != end_it)
+ {
+ node_iterator l_it = it.get_l_child();
+
+ const size_type o = (l_it == end_it)?
+ 0 :
+ l_it.get_metadata();
+
+ if (order == o)
+ return (*it);
+ else if (order < o)
+ it = l_it;
+ else
+ {
+ order -= o + 1;
+
+ it = it.get_r_child();
+ }
+ }
+
+ return (PB_DS_BASE_C_DEC::end_iterator());
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+find_by_order(size_type order) const
+{
+ return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+order_of_key(const_key_reference r_key) const
+{
+ const_node_iterator it = node_begin();
+
+ const_node_iterator end_it = node_end();
+
+ const cmp_fn& r_cmp_fn =
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->get_cmp_fn();
+
+ size_type ord = 0;
+
+ while (it != end_it)
+ {
+ const_node_iterator l_it = it.get_l_child();
+
+ if (r_cmp_fn(r_key, extract_key(*(*it))))
+ it = l_it;
+ else if (r_cmp_fn(extract_key(*(*it)), r_key))
+ {
+
+ ord += (l_it == end_it)?
+ 1 :
+ 1 + l_it.get_metadata();
+
+ it = it.get_r_child();
+ }
+ else
+ {
+ ord += (l_it == end_it)?
+ 0 :
+ l_it.get_metadata();
+
+ it = end_it;
+ }
+ }
+
+ return (ord);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+operator()(node_iterator node_it, const_node_iterator end_nd_it) const
+{
+ node_iterator l_child_it = node_it.get_l_child();
+ const size_type l_rank =(l_child_it == end_nd_it)? 0 : l_child_it.get_metadata();
+
+ node_iterator r_child_it = node_it.get_r_child();
+ const size_type r_rank =(r_child_it == end_nd_it)? 0 : r_child_it.get_metadata();
+
+ const_cast<metadata_reference>(node_it.get_metadata())=
+ 1 + l_rank + r_rank;
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~tree_order_statistics_node_update()
+{ }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
new file mode 100644
index 000000000..6ea68995e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_tree_node_update.hpp
+ * Contains a samle node update functor.
+ */
+
+#ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
+#define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
+
+// A sample node updator.
+template<typename Const_Node_Iterator,
+
+ class Node_Iterator,
+
+ class Cmp_Fn,
+
+ class Allocator
+ >
+class sample_tree_node_update
+{
+
+public:
+
+ // Metadata type.
+ typedef size_t metadata_type;
+
+protected:
+
+ // Default constructor.
+ sample_tree_node_update();
+
+ // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
+ inline void
+ operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
new file mode 100644
index 000000000..e4bd65649
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/tree_trace_base.hpp
@@ -0,0 +1,209 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file tree_trace_base.hpp
+ * Contains tree-related policies.
+ */
+
+#ifndef PB_DS_TREE_TRACE_BASE_HPP
+#define PB_DS_TREE_TRACE_BASE_HPP
+
+#ifdef PB_DS_TREE_TRACE
+
+#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
+#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+
+namespace __gnu_pbds
+{
+
+ namespace detail
+ {
+
+#ifdef PB_DS_TREE_TRACE
+
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ class Const_Node_Iterator, \
+ class Node_Iterator, \
+ class Cmp_Fn, \
+ bool Node_Based, \
+ class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ tree_trace_base< \
+ Const_Node_Iterator, \
+ Node_Iterator, \
+ Cmp_Fn, \
+ Node_Based, \
+ Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ basic_tree_policy_base< \
+ Const_Node_Iterator, \
+ Node_Iterator, \
+ Allocator>
+
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class Cmp_Fn,
+ bool Node_Based,
+ class Allocator>
+ class tree_trace_base : private PB_DS_BASE_C_DEC
+ {
+ public:
+ void
+ trace() const;
+
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ typedef Const_Node_Iterator const_node_iterator;
+
+ typedef typename Allocator::size_type size_type;
+
+ private:
+ void
+ trace_node(const_node_iterator nd_it, size_type level) const;
+
+ virtual bool
+ empty() const = 0;
+
+ virtual const_node_iterator
+ node_begin() const = 0;
+
+ virtual const_node_iterator
+ node_end() const = 0;
+
+ static void
+ print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>);
+
+ static void
+ print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>);
+
+ template<typename Metadata_>
+ static void
+ trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>);
+
+ static void
+ trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>);
+ };
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ trace() const
+ {
+ if (empty())
+ return;
+
+ trace_node(node_begin(), 0);
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ trace_node(const_node_iterator nd_it, size_type level) const
+ {
+ if (nd_it.get_r_child() != node_end())
+ trace_node(nd_it.get_r_child(), level + 1);
+
+ for (size_type i = 0; i < level; ++i)
+ std::cerr << ' ';
+
+ print_node_pointer(nd_it, integral_constant<int,Node_Based>());
+ std::cerr << base_type::extract_key(*(*nd_it));
+
+ typedef
+ type_to_type<
+ typename const_node_iterator::metadata_type>
+ m_type_ind_t;
+
+ trace_it_metadata(nd_it, m_type_ind_t());
+
+ std::cerr << std::endl;
+
+ if (nd_it.get_l_child() != node_end())
+ trace_node(nd_it.get_l_child(), level + 1);
+ }
+
+ PB_DS_CLASS_T_DEC
+ template<typename Metadata_>
+ void
+ PB_DS_CLASS_C_DEC::
+ trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>)
+ {
+ std::cerr << " (" <<
+ static_cast<unsigned long>(nd_it.get_metadata()) << ") ";
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>)
+ { }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>)
+ {
+ std::cerr << nd_it.m_p_nd << " ";
+ }
+
+ PB_DS_CLASS_T_DEC
+ void
+ PB_DS_CLASS_C_DEC::
+ print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>)
+ {
+ std::cerr <<* nd_it << " ";
+ }
+
+#undef PB_DS_CLASS_T_DEC
+
+#undef PB_DS_CLASS_C_DEC
+
+#undef PB_DS_BASE_C_DEC
+
+#endif // #ifdef PB_DS_TREE_TRACE
+
+ } // namespace detail
+
+} // namespace __gnu_pbds
+
+#endif // #ifdef PB_DS_TREE_TRACE
+
+#endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
new file mode 100644
index 000000000..b4de31fd0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
@@ -0,0 +1,116 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file node_metadata_selector.hpp
+ * Contains an implementation class for tries.
+ */
+
+#ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
+#define PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
+
+#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>
+#include <ext/pb_ds/detail/types_traits.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+ template<typename Node_Update, bool Null>
+ struct trie_metadata_helper
+ {
+ typedef typename Node_Update::metadata_type type;
+ };
+
+ template<typename Node_Update>
+ struct trie_metadata_helper<
+ Node_Update,
+ true>
+ {
+ typedef null_node_metadata type;
+ };
+
+ template<typename Key,
+ typename Data,
+ class Cmp_Fn,
+ template<typename Const_Node_Iterator,
+ class Const_Iterator,
+ class Cmp_Fn_,
+ class Allocator_>
+ class Node_Update,
+ class Allocator>
+ struct trie_node_metadata_selector
+ {
+ private:
+ typedef
+ dumconst_node_iterator<
+ Key,
+ Data,
+ Allocator>
+ dumconst_node_it;
+
+ enum
+ {
+ null_update =
+ is_same<
+ Node_Update<
+ dumconst_node_it,
+ dumconst_node_it,
+ Cmp_Fn,
+ Allocator>,
+ null_trie_node_update<
+ dumconst_node_it,
+ dumconst_node_it,
+ Cmp_Fn,
+ Allocator> >::value
+ };
+
+ public:
+ typedef
+ typename trie_metadata_helper<
+ Node_Update<
+ dumconst_node_it,
+ dumconst_node_it,
+ Cmp_Fn,
+ Allocator>,
+ null_update>::type
+ type;
+ };
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
new file mode 100644
index 000000000..65245e9dc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file null_node_update_imp.hpp
+ * Contains an implementation of null_node_update.
+ */
+
+PB_DS_CLASS_T_DEC
+template<typename Const_Node_Iterator_,
+ typename Node_Iterator_,
+ class E_Access_Traits_,
+ typename Allocator_>
+inline void
+PB_DS_CLASS_C_DEC::
+swap(null_trie_node_update< Const_Node_Iterator_, Node_Iterator_, E_Access_Traits_, Allocator_>& /*other*/)
+{ }
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
new file mode 100644
index 000000000..4e27ac21e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
@@ -0,0 +1,183 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file order_statistics_imp.hpp
+ * Contains forward declarations for order_statistics_key
+ */
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::iterator
+PB_DS_CLASS_C_DEC::
+find_by_order(size_type order)
+{
+ if (empty())
+ return (end());
+
+ ++order;
+
+ node_iterator nd_it = node_begin();
+
+ node_iterator end_nd_it = node_end();
+
+ while (true)
+ {
+ if (order > nd_it.get_metadata())
+ return (++base_type::rightmost_it(nd_it));
+
+ const size_type num_children = nd_it.num_children();
+
+ if (num_children == 0)
+ return (*nd_it);
+
+ for (size_type i = 0; i < num_children; ++i)
+ {
+ node_iterator child_nd_it = nd_it.get_child(i);
+
+ if (order <= child_nd_it.get_metadata())
+ {
+ i = num_children;
+
+ nd_it = child_nd_it;
+ }
+ else
+ order -= child_nd_it.get_metadata();
+ }
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+find_by_order(size_type order) const
+{
+ return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+order_of_key(const_key_reference r_key) const
+{
+ const E_Access_Traits& r_traits =
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();
+
+ return (order_of_prefix(
+ r_traits.begin(r_key),
+ r_traits.end(r_key)));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+order_of_prefix(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const
+{
+ if (empty())
+ return (0);
+
+ const E_Access_Traits& r_traits =
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();
+
+ const_node_iterator nd_it = node_begin();
+
+ const_node_iterator end_nd_it = node_end();
+
+ size_type ord = 0;
+
+ while (true)
+ {
+ const size_type num_children = nd_it.num_children();
+
+ if (num_children == 0)
+ {
+ const_key_reference r_key =
+ base_type::extract_key(*(*nd_it));
+
+ typename e_access_traits::const_iterator key_b =
+ r_traits.begin(r_key);
+
+ typename e_access_traits::const_iterator key_e =
+ r_traits.end(r_key);
+
+ return ((base_type::less( key_b, key_e, b, e, r_traits))?
+ ord + 1 :
+ ord);
+ }
+
+ const_node_iterator next_nd_it = end_nd_it;
+
+ size_type i = num_children - 1;
+
+ do
+ {
+ const_node_iterator child_nd_it = nd_it.get_child(i);
+
+ if (next_nd_it != end_nd_it)
+ ord += child_nd_it.get_metadata();
+ else if (!base_type::less(
+ b, e,
+ child_nd_it.valid_prefix().first,
+ child_nd_it.valid_prefix().second,
+ r_traits))
+ next_nd_it = child_nd_it;
+ }
+ while (i-- > 0);
+
+ if (next_nd_it == end_nd_it)
+ return (ord);
+
+ nd_it = next_nd_it;
+ }
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+operator()(node_iterator nd_it, const_node_iterator /*end_nd_it*/) const
+{
+ const size_type num_children = nd_it.num_children();
+
+ size_type children_rank = 0;
+
+ for (size_type i = 0; i < num_children; ++i)
+ children_rank += nd_it.get_child(i).get_metadata();
+
+ const_cast<size_type& >(nd_it.get_metadata()) =(num_children == 0)? 1 : children_rank;
+}
+
+PB_DS_CLASS_T_DEC
+PB_DS_CLASS_C_DEC::
+~trie_order_statistics_node_update()
+{ }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
new file mode 100644
index 000000000..cdd898929
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
@@ -0,0 +1,151 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file prefix_search_node_update_imp.hpp
+ * Contains an implementation of prefix_search_node_update.
+ */
+
+PB_DS_CLASS_T_DEC
+std::pair<
+ typename PB_DS_CLASS_C_DEC::const_iterator,
+ typename PB_DS_CLASS_C_DEC::const_iterator>
+PB_DS_CLASS_C_DEC::
+prefix_range(const_key_reference r_key) const
+{
+ const e_access_traits& r_traits = get_e_access_traits();
+
+ return (prefix_range(
+ r_traits.begin(r_key),
+ r_traits.end(r_key)));
+}
+
+PB_DS_CLASS_T_DEC
+std::pair<
+ typename PB_DS_CLASS_C_DEC::iterator,
+ typename PB_DS_CLASS_C_DEC::iterator>
+PB_DS_CLASS_C_DEC::
+prefix_range(const_key_reference r_key)
+{
+ return (prefix_range(
+ get_e_access_traits().begin(r_key),
+ get_e_access_traits().end(r_key)));
+}
+
+PB_DS_CLASS_T_DEC
+std::pair<
+ typename PB_DS_CLASS_C_DEC::const_iterator,
+ typename PB_DS_CLASS_C_DEC::const_iterator>
+PB_DS_CLASS_C_DEC::
+prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const
+{
+ const std::pair<iterator, iterator> non_const_ret =
+ const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e);
+
+ return (std::make_pair(
+ const_iterator(non_const_ret.first),
+ const_iterator(non_const_ret.second)));
+}
+
+PB_DS_CLASS_T_DEC
+std::pair<
+ typename PB_DS_CLASS_C_DEC::iterator,
+ typename PB_DS_CLASS_C_DEC::iterator>
+PB_DS_CLASS_C_DEC::
+prefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e)
+{
+ Node_Iterator nd_it = node_begin();
+ Node_Iterator end_nd_it = node_end();
+
+ const e_access_traits& r_traits =
+ get_e_access_traits();
+
+ const size_type given_range_length = std::distance(b, e);
+
+ while (true)
+ {
+ if (nd_it == end_nd_it)
+ return (std::make_pair(end(), end()));
+
+ const size_type common_range_length =
+ PB_DS_BASE_C_DEC::common_prefix_len(nd_it, b, e, r_traits);
+
+ if (common_range_length >= given_range_length)
+ {
+ iterator ret_b = leftmost_it(nd_it);
+
+ iterator ret_e = rightmost_it(nd_it);
+
+ return (std::make_pair(ret_b, ++ret_e));
+ }
+
+ nd_it = next_child(nd_it, b, e, end_nd_it, r_traits);
+ }
+}
+
+PB_DS_CLASS_T_DEC
+typename PB_DS_CLASS_C_DEC::node_iterator
+PB_DS_CLASS_C_DEC::
+next_child(node_iterator nd_it, typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e, node_iterator end_nd_it, const e_access_traits& r_traits)
+{
+ const size_type num_children = nd_it.num_children();
+
+ node_iterator ret = end_nd_it;
+
+ size_type max_length = 0;
+
+ for (size_type i = 0; i < num_children; ++i)
+ {
+ node_iterator pot = nd_it.get_child(i);
+
+ const size_type common_range_length =
+ PB_DS_BASE_C_DEC::common_prefix_len( pot, b, e, r_traits);
+
+ if (common_range_length > max_length)
+ {
+ ret = pot;
+
+ max_length = common_range_length;
+ }
+ }
+
+ return (ret);
+}
+
+PB_DS_CLASS_T_DEC
+inline void
+PB_DS_CLASS_C_DEC::
+operator()(node_iterator /*nd_it*/, const_node_iterator /*end_nd_it*/) const
+{ }
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
new file mode 100644
index 000000000..34fbe0cc3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_trie_e_access_traits.hpp
+ * Contains a sample probe policy.
+ */
+
+#ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
+#define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
+
+// A sample trie element-access traits.
+class sample_trie_e_access_traits
+{
+
+public:
+
+ // Size type.
+ typedef size_t size_type;
+
+ // Key type.
+ typedef std::string key_type;
+
+ // Const key reference type.
+ typedef
+ typename Allocator::template rebind<
+ key_type>::other::const_reference
+ const_key_reference;
+
+ // Element const iterator type.
+ typedef std::string::const_iterator const_iterator;
+
+ // Element type.
+ typedef char e_type;
+
+ enum
+ {
+ max_size = 4
+ };
+
+public:
+
+ // Returns a const_iterator to the first element of r_key.
+ inline static const_iterator
+ begin(const_key_reference r_key);
+
+ // Returns a const_iterator to the after-last element of r_key.
+ inline static const_iterator
+ end(const_key_reference r_key);
+
+ // Maps an element to a position.
+ inline static size_type
+ e_pos(e_type e);
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
new file mode 100644
index 000000000..55fd99787
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file sample_trie_node_update.hpp
+ * Contains a samle node update functor.
+ */
+
+#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
+#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
+
+// A sample node updator.
+template<typename Const_Node_Iterator,
+
+ class Node_Iterator,
+
+ class E_Access_Traits,
+
+ class Allocator
+ >
+class sample_trie_node_update
+{
+
+public:
+
+ // Metadata type.
+ typedef size_t metadata_type;
+
+protected:
+
+ // Default constructor.
+ sample_trie_node_update();
+
+ // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
+ inline void
+ operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
+
+};
+
+#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
new file mode 100644
index 000000000..228a4a5dc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file string_trie_e_access_traits_imp.hpp
+ * Contains a policy for extracting character positions from
+ * a string for a vector-based PATRICIA tree
+ */
+
+PB_DS_CLASS_T_DEC
+detail::integral_constant<int, Reverse> PB_DS_CLASS_C_DEC::s_rev_ind;
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::size_type
+PB_DS_CLASS_C_DEC::
+e_pos(e_type e)
+{
+ return (static_cast<size_type>(e - min_e_val));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin(const_key_reference r_key)
+{
+ return (begin_imp(r_key, s_rev_ind));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end(const_key_reference r_key)
+{
+ return (end_imp(r_key, s_rev_ind));
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin_imp(const_key_reference r_key, detail::false_type)
+{
+ return (r_key.begin());
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+begin_imp(const_key_reference r_key, detail::true_type)
+{
+ return (r_key.rbegin());
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end_imp(const_key_reference r_key, detail::false_type)
+{
+ return (r_key.end());
+}
+
+PB_DS_CLASS_T_DEC
+inline typename PB_DS_CLASS_C_DEC::const_iterator
+PB_DS_CLASS_C_DEC::
+end_imp(const_key_reference r_key, detail::true_type)
+{
+ return (r_key.rend());
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
new file mode 100644
index 000000000..db912a008
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
@@ -0,0 +1,249 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trie_policy_base.hpp
+ * Contains an implementation of trie_policy_base.
+ */
+
+#ifndef PB_DS_TRIE_POLICY_BASE_HPP
+#define PB_DS_TRIE_POLICY_BASE_HPP
+
+#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+
+#define PB_DS_CLASS_T_DEC \
+ template< \
+ class Const_Node_Iterator, \
+ class Node_Iterator, \
+ class E_Access_Traits, \
+ typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ trie_policy_base< \
+ Const_Node_Iterator, \
+ Node_Iterator, \
+ E_Access_Traits, \
+ Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ basic_tree_policy_base< \
+ Const_Node_Iterator, \
+ Node_Iterator, \
+ Allocator>
+
+ template<typename Const_Node_Iterator,
+ class Node_Iterator,
+ class E_Access_Traits,
+ class Allocator>
+ class trie_policy_base : public PB_DS_BASE_C_DEC
+ {
+
+ public:
+
+ typedef E_Access_Traits e_access_traits;
+
+ typedef Allocator allocator_type;
+
+ typedef typename allocator_type::size_type size_type;
+
+ typedef null_node_metadata metadata_type;
+
+ typedef Const_Node_Iterator const_node_iterator;
+
+ typedef Node_Iterator node_iterator;
+
+ typedef typename const_node_iterator::value_type const_iterator;
+
+ typedef typename node_iterator::value_type iterator;
+
+ public:
+
+ typedef typename PB_DS_BASE_C_DEC::key_type key_type;
+
+ typedef
+ typename PB_DS_BASE_C_DEC::const_key_reference
+ const_key_reference;
+
+ protected:
+
+ virtual const_iterator
+ end() const = 0;
+
+ virtual iterator
+ end() = 0;
+
+ virtual const_node_iterator
+ node_begin() const = 0;
+
+ virtual node_iterator
+ node_begin() = 0;
+
+ virtual const_node_iterator
+ node_end() const = 0;
+
+ virtual node_iterator
+ node_end() = 0;
+
+ virtual const e_access_traits&
+ get_e_access_traits() const = 0;
+
+ private:
+ typedef
+ std::pair<
+ typename e_access_traits::const_iterator,
+ typename e_access_traits::const_iterator>
+ prefix_range_t;
+
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ protected:
+ static size_type
+ common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);
+
+ static iterator
+ leftmost_it(node_iterator nd_it);
+
+ static iterator
+ rightmost_it(node_iterator nd_it);
+
+ static bool
+ less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);
+ };
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::size_type
+ PB_DS_CLASS_C_DEC::
+ common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)
+ {
+ prefix_range_t pref_range = nd_it.valid_prefix();
+
+ typename e_access_traits::const_iterator b_l = pref_range.first;
+ typename e_access_traits::const_iterator e_l = pref_range.second;
+
+ const size_type range_length_l =
+ std::distance(b_l, e_l);
+
+ const size_type range_length_r =
+ std::distance(b_r, e_r);
+
+ if (range_length_r < range_length_l)
+ {
+ std::swap(b_l, b_r);
+
+ std::swap(e_l, e_r);
+ }
+
+ size_type ret = 0;
+
+ while (b_l != e_l)
+ {
+ if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r))
+ return (ret);
+
+ ++ret;
+
+ ++b_l;
+
+ ++b_r;
+ }
+
+ return (ret);
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ leftmost_it(node_iterator nd_it)
+ {
+ if (nd_it.num_children() == 0)
+ return (*nd_it);
+
+ return (leftmost_it(nd_it.get_child(0)));
+ }
+
+ PB_DS_CLASS_T_DEC
+ typename PB_DS_CLASS_C_DEC::iterator
+ PB_DS_CLASS_C_DEC::
+ rightmost_it(node_iterator nd_it)
+ {
+ const size_type num_children = nd_it.num_children();
+
+ if (num_children == 0)
+ return (*nd_it);
+
+ return (rightmost_it(nd_it.get_child(num_children - 1)));
+ }
+
+ PB_DS_CLASS_T_DEC
+ bool
+ PB_DS_CLASS_C_DEC::
+ less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)
+ {
+ while (b_l != e_l)
+ {
+ if (b_r == e_r)
+ return (false);
+
+ size_type l_pos =
+ r_traits.e_pos(*b_l);
+ size_type r_pos =
+ r_traits.e_pos(*b_r);
+
+ if (l_pos != r_pos)
+ return (l_pos < r_pos);
+
+ ++b_l;
+ ++b_r;
+ }
+
+ return (b_r != e_r);
+ }
+
+#undef PB_DS_CLASS_T_DEC
+
+#undef PB_DS_CLASS_C_DEC
+
+#undef PB_DS_BASE_C_DEC
+
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp
new file mode 100644
index 000000000..55f349a26
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/type_utils.hpp
@@ -0,0 +1,167 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file type_utils.hpp
+ * Contains utilities for handnling types. All of these classes are based on
+ * "Modern C++" by Andrei Alxandrescu.
+ */
+
+#ifndef PB_DS_TYPE_UTILS_HPP
+#define PB_DS_TYPE_UTILS_HPP
+
+#include <cstddef>
+#include <utility>
+#include <tr1/type_traits>
+#include <ext/type_traits.h>
+#include <ext/numeric_traits.h>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ using std::tr1::is_same;
+ using std::tr1::is_const;
+ using std::tr1::is_pointer;
+ using std::tr1::is_reference;
+ using std::tr1::is_fundamental;
+ using std::tr1::is_member_object_pointer;
+ using std::tr1::is_member_pointer;
+ using std::tr1::is_base_of;
+ using std::tr1::remove_const;
+ using std::tr1::remove_reference;
+
+ // Need integral_const<bool, true> <-> integral_const<int, 1>, so
+ // because of this use the following typedefs instead of importing
+ // std::tr1's.
+ using std::tr1::integral_constant;
+ typedef std::tr1::integral_constant<int, 1> true_type;
+ typedef std::tr1::integral_constant<int, 0> false_type;
+
+ using __gnu_cxx::__conditional_type;
+ using __gnu_cxx::__numeric_traits;
+
+ template<typename T>
+ struct is_const_pointer
+ {
+ enum
+ {
+ value = is_const<T>::value && is_pointer<T>::value
+ };
+ };
+
+ template<typename T>
+ struct is_const_reference
+ {
+ enum
+ {
+ value = is_const<T>::value && is_reference<T>::value
+ };
+ };
+
+ template<typename T>
+ struct is_simple
+ {
+ enum
+ {
+ value = is_fundamental<typename remove_const<T>::type>::value
+ || is_pointer<typename remove_const<T>::type>::value
+ || is_member_pointer<T>::value
+ };
+ };
+
+ template<typename T>
+ class is_pair
+ {
+ private:
+ template<typename U>
+ struct is_pair_imp
+ {
+ enum
+ {
+ value = 0
+ };
+ };
+
+ template<typename U, typename V>
+ struct is_pair_imp<std::pair<U,V> >
+ {
+ enum
+ {
+ value = 1
+ };
+ };
+
+ public:
+ enum
+ {
+ value = is_pair_imp<T>::value
+ };
+ };
+
+ // Use C++0x's static_assert if possible.
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#define PB_DS_STATIC_ASSERT(UNIQUE, E) static_assert(E, #UNIQUE)
+#else
+ template<bool>
+ struct __static_assert;
+
+ template<>
+ struct __static_assert<true>
+ { };
+
+ template<int>
+ struct __static_assert_dumclass
+ {
+ enum
+ {
+ v = 1
+ };
+ };
+
+#define PB_DS_STATIC_ASSERT(UNIQUE, E) \
+ typedef __gnu_pbds::detail::__static_assert_dumclass<sizeof(__gnu_pbds::detail::__static_assert<bool(E)>)> UNIQUE##__static_assert_type
+
+#endif
+
+ template<typename Type>
+ struct type_to_type
+ {
+ typedef Type type;
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp
new file mode 100644
index 000000000..6d5a07838
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file types_traits.hpp
+ * Contains a traits class of types used by containers.
+ */
+
+#ifndef PB_DS_TYPES_TRAITS_HPP
+#define PB_DS_TYPES_TRAITS_HPP
+
+#include <ext/pb_ds/detail/basic_types.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <utility>
+
+namespace __gnu_pbds
+{
+ namespace detail
+ {
+ template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
+ struct vt_base_selector
+ {
+ typedef value_type_base<Key, Mapped, Alloc, Store_Extra> type;
+ };
+
+ template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>
+ struct types_traits
+ : public vt_base_selector<Key, Mapped, Alloc, Store_Extra>::type
+ {
+ typedef typename Alloc::template rebind<Key>::other key_allocator;
+ typedef typename key_allocator::value_type key_type;
+ typedef typename key_allocator::pointer key_pointer;
+ typedef typename key_allocator::const_pointer const_key_pointer;
+ typedef typename key_allocator::reference key_reference;
+ typedef typename key_allocator::const_reference const_key_reference;
+ typedef typename Alloc::size_type size_type;
+
+ // Extra value (used when the extra value is stored with each value).
+ typedef std::pair<size_type, size_type> comp_hash;
+
+ typedef integral_constant<int, Store_Extra> store_extra;
+ store_extra m_store_extra_indicator;
+
+ typedef typename no_throw_copies<Key, Mapped>::indicator no_throw_copies;
+ no_throw_copies m_no_throw_copies_indicator;
+ };
+ } // namespace detail
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
new file mode 100644
index 000000000..38d4eb1cf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
@@ -0,0 +1,129 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_iterator.hpp
+ * Contains an iterator class used for const ranging over the elements of the
+ * table.
+ */
+
+// Const range-type iterator.
+class const_iterator_ :
+ public const_point_iterator_
+
+{
+
+public:
+
+ // Category.
+ typedef std::forward_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef typename Allocator::difference_type difference_type;
+
+ // Iterator's value type.
+ typedef value_type_ value_type;
+
+ // Iterator's pointer type.
+ typedef pointer_ pointer;
+
+ // Iterator's const pointer type.
+ typedef const_pointer_ const_pointer;
+
+ // Iterator's reference type.
+ typedef reference_ reference;
+
+ // Iterator's const reference type.
+ typedef const_reference_ const_reference;
+
+public:
+
+ // Default constructor.
+ inline
+ const_iterator_()
+
+ : m_p_tbl(NULL)
+ { }
+
+ // Increments.
+ inline const_iterator_&
+ operator++()
+ {
+ m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);
+
+ return (*this);
+ }
+
+ // Increments.
+ inline const_iterator_
+ operator++(int)
+ {
+ const_iterator_ ret =* this;
+
+ m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);
+
+ return (ret);
+ }
+
+protected:
+
+ typedef const_point_iterator_ base_type;
+
+protected:
+
+ /**
+ * Constructor used by the table to initiate the generalized
+ * pointer and position (e.g., this is called from within a find()
+ * of a table.
+ * */
+ inline
+ const_iterator_(const_pointer_ p_value, PB_DS_GEN_POS pos, const PB_DS_CLASS_C_DEC* p_tbl) : const_point_iterator_(p_value),
+ m_p_tbl(p_tbl),
+ m_pos(pos)
+ { }
+
+protected:
+
+ /**
+ * Pointer to the table object which created the iterator (used for
+ * incrementing its position.
+ * */
+ const PB_DS_CLASS_C_DEC* m_p_tbl;
+
+ PB_DS_GEN_POS m_pos;
+
+ friend class PB_DS_CLASS_C_DEC;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
new file mode 100644
index 000000000..bc0b2ad62
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
@@ -0,0 +1,151 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file const_point_iterator.hpp
+ * Contains an iterator class returned by the tables' const find and insert
+ * methods.
+ */
+
+class point_iterator_;
+
+// Const point-type iterator.
+class const_point_iterator_
+{
+
+public:
+
+ // Category.
+ typedef trivial_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef trivial_iterator_difference_type difference_type;
+
+ // Iterator's value type.
+ typedef value_type_ value_type;
+
+ // Iterator's pointer type.
+ typedef pointer_ pointer;
+
+ // Iterator's const pointer type.
+ typedef const_pointer_ const_pointer;
+
+ // Iterator's reference type.
+ typedef reference_ reference;
+
+ // Iterator's const reference type.
+ typedef const_reference_ const_reference;
+
+public:
+
+ inline
+ const_point_iterator_(const_pointer p_value) : m_p_value(p_value)
+ { }
+
+ // Default constructor.
+ inline
+ const_point_iterator_()
+
+ : m_p_value(NULL)
+ { }
+
+ // Copy constructor.
+ inline
+ const_point_iterator_(const const_point_iterator_& other)
+
+ : m_p_value(other.m_p_value)
+ { }
+
+ // Copy constructor.
+ inline
+ const_point_iterator_(const point_iterator_& other)
+
+ : m_p_value(other.m_p_value)
+ { }
+
+ // Access.
+ inline const_pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+
+ return (m_p_value);
+ }
+
+ // Access.
+ inline const_reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+
+ return (*m_p_value);
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const point_iterator_& other) const
+ {
+ return (m_p_value == other.m_p_value);
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const const_point_iterator_& other) const
+ {
+ return (m_p_value == other.m_p_value);
+ }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const point_iterator_& other) const
+ {
+ return (m_p_value != other.m_p_value);
+ }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const const_point_iterator_& other) const
+ {
+ return (m_p_value != other.m_p_value);
+ }
+
+protected:
+ const_pointer m_p_value;
+
+ friend class point_iterator_;
+
+ friend class PB_DS_CLASS_C_DEC;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
new file mode 100644
index 000000000..3e21aba8b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/iterator.hpp
@@ -0,0 +1,150 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file iterator.hpp
+ * Contains an iterator_ class used for ranging over the elements of the
+ * table.
+ */
+
+// Range-type iterator.
+class iterator_ :
+ public const_iterator_
+
+{
+
+public:
+
+ // Category.
+ typedef std::forward_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef typename Allocator::difference_type difference_type;
+
+ // Iterator's value type.
+ typedef value_type_ value_type;
+
+ // Iterator's pointer type.
+ typedef pointer_ pointer;
+
+ // Iterator's const pointer type.
+ typedef const_pointer_ const_pointer;
+
+ // Iterator's reference type.
+ typedef reference_ reference;
+
+ // Iterator's const reference type.
+ typedef const_reference_ const_reference;
+
+public:
+
+ // Default constructor.
+ inline
+ iterator_()
+
+ : const_iterator_(NULL, PB_DS_GEN_POS(), NULL)
+ { }
+
+ // Conversion to a point-type iterator.
+ inline
+ operator point_iterator_()
+ {
+ return (point_iterator_(
+ const_cast<pointer>(const_iterator_::m_p_value)));
+ }
+
+ // Conversion to a point-type iterator.
+ inline
+ operator const point_iterator_() const
+ {
+ return (point_iterator_(
+ const_cast<pointer>(const_iterator_::m_p_value)));
+ }
+
+ // Access.
+ inline pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != NULL);
+
+ return (const_cast<pointer>(base_type::m_p_value));
+ }
+
+ // Access.
+ inline reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != NULL);
+
+ return (const_cast<reference>(*base_type::m_p_value));
+ }
+
+ // Increments.
+ inline iterator_&
+ operator++()
+ {
+ base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);
+
+ return (*this);
+ }
+
+ // Increments.
+ inline iterator_
+ operator++(int)
+ {
+ iterator_ ret =* this;
+
+ base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);
+
+ return (ret);
+ }
+
+protected:
+ typedef const_iterator_ base_type;
+
+protected:
+
+ /**
+ * Constructor used by the table to initiate the generalized
+ * pointer and position (e.g., this is called from within a find()
+ * of a table.
+ * */
+ inline
+ iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl) : const_iterator_(p_value, pos, p_tbl)
+ { }
+
+ friend class PB_DS_CLASS_C_DEC;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
new file mode 100644
index 000000000..37ce90069
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file point_iterator.hpp
+ * Contains an iterator class returned by the tables' find and insert
+ * methods.
+ */
+
+// Find type iterator.
+class point_iterator_
+{
+
+public:
+
+ // Category.
+ typedef trivial_iterator_tag iterator_category;
+
+ // Difference type.
+ typedef trivial_iterator_difference_type difference_type;
+
+ // Iterator's value type.
+ typedef value_type_ value_type;
+
+ // Iterator's pointer type.
+ typedef pointer_ pointer;
+
+ // Iterator's const pointer type.
+ typedef const_pointer_ const_pointer;
+
+ // Iterator's reference type.
+ typedef reference_ reference;
+
+ // Iterator's const reference type.
+ typedef const_reference_ const_reference;
+
+public:
+
+ // Default constructor.
+ inline
+ point_iterator_()
+
+ : m_p_value(NULL)
+ { }
+
+ // Copy constructor.
+ inline
+ point_iterator_(const point_iterator_& other)
+
+ : m_p_value(other.m_p_value)
+ { }
+
+ // Access.
+ inline pointer
+ operator->() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+
+ return (m_p_value);
+ }
+
+ // Access.
+ inline reference
+ operator*() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);
+
+ return (*m_p_value);
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const point_iterator_& other) const
+ {
+ return (m_p_value == other.m_p_value);
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator==(const const_point_iterator_& other) const
+ {
+ return (m_p_value == other.m_p_value);
+ }
+
+ // Compares content to a different iterator object.
+ inline bool
+ operator!=(const point_iterator_& other) const
+ {
+ return (m_p_value != other.m_p_value);
+ }
+
+ // Compares content (negatively) to a different iterator object.
+ inline bool
+ operator!=(const const_point_iterator_& other) const
+ {
+ return (m_p_value != other.m_p_value);
+ }
+
+ inline
+ point_iterator_(pointer p_value) : m_p_value(p_value)
+ { }
+
+protected:
+ friend class const_point_iterator_;
+
+ friend class PB_DS_CLASS_C_DEC;
+
+protected:
+ pointer m_p_value;
+};
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/exception.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/exception.hpp
new file mode 100644
index 000000000..4f796b1ef
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/exception.hpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file exception.hpp
+ * Contains exception classes.
+ */
+
+#ifndef PB_DS_EXCEPTION_HPP
+#define PB_DS_EXCEPTION_HPP
+
+#include <stdexcept>
+#include <cstdlib>
+
+namespace __gnu_pbds
+{
+ // Base class for exceptions.
+ struct container_error : public std::logic_error
+ {
+ container_error()
+ : std::logic_error(__N("__gnu_pbds::container_error")) { }
+ };
+
+ // An entry cannot be inserted into a container object for logical
+ // reasons (not, e.g., if memory is unabvailable, in which case
+ // the allocator_type's exception will be thrown).
+ struct insert_error : public container_error { };
+
+ // A join cannot be performed logical reasons (i.e., the ranges of
+ // the two container objects being joined overlaps.
+ struct join_error : public container_error { };
+
+ // A container cannot be resized.
+ struct resize_error : public container_error { };
+
+#if __EXCEPTIONS
+ inline void
+ __throw_container_error(void)
+ { throw container_error(); }
+
+ inline void
+ __throw_insert_error(void)
+ { throw insert_error(); }
+
+ inline void
+ __throw_join_error(void)
+ { throw join_error(); }
+
+ inline void
+ __throw_resize_error(void)
+ { throw resize_error(); }
+#else
+ inline void
+ __throw_container_error(void)
+ { std::abort(); }
+
+ inline void
+ __throw_insert_error(void)
+ { std::abort(); }
+
+ inline void
+ __throw_join_error(void)
+ { std::abort(); }
+
+ inline void
+ __throw_resize_error(void)
+ { std::abort(); }
+#endif
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp
new file mode 100644
index 000000000..24c0c4562
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp
@@ -0,0 +1,604 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file hash_policy.hpp
+ * Contains hash-related policies.
+ */
+
+#ifndef PB_DS_HASH_POLICY_HPP
+#define PB_DS_HASH_POLICY_HPP
+
+#include <algorithm>
+#include <vector>
+#include <cmath>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp>
+#include <ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp>
+#include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp>
+
+namespace __gnu_pbds
+{
+ // A null hash function, indicating that the combining hash function
+ // is actually a ranged hash function.
+ struct null_hash_fn
+ { };
+
+ // A null probe function, indicating that the combining probe
+ // function is actually a ranged probe function.
+ struct null_probe_fn
+ { };
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+#define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type>
+
+ // A probe sequence policy using fixed increments.
+ template<typename Size_Type = size_t>
+ class linear_probe_fn
+ {
+ public:
+ typedef Size_Type size_type;
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+ // Returns the i-th offset from the hash value.
+ inline size_type
+ operator()(size_type i) const;
+ };
+
+#include <ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+#define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type>
+
+ // A probe sequence policy using square increments.
+ template<typename Size_Type = size_t>
+ class quadratic_probe_fn
+ {
+ public:
+ typedef Size_Type size_type;
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+ // Returns the i-th offset from the hash value.
+ inline size_type
+ operator()(size_type i) const;
+ };
+
+#include <ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+#define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type>
+
+ // A mask range-hashing class (uses a bit-mask).
+ template<typename Size_Type = size_t>
+ class direct_mask_range_hashing
+ : public detail::mask_based_range_hashing<Size_Type>
+ {
+ private:
+ typedef detail::mask_based_range_hashing<Size_Type> mask_based_base;
+
+ public:
+ typedef Size_Type size_type;
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+ void
+ notify_resized(size_type size);
+
+ // Transforms the __hash value hash into a ranged-hash value
+ // (using a bit-mask).
+ inline size_type
+ operator()(size_type hash) const;
+ };
+
+#include <ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+#define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type>
+
+ // A mod range-hashing class (uses the modulo function).
+ template<typename Size_Type = size_t>
+ class direct_mod_range_hashing
+ : public detail::mod_based_range_hashing<Size_Type>
+ {
+ public:
+ typedef Size_Type size_type;
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+ void
+ notify_resized(size_type size);
+
+ // Transforms the __hash value hash into a ranged-hash value
+ // (using a modulo operation).
+ inline size_type
+ operator()(size_type hash) const;
+
+ private:
+ typedef detail::mod_based_range_hashing<size_type> mod_based_base;
+ };
+
+#include <ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type>
+#define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger<External_Load_Access, Size_Type>
+#define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base<Size_Type, External_Load_Access>
+
+ // A resize trigger policy based on a load check. It keeps the
+ // load factor between some load factors load_min and load_max.
+ template<bool External_Load_Access = false, typename Size_Type = size_t>
+ class hash_load_check_resize_trigger : private PB_DS_SIZE_BASE_C_DEC
+ {
+ public:
+ typedef Size_Type size_type;
+
+ enum
+ {
+ external_load_access = External_Load_Access
+ };
+
+ // Default constructor, or constructor taking load_min and
+ // load_max load factors between which this policy will keep the
+ // actual load.
+ hash_load_check_resize_trigger(float load_min = 0.125,
+ float load_max = 0.5);
+
+ void
+ swap(hash_load_check_resize_trigger& other);
+
+ virtual
+ ~hash_load_check_resize_trigger();
+
+ // Returns a pair of the minimal and maximal loads, respectively.
+ inline std::pair<float, float>
+ get_loads() const;
+
+ // Sets the loads through a pair of the minimal and maximal
+ // loads, respectively.
+ void
+ set_loads(std::pair<float, float> load_pair);
+
+ protected:
+ inline void
+ notify_insert_search_start();
+
+ inline void
+ notify_insert_search_collision();
+
+ inline void
+ notify_insert_search_end();
+
+ inline void
+ notify_find_search_start();
+
+ inline void
+ notify_find_search_collision();
+
+ inline void
+ notify_find_search_end();
+
+ inline void
+ notify_erase_search_start();
+
+ inline void
+ notify_erase_search_collision();
+
+ inline void
+ notify_erase_search_end();
+
+ // Notifies an element was inserted. The total number of entries
+ // in the table is num_entries.
+ inline void
+ notify_inserted(size_type num_entries);
+
+ inline void
+ notify_erased(size_type num_entries);
+
+ // Notifies the table was cleared.
+ void
+ notify_cleared();
+
+ // Notifies the table was resized as a result of this object's
+ // signifying that a resize is needed.
+ void
+ notify_resized(size_type new_size);
+
+ void
+ notify_externally_resized(size_type new_size);
+
+ inline bool
+ is_resize_needed() const;
+
+ inline bool
+ is_grow_needed(size_type size, size_type num_entries) const;
+
+ private:
+ virtual void
+ do_resize(size_type new_size);
+
+ typedef PB_DS_SIZE_BASE_C_DEC size_base;
+
+#ifdef _GLIBCXX_DEBUG
+ void
+ assert_valid() const;
+#endif
+
+ float m_load_min;
+ float m_load_max;
+ size_type m_next_shrink_size;
+ size_type m_next_grow_size;
+ bool m_resize_needed;
+ };
+
+#include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_SIZE_BASE_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type>
+#define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger<External_Load_Access, Size_Type>
+
+ // A resize trigger policy based on collision checks. It keeps the
+ // simulated load factor lower than some given load factor.
+ template<bool External_Load_Access = false, typename Size_Type = size_t>
+ class cc_hash_max_collision_check_resize_trigger
+ {
+ public:
+ typedef Size_Type size_type;
+
+ enum
+ {
+ external_load_access = External_Load_Access
+ };
+
+ // Default constructor, or constructor taking load, a __load
+ // factor which it will attempt to maintain.
+ cc_hash_max_collision_check_resize_trigger(float load = 0.5);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ // Returns the current load.
+ inline float
+ get_load() const;
+
+ // Sets the load; does not resize the container.
+ void
+ set_load(float load);
+
+ protected:
+ inline void
+ notify_insert_search_start();
+
+ inline void
+ notify_insert_search_collision();
+
+ inline void
+ notify_insert_search_end();
+
+ inline void
+ notify_find_search_start();
+
+ inline void
+ notify_find_search_collision();
+
+ inline void
+ notify_find_search_end();
+
+ inline void
+ notify_erase_search_start();
+
+ inline void
+ notify_erase_search_collision();
+
+ inline void
+ notify_erase_search_end();
+
+ inline void
+ notify_inserted(size_type num_entries);
+
+ inline void
+ notify_erased(size_type num_entries);
+
+ void
+ notify_cleared();
+
+ // Notifies the table was resized as a result of this object's
+ // signifying that a resize is needed.
+ void
+ notify_resized(size_type new_size);
+
+ void
+ notify_externally_resized(size_type new_size);
+
+ inline bool
+ is_resize_needed() const;
+
+ inline bool
+ is_grow_needed(size_type size, size_type num_entries) const;
+
+ private:
+ void
+ calc_max_num_coll();
+
+ inline void
+ calc_resize_needed();
+
+ float m_load;
+ size_type m_size;
+ size_type m_num_col;
+ size_type m_max_col;
+ bool m_resize_needed;
+ };
+
+#include <ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Type>
+#define PB_DS_CLASS_C_DEC hash_exponential_size_policy<Size_Type>
+
+ // A size policy whose sequence of sizes form an exponential
+ // sequence (typically powers of 2.
+ template<typename Size_Type = size_t>
+ class hash_exponential_size_policy
+ {
+ public:
+ typedef Size_Type size_type;
+
+ // Default constructor, or onstructor taking a start_size, or
+ // constructor taking a start size and grow_factor. The policy
+ // will use the sequence of sizes start_size, start_size*
+ // grow_factor, start_size* grow_factor^2, ...
+ hash_exponential_size_policy(size_type start_size = 8,
+ size_type grow_factor = 2);
+
+ void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+ size_type
+ get_nearest_larger_size(size_type size) const;
+
+ size_type
+ get_nearest_smaller_size(size_type size) const;
+
+ private:
+ size_type m_start_size;
+ size_type m_grow_factor;
+ };
+
+#include <ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC
+#define PB_DS_CLASS_C_DEC hash_prime_size_policy
+
+ // A size policy whose sequence of sizes form a nearly-exponential
+ // sequence of primes.
+ class hash_prime_size_policy
+ {
+ public:
+ // Size type.
+ typedef size_t size_type;
+
+ // Default constructor, or onstructor taking a start_size The
+ // policy will use the sequence of sizes approximately
+ // start_size, start_size* 2, start_size* 2^2, ...
+ hash_prime_size_policy(size_type start_size = 8);
+
+ inline void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ protected:
+ size_type
+ get_nearest_larger_size(size_type size) const;
+
+ size_type
+ get_nearest_smaller_size(size_type size) const;
+
+ private:
+ size_type m_start_size;
+ };
+
+#include <ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<typename Size_Policy, typename Trigger_Policy, bool External_Size_Access, typename Size_Type>
+
+#define PB_DS_CLASS_C_DEC hash_standard_resize_policy<Size_Policy, Trigger_Policy, External_Size_Access, Size_Type>
+
+ // A resize policy which delegates operations to size and trigger policies.
+ template<typename Size_Policy = hash_exponential_size_policy<>,
+ typename Trigger_Policy = hash_load_check_resize_trigger<>,
+ bool External_Size_Access = false,
+ typename Size_Type = size_t>
+ class hash_standard_resize_policy
+ : public Size_Policy, public Trigger_Policy
+ {
+ public:
+ typedef Size_Type size_type;
+ typedef Trigger_Policy trigger_policy;
+ typedef Size_Policy size_policy;
+
+ enum
+ {
+ external_size_access = External_Size_Access
+ };
+
+ // Default constructor.
+ hash_standard_resize_policy();
+
+ // constructor taking some policies r_size_policy will be copied
+ // by the Size_Policy object of this object.
+ hash_standard_resize_policy(const Size_Policy& r_size_policy);
+
+ // constructor taking some policies. r_size_policy will be
+ // copied by the Size_Policy object of this
+ // object. r_trigger_policy will be copied by the Trigger_Policy
+ // object of this object.
+ hash_standard_resize_policy(const Size_Policy& r_size_policy,
+ const Trigger_Policy& r_trigger_policy);
+
+ virtual
+ ~hash_standard_resize_policy();
+
+ inline void
+ swap(PB_DS_CLASS_C_DEC& other);
+
+ // Access to the Size_Policy object used.
+ Size_Policy&
+ get_size_policy();
+
+ // Const access to the Size_Policy object used.
+ const Size_Policy&
+ get_size_policy() const;
+
+ // Access to the Trigger_Policy object used.
+ Trigger_Policy&
+ get_trigger_policy();
+
+ // Access to the Trigger_Policy object used.
+ const Trigger_Policy&
+ get_trigger_policy() const;
+
+ // Returns the actual size of the container.
+ inline size_type
+ get_actual_size() const;
+
+ // Resizes the container to suggested_new_size, a suggested size
+ // (the actual size will be determined by the Size_Policy
+ // object).
+ void
+ resize(size_type suggested_new_size);
+
+ protected:
+ inline void
+ notify_insert_search_start();
+
+ inline void
+ notify_insert_search_collision();
+
+ inline void
+ notify_insert_search_end();
+
+ inline void
+ notify_find_search_start();
+
+ inline void
+ notify_find_search_collision();
+
+ inline void
+ notify_find_search_end();
+
+ inline void
+ notify_erase_search_start();
+
+ inline void
+ notify_erase_search_collision();
+
+ inline void
+ notify_erase_search_end();
+
+ inline void
+ notify_inserted(size_type num_e);
+
+ inline void
+ notify_erased(size_type num_e);
+
+ void
+ notify_cleared();
+
+ void
+ notify_resized(size_type new_size);
+
+ inline bool
+ is_resize_needed() const;
+
+ // Queries what the new size should be, when the container is
+ // resized naturally. The current __size of the container is
+ // size, and the number of used entries within the container is
+ // num_used_e.
+ size_type
+ get_new_size(size_type size, size_type num_used_e) const;
+
+ private:
+ // Resizes to new_size.
+ virtual void
+ do_resize(size_type new_size);
+
+ typedef Trigger_Policy trigger_policy_base;
+
+ typedef Size_Policy size_policy_base;
+
+ size_type m_size;
+ };
+
+#include <ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp
new file mode 100644
index 000000000..ec05b69c7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/list_update_policy.hpp
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file list_update_policy.hpp
+ * Contains policies for list update containers.
+ */
+
+#ifndef PB_DS_LU_POLICY_HPP
+#define PB_DS_LU_POLICY_HPP
+
+#include <cstdlib>
+#include <ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp>
+
+namespace __gnu_pbds
+{
+ // A null type that means that each link in a list-based container
+ // does not actually need metadata.
+ struct null_lu_metadata
+ { };
+
+#define PB_DS_CLASS_T_DEC template<typename Allocator>
+#define PB_DS_CLASS_C_DEC move_to_front_lu_policy<Allocator>
+
+ // A list-update policy that unconditionally moves elements to the
+ // front of the list.
+ template<typename Allocator = std::allocator<char> >
+ class move_to_front_lu_policy
+ {
+ public:
+ typedef Allocator allocator_type;
+
+ // Metadata on which this functor operates.
+ typedef null_lu_metadata metadata_type;
+
+ // Reference to metadata on which this functor operates.
+ typedef typename allocator_type::template rebind<metadata_type>::other metadata_rebind;
+ typedef typename metadata_rebind::reference metadata_reference;
+
+ // Creates a metadata object.
+ metadata_type
+ operator()() const;
+
+ // Decides whether a metadata object should be moved to the front
+ // of the list.
+ inline bool
+ operator()(metadata_reference r_metadata) const;
+
+ private:
+ static null_lu_metadata s_metadata;
+ };
+
+#include <ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC template<size_t Max_Count, class Allocator>
+#define PB_DS_CLASS_C_DEC counter_lu_policy<Max_Count, Allocator>
+
+ // A list-update policy that moves elements to the front of the list
+ // based on the counter algorithm.
+ template<size_t Max_Count = 5, typename Allocator = std::allocator<char> >
+ class counter_lu_policy
+ : private detail::counter_lu_policy_base<typename Allocator::size_type>
+ {
+ public:
+ typedef Allocator allocator_type;
+
+ enum
+ {
+ max_count = Max_Count
+ };
+
+ typedef typename allocator_type::size_type size_type;
+
+ // Metadata on which this functor operates.
+ typedef detail::counter_lu_metadata<size_type> metadata_type;
+
+ // Reference to metadata on which this functor operates.
+ typedef typename Allocator::template rebind<metadata_type>::other metadata_rebind;
+ typedef typename metadata_rebind::reference metadata_reference;
+
+ // Creates a metadata object.
+ metadata_type
+ operator()() const;
+
+ // Decides whether a metadata object should be moved to the front
+ // of the list.
+ bool
+ operator()(metadata_reference r_metadata) const;
+
+ private:
+ typedef detail::counter_lu_policy_base<typename Allocator::size_type> base_type;
+ };
+
+#include <ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp
new file mode 100644
index 000000000..531f70c65
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file priority_queue.hpp
+ * Contains priority_queues.
+ */
+
+#ifndef PB_DS_PRIORITY_QUEUE_HPP
+#define PB_DS_PRIORITY_QUEUE_HPP
+
+#include <ext/pb_ds/tag_and_trait.hpp>
+#include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>
+#include <ext/pb_ds/detail/standard_policies.hpp>
+
+namespace __gnu_pbds
+{
+ // A priority queue.
+ template<typename Value_Type,
+ typename Cmp_Fn = std::less<Value_Type>,
+ typename Tag = pairing_heap_tag,
+ typename Allocator = std::allocator<char> >
+ class priority_queue
+ : public detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type
+ {
+ private:
+ typedef typename detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type base_type;
+
+ public:
+ typedef Value_Type value_type;
+ typedef Cmp_Fn cmp_fn;
+ typedef Tag container_category;
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+
+ typedef typename allocator_type::template rebind<value_type>::other value_rebind;
+ typedef typename value_rebind::reference reference;
+ typedef typename value_rebind::const_reference const_reference;
+ typedef typename value_rebind::pointer pointer;
+ typedef typename value_rebind::const_pointer const_pointer;
+
+ typedef typename base_type::const_point_iterator const_point_iterator;
+ typedef typename base_type::point_iterator point_iterator;
+ typedef typename base_type::const_iterator const_iterator;
+ typedef typename base_type::iterator iterator;
+
+ priority_queue() { }
+
+ // Constructor taking some policy objects. r_cmp_fn will be copied
+ // by the Cmp_Fn object of the container object.
+ priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }
+
+ // Constructor taking __iterators to a range of value_types. The
+ // value_types between first_it and last_it will be inserted into
+ // the container object.
+ template<typename It>
+ priority_queue(It first_it, It last_it)
+ { base_type::copy_from_range(first_it, last_it); }
+
+ // Constructor taking __iterators to a range of value_types and
+ // some policy objects The value_types between first_it and
+ // last_it will be inserted into the container object. r_cmp_fn
+ // will be copied by the cmp_fn object of the container object.
+ template<typename It>
+ priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)
+ : base_type(r_cmp_fn)
+ { base_type::copy_from_range(first_it, last_it); }
+
+ priority_queue(const priority_queue& other)
+ : base_type((const base_type& )other) { }
+
+ virtual
+ ~priority_queue() { }
+
+ priority_queue&
+ operator=(const priority_queue& other)
+ {
+ if (this != &other)
+ {
+ priority_queue tmp(other);
+ swap(tmp);
+ }
+ return *this;
+ }
+
+ void
+ swap(priority_queue& other)
+ { base_type::swap(other); }
+ };
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
new file mode 100644
index 000000000..ccd2533cc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp
@@ -0,0 +1,363 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file tag_and_trait.hpp
+ * Contains tags and traits, e.g., ones describing underlying
+ * data structures.
+ */
+
+#ifndef PB_DS_TAG_AND_TRAIT_HPP
+#define PB_DS_TAG_AND_TRAIT_HPP
+
+#include <ext/pb_ds/detail/type_utils.hpp>
+
+/**
+ * @namespace __gnu_pbds
+ * @brief GNU extensions for policy-based data structures for public use.
+ */
+namespace __gnu_pbds
+{
+ // A trivial iterator tag. Signifies that the iterators has none of
+ // the STL's movement abilities.
+ struct trivial_iterator_tag
+ { };
+
+ // Prohibit moving trivial iterators.
+ typedef void trivial_iterator_difference_type;
+
+
+ // Signifies a basic invalidation guarantee that any iterator,
+ // pointer, or reference to a container object's mapped value type
+ // is valid as long as the container is not modified.
+ struct basic_invalidation_guarantee
+ { };
+
+ // Signifies an invalidation guarantee that includes all those of
+ // its base, and additionally, that any point-type iterator,
+ // pointer, or reference to a container object's mapped value type
+ // is valid as long as its corresponding entry has not be erased,
+ // regardless of modifications to the container object.
+ struct point_invalidation_guarantee : public basic_invalidation_guarantee
+ { };
+
+ // Signifies an invalidation guarantee that includes all those of
+ // its base, and additionally, that any range-type iterator
+ // (including the returns of begin() and end()) is in the correct
+ // relative positions to other range-type iterators as long as its
+ // corresponding entry has not be erased, regardless of
+ // modifications to the container object.
+ struct range_invalidation_guarantee : public point_invalidation_guarantee
+ { };
+
+
+ /// A mapped-policy indicating that an associative container is a set.
+ // XXX should this be a trait of the form is_set<T> ??
+ struct null_mapped_type { };
+
+
+ /// Base data structure tag.
+ struct container_tag
+ { };
+
+ /// Basic string container, inclusive of strings, ropes, etc.
+ struct string_tag : public container_tag { };
+
+ /// Basic sequence.
+ struct sequence_tag : public container_tag { };
+
+ /// Basic associative-container.
+ struct associative_container_tag : public container_tag { };
+
+ /// Basic hash.
+ struct basic_hash_tag : public associative_container_tag { };
+
+ /// Collision-chaining hash.
+ struct cc_hash_tag : public basic_hash_tag { };
+
+ /// General-probing hash.
+ struct gp_hash_tag : public basic_hash_tag { };
+
+ /// Basic tree.
+ struct basic_tree_tag : public associative_container_tag { };
+
+ /// tree.
+ struct tree_tag : public basic_tree_tag { };
+
+ /// Red-black tree.
+ struct rb_tree_tag : public tree_tag { };
+
+ /// Splay tree.
+ struct splay_tree_tag : public tree_tag { };
+
+ /// Ordered-vector tree.
+ struct ov_tree_tag : public tree_tag { };
+
+ /// trie.
+ struct trie_tag : public basic_tree_tag { };
+
+ /// PATRICIA trie.
+ struct pat_trie_tag : public trie_tag { };
+
+ /// List-update.
+ struct list_update_tag : public associative_container_tag { };
+
+ /// Basic priority-queue.
+ struct priority_queue_tag : public container_tag { };
+
+ /// Pairing-heap.
+ struct pairing_heap_tag : public priority_queue_tag { };
+
+ /// Binomial-heap.
+ struct binomial_heap_tag : public priority_queue_tag { };
+
+ /// Redundant-counter binomial-heap.
+ struct rc_binomial_heap_tag : public priority_queue_tag { };
+
+ /// Binary-heap (array-based).
+ struct binary_heap_tag : public priority_queue_tag { };
+
+ /// Thin heap.
+ struct thin_heap_tag : public priority_queue_tag { };
+
+
+ /// Base traits type for containers.
+ template<typename Tag>
+ struct container_traits_base;
+
+ template<>
+ struct container_traits_base<cc_hash_tag>
+ {
+ typedef cc_hash_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<gp_hash_tag>
+ {
+ typedef gp_hash_tag container_category;
+ typedef basic_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<rb_tree_tag>
+ {
+ typedef rb_tree_tag container_category;
+ typedef range_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = true,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = true
+ };
+ };
+
+ template<>
+ struct container_traits_base<splay_tree_tag>
+ {
+ typedef splay_tree_tag container_category;
+ typedef range_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = true,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = true
+ };
+ };
+
+ template<>
+ struct container_traits_base<ov_tree_tag>
+ {
+ typedef ov_tree_tag container_category;
+ typedef basic_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = true,
+ erase_can_throw = true,
+ split_join_can_throw = true,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<pat_trie_tag>
+ {
+ typedef pat_trie_tag container_category;
+ typedef range_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = true,
+ erase_can_throw = false,
+ split_join_can_throw = true,
+ reverse_iteration = true
+ };
+ };
+
+ template<>
+ struct container_traits_base<list_update_tag>
+ {
+ typedef list_update_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+
+ template<>
+ struct container_traits_base<pairing_heap_tag>
+ {
+ typedef pairing_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<thin_heap_tag>
+ {
+ typedef thin_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<binomial_heap_tag>
+ {
+ typedef binomial_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<rc_binomial_heap_tag>
+ {
+ typedef rc_binomial_heap_tag container_category;
+ typedef point_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = false,
+ reverse_iteration = false
+ };
+ };
+
+ template<>
+ struct container_traits_base<binary_heap_tag>
+ {
+ typedef binary_heap_tag container_category;
+ typedef basic_invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = false,
+ erase_can_throw = false,
+ split_join_can_throw = true,
+ reverse_iteration = false
+ };
+ };
+
+
+ /// container_traits
+ // See Matt Austern for the name, S. Meyers MEFC++ #2, others.
+ template<typename Cntnr>
+ struct container_traits
+ : public container_traits_base<typename Cntnr::container_category>
+ {
+ typedef Cntnr container_type;
+ typedef typename Cntnr::container_category container_category;
+ typedef container_traits_base<container_category> base_type;
+ typedef typename base_type::invalidation_guarantee invalidation_guarantee;
+
+ enum
+ {
+ order_preserving = base_type::order_preserving,
+ erase_can_throw = base_type::erase_can_throw,
+ split_join_can_throw = base_type::split_join_can_throw,
+ reverse_iteration = base_type::reverse_iteration
+ };
+ };
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp
new file mode 100644
index 000000000..990860ec0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/tree_policy.hpp
@@ -0,0 +1,162 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file tree_policy.hpp
+ * Contains tree-related policies.
+ */
+
+#ifndef PB_DS_TREE_POLICY_HPP
+#define PB_DS_TREE_POLICY_HPP
+
+#include <iterator>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>
+
+namespace __gnu_pbds
+{
+ // A null node updator, indicating that no node updates are required.
+ template<typename Const_Node_Iterator,
+ typename Node_Iterator,
+ typename Cmp_Fn,
+ typename Allocator>
+ struct null_tree_node_update
+ { };
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Const_Node_Iterator, class Node_Iterator, class Cmp_Fn, class Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ tree_order_statistics_node_update<Const_Node_Iterator, Node_Iterator, Cmp_Fn, Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ detail::basic_tree_policy_base<Const_Node_Iterator, Node_Iterator, Allocator>
+
+ // Functor updating ranks of entrees.
+ template<typename Const_Node_Iterator, typename Node_Iterator,
+ typename Cmp_Fn, typename Allocator>
+ class tree_order_statistics_node_update : private PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef Cmp_Fn cmp_fn;
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::const_key_reference const_key_reference;
+
+ typedef size_type metadata_type;
+ typedef Const_Node_Iterator const_node_iterator;
+ typedef Node_Iterator node_iterator;
+ typedef typename const_node_iterator::value_type const_iterator;
+ typedef typename node_iterator::value_type iterator;
+
+ // Finds an entry by __order. Returns a const_iterator to the
+ // entry with the __order order, or a const_iterator to the
+ // container object's end if order is at least the size of the
+ // container object.
+ inline const_iterator
+ find_by_order(size_type order) const;
+
+ // Finds an entry by __order. Returns an iterator to the entry
+ // with the __order order, or an iterator to the container
+ // object's end if order is at least the size of the container
+ // object.
+ inline iterator
+ find_by_order(size_type order);
+
+ // Returns the order of a key within a sequence. For exapmle, if
+ // r_key is the smallest key, this method will return 0; if r_key
+ // is a key between the smallest and next key, this method will
+ // return 1; if r_key is a key larger than the largest key, this
+ // method will return the size of r_c.
+ inline size_type
+ order_of_key(const_key_reference r_key) const;
+
+ private:
+ // Const reference to the container's value-type.
+ typedef typename base_type::const_reference const_reference;
+
+ // Const pointer to the container's value-type.
+ typedef typename base_type::const_pointer const_pointer;
+
+ typedef typename allocator_type::template rebind<metadata_type>::other metadata_rebind;
+ // Const metadata reference.
+ typedef typename metadata_rebind::const_reference const_metadata_reference;
+
+ // Metadata reference.
+ typedef typename metadata_rebind::reference metadata_reference;
+
+ // Returns the const_node_iterator associated with the tree's root node.
+ virtual const_node_iterator
+ node_begin() const = 0;
+
+ // Returns the node_iterator associated with the tree's root node.
+ virtual node_iterator
+ node_begin() = 0;
+
+ // Returns the const_node_iterator associated with a just-after leaf node.
+ virtual const_node_iterator
+ node_end() const = 0;
+
+ // Returns the node_iterator associated with a just-after leaf node.
+ virtual node_iterator
+ node_end() = 0;
+
+ // Access to the cmp_fn object.
+ virtual cmp_fn&
+ get_cmp_fn() = 0;
+
+ protected:
+ // Updates the rank of a node through a node_iterator node_it;
+ // end_nd_it is the end node iterator.
+ inline void
+ operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
+
+ virtual
+ ~tree_order_statistics_node_update();
+ };
+
+#include <ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
new file mode 100644
index 000000000..c10591bb7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pb_ds/trie_policy.hpp
@@ -0,0 +1,355 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/**
+ * @file trie_policy.hpp
+ * Contains trie-related policies.
+ */
+
+#ifndef PB_DS_TRIE_POLICY_HPP
+#define PB_DS_TRIE_POLICY_HPP
+
+#include <string>
+#include <ext/pb_ds/detail/type_utils.hpp>
+#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>
+
+namespace __gnu_pbds
+{
+ // A null node updator, indicating that no node updates are required.
+ template<typename Const_Node_Iterator,
+ typename Node_Iterator,
+ typename E_Access_Traits,
+ typename Allocator>
+ struct null_trie_node_update
+ { };
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename String, typename String::value_type Min_E_Val, typename String::value_type Max_E_Val, bool Reverse, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ string_trie_e_access_traits<String, Min_E_Val,Max_E_Val,Reverse,Allocator>
+
+ // Element access traits for string types.
+ template<typename String = std::string,
+ typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min,
+ typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max,
+ bool Reverse = false,
+ typename Allocator = std::allocator<char> >
+ struct string_trie_e_access_traits
+ {
+ public:
+ typedef typename Allocator::size_type size_type;
+ typedef String key_type;
+ typedef typename Allocator::template rebind<key_type>::other key_rebind;
+ typedef typename key_rebind::const_reference const_key_reference;
+
+ enum
+ {
+ reverse = Reverse
+ };
+
+ // Element const iterator type.
+ typedef typename detail::__conditional_type<Reverse, typename String::const_reverse_iterator, typename String::const_iterator>::__type const_iterator;
+
+ // Element type.
+ typedef typename std::iterator_traits<const_iterator>::value_type e_type;
+
+ enum
+ {
+ min_e_val = Min_E_Val,
+ max_e_val = Max_E_Val,
+ max_size = max_e_val - min_e_val + 1
+ };
+ PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2);
+
+ // Returns a const_iterator to the first element of
+ // const_key_reference agumnet.
+ inline static const_iterator
+ begin(const_key_reference);
+
+ // Returns a const_iterator to the after-last element of
+ // const_key_reference argument.
+ inline static const_iterator
+ end(const_key_reference);
+
+ // Maps an element to a position.
+ inline static size_type
+ e_pos(e_type e);
+
+ private:
+
+ inline static const_iterator
+ begin_imp(const_key_reference, detail::false_type);
+
+ inline static const_iterator
+ begin_imp(const_key_reference, detail::true_type);
+
+ inline static const_iterator
+ end_imp(const_key_reference, detail::false_type);
+
+ inline static const_iterator
+ end_imp(const_key_reference, detail::true_type);
+
+ static detail::integral_constant<int, Reverse> s_rev_ind;
+ };
+
+#include <ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_T_DEC \
+ template<typename Const_Node_Iterator,typename Node_Iterator,class E_Access_Traits, typename Allocator>
+
+#define PB_DS_CLASS_C_DEC \
+ trie_prefix_search_node_update<Const_Node_Iterator, Node_Iterator, E_Access_Traits,Allocator>
+
+#define PB_DS_BASE_C_DEC \
+ detail::trie_policy_base<Const_Node_Iterator,Node_Iterator,E_Access_Traits, Allocator>
+
+ // A node updator that allows tries to be searched for the range of
+ // values that match a certain prefix.
+ template<typename Const_Node_Iterator,
+ typename Node_Iterator,
+ typename E_Access_Traits,
+ typename Allocator>
+ class trie_prefix_search_node_update : private PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::const_key_reference const_key_reference;
+
+ // Element access traits.
+ typedef E_Access_Traits e_access_traits;
+
+ // Const element iterator.
+ typedef typename e_access_traits::const_iterator const_e_iterator;
+
+ // Allocator type.
+ typedef Allocator allocator_type;
+
+ // Size type.
+ typedef typename allocator_type::size_type size_type;
+ typedef detail::null_node_metadata metadata_type;
+ typedef Const_Node_Iterator const_node_iterator;
+ typedef Node_Iterator node_iterator;
+ typedef typename const_node_iterator::value_type const_iterator;
+ typedef typename node_iterator::value_type iterator;
+
+ // Finds the const iterator range corresponding to all values
+ // whose prefixes match r_key.
+ std::pair<const_iterator, const_iterator>
+ prefix_range(const_key_reference) const;
+
+ // Finds the iterator range corresponding to all values whose
+ // prefixes match r_key.
+ std::pair<iterator, iterator>
+ prefix_range(const_key_reference);
+
+ // Finds the const iterator range corresponding to all values
+ // whose prefixes match [b, e).
+ std::pair<const_iterator, const_iterator>
+ prefix_range(const_e_iterator, const_e_iterator) const;
+
+ // Finds the iterator range corresponding to all values whose
+ // prefixes match [b, e).
+ std::pair<iterator, iterator>
+ prefix_range(const_e_iterator, const_e_iterator);
+
+ protected:
+ // Called to update a node's metadata.
+ inline void
+ operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
+
+ private:
+ // Returns the const iterator associated with the just-after last element.
+ virtual const_iterator
+ end() const = 0;
+
+ // Returns the iterator associated with the just-after last element.
+ virtual iterator
+ end() = 0;
+
+ // Returns the const_node_iterator associated with the trie's root node.
+ virtual const_node_iterator
+ node_begin() const = 0;
+
+ // Returns the node_iterator associated with the trie's root node.
+ virtual node_iterator
+ node_begin() = 0;
+
+ // Returns the const_node_iterator associated with a just-after leaf node.
+ virtual const_node_iterator
+ node_end() const = 0;
+
+ // Returns the node_iterator associated with a just-after leaf node.
+ virtual node_iterator
+ node_end() = 0;
+
+ // Access to the cmp_fn object.
+ virtual const e_access_traits&
+ get_e_access_traits() const = 0;
+
+ node_iterator
+ next_child(node_iterator, const_e_iterator, const_e_iterator,
+ node_iterator, const e_access_traits&);
+ };
+
+#include <ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp>
+
+#undef PB_DS_CLASS_C_DEC
+
+#define PB_DS_CLASS_C_DEC \
+ trie_order_statistics_node_update<Const_Node_Iterator, Node_Iterator,E_Access_Traits, Allocator>
+
+ // Functor updating ranks of entrees.
+ template<typename Const_Node_Iterator,
+ typename Node_Iterator,
+ typename E_Access_Traits,
+ typename Allocator>
+ class trie_order_statistics_node_update : private PB_DS_BASE_C_DEC
+ {
+ private:
+ typedef PB_DS_BASE_C_DEC base_type;
+
+ public:
+ typedef E_Access_Traits e_access_traits;
+ typedef typename e_access_traits::const_iterator const_e_iterator;
+ typedef Allocator allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename base_type::key_type key_type;
+ typedef typename base_type::const_key_reference const_key_reference;
+
+ typedef size_type metadata_type;
+ typedef Const_Node_Iterator const_node_iterator;
+ typedef Node_Iterator node_iterator;
+ typedef typename const_node_iterator::value_type const_iterator;
+ typedef typename node_iterator::value_type iterator;
+
+ // Finds an entry by __order. Returns a const_iterator to the
+ // entry with the __order order, or a const_iterator to the
+ // container object's end if order is at least the size of the
+ // container object.
+ inline const_iterator
+ find_by_order(size_type) const;
+
+ // Finds an entry by __order. Returns an iterator to the entry
+ // with the __order order, or an iterator to the container
+ // object's end if order is at least the size of the container
+ // object.
+ inline iterator
+ find_by_order(size_type);
+
+ // Returns the order of a key within a sequence. For exapmle, if
+ // r_key is the smallest key, this method will return 0; if r_key
+ // is a key between the smallest and next key, this method will
+ // return 1; if r_key is a key larger than the largest key, this
+ // method will return the size of r_c.
+ inline size_type
+ order_of_key(const_key_reference) const;
+
+ // Returns the order of a prefix within a sequence. For exapmle,
+ // if [b, e] is the smallest prefix, this method will return 0; if
+ // r_key is a key between the smallest and next key, this method
+ // will return 1; if r_key is a key larger than the largest key,
+ // this method will return the size of r_c.
+ inline size_type
+ order_of_prefix(const_e_iterator, const_e_iterator) const;
+
+ private:
+ typedef typename base_type::const_reference const_reference;
+ typedef typename base_type::const_pointer const_pointer;
+
+ typedef typename Allocator::template rebind<metadata_type>::other metadata_rebind;
+ typedef typename metadata_rebind::const_reference const_metadata_reference;
+ typedef typename metadata_rebind::reference metadata_reference;
+
+ // Returns true if the container is empty.
+ virtual bool
+ empty() const = 0;
+
+ // Returns the iterator associated with the trie's first element.
+ virtual iterator
+ begin() = 0;
+
+ // Returns the iterator associated with the trie's
+ // just-after-last element.
+ virtual iterator
+ end() = 0;
+
+ // Returns the const_node_iterator associated with the trie's root node.
+ virtual const_node_iterator
+ node_begin() const = 0;
+
+ // Returns the node_iterator associated with the trie's root node.
+ virtual node_iterator
+ node_begin() = 0;
+
+ // Returns the const_node_iterator associated with a just-after
+ // leaf node.
+ virtual const_node_iterator
+ node_end() const = 0;
+
+ // Returns the node_iterator associated with a just-after leaf node.
+ virtual node_iterator
+ node_end() = 0;
+
+ // Access to the cmp_fn object.
+ virtual e_access_traits&
+ get_e_access_traits() = 0;
+
+ protected:
+ // Updates the rank of a node through a node_iterator node_it;
+ // end_nd_it is the end node iterator.
+ inline void
+ operator()(node_iterator, const_node_iterator) const;
+
+ // Destructor.
+ virtual
+ ~trie_order_statistics_node_update();
+ };
+
+#include <ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp>
+
+#undef PB_DS_CLASS_T_DEC
+#undef PB_DS_CLASS_C_DEC
+#undef PB_DS_BASE_C_DEC
+
+} // namespace __gnu_pbds
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pod_char_traits.h b/gcc-4.4.0/libstdc++-v3/include/ext/pod_char_traits.h
new file mode 100644
index 000000000..2797c1bf2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pod_char_traits.h
@@ -0,0 +1,182 @@
+// POD character, std::char_traits specialization -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/pod_char_traits.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+// Gabriel Dos Reis <gdr@integrable-solutions.net>
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#ifndef _POD_CHAR_TRAITS_H
+#define _POD_CHAR_TRAITS_H 1
+
+#include <string>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // POD character abstraction.
+ // NB: The char_type parameter is a subset of int_type, as to allow
+ // int_type to properly hold the full range of char_type values as
+ // well as EOF.
+ /// @brief A POD class that serves as a character abstraction class.
+ template<typename V, typename I, typename S = std::mbstate_t>
+ struct character
+ {
+ typedef V value_type;
+ typedef I int_type;
+ typedef S state_type;
+ typedef character<V, I, S> char_type;
+
+ value_type value;
+
+ template<typename V2>
+ static char_type
+ from(const V2& v)
+ {
+ char_type ret = { static_cast<value_type>(v) };
+ return ret;
+ }
+
+ template<typename V2>
+ static V2
+ to(const char_type& c)
+ {
+ V2 ret = { static_cast<V2>(c.value) };
+ return ret;
+ }
+
+ };
+
+ template<typename V, typename I, typename S>
+ inline bool
+ operator==(const character<V, I, S>& lhs, const character<V, I, S>& rhs)
+ { return lhs.value == rhs.value; }
+
+ template<typename V, typename I, typename S>
+ inline bool
+ operator<(const character<V, I, S>& lhs, const character<V, I, S>& rhs)
+ { return lhs.value < rhs.value; }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /// char_traits<__gnu_cxx::character> specialization.
+ template<typename V, typename I, typename S>
+ struct char_traits<__gnu_cxx::character<V, I, S> >
+ {
+ typedef __gnu_cxx::character<V, I, S> char_type;
+ typedef typename char_type::int_type int_type;
+ typedef typename char_type::state_type state_type;
+ typedef fpos<state_type> pos_type;
+ typedef streamoff off_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return lt(__s1[__i], __s2[__i]) ? -1 : 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ const char_type* __p = __s;
+ while (__p->value)
+ ++__p;
+ return (__p - __s);
+ }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ {
+ for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
+ if (*__p == __a)
+ return __p;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ return static_cast<char_type*>
+ (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)));
+ }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ std::copy(__s2, __s2 + __n, __s1);
+ return __s1;
+ }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ {
+ std::fill_n(__s, __n, __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type& __i)
+ { return char_type::template from(__i); }
+
+ static int_type
+ to_int_type(const char_type& __c)
+ { return char_type::template to<int_type>(__c); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof()
+ {
+ int_type __r = { -1 };
+ return __r;
+ }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? int_type() : __c; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pointer.h b/gcc-4.4.0/libstdc++-v3/include/ext/pointer.h
new file mode 100644
index 000000000..5aac7f178
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pointer.h
@@ -0,0 +1,551 @@
+// Custom pointer adapter and sample storage policies
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file ext/pointer.h
+ * @author Bob Walters
+ *
+ * Provides reusable _Pointer_adapter for assisting in the development of
+ * custom pointer types that can be used with the standard containers via
+ * the allocator::pointer and allocator::const_pointer typedefs.
+ */
+
+#ifndef _POINTER_H
+#define _POINTER_H 1
+
+#include <iosfwd>
+#include <bits/stl_iterator_base_types.h>
+#include <ext/cast.h>
+#include <ext/type_traits.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /**
+ * @brief A storage policy for use with _Pointer_adapter<> which yields a
+ * standard pointer.
+ *
+ * A _Storage_policy is required to provide 4 things:
+ * 1) A get() API for returning the stored pointer value.
+ * 2) An set() API for storing a pointer value.
+ * 3) An element_type typedef to define the type this points to.
+ * 4) An operator<() to support pointer comparison.
+ * 5) An operator==() to support pointer comparison.
+ */
+ template<typename _Tp>
+ class _Std_pointer_impl
+ {
+ public:
+ // the type this pointer points to.
+ typedef _Tp element_type;
+
+ // A method to fetch the pointer value as a standard T* value;
+ inline _Tp*
+ get() const
+ { return _M_value; }
+
+ // A method to set the pointer value, from a standard T* value;
+ inline void
+ set(element_type* __arg)
+ { _M_value = __arg; }
+
+ // Comparison of pointers
+ inline bool
+ operator<(const _Std_pointer_impl& __rarg) const
+ { return (_M_value < __rarg._M_value); }
+
+ inline bool
+ operator==(const _Std_pointer_impl& __rarg) const
+ { return (_M_value == __rarg._M_value); }
+
+ private:
+ element_type* _M_value;
+ };
+
+ /**
+ * @brief A storage policy for use with _Pointer_adapter<> which stores
+ * the pointer's address as an offset value which is relative to
+ * its own address.
+ *
+ * This is intended for pointers
+ * within shared memory regions which might be mapped at different
+ * addresses by different processes. For null pointers, a value of 1 is
+ * used. (0 is legitimate sometimes for nodes in circularly linked lists)
+ * This value was chosen as the least likely to generate an incorrect null,
+ * As there is no reason why any normal pointer would point 1 byte into
+ * its own pointer address.
+ */
+ template<typename _Tp>
+ class _Relative_pointer_impl
+ {
+ public:
+ typedef _Tp element_type;
+
+ _Tp*
+ get() const
+ {
+ if (_M_diff == 1)
+ return 0;
+ else
+ return reinterpret_cast<_Tp*>(reinterpret_cast<_UIntPtrType>(this)
+ + _M_diff);
+ }
+
+ void
+ set(_Tp* __arg)
+ {
+ if (!__arg)
+ _M_diff = 1;
+ else
+ _M_diff = reinterpret_cast<_UIntPtrType>(__arg)
+ - reinterpret_cast<_UIntPtrType>(this);
+ }
+
+ // Comparison of pointers
+ inline bool
+ operator<(const _Relative_pointer_impl& __rarg) const
+ { return (reinterpret_cast<_UIntPtrType>(this->get())
+ < reinterpret_cast<_UIntPtrType>(__rarg.get())); }
+
+ inline bool
+ operator==(const _Relative_pointer_impl& __rarg) const
+ { return (reinterpret_cast<_UIntPtrType>(this->get())
+ == reinterpret_cast<_UIntPtrType>(__rarg.get())); }
+
+ private:
+ typedef __gnu_cxx::__conditional_type<
+ (sizeof(unsigned long) >= sizeof(void*)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+ _UIntPtrType _M_diff;
+ };
+
+ /**
+ * Relative_pointer_impl needs a specialization for const T because of
+ * the casting done during pointer arithmetic.
+ */
+ template<typename _Tp>
+ class _Relative_pointer_impl<const _Tp>
+ {
+ public:
+ typedef const _Tp element_type;
+
+ const _Tp*
+ get() const
+ {
+ if (_M_diff == 1)
+ return 0;
+ else
+ return reinterpret_cast<const _Tp*>
+ (reinterpret_cast<_UIntPtrType>(this) + _M_diff);
+ }
+
+ void
+ set(const _Tp* __arg)
+ {
+ if (!__arg)
+ _M_diff = 1;
+ else
+ _M_diff = reinterpret_cast<_UIntPtrType>(__arg)
+ - reinterpret_cast<_UIntPtrType>(this);
+ }
+
+ // Comparison of pointers
+ inline bool
+ operator<(const _Relative_pointer_impl& __rarg) const
+ { return (reinterpret_cast<_UIntPtrType>(this->get())
+ < reinterpret_cast<_UIntPtrType>(__rarg.get())); }
+
+ inline bool
+ operator==(const _Relative_pointer_impl& __rarg) const
+ { return (reinterpret_cast<_UIntPtrType>(this->get())
+ == reinterpret_cast<_UIntPtrType>(__rarg.get())); }
+
+ private:
+ typedef __gnu_cxx::__conditional_type
+ <(sizeof(unsigned long) >= sizeof(void*)),
+ unsigned long, unsigned long long>::__type _UIntPtrType;
+ _UIntPtrType _M_diff;
+ };
+
+ /**
+ * The specialization on this type helps resolve the problem of
+ * reference to void, and eliminates the need to specialize _Pointer_adapter
+ * for cases of void*, const void*, and so on.
+ */
+ struct _Invalid_type { };
+
+ template<typename _Tp>
+ struct _Reference_type
+ { typedef _Tp& reference; };
+
+ template<>
+ struct _Reference_type<void>
+ { typedef _Invalid_type& reference; };
+
+ template<>
+ struct _Reference_type<const void>
+ { typedef const _Invalid_type& reference; };
+
+ template<>
+ struct _Reference_type<volatile void>
+ { typedef volatile _Invalid_type& reference; };
+
+ template<>
+ struct _Reference_type<volatile const void>
+ { typedef const volatile _Invalid_type& reference; };
+
+ /**
+ * This structure accomodates the way in which std::iterator_traits<>
+ * is normally specialized for const T*, so that value_type is still T.
+ */
+ template<typename _Tp>
+ struct _Unqualified_type
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct _Unqualified_type<const _Tp>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct _Unqualified_type<volatile _Tp>
+ { typedef volatile _Tp type; };
+
+ template<typename _Tp>
+ struct _Unqualified_type<volatile const _Tp>
+ { typedef volatile _Tp type; };
+
+ /**
+ * The following provides an 'alternative pointer' that works with the
+ * containers when specified as the pointer typedef of the allocator.
+ *
+ * The pointer type used with the containers doesn't have to be this class,
+ * but it must support the implicit conversions, pointer arithmetic,
+ * comparison operators, etc. that are supported by this class, and avoid
+ * raising compile-time ambiguities. Because creating a working pointer can
+ * be challenging, this pointer template was designed to wrapper an
+ * easier storage policy type, so that it becomes reusable for creating
+ * other pointer types.
+ *
+ * A key point of this class is also that it allows container writers to
+ * 'assume' Alocator::pointer is a typedef for a normal pointer. This class
+ * supports most of the conventions of a true pointer, and can, for instance
+ * handle implicit conversion to const and base class pointer types. The
+ * only impositions on container writers to support extended pointers are:
+ * 1) use the Allocator::pointer typedef appropriately for pointer types.
+ * 2) if you need pointer casting, use the __pointer_cast<> functions
+ * from ext/cast.h. This allows pointer cast operations to be overloaded
+ * is necessary by custom pointers.
+ *
+ * Note: The const qualifier works with this pointer adapter as follows:
+ *
+ * _Tp* == _Pointer_adapter<_Std_pointer_impl<_Tp> >;
+ * const _Tp* == _Pointer_adapter<_Std_pointer_impl<const _Tp> >;
+ * _Tp* const == const _Pointer_adapter<_Std_pointer_impl<_Tp> >;
+ * const _Tp* const == const _Pointer_adapter<_Std_pointer_impl<const _Tp> >;
+ */
+ template<typename _Storage_policy>
+ class _Pointer_adapter : public _Storage_policy
+ {
+ public:
+ typedef typename _Storage_policy::element_type element_type;
+
+ // These are needed for iterator_traits
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef typename _Unqualified_type<element_type>::type value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef _Pointer_adapter pointer;
+ typedef typename _Reference_type<element_type>::reference reference;
+
+ // Reminder: 'const' methods mean that the method is valid when the
+ // pointer is immutable, and has nothing to do with whether the
+ // 'pointee' is const.
+
+ // Default Constructor (Convert from element_type*)
+ _Pointer_adapter(element_type* __arg = 0)
+ { _Storage_policy::set(__arg); }
+
+ // Copy constructor from _Pointer_adapter of same type.
+ _Pointer_adapter(const _Pointer_adapter& __arg)
+ { _Storage_policy::set(__arg.get()); }
+
+ // Convert from _Up* if conversion to element_type* is valid.
+ template<typename _Up>
+ _Pointer_adapter(_Up* __arg)
+ { _Storage_policy::set(__arg); }
+
+ // Conversion from another _Pointer_adapter if _Up if static cast is
+ // valid.
+ template<typename _Up>
+ _Pointer_adapter(const _Pointer_adapter<_Up>& __arg)
+ { _Storage_policy::set(__arg.get()); }
+
+ // Destructor
+ ~_Pointer_adapter() { }
+
+ // Assignment operator
+ _Pointer_adapter&
+ operator=(const _Pointer_adapter& __arg)
+ {
+ _Storage_policy::set(__arg.get());
+ return *this;
+ }
+
+ template<typename _Up>
+ _Pointer_adapter&
+ operator=(const _Pointer_adapter<_Up>& __arg)
+ {
+ _Storage_policy::set(__arg.get());
+ return *this;
+ }
+
+ template<typename _Up>
+ _Pointer_adapter&
+ operator=(_Up* __arg)
+ {
+ _Storage_policy::set(__arg);
+ return *this;
+ }
+
+ // Operator*, returns element_type&
+ inline reference
+ operator*() const
+ { return *(_Storage_policy::get()); }
+
+ // Operator->, returns element_type*
+ inline element_type*
+ operator->() const
+ { return _Storage_policy::get(); }
+
+ // Operator[], returns a element_type& to the item at that loc.
+ inline reference
+ operator[](std::ptrdiff_t __index) const
+ { return _Storage_policy::get()[__index]; }
+
+ // To allow implicit conversion to "bool", for "if (ptr)..."
+ private:
+ typedef element_type*(_Pointer_adapter::*__unspecified_bool_type)() const;
+
+ public:
+ operator __unspecified_bool_type() const
+ {
+ return _Storage_policy::get() == 0 ? 0 :
+ &_Pointer_adapter::operator->;
+ }
+
+ // ! operator (for: if (!ptr)...)
+ inline bool
+ operator!() const
+ { return (_Storage_policy::get() == 0); }
+
+ // Pointer differences
+ inline friend std::ptrdiff_t
+ operator-(const _Pointer_adapter& __lhs, element_type* __rhs)
+ { return (__lhs.get() - __rhs); }
+
+ inline friend std::ptrdiff_t
+ operator-(element_type* __lhs, const _Pointer_adapter& __rhs)
+ { return (__lhs - __rhs.get()); }
+
+ template<typename _Up>
+ inline friend std::ptrdiff_t
+ operator-(const _Pointer_adapter& __lhs, _Up* __rhs)
+ { return (__lhs.get() - __rhs); }
+
+ template<typename _Up>
+ inline friend std::ptrdiff_t
+ operator-(_Up* __lhs, const _Pointer_adapter& __rhs)
+ { return (__lhs - __rhs.get()); }
+
+ template<typename _Up>
+ inline std::ptrdiff_t
+ operator-(const _Pointer_adapter<_Up>& __rhs) const
+ { return (_Storage_policy::get() - __rhs.get()); }
+
+ // Pointer math
+ // Note: There is a reason for all this overloading based on different
+ // integer types. In some libstdc++-v3 test cases, a templated
+ // operator+ is declared which can match any types. This operator
+ // tends to "steal" the recognition of _Pointer_adapter's own operator+
+ // unless the integer type matches perfectly.
+
+#define _CXX_POINTER_ARITH_OPERATOR_SET(INT_TYPE) \
+ inline friend _Pointer_adapter \
+ operator+(const _Pointer_adapter& __lhs, INT_TYPE __offset) \
+ { return _Pointer_adapter(__lhs.get() + __offset); } \
+\
+ inline friend _Pointer_adapter \
+ operator+(INT_TYPE __offset, const _Pointer_adapter& __rhs) \
+ { return _Pointer_adapter(__rhs.get() + __offset); } \
+\
+ inline friend _Pointer_adapter \
+ operator-(const _Pointer_adapter& __lhs, INT_TYPE __offset) \
+ { return _Pointer_adapter(__lhs.get() - __offset); } \
+\
+ inline _Pointer_adapter& \
+ operator+=(INT_TYPE __offset) \
+ { \
+ _Storage_policy::set(_Storage_policy::get() + __offset); \
+ return *this; \
+ } \
+\
+ inline _Pointer_adapter& \
+ operator-=(INT_TYPE __offset) \
+ { \
+ _Storage_policy::set(_Storage_policy::get() - __offset); \
+ return *this; \
+ } \
+// END of _CXX_POINTER_ARITH_OPERATOR_SET macro
+
+ // Expand into the various pointer arithmatic operators needed.
+ _CXX_POINTER_ARITH_OPERATOR_SET(short);
+ _CXX_POINTER_ARITH_OPERATOR_SET(unsigned short);
+ _CXX_POINTER_ARITH_OPERATOR_SET(int);
+ _CXX_POINTER_ARITH_OPERATOR_SET(unsigned int);
+ _CXX_POINTER_ARITH_OPERATOR_SET(long);
+ _CXX_POINTER_ARITH_OPERATOR_SET(unsigned long);
+
+ // Mathematical Manipulators
+ inline _Pointer_adapter&
+ operator++()
+ {
+ _Storage_policy::set(_Storage_policy::get() + 1);
+ return *this;
+ }
+
+ inline _Pointer_adapter
+ operator++(int __unused)
+ {
+ _Pointer_adapter tmp(*this);
+ _Storage_policy::set(_Storage_policy::get() + 1);
+ return tmp;
+ }
+
+ inline _Pointer_adapter&
+ operator--()
+ {
+ _Storage_policy::set(_Storage_policy::get() - 1);
+ return *this;
+ }
+
+ inline _Pointer_adapter
+ operator--(int)
+ {
+ _Pointer_adapter tmp(*this);
+ _Storage_policy::set(_Storage_policy::get() - 1);
+ return tmp;
+ }
+
+ }; // class _Pointer_adapter
+
+
+#define _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(OPERATOR,BLANK) \
+ template<typename _Tp1, typename _Tp2> \
+ inline bool \
+ operator OPERATOR##BLANK (const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \
+ { return __lhs.get() OPERATOR##BLANK __rhs; } \
+\
+ template<typename _Tp1, typename _Tp2> \
+ inline bool \
+ operator OPERATOR##BLANK (_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \
+ { return __lhs OPERATOR##BLANK __rhs.get(); } \
+\
+ template<typename _Tp1, typename _Tp2> \
+ inline bool \
+ operator OPERATOR##BLANK (const _Pointer_adapter<_Tp1>& __lhs, \
+ const _Pointer_adapter<_Tp2>& __rhs) \
+ { return __lhs.get() OPERATOR##BLANK __rhs.get(); } \
+\
+// End GCC_CXX_POINTER_COMPARISON_OPERATION_SET Macro
+
+ // Expand into the various comparison operators needed.
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(==,);
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(!=,);
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<,);
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<=,);
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>,);
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>=,);
+
+ // These are here for expressions like "ptr == 0", "ptr != 0"
+ template<typename _Tp>
+ inline bool
+ operator==(const _Pointer_adapter<_Tp>& __lhs, int __rhs)
+ { return __lhs.get() == reinterpret_cast<void*>(__rhs); }
+
+ template<typename _Tp>
+ inline bool
+ operator==(int __lhs, const _Pointer_adapter<_Tp>& __rhs)
+ { return __rhs.get() == reinterpret_cast<void*>(__lhs); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const _Pointer_adapter<_Tp>& __lhs, int __rhs)
+ { return __lhs.get() != reinterpret_cast<void*>(__rhs); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(int __lhs, const _Pointer_adapter<_Tp>& __rhs)
+ { return __rhs.get() != reinterpret_cast<void*>(__lhs); }
+
+ /**
+ * Comparison operators for _Pointer_adapter defer to the base class'es
+ * comparison operators, when possible.
+ */
+ template<typename _Tp>
+ inline bool
+ operator==(const _Pointer_adapter<_Tp>& __lhs,
+ const _Pointer_adapter<_Tp>& __rhs)
+ { return __lhs._Tp::operator==(__rhs); }
+
+ template<typename _Tp>
+ inline bool
+ operator<=(const _Pointer_adapter<_Tp>& __lhs,
+ const _Pointer_adapter<_Tp>& __rhs)
+ { return __lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const _Pointer_adapter<_Tp>& __lhs,
+ const _Pointer_adapter<_Tp>& __rhs)
+ { return !(__lhs._Tp::operator==(__rhs)); }
+
+ template<typename _Tp>
+ inline bool
+ operator>(const _Pointer_adapter<_Tp>& __lhs,
+ const _Pointer_adapter<_Tp>& __rhs)
+ { return !(__lhs._Tp::operator<(__rhs) || __lhs._Tp::operator==(__rhs)); }
+
+ template<typename _Tp>
+ inline bool
+ operator>=(const _Pointer_adapter<_Tp>& __lhs,
+ const _Pointer_adapter<_Tp>& __rhs)
+ { return !(__lhs._Tp::operator<(__rhs)); }
+
+ template<typename _CharT, typename _Traits, typename _StoreT>
+ inline std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const _Pointer_adapter<_StoreT>& __p)
+ { return (__os << __p.get()); }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _POINTER_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/pool_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/pool_allocator.h
new file mode 100644
index 000000000..87d145d71
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/pool_allocator.h
@@ -0,0 +1,263 @@
+// Allocators -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1996-1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/pool_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _POOL_ALLOCATOR_H
+#define _POOL_ALLOCATOR_H 1
+
+#include <bits/c++config.h>
+#include <cstdlib>
+#include <new>
+#include <bits/functexcept.h>
+#include <ext/atomicity.h>
+#include <ext/concurrence.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+
+ /**
+ * @brief Base class for __pool_alloc.
+ *
+ * Uses various allocators to fulfill underlying requests (and makes as
+ * few requests as possible when in default high-speed pool mode).
+ *
+ * Important implementation properties:
+ * 0. If globally mandated, then allocate objects from new
+ * 1. If the clients request an object of size > _S_max_bytes, the resulting
+ * object will be obtained directly from new
+ * 2. In all other cases, we allocate an object of size exactly
+ * _S_round_up(requested_size). Thus the client has enough size
+ * information that we can return the object to the proper free list
+ * without permanently losing part of the object.
+ */
+ class __pool_alloc_base
+ {
+ protected:
+
+ enum { _S_align = 8 };
+ enum { _S_max_bytes = 128 };
+ enum { _S_free_list_size = (size_t)_S_max_bytes / (size_t)_S_align };
+
+ union _Obj
+ {
+ union _Obj* _M_free_list_link;
+ char _M_client_data[1]; // The client sees this.
+ };
+
+ static _Obj* volatile _S_free_list[_S_free_list_size];
+
+ // Chunk allocation state.
+ static char* _S_start_free;
+ static char* _S_end_free;
+ static size_t _S_heap_size;
+
+ size_t
+ _M_round_up(size_t __bytes)
+ { return ((__bytes + (size_t)_S_align - 1) & ~((size_t)_S_align - 1)); }
+
+ _Obj* volatile*
+ _M_get_free_list(size_t __bytes);
+
+ __mutex&
+ _M_get_mutex();
+
+ // Returns an object of size __n, and optionally adds to size __n
+ // free list.
+ void*
+ _M_refill(size_t __n);
+
+ // Allocates a chunk for nobjs of size size. nobjs may be reduced
+ // if it is inconvenient to allocate the requested number.
+ char*
+ _M_allocate_chunk(size_t __n, int& __nobjs);
+ };
+
+
+ /**
+ * @brief Allocator using a memory pool with a single lock.
+ * @ingroup allocators
+ */
+ template<typename _Tp>
+ class __pool_alloc : private __pool_alloc_base
+ {
+ private:
+ static _Atomic_word _S_force_new;
+
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template<typename _Tp1>
+ struct rebind
+ { typedef __pool_alloc<_Tp1> other; };
+
+ __pool_alloc() throw() { }
+
+ __pool_alloc(const __pool_alloc&) throw() { }
+
+ template<typename _Tp1>
+ __pool_alloc(const __pool_alloc<_Tp1>&) throw() { }
+
+ ~__pool_alloc() throw() { }
+
+ pointer
+ address(reference __x) const { return &__x; }
+
+ const_pointer
+ address(const_reference __x) const { return &__x; }
+
+ size_type
+ max_size() const throw()
+ { return size_t(-1) / sizeof(_Tp); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 402. wrong new expression in [some_] allocator::construct
+ void
+ construct(pointer __p, const _Tp& __val)
+ { ::new((void *)__p) _Tp(__val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
+#endif
+
+ void
+ destroy(pointer __p) { __p->~_Tp(); }
+
+ pointer
+ allocate(size_type __n, const void* = 0);
+
+ void
+ deallocate(pointer __p, size_type __n);
+ };
+
+ template<typename _Tp>
+ inline bool
+ operator==(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&)
+ { return true; }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&)
+ { return false; }
+
+ template<typename _Tp>
+ _Atomic_word
+ __pool_alloc<_Tp>::_S_force_new;
+
+ template<typename _Tp>
+ _Tp*
+ __pool_alloc<_Tp>::allocate(size_type __n, const void*)
+ {
+ pointer __ret = 0;
+ if (__builtin_expect(__n != 0, true))
+ {
+ if (__builtin_expect(__n > this->max_size(), false))
+ std::__throw_bad_alloc();
+
+ // If there is a race through here, assume answer from getenv
+ // will resolve in same direction. Inspired by techniques
+ // to efficiently support threading found in basic_string.h.
+ if (_S_force_new == 0)
+ {
+ if (std::getenv("GLIBCXX_FORCE_NEW"))
+ __atomic_add_dispatch(&_S_force_new, 1);
+ else
+ __atomic_add_dispatch(&_S_force_new, -1);
+ }
+
+ const size_t __bytes = __n * sizeof(_Tp);
+ if (__bytes > size_t(_S_max_bytes) || _S_force_new > 0)
+ __ret = static_cast<_Tp*>(::operator new(__bytes));
+ else
+ {
+ _Obj* volatile* __free_list = _M_get_free_list(__bytes);
+
+ __scoped_lock sentry(_M_get_mutex());
+ _Obj* __restrict__ __result = *__free_list;
+ if (__builtin_expect(__result == 0, 0))
+ __ret = static_cast<_Tp*>(_M_refill(_M_round_up(__bytes)));
+ else
+ {
+ *__free_list = __result->_M_free_list_link;
+ __ret = reinterpret_cast<_Tp*>(__result);
+ }
+ if (__builtin_expect(__ret == 0, 0))
+ std::__throw_bad_alloc();
+ }
+ }
+ return __ret;
+ }
+
+ template<typename _Tp>
+ void
+ __pool_alloc<_Tp>::deallocate(pointer __p, size_type __n)
+ {
+ if (__builtin_expect(__n != 0 && __p != 0, true))
+ {
+ const size_t __bytes = __n * sizeof(_Tp);
+ if (__bytes > static_cast<size_t>(_S_max_bytes) || _S_force_new > 0)
+ ::operator delete(__p);
+ else
+ {
+ _Obj* volatile* __free_list = _M_get_free_list(__bytes);
+ _Obj* __q = reinterpret_cast<_Obj*>(__p);
+
+ __scoped_lock sentry(_M_get_mutex());
+ __q ->_M_free_list_link = *__free_list;
+ *__free_list = __q;
+ }
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/rb_tree b/gcc-4.4.0/libstdc++-v3/include/ext/rb_tree
new file mode 100644
index 000000000..185d02efe
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/rb_tree
@@ -0,0 +1,93 @@
+// rb_tree extension -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/rb_tree
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _RB_TREE
+#define _RB_TREE 1
+
+#pragma GCC system_header
+
+#include <bits/stl_tree.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::_Rb_tree;
+ using std::allocator;
+
+ // Class rb_tree is not part of the C++ standard. It is provided for
+ // compatibility with the HP STL.
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template <class _Key, class _Value, class _KeyOfValue, class _Compare,
+ class _Alloc = allocator<_Value> >
+ struct rb_tree
+ : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
+ {
+ typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;
+ typedef typename _Base::allocator_type allocator_type;
+
+ rb_tree(const _Compare& __comp = _Compare(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__comp, __a) { }
+
+ ~rb_tree() { }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/rc_string_base.h b/gcc-4.4.0/libstdc++-v3/include/ext/rc_string_base.h
new file mode 100644
index 000000000..dce5e0671
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/rc_string_base.h
@@ -0,0 +1,718 @@
+// Reference-counted versatile string base -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/rc_string_base.h
+ * This file is a GNU extension to the Standard C++ Library.
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _RC_STRING_BASE_H
+#define _RC_STRING_BASE_H 1
+
+#include <ext/atomicity.h>
+#include <bits/stl_iterator_base_funcs.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /**
+ * Documentation? What's that?
+ * Nathan Myers <ncm@cantrip.org>.
+ *
+ * A string looks like this:
+ *
+ * @code
+ * [_Rep]
+ * _M_length
+ * [__rc_string_base<char_type>] _M_capacity
+ * _M_dataplus _M_refcount
+ * _M_p ----------------> unnamed array of char_type
+ * @endcode
+ *
+ * Where the _M_p points to the first character in the string, and
+ * you cast it to a pointer-to-_Rep and subtract 1 to get a
+ * pointer to the header.
+ *
+ * This approach has the enormous advantage that a string object
+ * requires only one allocation. All the ugliness is confined
+ * within a single pair of inline functions, which each compile to
+ * a single "add" instruction: _Rep::_M_refdata(), and
+ * __rc_string_base::_M_rep(); and the allocation function which gets a
+ * block of raw bytes and with room enough and constructs a _Rep
+ * object at the front.
+ *
+ * The reason you want _M_data pointing to the character array and
+ * not the _Rep is so that the debugger can see the string
+ * contents. (Probably we should add a non-inline member to get
+ * the _Rep for the debugger to use, so users can check the actual
+ * string length.)
+ *
+ * Note that the _Rep object is a POD so that you can have a
+ * static "empty string" _Rep object already "constructed" before
+ * static constructors have run. The reference-count encoding is
+ * chosen so that a 0 indicates one reference, so you never try to
+ * destroy the empty-string _Rep object.
+ *
+ * All but the last paragraph is considered pretty conventional
+ * for a C++ string implementation.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __rc_string_base
+ : protected __vstring_utility<_CharT, _Traits, _Alloc>
+ {
+ public:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef _Alloc allocator_type;
+
+ typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
+ typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+
+ private:
+ // _Rep: string representation
+ // Invariants:
+ // 1. String really contains _M_length + 1 characters: due to 21.3.4
+ // must be kept null-terminated.
+ // 2. _M_capacity >= _M_length
+ // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT).
+ // 3. _M_refcount has three states:
+ // -1: leaked, one reference, no ref-copies allowed, non-const.
+ // 0: one reference, non-const.
+ // n>0: n + 1 references, operations require a lock, const.
+ // 4. All fields == 0 is an empty string, given the extra storage
+ // beyond-the-end for a null terminator; thus, the shared
+ // empty string representation needs no constructor.
+ struct _Rep
+ {
+ union
+ {
+ struct
+ {
+ size_type _M_length;
+ size_type _M_capacity;
+ _Atomic_word _M_refcount;
+ } _M_info;
+
+ // Only for alignment purposes.
+ _CharT _M_align;
+ };
+
+ typedef typename _Alloc::template rebind<_Rep>::other _Rep_alloc_type;
+
+ _CharT*
+ _M_refdata() throw()
+ { return reinterpret_cast<_CharT*>(this + 1); }
+
+ _CharT*
+ _M_refcopy() throw()
+ {
+ __atomic_add_dispatch(&_M_info._M_refcount, 1);
+ return _M_refdata();
+ } // XXX MT
+
+ void
+ _M_set_length(size_type __n)
+ {
+ _M_info._M_refcount = 0; // One reference.
+ _M_info._M_length = __n;
+ // grrr. (per 21.3.4)
+ // You cannot leave those LWG people alone for a second.
+ traits_type::assign(_M_refdata()[__n], _CharT());
+ }
+
+ // Create & Destroy
+ static _Rep*
+ _S_create(size_type, size_type, const _Alloc&);
+
+ void
+ _M_destroy(const _Alloc&) throw();
+
+ _CharT*
+ _M_clone(const _Alloc&, size_type __res = 0);
+ };
+
+ struct _Rep_empty
+ : public _Rep
+ {
+ _CharT _M_terminal;
+ };
+
+ static _Rep_empty _S_empty_rep;
+
+ // The maximum number of individual char_type elements of an
+ // individual string is determined by _S_max_size. This is the
+ // value that will be returned by max_size(). (Whereas npos
+ // is the maximum number of bytes the allocator can allocate.)
+ // If one was to divvy up the theoretical largest size string,
+ // with a terminating character and m _CharT elements, it'd
+ // look like this:
+ // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)
+ // + sizeof(_Rep) - 1
+ // (NB: last two terms for rounding reasons, see _M_create below)
+ // Solving for m:
+ // m = ((npos - 2 * sizeof(_Rep) + 1) / sizeof(_CharT)) - 1
+ // In addition, this implementation halves this amount.
+ enum { _S_max_size = (((static_cast<size_type>(-1) - 2 * sizeof(_Rep)
+ + 1) / sizeof(_CharT)) - 1) / 2 };
+
+ // Data Member (private):
+ mutable typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus;
+
+ void
+ _M_data(_CharT* __p)
+ { _M_dataplus._M_p = __p; }
+
+ _Rep*
+ _M_rep() const
+ { return &((reinterpret_cast<_Rep*>(_M_data()))[-1]); }
+
+ _CharT*
+ _M_grab(const _Alloc& __alloc) const
+ {
+ return (!_M_is_leaked() && _M_get_allocator() == __alloc)
+ ? _M_rep()->_M_refcopy() : _M_rep()->_M_clone(__alloc);
+ }
+
+ void
+ _M_dispose()
+ {
+ if (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount,
+ -1) <= 0)
+ _M_rep()->_M_destroy(_M_get_allocator());
+ } // XXX MT
+
+ bool
+ _M_is_leaked() const
+ { return _M_rep()->_M_info._M_refcount < 0; }
+
+ void
+ _M_set_sharable()
+ { _M_rep()->_M_info._M_refcount = 0; }
+
+ void
+ _M_leak_hard();
+
+ // _S_construct_aux is used to implement the 21.3.1 para 15 which
+ // requires special behaviour if _InIterator is an integral type
+ template<typename _InIterator>
+ static _CharT*
+ _S_construct_aux(_InIterator __beg, _InIterator __end,
+ const _Alloc& __a, std::__false_type)
+ {
+ typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
+ return _S_construct(__beg, __end, __a, _Tag());
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ static _CharT*
+ _S_construct_aux(_Integer __beg, _Integer __end,
+ const _Alloc& __a, std::__true_type)
+ { return _S_construct(static_cast<size_type>(__beg), __end, __a); }
+
+ template<typename _InIterator>
+ static _CharT*
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)
+ {
+ typedef typename std::__is_integer<_InIterator>::__type _Integral;
+ return _S_construct_aux(__beg, __end, __a, _Integral());
+ }
+
+ // For Input Iterators, used in istreambuf_iterators, etc.
+ template<typename _InIterator>
+ static _CharT*
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
+ std::input_iterator_tag);
+
+ // For forward_iterators up to random_access_iterators, used for
+ // string::iterator, _CharT*, etc.
+ template<typename _FwdIterator>
+ static _CharT*
+ _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a,
+ std::forward_iterator_tag);
+
+ static _CharT*
+ _S_construct(size_type __req, _CharT __c, const _Alloc& __a);
+
+ public:
+ size_type
+ _M_max_size() const
+ { return size_type(_S_max_size); }
+
+ _CharT*
+ _M_data() const
+ { return _M_dataplus._M_p; }
+
+ size_type
+ _M_length() const
+ { return _M_rep()->_M_info._M_length; }
+
+ size_type
+ _M_capacity() const
+ { return _M_rep()->_M_info._M_capacity; }
+
+ bool
+ _M_is_shared() const
+ { return _M_rep()->_M_info._M_refcount > 0; }
+
+ void
+ _M_set_leaked()
+ { _M_rep()->_M_info._M_refcount = -1; }
+
+ void
+ _M_leak() // for use in begin() & non-const op[]
+ {
+ if (!_M_is_leaked())
+ _M_leak_hard();
+ }
+
+ void
+ _M_set_length(size_type __n)
+ { _M_rep()->_M_set_length(__n); }
+
+ __rc_string_base()
+ : _M_dataplus(_S_empty_rep._M_refcopy()) { }
+
+ __rc_string_base(const _Alloc& __a);
+
+ __rc_string_base(const __rc_string_base& __rcs);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ __rc_string_base(__rc_string_base&& __rcs)
+ : _M_dataplus(__rcs._M_get_allocator(), __rcs._M_data())
+ { __rcs._M_data(_S_empty_rep._M_refcopy()); }
+#endif
+
+ __rc_string_base(size_type __n, _CharT __c, const _Alloc& __a);
+
+ template<typename _InputIterator>
+ __rc_string_base(_InputIterator __beg, _InputIterator __end,
+ const _Alloc& __a);
+
+ ~__rc_string_base()
+ { _M_dispose(); }
+
+ allocator_type&
+ _M_get_allocator()
+ { return _M_dataplus; }
+
+ const allocator_type&
+ _M_get_allocator() const
+ { return _M_dataplus; }
+
+ void
+ _M_swap(__rc_string_base& __rcs);
+
+ void
+ _M_assign(const __rc_string_base& __rcs);
+
+ void
+ _M_reserve(size_type __res);
+
+ void
+ _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
+ size_type __len2);
+
+ void
+ _M_erase(size_type __pos, size_type __n);
+
+ void
+ _M_clear()
+ { _M_erase(size_type(0), _M_length()); }
+
+ bool
+ _M_compare(const __rc_string_base&) const
+ { return false; }
+ };
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep_empty
+ __rc_string_base<_CharT, _Traits, _Alloc>::_S_empty_rep;
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep*
+ __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
+ _S_create(size_type __capacity, size_type __old_capacity,
+ const _Alloc& __alloc)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 83. String::npos vs. string::max_size()
+ if (__capacity > size_type(_S_max_size))
+ std::__throw_length_error(__N("__rc_string_base::_Rep::_S_create"));
+
+ // The standard places no restriction on allocating more memory
+ // than is strictly needed within this layer at the moment or as
+ // requested by an explicit application call to reserve().
+
+ // Many malloc implementations perform quite poorly when an
+ // application attempts to allocate memory in a stepwise fashion
+ // growing each allocation size by only 1 char. Additionally,
+ // it makes little sense to allocate less linear memory than the
+ // natural blocking size of the malloc implementation.
+ // Unfortunately, we would need a somewhat low-level calculation
+ // with tuned parameters to get this perfect for any particular
+ // malloc implementation. Fortunately, generalizations about
+ // common features seen among implementations seems to suffice.
+
+ // __pagesize need not match the actual VM page size for good
+ // results in practice, thus we pick a common value on the low
+ // side. __malloc_header_size is an estimate of the amount of
+ // overhead per memory allocation (in practice seen N * sizeof
+ // (void*) where N is 0, 2 or 4). According to folklore,
+ // picking this value on the high side is better than
+ // low-balling it (especially when this algorithm is used with
+ // malloc implementations that allocate memory blocks rounded up
+ // to a size which is a power of 2).
+ const size_type __pagesize = 4096;
+ const size_type __malloc_header_size = 4 * sizeof(void*);
+
+ // The below implements an exponential growth policy, necessary to
+ // meet amortized linear time requirements of the library: see
+ // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
+ if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
+ {
+ __capacity = 2 * __old_capacity;
+ // Never allocate a string bigger than _S_max_size.
+ if (__capacity > size_type(_S_max_size))
+ __capacity = size_type(_S_max_size);
+ }
+
+ // NB: Need an array of char_type[__capacity], plus a terminating
+ // null char_type() element, plus enough for the _Rep data structure,
+ // plus sizeof(_Rep) - 1 to upper round to a size multiple of
+ // sizeof(_Rep).
+ // Whew. Seemingly so needy, yet so elemental.
+ size_type __size = ((__capacity + 1) * sizeof(_CharT)
+ + 2 * sizeof(_Rep) - 1);
+
+ const size_type __adj_size = __size + __malloc_header_size;
+ if (__adj_size > __pagesize && __capacity > __old_capacity)
+ {
+ const size_type __extra = __pagesize - __adj_size % __pagesize;
+ __capacity += __extra / sizeof(_CharT);
+ if (__capacity > size_type(_S_max_size))
+ __capacity = size_type(_S_max_size);
+ __size = (__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1;
+ }
+
+ // NB: Might throw, but no worries about a leak, mate: _Rep()
+ // does not throw.
+ _Rep* __place = _Rep_alloc_type(__alloc).allocate(__size / sizeof(_Rep));
+ _Rep* __p = new (__place) _Rep;
+ __p->_M_info._M_capacity = __capacity;
+ return __p;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
+ _M_destroy(const _Alloc& __a) throw ()
+ {
+ const size_type __size = ((_M_info._M_capacity + 1) * sizeof(_CharT)
+ + 2 * sizeof(_Rep) - 1);
+ _Rep_alloc_type(__a).deallocate(this, __size / sizeof(_Rep));
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
+ _M_clone(const _Alloc& __alloc, size_type __res)
+ {
+ // Requested capacity of the clone.
+ const size_type __requested_cap = _M_info._M_length + __res;
+ _Rep* __r = _Rep::_S_create(__requested_cap, _M_info._M_capacity,
+ __alloc);
+
+ if (_M_info._M_length)
+ _S_copy(__r->_M_refdata(), _M_refdata(), _M_info._M_length);
+
+ __r->_M_set_length(_M_info._M_length);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ __rc_string_base(const _Alloc& __a)
+ : _M_dataplus(__a, _S_construct(size_type(), _CharT(), __a)) { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ __rc_string_base(const __rc_string_base& __rcs)
+ : _M_dataplus(__rcs._M_get_allocator(),
+ __rcs._M_grab(__rcs._M_get_allocator())) { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ __rc_string_base(size_type __n, _CharT __c, const _Alloc& __a)
+ : _M_dataplus(__a, _S_construct(__n, __c, __a)) { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InputIterator>
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ __rc_string_base(_InputIterator __beg, _InputIterator __end,
+ const _Alloc& __a)
+ : _M_dataplus(__a, _S_construct(__beg, __end, __a)) { }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_leak_hard()
+ {
+ if (_M_is_shared())
+ _M_erase(0, 0);
+ _M_set_leaked();
+ }
+
+ // NB: This is the special case for Input Iterators, used in
+ // istreambuf_iterators, etc.
+ // Input Iterators have a cost structure very different from
+ // pointers, calling for a different coding style.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InIterator>
+ _CharT*
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
+ std::input_iterator_tag)
+ {
+ if (__beg == __end && __a == _Alloc())
+ return _S_empty_rep._M_refcopy();
+
+ // Avoid reallocation for common case.
+ _CharT __buf[128];
+ size_type __len = 0;
+ while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))
+ {
+ __buf[__len++] = *__beg;
+ ++__beg;
+ }
+ _Rep* __r = _Rep::_S_create(__len, size_type(0), __a);
+ _S_copy(__r->_M_refdata(), __buf, __len);
+ __try
+ {
+ while (__beg != __end)
+ {
+ if (__len == __r->_M_info._M_capacity)
+ {
+ // Allocate more space.
+ _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);
+ _S_copy(__another->_M_refdata(), __r->_M_refdata(), __len);
+ __r->_M_destroy(__a);
+ __r = __another;
+ }
+ __r->_M_refdata()[__len++] = *__beg;
+ ++__beg;
+ }
+ }
+ __catch(...)
+ {
+ __r->_M_destroy(__a);
+ __throw_exception_again;
+ }
+ __r->_M_set_length(__len);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InIterator>
+ _CharT*
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,
+ std::forward_iterator_tag)
+ {
+ if (__beg == __end && __a == _Alloc())
+ return _S_empty_rep._M_refcopy();
+
+ // NB: Not required, but considered best practice.
+ if (__builtin_expect(__is_null_pointer(__beg) && __beg != __end, 0))
+ std::__throw_logic_error(__N("__rc_string_base::"
+ "_S_construct NULL not valid"));
+
+ const size_type __dnew = static_cast<size_type>(std::distance(__beg,
+ __end));
+ // Check for out_of_range and length_error exceptions.
+ _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
+ __try
+ { _S_copy_chars(__r->_M_refdata(), __beg, __end); }
+ __catch(...)
+ {
+ __r->_M_destroy(__a);
+ __throw_exception_again;
+ }
+ __r->_M_set_length(__dnew);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _S_construct(size_type __n, _CharT __c, const _Alloc& __a)
+ {
+ if (__n == 0 && __a == _Alloc())
+ return _S_empty_rep._M_refcopy();
+
+ // Check for out_of_range and length_error exceptions.
+ _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
+ if (__n)
+ _S_assign(__r->_M_refdata(), __n, __c);
+
+ __r->_M_set_length(__n);
+ return __r->_M_refdata();
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_swap(__rc_string_base& __rcs)
+ {
+ if (_M_is_leaked())
+ _M_set_sharable();
+ if (__rcs._M_is_leaked())
+ __rcs._M_set_sharable();
+
+ _CharT* __tmp = _M_data();
+ _M_data(__rcs._M_data());
+ __rcs._M_data(__tmp);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(),
+ __rcs._M_get_allocator());
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_assign(const __rc_string_base& __rcs)
+ {
+ if (_M_rep() != __rcs._M_rep())
+ {
+ _CharT* __tmp = __rcs._M_grab(_M_get_allocator());
+ _M_dispose();
+ _M_data(__tmp);
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_reserve(size_type __res)
+ {
+ // Make sure we don't shrink below the current size.
+ if (__res < _M_length())
+ __res = _M_length();
+
+ if (__res != _M_capacity() || _M_is_shared())
+ {
+ _CharT* __tmp = _M_rep()->_M_clone(_M_get_allocator(),
+ __res - _M_length());
+ _M_dispose();
+ _M_data(__tmp);
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
+ size_type __len2)
+ {
+ const size_type __how_much = _M_length() - __pos - __len1;
+
+ _Rep* __r = _Rep::_S_create(_M_length() + __len2 - __len1,
+ _M_capacity(), _M_get_allocator());
+
+ if (__pos)
+ _S_copy(__r->_M_refdata(), _M_data(), __pos);
+ if (__s && __len2)
+ _S_copy(__r->_M_refdata() + __pos, __s, __len2);
+ if (__how_much)
+ _S_copy(__r->_M_refdata() + __pos + __len2,
+ _M_data() + __pos + __len1, __how_much);
+
+ _M_dispose();
+ _M_data(__r->_M_refdata());
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_erase(size_type __pos, size_type __n)
+ {
+ const size_type __new_size = _M_length() - __n;
+ const size_type __how_much = _M_length() - __pos - __n;
+
+ if (_M_is_shared())
+ {
+ // Must reallocate.
+ _Rep* __r = _Rep::_S_create(__new_size, _M_capacity(),
+ _M_get_allocator());
+
+ if (__pos)
+ _S_copy(__r->_M_refdata(), _M_data(), __pos);
+ if (__how_much)
+ _S_copy(__r->_M_refdata() + __pos,
+ _M_data() + __pos + __n, __how_much);
+
+ _M_dispose();
+ _M_data(__r->_M_refdata());
+ }
+ else if (__how_much && __n)
+ {
+ // Work in-place.
+ _S_move(_M_data() + __pos,
+ _M_data() + __pos + __n, __how_much);
+ }
+
+ _M_rep()->_M_set_length(__new_size);
+ }
+
+ template<>
+ inline bool
+ __rc_string_base<char, std::char_traits<char>,
+ std::allocator<char> >::
+ _M_compare(const __rc_string_base& __rcs) const
+ {
+ if (_M_rep() == __rcs._M_rep())
+ return true;
+ return false;
+ }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ inline bool
+ __rc_string_base<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t> >::
+ _M_compare(const __rc_string_base& __rcs) const
+ {
+ if (_M_rep() == __rcs._M_rep())
+ return true;
+ return false;
+ }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _RC_STRING_BASE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/rope b/gcc-4.4.0/libstdc++-v3/include/ext/rope
new file mode 100644
index 000000000..462c8f5db
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/rope
@@ -0,0 +1,2958 @@
+// SGI's rope class -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ext/rope
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _ROPE
+#define _ROPE 1
+
+#include <algorithm>
+#include <iosfwd>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_function.h>
+#include <bits/stl_numeric.h>
+#include <bits/allocator.h>
+#include <bits/gthr.h>
+#include <tr1/functional>
+
+# ifdef __GC
+# define __GC_CONST const
+# else
+# define __GC_CONST // constant except for deallocation
+# endif
+
+#include <ext/memory> // For uninitialized_copy_n
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ namespace __detail
+ {
+ enum { _S_max_rope_depth = 45 };
+ enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
+ } // namespace __detail
+
+ using std::size_t;
+ using std::ptrdiff_t;
+ using std::allocator;
+ using std::_Destroy;
+
+ // See libstdc++/36832.
+ template<typename _ForwardIterator, typename _Allocator>
+ void
+ _Destroy_const(_ForwardIterator __first,
+ _ForwardIterator __last, _Allocator __alloc)
+ {
+ for (; __first != __last; ++__first)
+ __alloc.destroy(&*__first);
+ }
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ _Destroy_const(_ForwardIterator __first,
+ _ForwardIterator __last, allocator<_Tp>)
+ { _Destroy(__first, __last); }
+
+ // The _S_eos function is used for those functions that
+ // convert to/from C-like strings to detect the end of the string.
+
+ // The end-of-C-string character.
+ // This is what the draft standard says it should be.
+ template <class _CharT>
+ inline _CharT
+ _S_eos(_CharT*)
+ { return _CharT(); }
+
+ // Test for basic character types.
+ // For basic character types leaves having a trailing eos.
+ template <class _CharT>
+ inline bool
+ _S_is_basic_char_type(_CharT*)
+ { return false; }
+
+ template <class _CharT>
+ inline bool
+ _S_is_one_byte_char_type(_CharT*)
+ { return false; }
+
+ inline bool
+ _S_is_basic_char_type(char*)
+ { return true; }
+
+ inline bool
+ _S_is_one_byte_char_type(char*)
+ { return true; }
+
+ inline bool
+ _S_is_basic_char_type(wchar_t*)
+ { return true; }
+
+ // Store an eos iff _CharT is a basic character type.
+ // Do not reference _S_eos if it isn't.
+ template <class _CharT>
+ inline void
+ _S_cond_store_eos(_CharT&) { }
+
+ inline void
+ _S_cond_store_eos(char& __c)
+ { __c = 0; }
+
+ inline void
+ _S_cond_store_eos(wchar_t& __c)
+ { __c = 0; }
+
+ // char_producers are logically functions that generate a section of
+ // a string. These can be converted to ropes. The resulting rope
+ // invokes the char_producer on demand. This allows, for example,
+ // files to be viewed as ropes without reading the entire file.
+ template <class _CharT>
+ class char_producer
+ {
+ public:
+ virtual ~char_producer() { };
+
+ virtual void
+ operator()(size_t __start_pos, size_t __len,
+ _CharT* __buffer) = 0;
+ // Buffer should really be an arbitrary output iterator.
+ // That way we could flatten directly into an ostream, etc.
+ // This is thoroughly impossible, since iterator types don't
+ // have runtime descriptions.
+ };
+
+ // Sequence buffers:
+ //
+ // Sequence must provide an append operation that appends an
+ // array to the sequence. Sequence buffers are useful only if
+ // appending an entire array is cheaper than appending element by element.
+ // This is true for many string representations.
+ // This should perhaps inherit from ostream<sequence::value_type>
+ // and be implemented correspondingly, so that they can be used
+ // for formatted. For the sake of portability, we don't do this yet.
+ //
+ // For now, sequence buffers behave as output iterators. But they also
+ // behave a little like basic_ostringstream<sequence::value_type> and a
+ // little like containers.
+
+ template<class _Sequence, size_t _Buf_sz = 100>
+ class sequence_buffer
+ : public std::iterator<std::output_iterator_tag, void, void, void, void>
+ {
+ public:
+ typedef typename _Sequence::value_type value_type;
+ protected:
+ _Sequence* _M_prefix;
+ value_type _M_buffer[_Buf_sz];
+ size_t _M_buf_count;
+ public:
+
+ void
+ flush()
+ {
+ _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
+ _M_buf_count = 0;
+ }
+
+ ~sequence_buffer()
+ { flush(); }
+
+ sequence_buffer()
+ : _M_prefix(0), _M_buf_count(0) { }
+
+ sequence_buffer(const sequence_buffer& __x)
+ {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ }
+
+ sequence_buffer(sequence_buffer& __x)
+ {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ }
+
+ sequence_buffer(_Sequence& __s)
+ : _M_prefix(&__s), _M_buf_count(0) { }
+
+ sequence_buffer&
+ operator=(sequence_buffer& __x)
+ {
+ __x.flush();
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = 0;
+ return *this;
+ }
+
+ sequence_buffer&
+ operator=(const sequence_buffer& __x)
+ {
+ _M_prefix = __x._M_prefix;
+ _M_buf_count = __x._M_buf_count;
+ std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
+ return *this;
+ }
+
+ void
+ push_back(value_type __x)
+ {
+ if (_M_buf_count < _Buf_sz)
+ {
+ _M_buffer[_M_buf_count] = __x;
+ ++_M_buf_count;
+ }
+ else
+ {
+ flush();
+ _M_buffer[0] = __x;
+ _M_buf_count = 1;
+ }
+ }
+
+ void
+ append(value_type* __s, size_t __len)
+ {
+ if (__len + _M_buf_count <= _Buf_sz)
+ {
+ size_t __i = _M_buf_count;
+ for (size_t __j = 0; __j < __len; __i++, __j++)
+ _M_buffer[__i] = __s[__j];
+ _M_buf_count += __len;
+ }
+ else if (0 == _M_buf_count)
+ _M_prefix->append(__s, __s + __len);
+ else
+ {
+ flush();
+ append(__s, __len);
+ }
+ }
+
+ sequence_buffer&
+ write(value_type* __s, size_t __len)
+ {
+ append(__s, __len);
+ return *this;
+ }
+
+ sequence_buffer&
+ put(value_type __x)
+ {
+ push_back(__x);
+ return *this;
+ }
+
+ sequence_buffer&
+ operator=(const value_type& __rhs)
+ {
+ push_back(__rhs);
+ return *this;
+ }
+
+ sequence_buffer&
+ operator*()
+ { return *this; }
+
+ sequence_buffer&
+ operator++()
+ { return *this; }
+
+ sequence_buffer
+ operator++(int)
+ { return *this; }
+ };
+
+ // The following should be treated as private, at least for now.
+ template<class _CharT>
+ class _Rope_char_consumer
+ {
+ public:
+ // If we had member templates, these should not be virtual.
+ // For now we need to use run-time parametrization where
+ // compile-time would do. Hence this should all be private
+ // for now.
+ // The symmetry with char_producer is accidental and temporary.
+ virtual ~_Rope_char_consumer() { };
+
+ virtual bool
+ operator()(const _CharT* __buffer, size_t __len) = 0;
+ };
+
+ // First a lot of forward declarations. The standard seems to require
+ // much stricter "declaration before use" than many of the implementations
+ // that preceded it.
+ template<class _CharT, class _Alloc = allocator<_CharT> >
+ class rope;
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeConcatenation;
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeLeaf;
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeFunction;
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeSubstring;
+
+ template<class _CharT, class _Alloc>
+ class _Rope_iterator;
+
+ template<class _CharT, class _Alloc>
+ class _Rope_const_iterator;
+
+ template<class _CharT, class _Alloc>
+ class _Rope_char_ref_proxy;
+
+ template<class _CharT, class _Alloc>
+ class _Rope_char_ptr_proxy;
+
+ template<class _CharT, class _Alloc>
+ bool
+ operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ _Rope_const_iterator<_CharT, _Alloc>
+ operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ ptrdiff_t __n);
+
+ template<class _CharT, class _Alloc>
+ _Rope_const_iterator<_CharT, _Alloc>
+ operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ ptrdiff_t __n);
+
+ template<class _CharT, class _Alloc>
+ _Rope_const_iterator<_CharT, _Alloc>
+ operator+(ptrdiff_t __n,
+ const _Rope_const_iterator<_CharT, _Alloc>& __x);
+
+ template<class _CharT, class _Alloc>
+ bool
+ operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ bool
+ operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ ptrdiff_t
+ operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ _Rope_iterator<_CharT, _Alloc>
+ operator-(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
+
+ template<class _CharT, class _Alloc>
+ _Rope_iterator<_CharT, _Alloc>
+ operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
+
+ template<class _CharT, class _Alloc>
+ _Rope_iterator<_CharT, _Alloc>
+ operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x);
+
+ template<class _CharT, class _Alloc>
+ bool
+ operator==(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ bool
+ operator<(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ ptrdiff_t
+ operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y);
+
+ template<class _CharT, class _Alloc>
+ rope<_CharT, _Alloc>
+ operator+(const rope<_CharT, _Alloc>& __left,
+ const rope<_CharT, _Alloc>& __right);
+
+ template<class _CharT, class _Alloc>
+ rope<_CharT, _Alloc>
+ operator+(const rope<_CharT, _Alloc>& __left, const _CharT* __right);
+
+ template<class _CharT, class _Alloc>
+ rope<_CharT, _Alloc>
+ operator+(const rope<_CharT, _Alloc>& __left, _CharT __right);
+
+ // Some helpers, so we can use power on ropes.
+ // See below for why this isn't local to the implementation.
+
+ // This uses a nonstandard refcount convention.
+ // The result has refcount 0.
+ template<class _CharT, class _Alloc>
+ struct _Rope_Concat_fn
+ : public std::binary_function<rope<_CharT, _Alloc>, rope<_CharT, _Alloc>,
+ rope<_CharT, _Alloc> >
+ {
+ rope<_CharT, _Alloc>
+ operator()(const rope<_CharT, _Alloc>& __x,
+ const rope<_CharT, _Alloc>& __y)
+ { return __x + __y; }
+ };
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>
+ identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
+ { return rope<_CharT, _Alloc>(); }
+
+ // Class _Refcount_Base provides a type, _RC_t, a data member,
+ // _M_ref_count, and member functions _M_incr and _M_decr, which perform
+ // atomic preincrement/predecrement. The constructor initializes
+ // _M_ref_count.
+ struct _Refcount_Base
+ {
+ // The type _RC_t
+ typedef size_t _RC_t;
+
+ // The data member _M_ref_count
+ volatile _RC_t _M_ref_count;
+
+ // Constructor
+ __gthread_mutex_t _M_ref_count_lock;
+
+ _Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()
+ {
+#ifdef __GTHREAD_MUTEX_INIT
+ __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
+ _M_ref_count_lock = __tmp;
+#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
+ __GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);
+#else
+#error __GTHREAD_MUTEX_INIT or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org.
+#endif
+ }
+
+ void
+ _M_incr()
+ {
+ __gthread_mutex_lock(&_M_ref_count_lock);
+ ++_M_ref_count;
+ __gthread_mutex_unlock(&_M_ref_count_lock);
+ }
+
+ _RC_t
+ _M_decr()
+ {
+ __gthread_mutex_lock(&_M_ref_count_lock);
+ volatile _RC_t __tmp = --_M_ref_count;
+ __gthread_mutex_unlock(&_M_ref_count_lock);
+ return __tmp;
+ }
+ };
+
+ //
+ // What follows should really be local to rope. Unfortunately,
+ // that doesn't work, since it makes it impossible to define generic
+ // equality on rope iterators. According to the draft standard, the
+ // template parameters for such an equality operator cannot be inferred
+ // from the occurrence of a member class as a parameter.
+ // (SGI compilers in fact allow this, but the __result wouldn't be
+ // portable.)
+ // Similarly, some of the static member functions are member functions
+ // only to avoid polluting the global namespace, and to circumvent
+ // restrictions on type inference for template functions.
+ //
+
+ //
+ // The internal data structure for representing a rope. This is
+ // private to the implementation. A rope is really just a pointer
+ // to one of these.
+ //
+ // A few basic functions for manipulating this data structure
+ // are members of _RopeRep. Most of the more complex algorithms
+ // are implemented as rope members.
+ //
+ // Some of the static member functions of _RopeRep have identically
+ // named functions in rope that simply invoke the _RopeRep versions.
+
+#define __ROPE_DEFINE_ALLOCS(__a) \
+ __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \
+ typedef _Rope_RopeConcatenation<_CharT,__a> __C; \
+ __ROPE_DEFINE_ALLOC(__C,_C) \
+ typedef _Rope_RopeLeaf<_CharT,__a> __L; \
+ __ROPE_DEFINE_ALLOC(__L,_L) \
+ typedef _Rope_RopeFunction<_CharT,__a> __F; \
+ __ROPE_DEFINE_ALLOC(__F,_F) \
+ typedef _Rope_RopeSubstring<_CharT,__a> __S; \
+ __ROPE_DEFINE_ALLOC(__S,_S)
+
+ // Internal rope nodes potentially store a copy of the allocator
+ // instance used to allocate them. This is mostly redundant.
+ // But the alternative would be to pass allocator instances around
+ // in some form to nearly all internal functions, since any pointer
+ // assignment may result in a zero reference count and thus require
+ // deallocation.
+
+#define __STATIC_IF_SGI_ALLOC /* not static */
+
+ template <class _CharT, class _Alloc>
+ struct _Rope_rep_base
+ : public _Alloc
+ {
+ typedef _Alloc allocator_type;
+
+ allocator_type
+ get_allocator() const
+ { return *static_cast<const _Alloc*>(this); }
+
+ allocator_type&
+ _M_get_allocator()
+ { return *static_cast<_Alloc*>(this); }
+
+ const allocator_type&
+ _M_get_allocator() const
+ { return *static_cast<const _Alloc*>(this); }
+
+ _Rope_rep_base(size_t __size, const allocator_type&)
+ : _M_size(__size) { }
+
+ size_t _M_size;
+
+# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
+ typedef typename \
+ _Alloc::template rebind<_Tp>::other __name##Alloc; \
+ static _Tp* __name##_allocate(size_t __n) \
+ { return __name##Alloc().allocate(__n); } \
+ static void __name##_deallocate(_Tp *__p, size_t __n) \
+ { __name##Alloc().deallocate(__p, __n); }
+ __ROPE_DEFINE_ALLOCS(_Alloc)
+# undef __ROPE_DEFINE_ALLOC
+ };
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeRep
+ : public _Rope_rep_base<_CharT, _Alloc>
+# ifndef __GC
+ , _Refcount_Base
+# endif
+ {
+ public:
+ __detail::_Tag _M_tag:8;
+ bool _M_is_balanced:8;
+ unsigned char _M_depth;
+ __GC_CONST _CharT* _M_c_string;
+ __gthread_mutex_t _M_c_string_lock;
+ /* Flattened version of string, if needed. */
+ /* typically 0. */
+ /* If it's not 0, then the memory is owned */
+ /* by this node. */
+ /* In the case of a leaf, this may point to */
+ /* the same memory as the data field. */
+ typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
+ allocator_type;
+
+ using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
+ using _Rope_rep_base<_CharT, _Alloc>::_M_get_allocator;
+
+ _Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size,
+ const allocator_type& __a)
+ : _Rope_rep_base<_CharT, _Alloc>(__size, __a),
+#ifndef __GC
+ _Refcount_Base(1),
+#endif
+ _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
+#ifdef __GTHREAD_MUTEX_INIT
+ {
+ // Do not copy a POSIX/gthr mutex once in use. However, bits are bits.
+ __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
+ _M_c_string_lock = __tmp;
+ }
+#else
+ { __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
+#endif
+#ifdef __GC
+ void
+ _M_incr () { }
+#endif
+ static void
+ _S_free_string(__GC_CONST _CharT*, size_t __len,
+ allocator_type& __a);
+#define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
+ // Deallocate data section of a leaf.
+ // This shouldn't be a member function.
+ // But its hard to do anything else at the
+ // moment, because it's templatized w.r.t.
+ // an allocator.
+ // Does nothing if __GC is defined.
+#ifndef __GC
+ void _M_free_c_string();
+ void _M_free_tree();
+ // Deallocate t. Assumes t is not 0.
+ void
+ _M_unref_nonnil()
+ {
+ if (0 == _M_decr())
+ _M_free_tree();
+ }
+
+ void
+ _M_ref_nonnil()
+ { _M_incr(); }
+
+ static void
+ _S_unref(_Rope_RopeRep* __t)
+ {
+ if (0 != __t)
+ __t->_M_unref_nonnil();
+ }
+
+ static void
+ _S_ref(_Rope_RopeRep* __t)
+ {
+ if (0 != __t)
+ __t->_M_incr();
+ }
+
+ static void
+ _S_free_if_unref(_Rope_RopeRep* __t)
+ {
+ if (0 != __t && 0 == __t->_M_ref_count)
+ __t->_M_free_tree();
+ }
+# else /* __GC */
+ void _M_unref_nonnil() { }
+ void _M_ref_nonnil() { }
+ static void _S_unref(_Rope_RopeRep*) { }
+ static void _S_ref(_Rope_RopeRep*) { }
+ static void _S_free_if_unref(_Rope_RopeRep*) { }
+# endif
+protected:
+ _Rope_RopeRep&
+ operator=(const _Rope_RopeRep&);
+
+ _Rope_RopeRep(const _Rope_RopeRep&);
+ };
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeLeaf
+ : public _Rope_RopeRep<_CharT, _Alloc>
+ {
+ public:
+ // Apparently needed by VC++
+ // The data fields of leaves are allocated with some
+ // extra space, to accommodate future growth and for basic
+ // character types, to hold a trailing eos character.
+ enum { _S_alloc_granularity = 8 };
+
+ static size_t
+ _S_rounded_up_size(size_t __n)
+ {
+ size_t __size_with_eos;
+
+ if (_S_is_basic_char_type((_CharT*)0))
+ __size_with_eos = __n + 1;
+ else
+ __size_with_eos = __n;
+#ifdef __GC
+ return __size_with_eos;
+#else
+ // Allow slop for in-place expansion.
+ return ((__size_with_eos + size_t(_S_alloc_granularity) - 1)
+ &~ (size_t(_S_alloc_granularity) - 1));
+#endif
+ }
+ __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
+ /* The allocated size is */
+ /* _S_rounded_up_size(size), except */
+ /* in the GC case, in which it */
+ /* doesn't matter. */
+ typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
+ allocator_type;
+
+ _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
+ const allocator_type& __a)
+ : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
+ __size, __a), _M_data(__d)
+ {
+ if (_S_is_basic_char_type((_CharT *)0))
+ {
+ // already eos terminated.
+ this->_M_c_string = __d;
+ }
+ }
+ // The constructor assumes that d has been allocated with
+ // the proper allocator and the properly padded size.
+ // In contrast, the destructor deallocates the data:
+#ifndef __GC
+ ~_Rope_RopeLeaf() throw()
+ {
+ if (_M_data != this->_M_c_string)
+ this->_M_free_c_string();
+
+ __STL_FREE_STRING(_M_data, this->_M_size, this->_M_get_allocator());
+ }
+#endif
+protected:
+ _Rope_RopeLeaf&
+ operator=(const _Rope_RopeLeaf&);
+
+ _Rope_RopeLeaf(const _Rope_RopeLeaf&);
+ };
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeConcatenation
+ : public _Rope_RopeRep<_CharT, _Alloc>
+ {
+ public:
+ _Rope_RopeRep<_CharT, _Alloc>* _M_left;
+ _Rope_RopeRep<_CharT, _Alloc>* _M_right;
+
+ typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
+ allocator_type;
+
+ _Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
+ _Rope_RopeRep<_CharT, _Alloc>* __r,
+ const allocator_type& __a)
+ : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,
+ std::max(__l->_M_depth,
+ __r->_M_depth) + 1,
+ false,
+ __l->_M_size + __r->_M_size, __a),
+ _M_left(__l), _M_right(__r)
+ { }
+#ifndef __GC
+ ~_Rope_RopeConcatenation() throw()
+ {
+ this->_M_free_c_string();
+ _M_left->_M_unref_nonnil();
+ _M_right->_M_unref_nonnil();
+ }
+#endif
+protected:
+ _Rope_RopeConcatenation&
+ operator=(const _Rope_RopeConcatenation&);
+
+ _Rope_RopeConcatenation(const _Rope_RopeConcatenation&);
+ };
+
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeFunction
+ : public _Rope_RopeRep<_CharT, _Alloc>
+ {
+ public:
+ char_producer<_CharT>* _M_fn;
+#ifndef __GC
+ bool _M_delete_when_done; // Char_producer is owned by the
+ // rope and should be explicitly
+ // deleted when the rope becomes
+ // inaccessible.
+#else
+ // In the GC case, we either register the rope for
+ // finalization, or not. Thus the field is unnecessary;
+ // the information is stored in the collector data structures.
+ // We do need a finalization procedure to be invoked by the
+ // collector.
+ static void
+ _S_fn_finalization_proc(void * __tree, void *)
+ { delete ((_Rope_RopeFunction *)__tree) -> _M_fn; }
+#endif
+ typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
+ allocator_type;
+
+ _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
+ bool __d, const allocator_type& __a)
+ : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
+ , _M_fn(__f)
+#ifndef __GC
+ , _M_delete_when_done(__d)
+#endif
+ {
+#ifdef __GC
+ if (__d)
+ {
+ GC_REGISTER_FINALIZER(this, _Rope_RopeFunction::
+ _S_fn_finalization_proc, 0, 0, 0);
+ }
+#endif
+ }
+#ifndef __GC
+ ~_Rope_RopeFunction() throw()
+ {
+ this->_M_free_c_string();
+ if (_M_delete_when_done)
+ delete _M_fn;
+ }
+# endif
+ protected:
+ _Rope_RopeFunction&
+ operator=(const _Rope_RopeFunction&);
+
+ _Rope_RopeFunction(const _Rope_RopeFunction&);
+ };
+ // Substring results are usually represented using just
+ // concatenation nodes. But in the case of very long flat ropes
+ // or ropes with a functional representation that isn't practical.
+ // In that case, we represent the __result as a special case of
+ // RopeFunction, whose char_producer points back to the rope itself.
+ // In all cases except repeated substring operations and
+ // deallocation, we treat the __result as a RopeFunction.
+ template<class _CharT, class _Alloc>
+ struct _Rope_RopeSubstring
+ : public _Rope_RopeFunction<_CharT, _Alloc>,
+ public char_producer<_CharT>
+ {
+ public:
+ // XXX this whole class should be rewritten.
+ _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0
+ size_t _M_start;
+
+ virtual void
+ operator()(size_t __start_pos, size_t __req_len,
+ _CharT* __buffer)
+ {
+ switch(_M_base->_M_tag)
+ {
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ {
+ char_producer<_CharT>* __fn =
+ ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
+ (*__fn)(__start_pos + _M_start, __req_len, __buffer);
+ }
+ break;
+ case __detail::_S_leaf:
+ {
+ __GC_CONST _CharT* __s =
+ ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
+ uninitialized_copy_n(__s + __start_pos + _M_start, __req_len,
+ __buffer);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
+ allocator_type;
+
+ _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s,
+ size_t __l, const allocator_type& __a)
+ : _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),
+ char_producer<_CharT>(), _M_base(__b), _M_start(__s)
+ {
+#ifndef __GC
+ _M_base->_M_ref_nonnil();
+#endif
+ this->_M_tag = __detail::_S_substringfn;
+ }
+ virtual ~_Rope_RopeSubstring() throw()
+ {
+#ifndef __GC
+ _M_base->_M_unref_nonnil();
+ // _M_free_c_string(); -- done by parent class
+#endif
+ }
+ };
+
+ // Self-destructing pointers to Rope_rep.
+ // These are not conventional smart pointers. Their
+ // only purpose in life is to ensure that unref is called
+ // on the pointer either at normal exit or if an exception
+ // is raised. It is the caller's responsibility to
+ // adjust reference counts when these pointers are initialized
+ // or assigned to. (This convention significantly reduces
+ // the number of potentially expensive reference count
+ // updates.)
+#ifndef __GC
+ template<class _CharT, class _Alloc>
+ struct _Rope_self_destruct_ptr
+ {
+ _Rope_RopeRep<_CharT, _Alloc>* _M_ptr;
+
+ ~_Rope_self_destruct_ptr()
+ { _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); }
+#ifdef __EXCEPTIONS
+ _Rope_self_destruct_ptr() : _M_ptr(0) { };
+#else
+ _Rope_self_destruct_ptr() { };
+#endif
+ _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p)
+ : _M_ptr(__p) { }
+
+ _Rope_RopeRep<_CharT, _Alloc>&
+ operator*()
+ { return *_M_ptr; }
+
+ _Rope_RopeRep<_CharT, _Alloc>*
+ operator->()
+ { return _M_ptr; }
+
+ operator _Rope_RopeRep<_CharT, _Alloc>*()
+ { return _M_ptr; }
+
+ _Rope_self_destruct_ptr&
+ operator=(_Rope_RopeRep<_CharT, _Alloc>* __x)
+ { _M_ptr = __x; return *this; }
+ };
+#endif
+
+ // Dereferencing a nonconst iterator has to return something
+ // that behaves almost like a reference. It's not possible to
+ // return an actual reference since assignment requires extra
+ // work. And we would get into the same problems as with the
+ // CD2 version of basic_string.
+ template<class _CharT, class _Alloc>
+ class _Rope_char_ref_proxy
+ {
+ friend class rope<_CharT, _Alloc>;
+ friend class _Rope_iterator<_CharT, _Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;
+#ifdef __GC
+ typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;
+#else
+ typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;
+#endif
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef rope<_CharT, _Alloc> _My_rope;
+ size_t _M_pos;
+ _CharT _M_current;
+ bool _M_current_valid;
+ _My_rope* _M_root; // The whole rope.
+ public:
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p)
+ : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }
+
+ _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
+ : _M_pos(__x._M_pos), _M_current(__x._M_current),
+ _M_current_valid(false), _M_root(__x._M_root) { }
+
+ // Don't preserve cache if the reference can outlive the
+ // expression. We claim that's not possible without calling
+ // a copy constructor or generating reference to a proxy
+ // reference. We declare the latter to have undefined semantics.
+ _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
+ : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }
+
+ inline operator _CharT () const;
+
+ _Rope_char_ref_proxy&
+ operator=(_CharT __c);
+
+ _Rope_char_ptr_proxy<_CharT, _Alloc> operator&() const;
+
+ _Rope_char_ref_proxy&
+ operator=(const _Rope_char_ref_proxy& __c)
+ { return operator=((_CharT)__c); }
+ };
+
+ template<class _CharT, class __Alloc>
+ inline void
+ swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
+ _Rope_char_ref_proxy <_CharT, __Alloc > __b)
+ {
+ _CharT __tmp = __a;
+ __a = __b;
+ __b = __tmp;
+ }
+
+ template<class _CharT, class _Alloc>
+ class _Rope_char_ptr_proxy
+ {
+ // XXX this class should be rewritten.
+ friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
+ size_t _M_pos;
+ rope<_CharT,_Alloc>* _M_root; // The whole rope.
+ public:
+ _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) { }
+
+ _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) { }
+
+ _Rope_char_ptr_proxy() { }
+
+ _Rope_char_ptr_proxy(_CharT* __x)
+ : _M_root(0), _M_pos(0) { }
+
+ _Rope_char_ptr_proxy&
+ operator=(const _Rope_char_ptr_proxy& __x)
+ {
+ _M_pos = __x._M_pos;
+ _M_root = __x._M_root;
+ return *this;
+ }
+
+ template<class _CharT2, class _Alloc2>
+ friend bool
+ operator==(const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __x,
+ const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __y);
+
+ _Rope_char_ref_proxy<_CharT, _Alloc> operator*() const
+ { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root, _M_pos); }
+ };
+
+ // Rope iterators:
+ // Unlike in the C version, we cache only part of the stack
+ // for rope iterators, since they must be efficiently copyable.
+ // When we run out of cache, we have to reconstruct the iterator
+ // value.
+ // Pointers from iterators are not included in reference counts.
+ // Iterators are assumed to be thread private. Ropes can
+ // be shared.
+
+ template<class _CharT, class _Alloc>
+ class _Rope_iterator_base
+ : public std::iterator<std::random_access_iterator_tag, _CharT>
+ {
+ friend class rope<_CharT, _Alloc>;
+ public:
+ typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ // Borland doesn't want this to be protected.
+ protected:
+ enum { _S_path_cache_len = 4 }; // Must be <= 9.
+ enum { _S_iterator_buf_len = 15 };
+ size_t _M_current_pos;
+ _RopeRep* _M_root; // The whole rope.
+ size_t _M_leaf_pos; // Starting position for current leaf
+ __GC_CONST _CharT* _M_buf_start;
+ // Buffer possibly
+ // containing current char.
+ __GC_CONST _CharT* _M_buf_ptr;
+ // Pointer to current char in buffer.
+ // != 0 ==> buffer valid.
+ __GC_CONST _CharT* _M_buf_end;
+ // One past __last valid char in buffer.
+ // What follows is the path cache. We go out of our
+ // way to make this compact.
+ // Path_end contains the bottom section of the path from
+ // the root to the current leaf.
+ const _RopeRep* _M_path_end[_S_path_cache_len];
+ int _M_leaf_index; // Last valid __pos in path_end;
+ // _M_path_end[0] ... _M_path_end[leaf_index-1]
+ // point to concatenation nodes.
+ unsigned char _M_path_directions;
+ // (path_directions >> __i) & 1 is 1
+ // iff we got from _M_path_end[leaf_index - __i - 1]
+ // to _M_path_end[leaf_index - __i] by going to the
+ // __right. Assumes path_cache_len <= 9.
+ _CharT _M_tmp_buf[_S_iterator_buf_len];
+ // Short buffer for surrounding chars.
+ // This is useful primarily for
+ // RopeFunctions. We put the buffer
+ // here to avoid locking in the
+ // multithreaded case.
+ // The cached path is generally assumed to be valid
+ // only if the buffer is valid.
+ static void _S_setbuf(_Rope_iterator_base& __x);
+ // Set buffer contents given
+ // path cache.
+ static void _S_setcache(_Rope_iterator_base& __x);
+ // Set buffer contents and
+ // path cache.
+ static void _S_setcache_for_incr(_Rope_iterator_base& __x);
+ // As above, but assumes path
+ // cache is valid for previous posn.
+ _Rope_iterator_base() { }
+
+ _Rope_iterator_base(_RopeRep* __root, size_t __pos)
+ : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }
+
+ void _M_incr(size_t __n);
+ void _M_decr(size_t __n);
+ public:
+ size_t
+ index() const
+ { return _M_current_pos; }
+
+ _Rope_iterator_base(const _Rope_iterator_base& __x)
+ {
+ if (0 != __x._M_buf_ptr)
+ *this = __x;
+ else
+ {
+ _M_current_pos = __x._M_current_pos;
+ _M_root = __x._M_root;
+ _M_buf_ptr = 0;
+ }
+ }
+ };
+
+ template<class _CharT, class _Alloc>
+ class _Rope_iterator;
+
+ template<class _CharT, class _Alloc>
+ class _Rope_const_iterator
+ : public _Rope_iterator_base<_CharT, _Alloc>
+ {
+ friend class rope<_CharT, _Alloc>;
+ protected:
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ // The one from the base class may not be directly visible.
+ _Rope_const_iterator(const _RopeRep* __root, size_t __pos)
+ : _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),
+ __pos)
+ // Only nonconst iterators modify root ref count
+ { }
+ public:
+ typedef _CharT reference; // Really a value. Returning a reference
+ // Would be a mess, since it would have
+ // to be included in refcount.
+ typedef const _CharT* pointer;
+
+ public:
+ _Rope_const_iterator() { };
+
+ _Rope_const_iterator(const _Rope_const_iterator& __x)
+ : _Rope_iterator_base<_CharT,_Alloc>(__x) { }
+
+ _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x);
+
+ _Rope_const_iterator(const rope<_CharT, _Alloc>& __r, size_t __pos)
+ : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { }
+
+ _Rope_const_iterator&
+ operator=(const _Rope_const_iterator& __x)
+ {
+ if (0 != __x._M_buf_ptr)
+ *(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x;
+ else
+ {
+ this->_M_current_pos = __x._M_current_pos;
+ this->_M_root = __x._M_root;
+ this->_M_buf_ptr = 0;
+ }
+ return(*this);
+ }
+
+ reference
+ operator*()
+ {
+ if (0 == this->_M_buf_ptr)
+ _S_setcache(*this);
+ return *this->_M_buf_ptr;
+ }
+
+ // Without this const version, Rope iterators do not meet the
+ // requirements of an Input Iterator.
+ reference
+ operator*() const
+ {
+ return *const_cast<_Rope_const_iterator&>(*this);
+ }
+
+ _Rope_const_iterator&
+ operator++()
+ {
+ __GC_CONST _CharT* __next;
+ if (0 != this->_M_buf_ptr
+ && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end)
+ {
+ this->_M_buf_ptr = __next;
+ ++this->_M_current_pos;
+ }
+ else
+ this->_M_incr(1);
+ return *this;
+ }
+
+ _Rope_const_iterator&
+ operator+=(ptrdiff_t __n)
+ {
+ if (__n >= 0)
+ this->_M_incr(__n);
+ else
+ this->_M_decr(-__n);
+ return *this;
+ }
+
+ _Rope_const_iterator&
+ operator--()
+ {
+ this->_M_decr(1);
+ return *this;
+ }
+
+ _Rope_const_iterator&
+ operator-=(ptrdiff_t __n)
+ {
+ if (__n >= 0)
+ this->_M_decr(__n);
+ else
+ this->_M_incr(-__n);
+ return *this;
+ }
+
+ _Rope_const_iterator
+ operator++(int)
+ {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ // This makes a subsequent dereference expensive.
+ // Perhaps we should instead copy the iterator
+ // if it has a valid cache?
+ }
+
+ _Rope_const_iterator
+ operator--(int)
+ {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
+ }
+
+ template<class _CharT2, class _Alloc2>
+ friend _Rope_const_iterator<_CharT2, _Alloc2>
+ operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
+ ptrdiff_t __n);
+
+ template<class _CharT2, class _Alloc2>
+ friend _Rope_const_iterator<_CharT2, _Alloc2>
+ operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
+ ptrdiff_t __n);
+
+ template<class _CharT2, class _Alloc2>
+ friend _Rope_const_iterator<_CharT2, _Alloc2>
+ operator+(ptrdiff_t __n,
+ const _Rope_const_iterator<_CharT2, _Alloc2>& __x);
+
+ reference
+ operator[](size_t __n)
+ { return rope<_CharT, _Alloc>::_S_fetch(this->_M_root,
+ this->_M_current_pos + __n); }
+
+ template<class _CharT2, class _Alloc2>
+ friend bool
+ operator==(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
+ const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
+
+ template<class _CharT2, class _Alloc2>
+ friend bool
+ operator<(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
+ const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
+
+ template<class _CharT2, class _Alloc2>
+ friend ptrdiff_t
+ operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
+ const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
+ };
+
+ template<class _CharT, class _Alloc>
+ class _Rope_iterator
+ : public _Rope_iterator_base<_CharT, _Alloc>
+ {
+ friend class rope<_CharT, _Alloc>;
+ protected:
+ typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep;
+ rope<_CharT, _Alloc>* _M_root_rope;
+
+ // root is treated as a cached version of this, and is used to
+ // detect changes to the underlying rope.
+
+ // Root is included in the reference count. This is necessary
+ // so that we can detect changes reliably. Unfortunately, it
+ // requires careful bookkeeping for the nonGC case.
+ _Rope_iterator(rope<_CharT, _Alloc>* __r, size_t __pos)
+ : _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),
+ _M_root_rope(__r)
+ { _RopeRep::_S_ref(this->_M_root);
+ if (!(__r -> empty()))
+ _S_setcache(*this);
+ }
+
+ void _M_check();
+ public:
+ typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;
+ typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer;
+
+ rope<_CharT, _Alloc>&
+ container()
+ { return *_M_root_rope; }
+
+ _Rope_iterator()
+ {
+ this->_M_root = 0; // Needed for reference counting.
+ };
+
+ _Rope_iterator(const _Rope_iterator& __x)
+ : _Rope_iterator_base<_CharT, _Alloc>(__x)
+ {
+ _M_root_rope = __x._M_root_rope;
+ _RopeRep::_S_ref(this->_M_root);
+ }
+
+ _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos);
+
+ ~_Rope_iterator()
+ { _RopeRep::_S_unref(this->_M_root); }
+
+ _Rope_iterator&
+ operator=(const _Rope_iterator& __x)
+ {
+ _RopeRep* __old = this->_M_root;
+
+ _RopeRep::_S_ref(__x._M_root);
+ if (0 != __x._M_buf_ptr)
+ {
+ _M_root_rope = __x._M_root_rope;
+ *(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x;
+ }
+ else
+ {
+ this->_M_current_pos = __x._M_current_pos;
+ this->_M_root = __x._M_root;
+ _M_root_rope = __x._M_root_rope;
+ this->_M_buf_ptr = 0;
+ }
+ _RopeRep::_S_unref(__old);
+ return(*this);
+ }
+
+ reference
+ operator*()
+ {
+ _M_check();
+ if (0 == this->_M_buf_ptr)
+ return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
+ this->_M_current_pos);
+ else
+ return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
+ this->_M_current_pos,
+ *this->_M_buf_ptr);
+ }
+
+ // See above comment.
+ reference
+ operator*() const
+ {
+ return *const_cast<_Rope_iterator&>(*this);
+ }
+
+ _Rope_iterator&
+ operator++()
+ {
+ this->_M_incr(1);
+ return *this;
+ }
+
+ _Rope_iterator&
+ operator+=(ptrdiff_t __n)
+ {
+ if (__n >= 0)
+ this->_M_incr(__n);
+ else
+ this->_M_decr(-__n);
+ return *this;
+ }
+
+ _Rope_iterator&
+ operator--()
+ {
+ this->_M_decr(1);
+ return *this;
+ }
+
+ _Rope_iterator&
+ operator-=(ptrdiff_t __n)
+ {
+ if (__n >= 0)
+ this->_M_decr(__n);
+ else
+ this->_M_incr(-__n);
+ return *this;
+ }
+
+ _Rope_iterator
+ operator++(int)
+ {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_incr(1);
+ return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
+ }
+
+ _Rope_iterator
+ operator--(int)
+ {
+ size_t __old_pos = this->_M_current_pos;
+ this->_M_decr(1);
+ return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
+ }
+
+ reference
+ operator[](ptrdiff_t __n)
+ { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
+ this->_M_current_pos
+ + __n); }
+
+ template<class _CharT2, class _Alloc2>
+ friend bool
+ operator==(const _Rope_iterator<_CharT2, _Alloc2>& __x,
+ const _Rope_iterator<_CharT2, _Alloc2>& __y);
+
+ template<class _CharT2, class _Alloc2>
+ friend bool
+ operator<(const _Rope_iterator<_CharT2, _Alloc2>& __x,
+ const _Rope_iterator<_CharT2, _Alloc2>& __y);
+
+ template<class _CharT2, class _Alloc2>
+ friend ptrdiff_t
+ operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x,
+ const _Rope_iterator<_CharT2, _Alloc2>& __y);
+
+ template<class _CharT2, class _Alloc2>
+ friend _Rope_iterator<_CharT2, _Alloc2>
+ operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
+
+ template<class _CharT2, class _Alloc2>
+ friend _Rope_iterator<_CharT2, _Alloc2>
+ operator+(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
+
+ template<class _CharT2, class _Alloc2>
+ friend _Rope_iterator<_CharT2, _Alloc2>
+ operator+(ptrdiff_t __n, const _Rope_iterator<_CharT2, _Alloc2>& __x);
+ };
+
+
+ template <class _CharT, class _Alloc>
+ struct _Rope_base
+ : public _Alloc
+ {
+ typedef _Alloc allocator_type;
+
+ allocator_type
+ get_allocator() const
+ { return *static_cast<const _Alloc*>(this); }
+
+ allocator_type&
+ _M_get_allocator()
+ { return *static_cast<_Alloc*>(this); }
+
+ const allocator_type&
+ _M_get_allocator() const
+ { return *static_cast<const _Alloc*>(this); }
+
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ // The one in _Base may not be visible due to template rules.
+
+ _Rope_base(_RopeRep* __t, const allocator_type&)
+ : _M_tree_ptr(__t) { }
+
+ _Rope_base(const allocator_type&) { }
+
+ // The only data member of a rope:
+ _RopeRep *_M_tree_ptr;
+
+#define __ROPE_DEFINE_ALLOC(_Tp, __name) \
+ typedef typename \
+ _Alloc::template rebind<_Tp>::other __name##Alloc; \
+ static _Tp* __name##_allocate(size_t __n) \
+ { return __name##Alloc().allocate(__n); } \
+ static void __name##_deallocate(_Tp *__p, size_t __n) \
+ { __name##Alloc().deallocate(__p, __n); }
+ __ROPE_DEFINE_ALLOCS(_Alloc)
+#undef __ROPE_DEFINE_ALLOC
+
+ protected:
+ _Rope_base&
+ operator=(const _Rope_base&);
+
+ _Rope_base(const _Rope_base&);
+ };
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template <class _CharT, class _Alloc>
+ class rope : public _Rope_base<_CharT, _Alloc>
+ {
+ public:
+ typedef _CharT value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef _CharT const_reference;
+ typedef const _CharT* const_pointer;
+ typedef _Rope_iterator<_CharT, _Alloc> iterator;
+ typedef _Rope_const_iterator<_CharT, _Alloc> const_iterator;
+ typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;
+ typedef _Rope_char_ptr_proxy<_CharT, _Alloc> pointer;
+
+ friend class _Rope_iterator<_CharT, _Alloc>;
+ friend class _Rope_const_iterator<_CharT, _Alloc>;
+ friend struct _Rope_RopeRep<_CharT, _Alloc>;
+ friend class _Rope_iterator_base<_CharT, _Alloc>;
+ friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;
+ friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
+ friend struct _Rope_RopeSubstring<_CharT, _Alloc>;
+
+ protected:
+ typedef _Rope_base<_CharT, _Alloc> _Base;
+ typedef typename _Base::allocator_type allocator_type;
+ using _Base::_M_tree_ptr;
+ using _Base::get_allocator;
+ using _Base::_M_get_allocator;
+ typedef __GC_CONST _CharT* _Cstrptr;
+
+ static _CharT _S_empty_c_str[1];
+
+ static bool
+ _S_is0(_CharT __c)
+ { return __c == _S_eos((_CharT*)0); }
+
+ enum { _S_copy_max = 23 };
+ // For strings shorter than _S_copy_max, we copy to
+ // concatenate.
+
+ typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
+ typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
+ typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
+ typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
+ typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
+
+ // Retrieve a character at the indicated position.
+ static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
+
+#ifndef __GC
+ // Obtain a pointer to the character at the indicated position.
+ // The pointer can be used to change the character.
+ // If such a pointer cannot be produced, as is frequently the
+ // case, 0 is returned instead.
+ // (Returns nonzero only if all nodes in the path have a refcount
+ // of 1.)
+ static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
+#endif
+
+ static bool
+ _S_apply_to_pieces(// should be template parameter
+ _Rope_char_consumer<_CharT>& __c,
+ const _RopeRep* __r,
+ size_t __begin, size_t __end);
+ // begin and end are assumed to be in range.
+
+#ifndef __GC
+ static void
+ _S_unref(_RopeRep* __t)
+ { _RopeRep::_S_unref(__t); }
+
+ static void
+ _S_ref(_RopeRep* __t)
+ { _RopeRep::_S_ref(__t); }
+
+#else /* __GC */
+ static void _S_unref(_RopeRep*) { }
+ static void _S_ref(_RopeRep*) { }
+#endif
+
+#ifdef __GC
+ typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;
+#else
+ typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;
+#endif
+
+ // _Result is counted in refcount.
+ static _RopeRep* _S_substring(_RopeRep* __base,
+ size_t __start, size_t __endp1);
+
+ static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate rope and char ptr, copying __s.
+ // Should really take an arbitrary iterator.
+ // Result is counted in refcount.
+ static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
+ const _CharT* __iter,
+ size_t __slen)
+ // As above, but one reference to __r is about to be
+ // destroyed. Thus the pieces may be recycled if all
+ // relevant reference counts are 1.
+#ifdef __GC
+ // We can't really do anything since refcounts are unavailable.
+ { return _S_concat_char_iter(__r, __iter, __slen); }
+#else
+ ;
+#endif
+
+ static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right);
+ // General concatenation on _RopeRep. _Result
+ // has refcount of 1. Adjusts argument refcounts.
+
+ public:
+ void
+ apply_to_pieces(size_t __begin, size_t __end,
+ _Rope_char_consumer<_CharT>& __c) const
+ { _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); }
+
+ protected:
+
+ static size_t
+ _S_rounded_up_size(size_t __n)
+ { return _RopeLeaf::_S_rounded_up_size(__n); }
+
+ static size_t
+ _S_allocated_capacity(size_t __n)
+ {
+ if (_S_is_basic_char_type((_CharT*)0))
+ return _S_rounded_up_size(__n) - 1;
+ else
+ return _S_rounded_up_size(__n);
+
+ }
+
+ // Allocate and construct a RopeLeaf using the supplied allocator
+ // Takes ownership of s instead of copying.
+ static _RopeLeaf*
+ _S_new_RopeLeaf(__GC_CONST _CharT *__s,
+ size_t __size, allocator_type& __a)
+ {
+ _RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1);
+ return new(__space) _RopeLeaf(__s, __size, __a);
+ }
+
+ static _RopeConcatenation*
+ _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
+ allocator_type& __a)
+ {
+ _RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1);
+ return new(__space) _RopeConcatenation(__left, __right, __a);
+ }
+
+ static _RopeFunction*
+ _S_new_RopeFunction(char_producer<_CharT>* __f,
+ size_t __size, bool __d, allocator_type& __a)
+ {
+ _RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1);
+ return new(__space) _RopeFunction(__f, __size, __d, __a);
+ }
+
+ static _RopeSubstring*
+ _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
+ size_t __l, allocator_type& __a)
+ {
+ _RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1);
+ return new(__space) _RopeSubstring(__b, __s, __l, __a);
+ }
+
+ static _RopeLeaf*
+ _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
+ size_t __size, allocator_type& __a)
+#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
+ _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
+ {
+ if (0 == __size)
+ return 0;
+ _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
+
+ __uninitialized_copy_n_a(__s, __size, __buf, __a);
+ _S_cond_store_eos(__buf[__size]);
+ __try
+ { return _S_new_RopeLeaf(__buf, __size, __a); }
+ __catch(...)
+ {
+ _RopeRep::__STL_FREE_STRING(__buf, __size, __a);
+ __throw_exception_again;
+ }
+ }
+
+ // Concatenation of nonempty strings.
+ // Always builds a concatenation node.
+ // Rebalances if the result is too deep.
+ // Result has refcount 1.
+ // Does not increment left and right ref counts even though
+ // they are referenced.
+ static _RopeRep*
+ _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
+
+ // Concatenation helper functions
+ static _RopeLeaf*
+ _S_leaf_concat_char_iter(_RopeLeaf* __r,
+ const _CharT* __iter, size_t __slen);
+ // Concatenate by copying leaf.
+ // should take an arbitrary iterator
+ // result has refcount 1.
+#ifndef __GC
+ static _RopeLeaf*
+ _S_destr_leaf_concat_char_iter(_RopeLeaf* __r,
+ const _CharT* __iter, size_t __slen);
+ // A version that potentially clobbers __r if __r->_M_ref_count == 1.
+#endif
+
+ private:
+
+ static size_t _S_char_ptr_len(const _CharT* __s);
+ // slightly generalized strlen
+
+ rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
+ : _Base(__t, __a) { }
+
+
+ // Copy __r to the _CharT buffer.
+ // Returns __buffer + __r->_M_size.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
+
+ // Again, with explicit starting position and length.
+ // Assumes that buffer is uninitialized.
+ static _CharT* _S_flatten(_RopeRep* __r,
+ size_t __start, size_t __len,
+ _CharT* __buffer);
+
+ static const unsigned long
+ _S_min_len[__detail::_S_max_rope_depth + 1];
+
+ static bool
+ _S_is_balanced(_RopeRep* __r)
+ { return (__r->_M_size >= _S_min_len[__r->_M_depth]); }
+
+ static bool
+ _S_is_almost_balanced(_RopeRep* __r)
+ { return (__r->_M_depth == 0
+ || __r->_M_size >= _S_min_len[__r->_M_depth - 1]); }
+
+ static bool
+ _S_is_roughly_balanced(_RopeRep* __r)
+ { return (__r->_M_depth <= 1
+ || __r->_M_size >= _S_min_len[__r->_M_depth - 2]); }
+
+ // Assumes the result is not empty.
+ static _RopeRep*
+ _S_concat_and_set_balanced(_RopeRep* __left, _RopeRep* __right)
+ {
+ _RopeRep* __result = _S_concat(__left, __right);
+ if (_S_is_balanced(__result))
+ __result->_M_is_balanced = true;
+ return __result;
+ }
+
+ // The basic rebalancing operation. Logically copies the
+ // rope. The result has refcount of 1. The client will
+ // usually decrement the reference count of __r.
+ // The result is within height 2 of balanced by the above
+ // definition.
+ static _RopeRep* _S_balance(_RopeRep* __r);
+
+ // Add all unbalanced subtrees to the forest of balanced trees.
+ // Used only by balance.
+ static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
+
+ // Add __r to forest, assuming __r is already balanced.
+ static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
+
+ // Print to stdout, exposing structure
+ static void _S_dump(_RopeRep* __r, int __indent = 0);
+
+ // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
+ static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
+
+ public:
+ bool
+ empty() const
+ { return 0 == this->_M_tree_ptr; }
+
+ // Comparison member function. This is public only for those
+ // clients that need a ternary comparison. Others
+ // should use the comparison operators below.
+ int
+ compare(const rope& __y) const
+ { return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }
+
+ rope(const _CharT* __s, const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ this->_M_tree_ptr =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
+ _M_get_allocator());
+ }
+
+ rope(const _CharT* __s, size_t __len,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ this->_M_tree_ptr =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, _M_get_allocator());
+ }
+
+ // Should perhaps be templatized with respect to the iterator type
+ // and use Sequence_buffer. (It should perhaps use sequence_buffer
+ // even now.)
+ rope(const _CharT* __s, const _CharT* __e,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ this->_M_tree_ptr =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, _M_get_allocator());
+ }
+
+ rope(const const_iterator& __s, const const_iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _Base(_S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos), __a)
+ { }
+
+ rope(const iterator& __s, const iterator& __e,
+ const allocator_type& __a = allocator_type())
+ : _Base(_S_substring(__s._M_root, __s._M_current_pos,
+ __e._M_current_pos), __a)
+ { }
+
+ rope(_CharT __c, const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ _CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));
+
+ _M_get_allocator().construct(__buf, __c);
+ __try
+ {
+ this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1,
+ _M_get_allocator());
+ }
+ __catch(...)
+ {
+ _RopeRep::__STL_FREE_STRING(__buf, 1, _M_get_allocator());
+ __throw_exception_again;
+ }
+ }
+
+ rope(size_t __n, _CharT __c,
+ const allocator_type& __a = allocator_type());
+
+ rope(const allocator_type& __a = allocator_type())
+ : _Base(0, __a) { }
+
+ // Construct a rope from a function that can compute its members
+ rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ {
+ this->_M_tree_ptr = (0 == __len) ?
+ 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+ }
+
+ rope(const rope& __x, const allocator_type& __a = allocator_type())
+ : _Base(__x._M_tree_ptr, __a)
+ { _S_ref(this->_M_tree_ptr); }
+
+ ~rope() throw()
+ { _S_unref(this->_M_tree_ptr); }
+
+ rope&
+ operator=(const rope& __x)
+ {
+ _RopeRep* __old = this->_M_tree_ptr;
+ this->_M_tree_ptr = __x._M_tree_ptr;
+ _S_ref(this->_M_tree_ptr);
+ _S_unref(__old);
+ return *this;
+ }
+
+ void
+ clear()
+ {
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = 0;
+ }
+
+ void
+ push_back(_CharT __x)
+ {
+ _RopeRep* __old = this->_M_tree_ptr;
+ this->_M_tree_ptr
+ = _S_destr_concat_char_iter(this->_M_tree_ptr, &__x, 1);
+ _S_unref(__old);
+ }
+
+ void
+ pop_back()
+ {
+ _RopeRep* __old = this->_M_tree_ptr;
+ this->_M_tree_ptr = _S_substring(this->_M_tree_ptr,
+ 0, this->_M_tree_ptr->_M_size - 1);
+ _S_unref(__old);
+ }
+
+ _CharT
+ back() const
+ { return _S_fetch(this->_M_tree_ptr, this->_M_tree_ptr->_M_size - 1); }
+
+ void
+ push_front(_CharT __x)
+ {
+ _RopeRep* __old = this->_M_tree_ptr;
+ _RopeRep* __left =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, _M_get_allocator());
+ __try
+ {
+ this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
+ _S_unref(__old);
+ _S_unref(__left);
+ }
+ __catch(...)
+ {
+ _S_unref(__left);
+ __throw_exception_again;
+ }
+ }
+
+ void
+ pop_front()
+ {
+ _RopeRep* __old = this->_M_tree_ptr;
+ this->_M_tree_ptr
+ = _S_substring(this->_M_tree_ptr, 1, this->_M_tree_ptr->_M_size);
+ _S_unref(__old);
+ }
+
+ _CharT
+ front() const
+ { return _S_fetch(this->_M_tree_ptr, 0); }
+
+ void
+ balance()
+ {
+ _RopeRep* __old = this->_M_tree_ptr;
+ this->_M_tree_ptr = _S_balance(this->_M_tree_ptr);
+ _S_unref(__old);
+ }
+
+ void
+ copy(_CharT* __buffer) const
+ {
+ _Destroy_const(__buffer, __buffer + size(), _M_get_allocator());
+ _S_flatten(this->_M_tree_ptr, __buffer);
+ }
+
+ // This is the copy function from the standard, but
+ // with the arguments reordered to make it consistent with the
+ // rest of the interface.
+ // Note that this guaranteed not to compile if the draft standard
+ // order is assumed.
+ size_type
+ copy(size_type __pos, size_type __n, _CharT* __buffer) const
+ {
+ size_t __size = size();
+ size_t __len = (__pos + __n > __size? __size - __pos : __n);
+
+ _Destroy_const(__buffer, __buffer + __len, _M_get_allocator());
+ _S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
+ return __len;
+ }
+
+ // Print to stdout, exposing structure. May be useful for
+ // performance debugging.
+ void
+ dump()
+ { _S_dump(this->_M_tree_ptr); }
+
+ // Convert to 0 terminated string in new allocated memory.
+ // Embedded 0s in the input do not terminate the copy.
+ const _CharT* c_str() const;
+
+ // As above, but also use the flattened representation as
+ // the new rope representation.
+ const _CharT* replace_with_c_str();
+
+ // Reclaim memory for the c_str generated flattened string.
+ // Intentionally undocumented, since it's hard to say when this
+ // is safe for multiple threads.
+ void
+ delete_c_str ()
+ {
+ if (0 == this->_M_tree_ptr)
+ return;
+ if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag &&
+ ((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
+ this->_M_tree_ptr->_M_c_string)
+ {
+ // Representation shared
+ return;
+ }
+#ifndef __GC
+ this->_M_tree_ptr->_M_free_c_string();
+#endif
+ this->_M_tree_ptr->_M_c_string = 0;
+ }
+
+ _CharT
+ operator[] (size_type __pos) const
+ { return _S_fetch(this->_M_tree_ptr, __pos); }
+
+ _CharT
+ at(size_type __pos) const
+ {
+ // if (__pos >= size()) throw out_of_range; // XXX
+ return (*this)[__pos];
+ }
+
+ const_iterator
+ begin() const
+ { return(const_iterator(this->_M_tree_ptr, 0)); }
+
+ // An easy way to get a const iterator from a non-const container.
+ const_iterator
+ const_begin() const
+ { return(const_iterator(this->_M_tree_ptr, 0)); }
+
+ const_iterator
+ end() const
+ { return(const_iterator(this->_M_tree_ptr, size())); }
+
+ const_iterator
+ const_end() const
+ { return(const_iterator(this->_M_tree_ptr, size())); }
+
+ size_type
+ size() const
+ { return(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size); }
+
+ size_type
+ length() const
+ { return size(); }
+
+ size_type
+ max_size() const
+ {
+ return _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1;
+ // Guarantees that the result can be sufficiently
+ // balanced. Longer ropes will probably still work,
+ // but it's harder to make guarantees.
+ }
+
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ const_rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ const_rend() const
+ { return const_reverse_iterator(begin()); }
+
+ template<class _CharT2, class _Alloc2>
+ friend rope<_CharT2, _Alloc2>
+ operator+(const rope<_CharT2, _Alloc2>& __left,
+ const rope<_CharT2, _Alloc2>& __right);
+
+ template<class _CharT2, class _Alloc2>
+ friend rope<_CharT2, _Alloc2>
+ operator+(const rope<_CharT2, _Alloc2>& __left, const _CharT2* __right);
+
+ template<class _CharT2, class _Alloc2>
+ friend rope<_CharT2, _Alloc2>
+ operator+(const rope<_CharT2, _Alloc2>& __left, _CharT2 __right);
+
+ // The symmetric cases are intentionally omitted, since they're
+ // presumed to be less common, and we don't handle them as well.
+
+ // The following should really be templatized. The first
+ // argument should be an input iterator or forward iterator with
+ // value_type _CharT.
+ rope&
+ append(const _CharT* __iter, size_t __n)
+ {
+ _RopeRep* __result =
+ _S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ return *this;
+ }
+
+ rope&
+ append(const _CharT* __c_string)
+ {
+ size_t __len = _S_char_ptr_len(__c_string);
+ append(__c_string, __len);
+ return(*this);
+ }
+
+ rope&
+ append(const _CharT* __s, const _CharT* __e)
+ {
+ _RopeRep* __result =
+ _S_destr_concat_char_iter(this->_M_tree_ptr, __s, __e - __s);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ return *this;
+ }
+
+ rope&
+ append(const_iterator __s, const_iterator __e)
+ {
+ _Self_destruct_ptr __appendee(_S_substring(__s._M_root,
+ __s._M_current_pos,
+ __e._M_current_pos));
+ _RopeRep* __result = _S_concat(this->_M_tree_ptr,
+ (_RopeRep*)__appendee);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ return *this;
+ }
+
+ rope&
+ append(_CharT __c)
+ {
+ _RopeRep* __result =
+ _S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ return *this;
+ }
+
+ rope&
+ append()
+ { return append(_CharT()); } // XXX why?
+
+ rope&
+ append(const rope& __y)
+ {
+ _RopeRep* __result = _S_concat(this->_M_tree_ptr, __y._M_tree_ptr);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ return *this;
+ }
+
+ rope&
+ append(size_t __n, _CharT __c)
+ {
+ rope<_CharT,_Alloc> __last(__n, __c);
+ return append(__last);
+ }
+
+ void
+ swap(rope& __b)
+ {
+ _RopeRep* __tmp = this->_M_tree_ptr;
+ this->_M_tree_ptr = __b._M_tree_ptr;
+ __b._M_tree_ptr = __tmp;
+ }
+
+ protected:
+ // Result is included in refcount.
+ static _RopeRep*
+ replace(_RopeRep* __old, size_t __pos1,
+ size_t __pos2, _RopeRep* __r)
+ {
+ if (0 == __old)
+ {
+ _S_ref(__r);
+ return __r;
+ }
+ _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
+ _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size));
+ _RopeRep* __result;
+
+ if (0 == __r)
+ __result = _S_concat(__left, __right);
+ else
+ {
+ _Self_destruct_ptr __left_result(_S_concat(__left, __r));
+ __result = _S_concat(__left_result, __right);
+ }
+ return __result;
+ }
+
+ public:
+ void
+ insert(size_t __p, const rope& __r)
+ {
+ _RopeRep* __result =
+ replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ }
+
+ void
+ insert(size_t __p, size_t __n, _CharT __c)
+ {
+ rope<_CharT,_Alloc> __r(__n,__c);
+ insert(__p, __r);
+ }
+
+ void
+ insert(size_t __p, const _CharT* __i, size_t __n)
+ {
+ _Self_destruct_ptr __left(_S_substring(this->_M_tree_ptr, 0, __p));
+ _Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr,
+ __p, size()));
+ _Self_destruct_ptr __left_result(_S_concat_char_iter(__left, __i, __n));
+ // _S_ destr_concat_char_iter should be safe here.
+ // But as it stands it's probably not a win, since __left
+ // is likely to have additional references.
+ _RopeRep* __result = _S_concat(__left_result, __right);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ }
+
+ void
+ insert(size_t __p, const _CharT* __c_string)
+ { insert(__p, __c_string, _S_char_ptr_len(__c_string)); }
+
+ void
+ insert(size_t __p, _CharT __c)
+ { insert(__p, &__c, 1); }
+
+ void
+ insert(size_t __p)
+ {
+ _CharT __c = _CharT();
+ insert(__p, &__c, 1);
+ }
+
+ void
+ insert(size_t __p, const _CharT* __i, const _CharT* __j)
+ {
+ rope __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void
+ insert(size_t __p, const const_iterator& __i,
+ const const_iterator& __j)
+ {
+ rope __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ void
+ insert(size_t __p, const iterator& __i,
+ const iterator& __j)
+ {
+ rope __r(__i, __j);
+ insert(__p, __r);
+ }
+
+ // (position, length) versions of replace operations:
+
+ void
+ replace(size_t __p, size_t __n, const rope& __r)
+ {
+ _RopeRep* __result =
+ replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ }
+
+ void
+ replace(size_t __p, size_t __n,
+ const _CharT* __i, size_t __i_len)
+ {
+ rope __r(__i, __i_len);
+ replace(__p, __n, __r);
+ }
+
+ void
+ replace(size_t __p, size_t __n, _CharT __c)
+ {
+ rope __r(__c);
+ replace(__p, __n, __r);
+ }
+
+ void
+ replace(size_t __p, size_t __n, const _CharT* __c_string)
+ {
+ rope __r(__c_string);
+ replace(__p, __n, __r);
+ }
+
+ void
+ replace(size_t __p, size_t __n,
+ const _CharT* __i, const _CharT* __j)
+ {
+ rope __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void
+ replace(size_t __p, size_t __n,
+ const const_iterator& __i, const const_iterator& __j)
+ {
+ rope __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ void
+ replace(size_t __p, size_t __n,
+ const iterator& __i, const iterator& __j)
+ {
+ rope __r(__i, __j);
+ replace(__p, __n, __r);
+ }
+
+ // Single character variants:
+ void
+ replace(size_t __p, _CharT __c)
+ {
+ iterator __i(this, __p);
+ *__i = __c;
+ }
+
+ void
+ replace(size_t __p, const rope& __r)
+ { replace(__p, 1, __r); }
+
+ void
+ replace(size_t __p, const _CharT* __i, size_t __i_len)
+ { replace(__p, 1, __i, __i_len); }
+
+ void
+ replace(size_t __p, const _CharT* __c_string)
+ { replace(__p, 1, __c_string); }
+
+ void
+ replace(size_t __p, const _CharT* __i, const _CharT* __j)
+ { replace(__p, 1, __i, __j); }
+
+ void
+ replace(size_t __p, const const_iterator& __i,
+ const const_iterator& __j)
+ { replace(__p, 1, __i, __j); }
+
+ void
+ replace(size_t __p, const iterator& __i,
+ const iterator& __j)
+ { replace(__p, 1, __i, __j); }
+
+ // Erase, (position, size) variant.
+ void
+ erase(size_t __p, size_t __n)
+ {
+ _RopeRep* __result = replace(this->_M_tree_ptr, __p,
+ __p + __n, 0);
+ _S_unref(this->_M_tree_ptr);
+ this->_M_tree_ptr = __result;
+ }
+
+ // Erase, single character
+ void
+ erase(size_t __p)
+ { erase(__p, __p + 1); }
+
+ // Insert, iterator variants.
+ iterator
+ insert(const iterator& __p, const rope& __r)
+ {
+ insert(__p.index(), __r);
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p, size_t __n, _CharT __c)
+ {
+ insert(__p.index(), __n, __c);
+ return __p;
+ }
+
+ iterator insert(const iterator& __p, _CharT __c)
+ {
+ insert(__p.index(), __c);
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p )
+ {
+ insert(__p.index());
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p, const _CharT* c_string)
+ {
+ insert(__p.index(), c_string);
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p, const _CharT* __i, size_t __n)
+ {
+ insert(__p.index(), __i, __n);
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p, const _CharT* __i,
+ const _CharT* __j)
+ {
+ insert(__p.index(), __i, __j);
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p,
+ const const_iterator& __i, const const_iterator& __j)
+ {
+ insert(__p.index(), __i, __j);
+ return __p;
+ }
+
+ iterator
+ insert(const iterator& __p,
+ const iterator& __i, const iterator& __j)
+ {
+ insert(__p.index(), __i, __j);
+ return __p;
+ }
+
+ // Replace, range variants.
+ void
+ replace(const iterator& __p, const iterator& __q, const rope& __r)
+ { replace(__p.index(), __q.index() - __p.index(), __r); }
+
+ void
+ replace(const iterator& __p, const iterator& __q, _CharT __c)
+ { replace(__p.index(), __q.index() - __p.index(), __c); }
+
+ void
+ replace(const iterator& __p, const iterator& __q,
+ const _CharT* __c_string)
+ { replace(__p.index(), __q.index() - __p.index(), __c_string); }
+
+ void
+ replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, size_t __n)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
+
+ void
+ replace(const iterator& __p, const iterator& __q,
+ const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+
+ void
+ replace(const iterator& __p, const iterator& __q,
+ const const_iterator& __i, const const_iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+
+ void
+ replace(const iterator& __p, const iterator& __q,
+ const iterator& __i, const iterator& __j)
+ { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
+
+ // Replace, iterator variants.
+ void
+ replace(const iterator& __p, const rope& __r)
+ { replace(__p.index(), __r); }
+
+ void
+ replace(const iterator& __p, _CharT __c)
+ { replace(__p.index(), __c); }
+
+ void
+ replace(const iterator& __p, const _CharT* __c_string)
+ { replace(__p.index(), __c_string); }
+
+ void
+ replace(const iterator& __p, const _CharT* __i, size_t __n)
+ { replace(__p.index(), __i, __n); }
+
+ void
+ replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
+ { replace(__p.index(), __i, __j); }
+
+ void
+ replace(const iterator& __p, const_iterator __i, const_iterator __j)
+ { replace(__p.index(), __i, __j); }
+
+ void
+ replace(const iterator& __p, iterator __i, iterator __j)
+ { replace(__p.index(), __i, __j); }
+
+ // Iterator and range variants of erase
+ iterator
+ erase(const iterator& __p, const iterator& __q)
+ {
+ size_t __p_index = __p.index();
+ erase(__p_index, __q.index() - __p_index);
+ return iterator(this, __p_index);
+ }
+
+ iterator
+ erase(const iterator& __p)
+ {
+ size_t __p_index = __p.index();
+ erase(__p_index, 1);
+ return iterator(this, __p_index);
+ }
+
+ rope
+ substr(size_t __start, size_t __len = 1) const
+ {
+ return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
+ __start,
+ __start + __len));
+ }
+
+ rope
+ substr(iterator __start, iterator __end) const
+ {
+ return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
+ __start.index(),
+ __end.index()));
+ }
+
+ rope
+ substr(iterator __start) const
+ {
+ size_t __pos = __start.index();
+ return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
+ __pos, __pos + 1));
+ }
+
+ rope
+ substr(const_iterator __start, const_iterator __end) const
+ {
+ // This might eventually take advantage of the cache in the
+ // iterator.
+ return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
+ __start.index(),
+ __end.index()));
+ }
+
+ rope<_CharT, _Alloc>
+ substr(const_iterator __start)
+ {
+ size_t __pos = __start.index();
+ return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
+ __pos, __pos + 1));
+ }
+
+ static const size_type npos;
+
+ size_type find(_CharT __c, size_type __pos = 0) const;
+
+ size_type
+ find(const _CharT* __s, size_type __pos = 0) const
+ {
+ size_type __result_pos;
+ const_iterator __result =
+ std::search(const_begin() + __pos, const_end(),
+ __s, __s + _S_char_ptr_len(__s));
+ __result_pos = __result.index();
+#ifndef __STL_OLD_ROPE_SEMANTICS
+ if (__result_pos == size())
+ __result_pos = npos;
+#endif
+ return __result_pos;
+ }
+
+ iterator
+ mutable_begin()
+ { return(iterator(this, 0)); }
+
+ iterator
+ mutable_end()
+ { return(iterator(this, size())); }
+
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+
+ reverse_iterator
+ mutable_rbegin()
+ { return reverse_iterator(mutable_end()); }
+
+ reverse_iterator
+ mutable_rend()
+ { return reverse_iterator(mutable_begin()); }
+
+ reference
+ mutable_reference_at(size_type __pos)
+ { return reference(this, __pos); }
+
+#ifdef __STD_STUFF
+ reference
+ operator[] (size_type __pos)
+ { return _char_ref_proxy(this, __pos); }
+
+ reference
+ at(size_type __pos)
+ {
+ // if (__pos >= size()) throw out_of_range; // XXX
+ return (*this)[__pos];
+ }
+
+ void resize(size_type __n, _CharT __c) { }
+ void resize(size_type __n) { }
+ void reserve(size_type __res_arg = 0) { }
+
+ size_type
+ capacity() const
+ { return max_size(); }
+
+ // Stuff below this line is dangerous because it's error prone.
+ // I would really like to get rid of it.
+ // copy function with funny arg ordering.
+ size_type
+ copy(_CharT* __buffer, size_type __n,
+ size_type __pos = 0) const
+ { return copy(__pos, __n, __buffer); }
+
+ iterator
+ end()
+ { return mutable_end(); }
+
+ iterator
+ begin()
+ { return mutable_begin(); }
+
+ reverse_iterator
+ rend()
+ { return mutable_rend(); }
+
+ reverse_iterator
+ rbegin()
+ { return mutable_rbegin(); }
+
+#else
+ const_iterator
+ end()
+ { return const_end(); }
+
+ const_iterator
+ begin()
+ { return const_begin(); }
+
+ const_reverse_iterator
+ rend()
+ { return const_rend(); }
+
+ const_reverse_iterator
+ rbegin()
+ { return const_rbegin(); }
+
+#endif
+ };
+
+ template <class _CharT, class _Alloc>
+ const typename rope<_CharT, _Alloc>::size_type
+ rope<_CharT, _Alloc>::npos = (size_type)(-1);
+
+ template <class _CharT, class _Alloc>
+ inline bool operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return (__x._M_current_pos == __y._M_current_pos
+ && __x._M_root == __y._M_root); }
+
+ template <class _CharT, class _Alloc>
+ inline bool operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return (__x._M_current_pos < __y._M_current_pos); }
+
+ template <class _CharT, class _Alloc>
+ inline bool operator!=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ template <class _CharT, class _Alloc>
+ inline bool operator>(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return __y < __x; }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator<=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator>=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ template <class _CharT, class _Alloc>
+ inline ptrdiff_t
+ operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ const _Rope_const_iterator<_CharT, _Alloc>& __y)
+ { return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_const_iterator<_CharT, _Alloc>
+ operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
+ { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
+ __x._M_current_pos - __n); }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_const_iterator<_CharT, _Alloc>
+ operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
+ { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
+ __x._M_current_pos + __n); }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_const_iterator<_CharT, _Alloc>
+ operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT, _Alloc>& __x)
+ { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
+ __x._M_current_pos + __n); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator==(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ {return (__x._M_current_pos == __y._M_current_pos
+ && __x._M_root_rope == __y._M_root_rope); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator<(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ { return (__x._M_current_pos < __y._M_current_pos); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator!=(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator>(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ { return __y < __x; }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator<=(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator>=(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ template <class _CharT, class _Alloc>
+ inline ptrdiff_t
+ operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
+ const _Rope_iterator<_CharT, _Alloc>& __y)
+ { return ((ptrdiff_t)__x._M_current_pos
+ - (ptrdiff_t)__y._M_current_pos); }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_iterator<_CharT, _Alloc>
+ operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
+ ptrdiff_t __n)
+ { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
+ __x._M_current_pos - __n); }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_iterator<_CharT, _Alloc>
+ operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
+ { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
+ __x._M_current_pos + __n); }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_iterator<_CharT, _Alloc>
+ operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)
+ { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
+ __x._M_current_pos + __n); }
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>
+ operator+(const rope<_CharT, _Alloc>& __left,
+ const rope<_CharT, _Alloc>& __right)
+ {
+ // Inlining this should make it possible to keep __left and
+ // __right in registers.
+ typedef rope<_CharT, _Alloc> rope_type;
+ return rope_type(rope_type::_S_concat(__left._M_tree_ptr,
+ __right._M_tree_ptr));
+ }
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>&
+ operator+=(rope<_CharT, _Alloc>& __left,
+ const rope<_CharT, _Alloc>& __right)
+ {
+ __left.append(__right);
+ return __left;
+ }
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>
+ operator+(const rope<_CharT, _Alloc>& __left,
+ const _CharT* __right)
+ {
+ typedef rope<_CharT, _Alloc> rope_type;
+ size_t __rlen = rope_type::_S_char_ptr_len(__right);
+ return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
+ __right, __rlen));
+ }
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>&
+ operator+=(rope<_CharT, _Alloc>& __left,
+ const _CharT* __right)
+ {
+ __left.append(__right);
+ return __left;
+ }
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>
+ operator+(const rope<_CharT, _Alloc>& __left, _CharT __right)
+ {
+ typedef rope<_CharT, _Alloc> rope_type;
+ return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
+ &__right, 1));
+ }
+
+ template <class _CharT, class _Alloc>
+ inline rope<_CharT, _Alloc>&
+ operator+=(rope<_CharT, _Alloc>& __left, _CharT __right)
+ {
+ __left.append(__right);
+ return __left;
+ }
+
+ template <class _CharT, class _Alloc>
+ bool
+ operator<(const rope<_CharT, _Alloc>& __left,
+ const rope<_CharT, _Alloc>& __right)
+ { return __left.compare(__right) < 0; }
+
+ template <class _CharT, class _Alloc>
+ bool
+ operator==(const rope<_CharT, _Alloc>& __left,
+ const rope<_CharT, _Alloc>& __right)
+ { return __left.compare(__right) == 0; }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)
+ { return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator!=(const rope<_CharT, _Alloc>& __x,
+ const rope<_CharT, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator>(const rope<_CharT, _Alloc>& __x,
+ const rope<_CharT, _Alloc>& __y)
+ { return __y < __x; }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator<=(const rope<_CharT, _Alloc>& __x,
+ const rope<_CharT, _Alloc>& __y)
+ { return !(__y < __x); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator>=(const rope<_CharT, _Alloc>& __x,
+ const rope<_CharT, _Alloc>& __y)
+ { return !(__x < __y); }
+
+ template <class _CharT, class _Alloc>
+ inline bool
+ operator!=(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
+ const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)
+ { return !(__x == __y); }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r);
+
+ typedef rope<char> crope;
+ typedef rope<wchar_t> wrope;
+
+ inline crope::reference
+ __mutable_reference_at(crope& __c, size_t __i)
+ { return __c.mutable_reference_at(__i); }
+
+ inline wrope::reference
+ __mutable_reference_at(wrope& __c, size_t __i)
+ { return __c.mutable_reference_at(__i); }
+
+ template <class _CharT, class _Alloc>
+ inline void
+ swap(rope<_CharT, _Alloc>& __x, rope<_CharT, _Alloc>& __y)
+ { __x.swap(__y); }
+
+_GLIBCXX_END_NAMESPACE
+
+
+namespace std
+{
+namespace tr1
+{
+ template<>
+ struct hash<__gnu_cxx::crope>
+ {
+ size_t
+ operator()(const __gnu_cxx::crope& __str) const
+ {
+ size_t __size = __str.size();
+ if (0 == __size)
+ return 0;
+ return 13 * __str[0] + 5 * __str[__size - 1] + __size;
+ }
+ };
+
+
+ template<>
+ struct hash<__gnu_cxx::wrope>
+ {
+ size_t
+ operator()(const __gnu_cxx::wrope& __str) const
+ {
+ size_t __size = __str.size();
+ if (0 == __size)
+ return 0;
+ return 13 * __str[0] + 5 * __str[__size - 1] + __size;
+ }
+ };
+} // namespace tr1
+} // namespace std
+
+# include <ext/ropeimpl.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/ropeimpl.h b/gcc-4.4.0/libstdc++-v3/include/ext/ropeimpl.h
new file mode 100644
index 000000000..e79bca40b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/ropeimpl.h
@@ -0,0 +1,1701 @@
+// SGI's rope class implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file ropeimpl.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#include <cstdio>
+#include <ostream>
+#include <bits/functexcept.h>
+
+#include <ext/algorithm> // For copy_n and lexicographical_compare_3way
+#include <ext/memory> // For uninitialized_copy_n
+#include <ext/numeric> // For power
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::printf;
+ using std::basic_ostream;
+ using std::__throw_length_error;
+ using std::_Destroy;
+ using std::uninitialized_fill_n;
+
+ // Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
+ // if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
+ // Results in a valid buf_ptr if the iterator can be legitimately
+ // dereferenced.
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_iterator_base<_CharT, _Alloc>::
+ _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x)
+ {
+ const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
+ size_t __leaf_pos = __x._M_leaf_pos;
+ size_t __pos = __x._M_current_pos;
+
+ switch(__leaf->_M_tag)
+ {
+ case __detail::_S_leaf:
+ __x._M_buf_start = ((_Rope_RopeLeaf<_CharT, _Alloc>*)__leaf)->_M_data;
+ __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
+ __x._M_buf_end = __x._M_buf_start + __leaf->_M_size;
+ break;
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ {
+ size_t __len = _S_iterator_buf_len;
+ size_t __buf_start_pos = __leaf_pos;
+ size_t __leaf_end = __leaf_pos + __leaf->_M_size;
+ char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT,
+ _Alloc>*)__leaf)->_M_fn;
+ if (__buf_start_pos + __len <= __pos)
+ {
+ __buf_start_pos = __pos - __len / 4;
+ if (__buf_start_pos + __len > __leaf_end)
+ __buf_start_pos = __leaf_end - __len;
+ }
+ if (__buf_start_pos + __len > __leaf_end)
+ __len = __leaf_end - __buf_start_pos;
+ (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf);
+ __x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos);
+ __x._M_buf_start = __x._M_tmp_buf;
+ __x._M_buf_end = __x._M_tmp_buf + __len;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Set path and buffer inside a rope iterator. We assume that
+ // pos and root are already set.
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_iterator_base<_CharT, _Alloc>::
+ _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)
+ {
+ const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1];
+ const _RopeRep* __curr_rope;
+ int __curr_depth = -1; /* index into path */
+ size_t __curr_start_pos = 0;
+ size_t __pos = __x._M_current_pos;
+ unsigned char __dirns = 0; // Bit vector marking right turns in the path
+
+ if (__pos >= __x._M_root->_M_size)
+ {
+ __x._M_buf_ptr = 0;
+ return;
+ }
+ __curr_rope = __x._M_root;
+ if (0 != __curr_rope->_M_c_string)
+ {
+ /* Treat the root as a leaf. */
+ __x._M_buf_start = __curr_rope->_M_c_string;
+ __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size;
+ __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
+ __x._M_path_end[0] = __curr_rope;
+ __x._M_leaf_index = 0;
+ __x._M_leaf_pos = 0;
+ return;
+ }
+ for(;;)
+ {
+ ++__curr_depth;
+ __path[__curr_depth] = __curr_rope;
+ switch(__curr_rope->_M_tag)
+ {
+ case __detail::_S_leaf:
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ __x._M_leaf_pos = __curr_start_pos;
+ goto done;
+ case __detail::_S_concat:
+ {
+ _Rope_RopeConcatenation<_CharT, _Alloc>* __c =
+ (_Rope_RopeConcatenation<_CharT, _Alloc>*)__curr_rope;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size;
+
+ __dirns <<= 1;
+ if (__pos >= __curr_start_pos + __left_len)
+ {
+ __dirns |= 1;
+ __curr_rope = __c->_M_right;
+ __curr_start_pos += __left_len;
+ }
+ else
+ __curr_rope = __left;
+ }
+ break;
+ }
+ }
+ done:
+ // Copy last section of path into _M_path_end.
+ {
+ int __i = -1;
+ int __j = __curr_depth + 1 - int(_S_path_cache_len);
+
+ if (__j < 0) __j = 0;
+ while (__j <= __curr_depth)
+ __x._M_path_end[++__i] = __path[__j++];
+ __x._M_leaf_index = __i;
+ }
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+ }
+
+ // Specialized version of the above. Assumes that
+ // the path cache is valid for the previous position.
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_iterator_base<_CharT, _Alloc>::
+ _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x)
+ {
+ int __current_index = __x._M_leaf_index;
+ const _RopeRep* __current_node = __x._M_path_end[__current_index];
+ size_t __len = __current_node->_M_size;
+ size_t __node_start_pos = __x._M_leaf_pos;
+ unsigned char __dirns = __x._M_path_directions;
+ _Rope_RopeConcatenation<_CharT, _Alloc>* __c;
+
+ if (__x._M_current_pos - __node_start_pos < __len)
+ {
+ /* More stuff in this leaf, we just didn't cache it. */
+ _S_setbuf(__x);
+ return;
+ }
+ // node_start_pos is starting position of last_node.
+ while (--__current_index >= 0)
+ {
+ if (!(__dirns & 1) /* Path turned left */)
+ break;
+ __current_node = __x._M_path_end[__current_index];
+ __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;
+ // Otherwise we were in the right child. Thus we should pop
+ // the concatenation node.
+ __node_start_pos -= __c->_M_left->_M_size;
+ __dirns >>= 1;
+ }
+ if (__current_index < 0)
+ {
+ // We underflowed the cache. Punt.
+ _S_setcache(__x);
+ return;
+ }
+ __current_node = __x._M_path_end[__current_index];
+ __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;
+ // current_node is a concatenation node. We are positioned on the first
+ // character in its right child.
+ // node_start_pos is starting position of current_node.
+ __node_start_pos += __c->_M_left->_M_size;
+ __current_node = __c->_M_right;
+ __x._M_path_end[++__current_index] = __current_node;
+ __dirns |= 1;
+ while (__detail::_S_concat == __current_node->_M_tag)
+ {
+ ++__current_index;
+ if (int(_S_path_cache_len) == __current_index)
+ {
+ int __i;
+ for (__i = 0; __i < int(_S_path_cache_len) - 1; __i++)
+ __x._M_path_end[__i] = __x._M_path_end[__i+1];
+ --__current_index;
+ }
+ __current_node =
+ ((_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node)->_M_left;
+ __x._M_path_end[__current_index] = __current_node;
+ __dirns <<= 1;
+ // node_start_pos is unchanged.
+ }
+ __x._M_leaf_index = __current_index;
+ __x._M_leaf_pos = __node_start_pos;
+ __x._M_path_directions = __dirns;
+ _S_setbuf(__x);
+ }
+
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_iterator_base<_CharT, _Alloc>::
+ _M_incr(size_t __n)
+ {
+ _M_current_pos += __n;
+ if (0 != _M_buf_ptr)
+ {
+ size_t __chars_left = _M_buf_end - _M_buf_ptr;
+ if (__chars_left > __n)
+ _M_buf_ptr += __n;
+ else if (__chars_left == __n)
+ {
+ _M_buf_ptr += __n;
+ _S_setcache_for_incr(*this);
+ }
+ else
+ _M_buf_ptr = 0;
+ }
+ }
+
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_iterator_base<_CharT, _Alloc>::
+ _M_decr(size_t __n)
+ {
+ if (0 != _M_buf_ptr)
+ {
+ size_t __chars_left = _M_buf_ptr - _M_buf_start;
+ if (__chars_left >= __n)
+ _M_buf_ptr -= __n;
+ else
+ _M_buf_ptr = 0;
+ }
+ _M_current_pos -= __n;
+ }
+
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_iterator<_CharT, _Alloc>::
+ _M_check()
+ {
+ if (_M_root_rope->_M_tree_ptr != this->_M_root)
+ {
+ // _Rope was modified. Get things fixed up.
+ _RopeRep::_S_unref(this->_M_root);
+ this->_M_root = _M_root_rope->_M_tree_ptr;
+ _RopeRep::_S_ref(this->_M_root);
+ this->_M_buf_ptr = 0;
+ }
+ }
+
+ template <class _CharT, class _Alloc>
+ inline
+ _Rope_const_iterator<_CharT, _Alloc>::
+ _Rope_const_iterator(const _Rope_iterator<_CharT, _Alloc>& __x)
+ : _Rope_iterator_base<_CharT, _Alloc>(__x)
+ { }
+
+ template <class _CharT, class _Alloc>
+ inline
+ _Rope_iterator<_CharT, _Alloc>::
+ _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos)
+ : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
+ _M_root_rope(&__r)
+ { _RopeRep::_S_ref(this->_M_root); }
+
+ template <class _CharT, class _Alloc>
+ inline size_t
+ rope<_CharT, _Alloc>::
+ _S_char_ptr_len(const _CharT* __s)
+ {
+ const _CharT* __p = __s;
+
+ while (!_S_is0(*__p))
+ ++__p;
+ return (__p - __s);
+ }
+
+
+#ifndef __GC
+
+ template <class _CharT, class _Alloc>
+ inline void
+ _Rope_RopeRep<_CharT, _Alloc>::
+ _M_free_c_string()
+ {
+ _CharT* __cstr = _M_c_string;
+ if (0 != __cstr)
+ {
+ size_t __size = this->_M_size + 1;
+ _Destroy(__cstr, __cstr + __size, _M_get_allocator());
+ this->_Data_deallocate(__cstr, __size);
+ }
+ }
+
+ template <class _CharT, class _Alloc>
+ inline void
+ _Rope_RopeRep<_CharT, _Alloc>::
+ _S_free_string(_CharT* __s, size_t __n, allocator_type& __a)
+ {
+ if (!_S_is_basic_char_type((_CharT*)0))
+ _Destroy(__s, __s + __n, __a);
+
+ // This has to be a static member, so this gets a bit messy
+ __a.deallocate(__s,
+ _Rope_RopeLeaf<_CharT, _Alloc>::_S_rounded_up_size(__n));
+ }
+
+ // There are several reasons for not doing this with virtual destructors
+ // and a class specific delete operator:
+ // - A class specific delete operator can't easily get access to
+ // allocator instances if we need them.
+ // - Any virtual function would need a 4 or byte vtable pointer;
+ // this only requires a one byte tag per object.
+ template <class _CharT, class _Alloc>
+ void
+ _Rope_RopeRep<_CharT, _Alloc>::
+ _M_free_tree()
+ {
+ switch(_M_tag)
+ {
+ case __detail::_S_leaf:
+ {
+ _Rope_RopeLeaf<_CharT, _Alloc>* __l
+ = (_Rope_RopeLeaf<_CharT, _Alloc>*)this;
+ __l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();
+ _L_deallocate(__l, 1);
+ break;
+ }
+ case __detail::_S_concat:
+ {
+ _Rope_RopeConcatenation<_CharT,_Alloc>* __c
+ = (_Rope_RopeConcatenation<_CharT, _Alloc>*)this;
+ __c->_Rope_RopeConcatenation<_CharT, _Alloc>::
+ ~_Rope_RopeConcatenation();
+ _C_deallocate(__c, 1);
+ break;
+ }
+ case __detail::_S_function:
+ {
+ _Rope_RopeFunction<_CharT, _Alloc>* __f
+ = (_Rope_RopeFunction<_CharT, _Alloc>*)this;
+ __f->_Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();
+ _F_deallocate(__f, 1);
+ break;
+ }
+ case __detail::_S_substringfn:
+ {
+ _Rope_RopeSubstring<_CharT, _Alloc>* __ss =
+ (_Rope_RopeSubstring<_CharT, _Alloc>*)this;
+ __ss->_Rope_RopeSubstring<_CharT, _Alloc>::
+ ~_Rope_RopeSubstring();
+ _S_deallocate(__ss, 1);
+ break;
+ }
+ }
+ }
+#else
+
+ template <class _CharT, class _Alloc>
+ inline void
+ _Rope_RopeRep<_CharT, _Alloc>::
+ _S_free_string(const _CharT*, size_t, allocator_type)
+ { }
+
+#endif
+
+ // Concatenate a C string onto a leaf rope by copying the rope data.
+ // Used for short ropes.
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT, _Alloc>::_RopeLeaf*
+ rope<_CharT, _Alloc>::
+ _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
+ {
+ size_t __old_len = __r->_M_size;
+ _CharT* __new_data = (_CharT*)
+ _Data_allocate(_S_rounded_up_size(__old_len + __len));
+ _RopeLeaf* __result;
+
+ uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
+ uninitialized_copy_n(__iter, __len, __new_data + __old_len);
+ _S_cond_store_eos(__new_data[__old_len + __len]);
+ __try
+ {
+ __result = _S_new_RopeLeaf(__new_data, __old_len + __len,
+ __r->_M_get_allocator());
+ }
+ __catch(...)
+ {
+ _RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
+ __r->_M_get_allocator());
+ __throw_exception_again;
+ }
+ return __result;
+ }
+
+#ifndef __GC
+ // As above, but it's OK to clobber original if refcount is 1
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT,_Alloc>::_RopeLeaf*
+ rope<_CharT, _Alloc>::
+ _S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,
+ size_t __len)
+ {
+ if (__r->_M_ref_count > 1)
+ return _S_leaf_concat_char_iter(__r, __iter, __len);
+ size_t __old_len = __r->_M_size;
+ if (_S_allocated_capacity(__old_len) >= __old_len + __len)
+ {
+ // The space has been partially initialized for the standard
+ // character types. But that doesn't matter for those types.
+ uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len);
+ if (_S_is_basic_char_type((_CharT*)0))
+ _S_cond_store_eos(__r->_M_data[__old_len + __len]);
+ else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string)
+ {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+ __r->_M_size = __old_len + __len;
+ __r->_M_ref_count = 2;
+ return __r;
+ }
+ else
+ {
+ _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
+ return __result;
+ }
+ }
+#endif
+
+ // Assumes left and right are not 0.
+ // Does not increment (nor decrement on exception) child reference counts.
+ // Result has ref count 1.
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT, _Alloc>::_RopeRep*
+ rope<_CharT, _Alloc>::
+ _S_tree_concat(_RopeRep* __left, _RopeRep* __right)
+ {
+ _RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
+ __left->
+ _M_get_allocator());
+ size_t __depth = __result->_M_depth;
+
+ if (__depth > 20
+ && (__result->_M_size < 1000
+ || __depth > size_t(__detail::_S_max_rope_depth)))
+ {
+ _RopeRep* __balanced;
+
+ __try
+ {
+ __balanced = _S_balance(__result);
+ __result->_M_unref_nonnil();
+ }
+ __catch(...)
+ {
+ _C_deallocate(__result,1);
+ __throw_exception_again;
+ }
+ // In case of exception, we need to deallocate
+ // otherwise dangling result node. But caller
+ // still owns its children. Thus unref is
+ // inappropriate.
+ return __balanced;
+ }
+ else
+ return __result;
+ }
+
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT, _Alloc>::_RopeRep*
+ rope<_CharT, _Alloc>::
+ _S_concat_char_iter(_RopeRep* __r, const _CharT*__s, size_t __slen)
+ {
+ _RopeRep* __result;
+ if (0 == __slen)
+ {
+ _S_ref(__r);
+ return __r;
+ }
+ if (0 == __r)
+ return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
+ __r->_M_get_allocator());
+ if (__r->_M_tag == __detail::_S_leaf
+ && __r->_M_size + __slen <= size_t(_S_copy_max))
+ {
+ __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
+ return __result;
+ }
+ if (__detail::_S_concat == __r->_M_tag
+ && __detail::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag)
+ {
+ _RopeLeaf* __right =
+ (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
+ if (__right->_M_size + __slen <= size_t(_S_copy_max))
+ {
+ _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
+ _RopeRep* __nright =
+ _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
+ __left->_M_ref_nonnil();
+ __try
+ { __result = _S_tree_concat(__left, __nright); }
+ __catch(...)
+ {
+ _S_unref(__left);
+ _S_unref(__nright);
+ __throw_exception_again;
+ }
+ return __result;
+ }
+ }
+ _RopeRep* __nright =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
+ __try
+ {
+ __r->_M_ref_nonnil();
+ __result = _S_tree_concat(__r, __nright);
+ }
+ __catch(...)
+ {
+ _S_unref(__r);
+ _S_unref(__nright);
+ __throw_exception_again;
+ }
+ return __result;
+ }
+
+#ifndef __GC
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT,_Alloc>::_RopeRep*
+ rope<_CharT,_Alloc>::
+ _S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s, size_t __slen)
+ {
+ _RopeRep* __result;
+ if (0 == __r)
+ return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
+ __r->_M_get_allocator());
+ size_t __count = __r->_M_ref_count;
+ size_t __orig_size = __r->_M_size;
+ if (__count > 1)
+ return _S_concat_char_iter(__r, __s, __slen);
+ if (0 == __slen)
+ {
+ __r->_M_ref_count = 2; // One more than before
+ return __r;
+ }
+ if (__orig_size + __slen <= size_t(_S_copy_max)
+ && __detail::_S_leaf == __r->_M_tag)
+ {
+ __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s,
+ __slen);
+ return __result;
+ }
+ if (__detail::_S_concat == __r->_M_tag)
+ {
+ _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)
+ __r)->_M_right);
+ if (__detail::_S_leaf == __right->_M_tag
+ && __right->_M_size + __slen <= size_t(_S_copy_max))
+ {
+ _RopeRep* __new_right =
+ _S_destr_leaf_concat_char_iter(__right, __s, __slen);
+ if (__right == __new_right)
+ __new_right->_M_ref_count = 1;
+ else
+ __right->_M_unref_nonnil();
+ __r->_M_ref_count = 2; // One more than before.
+ ((_RopeConcatenation*)__r)->_M_right = __new_right;
+ __r->_M_size = __orig_size + __slen;
+ if (0 != __r->_M_c_string)
+ {
+ __r->_M_free_c_string();
+ __r->_M_c_string = 0;
+ }
+ return __r;
+ }
+ }
+ _RopeRep* __right =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
+ __r->_M_ref_nonnil();
+ __try
+ { __result = _S_tree_concat(__r, __right); }
+ __catch(...)
+ {
+ _S_unref(__r);
+ _S_unref(__right);
+ __throw_exception_again;
+ }
+ return __result;
+ }
+#endif /* !__GC */
+
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT, _Alloc>::_RopeRep*
+ rope<_CharT, _Alloc>::
+ _S_concat(_RopeRep* __left, _RopeRep* __right)
+ {
+ if (0 == __left)
+ {
+ _S_ref(__right);
+ return __right;
+ }
+ if (0 == __right)
+ {
+ __left->_M_ref_nonnil();
+ return __left;
+ }
+ if (__detail::_S_leaf == __right->_M_tag)
+ {
+ if (__detail::_S_leaf == __left->_M_tag)
+ {
+ if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max))
+ return _S_leaf_concat_char_iter((_RopeLeaf*)__left,
+ ((_RopeLeaf*)__right)->_M_data,
+ __right->_M_size);
+ }
+ else if (__detail::_S_concat == __left->_M_tag
+ && __detail::_S_leaf == ((_RopeConcatenation*)
+ __left)->_M_right->_M_tag)
+ {
+ _RopeLeaf* __leftright =
+ (_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);
+ if (__leftright->_M_size
+ + __right->_M_size <= size_t(_S_copy_max))
+ {
+ _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;
+ _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
+ ((_RopeLeaf*)
+ __right)->
+ _M_data,
+ __right->_M_size);
+ __leftleft->_M_ref_nonnil();
+ __try
+ { return(_S_tree_concat(__leftleft, __rest)); }
+ __catch(...)
+ {
+ _S_unref(__leftleft);
+ _S_unref(__rest);
+ __throw_exception_again;
+ }
+ }
+ }
+ }
+ __left->_M_ref_nonnil();
+ __right->_M_ref_nonnil();
+ __try
+ { return(_S_tree_concat(__left, __right)); }
+ __catch(...)
+ {
+ _S_unref(__left);
+ _S_unref(__right);
+ __throw_exception_again;
+ }
+ }
+
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT, _Alloc>::_RopeRep*
+ rope<_CharT, _Alloc>::
+ _S_substring(_RopeRep* __base, size_t __start, size_t __endp1)
+ {
+ if (0 == __base)
+ return 0;
+ size_t __len = __base->_M_size;
+ size_t __adj_endp1;
+ const size_t __lazy_threshold = 128;
+
+ if (__endp1 >= __len)
+ {
+ if (0 == __start)
+ {
+ __base->_M_ref_nonnil();
+ return __base;
+ }
+ else
+ __adj_endp1 = __len;
+
+ }
+ else
+ __adj_endp1 = __endp1;
+
+ switch(__base->_M_tag)
+ {
+ case __detail::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__base;
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ size_t __left_len = __left->_M_size;
+ _RopeRep* __result;
+
+ if (__adj_endp1 <= __left_len)
+ return _S_substring(__left, __start, __endp1);
+ else if (__start >= __left_len)
+ return _S_substring(__right, __start - __left_len,
+ __adj_endp1 - __left_len);
+ _Self_destruct_ptr __left_result(_S_substring(__left,
+ __start,
+ __left_len));
+ _Self_destruct_ptr __right_result(_S_substring(__right, 0,
+ __endp1
+ - __left_len));
+ __result = _S_concat(__left_result, __right_result);
+ return __result;
+ }
+ case __detail::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__base;
+ _RopeLeaf* __result;
+ size_t __result_len;
+ if (__start >= __adj_endp1)
+ return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold)
+ goto lazy;
+#ifdef __GC
+ const _CharT* __section = __l->_M_data + __start;
+ __result = _S_new_RopeLeaf(__section, __result_len,
+ __base->_M_get_allocator());
+ __result->_M_c_string = 0; // Not eos terminated.
+#else
+ // We should sometimes create substring node instead.
+ __result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start,
+ __result_len,
+ __base->
+ _M_get_allocator());
+#endif
+ return __result;
+ }
+ case __detail::_S_substringfn:
+ // Avoid introducing multiple layers of substring nodes.
+ {
+ _RopeSubstring* __old = (_RopeSubstring*)__base;
+ size_t __result_len;
+ if (__start >= __adj_endp1)
+ return 0;
+ __result_len = __adj_endp1 - __start;
+ if (__result_len > __lazy_threshold)
+ {
+ _RopeSubstring* __result =
+ _S_new_RopeSubstring(__old->_M_base,
+ __start + __old->_M_start,
+ __adj_endp1 - __start,
+ __base->_M_get_allocator());
+ return __result;
+
+ } // *** else fall through: ***
+ }
+ case __detail::_S_function:
+ {
+ _RopeFunction* __f = (_RopeFunction*)__base;
+ _CharT* __section;
+ size_t __result_len;
+ if (__start >= __adj_endp1)
+ return 0;
+ __result_len = __adj_endp1 - __start;
+
+ if (__result_len > __lazy_threshold)
+ goto lazy;
+ __section = (_CharT*)
+ _Data_allocate(_S_rounded_up_size(__result_len));
+ __try
+ { (*(__f->_M_fn))(__start, __result_len, __section); }
+ __catch(...)
+ {
+ _RopeRep::__STL_FREE_STRING(__section, __result_len,
+ __base->_M_get_allocator());
+ __throw_exception_again;
+ }
+ _S_cond_store_eos(__section[__result_len]);
+ return _S_new_RopeLeaf(__section, __result_len,
+ __base->_M_get_allocator());
+ }
+ }
+ lazy:
+ {
+ // Create substring node.
+ return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
+ __base->_M_get_allocator());
+ }
+ }
+
+ template<class _CharT>
+ class _Rope_flatten_char_consumer
+ : public _Rope_char_consumer<_CharT>
+ {
+ private:
+ _CharT* _M_buf_ptr;
+ public:
+
+ _Rope_flatten_char_consumer(_CharT* __buffer)
+ { _M_buf_ptr = __buffer; };
+
+ ~_Rope_flatten_char_consumer() {}
+
+ bool
+ operator()(const _CharT* __leaf, size_t __n)
+ {
+ uninitialized_copy_n(__leaf, __n, _M_buf_ptr);
+ _M_buf_ptr += __n;
+ return true;
+ }
+ };
+
+ template<class _CharT>
+ class _Rope_find_char_char_consumer
+ : public _Rope_char_consumer<_CharT>
+ {
+ private:
+ _CharT _M_pattern;
+ public:
+ size_t _M_count; // Number of nonmatching characters
+
+ _Rope_find_char_char_consumer(_CharT __p)
+ : _M_pattern(__p), _M_count(0) {}
+
+ ~_Rope_find_char_char_consumer() {}
+
+ bool
+ operator()(const _CharT* __leaf, size_t __n)
+ {
+ size_t __i;
+ for (__i = 0; __i < __n; __i++)
+ {
+ if (__leaf[__i] == _M_pattern)
+ {
+ _M_count += __i;
+ return false;
+ }
+ }
+ _M_count += __n; return true;
+ }
+ };
+
+ template<class _CharT, class _Traits>
+ // Here _CharT is both the stream and rope character type.
+ class _Rope_insert_char_consumer
+ : public _Rope_char_consumer<_CharT>
+ {
+ private:
+ typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
+ _Insert_ostream& _M_o;
+ public:
+ _Rope_insert_char_consumer(_Insert_ostream& __writer)
+ : _M_o(__writer) {};
+ ~_Rope_insert_char_consumer() { };
+ // Caller is presumed to own the ostream
+ bool operator() (const _CharT* __leaf, size_t __n);
+ // Returns true to continue traversal.
+ };
+
+ template<class _CharT, class _Traits>
+ bool
+ _Rope_insert_char_consumer<_CharT, _Traits>::
+ operator()(const _CharT* __leaf, size_t __n)
+ {
+ size_t __i;
+ // We assume that formatting is set up correctly for each element.
+ for (__i = 0; __i < __n; __i++)
+ _M_o.put(__leaf[__i]);
+ return true;
+ }
+
+ template <class _CharT, class _Alloc>
+ bool
+ rope<_CharT, _Alloc>::
+ _S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c,
+ const _RopeRep* __r, size_t __begin, size_t __end)
+ {
+ if (0 == __r)
+ return true;
+ switch(__r->_M_tag)
+ {
+ case __detail::_S_concat:
+ {
+ _RopeConcatenation* __conc = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __conc->_M_left;
+ size_t __left_len = __left->_M_size;
+ if (__begin < __left_len)
+ {
+ size_t __left_end = std::min(__left_len, __end);
+ if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
+ return false;
+ }
+ if (__end > __left_len)
+ {
+ _RopeRep* __right = __conc->_M_right;
+ size_t __right_start = std::max(__left_len, __begin);
+ if (!_S_apply_to_pieces(__c, __right,
+ __right_start - __left_len,
+ __end - __left_len))
+ return false;
+ }
+ }
+ return true;
+ case __detail::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ return __c(__l->_M_data + __begin, __end - __begin);
+ }
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ {
+ _RopeFunction* __f = (_RopeFunction*)__r;
+ size_t __len = __end - __begin;
+ bool __result;
+ _CharT* __buffer =
+ (_CharT*)_Alloc().allocate(__len * sizeof(_CharT));
+ __try
+ {
+ (*(__f->_M_fn))(__begin, __len, __buffer);
+ __result = __c(__buffer, __len);
+ _Alloc().deallocate(__buffer, __len * sizeof(_CharT));
+ }
+ __catch(...)
+ {
+ _Alloc().deallocate(__buffer, __len * sizeof(_CharT));
+ __throw_exception_again;
+ }
+ return __result;
+ }
+ default:
+ return false;
+ }
+ }
+
+ template<class _CharT, class _Traits>
+ inline void
+ _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
+ {
+ char __f = __o.fill();
+ size_t __i;
+
+ for (__i = 0; __i < __n; __i++)
+ __o.put(__f);
+ }
+
+
+ template <class _CharT>
+ inline bool
+ _Rope_is_simple(_CharT*)
+ { return false; }
+
+ inline bool
+ _Rope_is_simple(char*)
+ { return true; }
+
+ inline bool
+ _Rope_is_simple(wchar_t*)
+ { return true; }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r)
+ {
+ size_t __w = __o.width();
+ bool __left = bool(__o.flags() & std::ios::left);
+ size_t __pad_len;
+ size_t __rope_len = __r.size();
+ _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
+ bool __is_simple = _Rope_is_simple((_CharT*)0);
+
+ if (__rope_len < __w)
+ __pad_len = __w - __rope_len;
+ else
+ __pad_len = 0;
+
+ if (!__is_simple)
+ __o.width(__w / __rope_len);
+ __try
+ {
+ if (__is_simple && !__left && __pad_len > 0)
+ _Rope_fill(__o, __pad_len);
+ __r.apply_to_pieces(0, __r.size(), __c);
+ if (__is_simple && __left && __pad_len > 0)
+ _Rope_fill(__o, __pad_len);
+ if (!__is_simple)
+ __o.width(__w);
+ }
+ __catch(...)
+ {
+ if (!__is_simple)
+ __o.width(__w);
+ __throw_exception_again;
+ }
+ return __o;
+ }
+
+ template <class _CharT, class _Alloc>
+ _CharT*
+ rope<_CharT, _Alloc>::
+ _S_flatten(_RopeRep* __r, size_t __start, size_t __len,
+ _CharT* __buffer)
+ {
+ _Rope_flatten_char_consumer<_CharT> __c(__buffer);
+ _S_apply_to_pieces(__c, __r, __start, __start + __len);
+ return(__buffer + __len);
+ }
+
+ template <class _CharT, class _Alloc>
+ size_t
+ rope<_CharT, _Alloc>::
+ find(_CharT __pattern, size_t __start) const
+ {
+ _Rope_find_char_char_consumer<_CharT> __c(__pattern);
+ _S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());
+ size_type __result_pos = __start + __c._M_count;
+#ifndef __STL_OLD_ROPE_SEMANTICS
+ if (__result_pos == size())
+ __result_pos = npos;
+#endif
+ return __result_pos;
+ }
+
+ template <class _CharT, class _Alloc>
+ _CharT*
+ rope<_CharT, _Alloc>::
+ _S_flatten(_RopeRep* __r, _CharT* __buffer)
+ {
+ if (0 == __r)
+ return __buffer;
+ switch(__r->_M_tag)
+ {
+ case __detail::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+ _CharT* __rest = _S_flatten(__left, __buffer);
+ return _S_flatten(__right, __rest);
+ }
+ case __detail::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ return copy_n(__l->_M_data, __l->_M_size, __buffer).second;
+ }
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ // We don't yet do anything with substring nodes.
+ // This needs to be fixed before ropefiles will work well.
+ {
+ _RopeFunction* __f = (_RopeFunction*)__r;
+ (*(__f->_M_fn))(0, __f->_M_size, __buffer);
+ return __buffer + __f->_M_size;
+ }
+ default:
+ return 0;
+ }
+ }
+
+ // This needs work for _CharT != char
+ template <class _CharT, class _Alloc>
+ void
+ rope<_CharT, _Alloc>::
+ _S_dump(_RopeRep* __r, int __indent)
+ {
+ for (int __i = 0; __i < __indent; __i++)
+ putchar(' ');
+ if (0 == __r)
+ {
+ printf("NULL\n");
+ return;
+ }
+ if (_S_concat == __r->_M_tag)
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ _RopeRep* __right = __c->_M_right;
+
+#ifdef __GC
+ printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n",
+ __r, __r->_M_depth, __r->_M_size,
+ __r->_M_is_balanced? "" : "not");
+#else
+ printf("Concatenation %p (rc = %ld, depth = %d, "
+ "len = %ld, %s balanced)\n",
+ __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size,
+ __r->_M_is_balanced? "" : "not");
+#endif
+ _S_dump(__left, __indent + 2);
+ _S_dump(__right, __indent + 2);
+ return;
+ }
+ else
+ {
+ char* __kind;
+
+ switch (__r->_M_tag)
+ {
+ case __detail::_S_leaf:
+ __kind = "Leaf";
+ break;
+ case __detail::_S_function:
+ __kind = "Function";
+ break;
+ case __detail::_S_substringfn:
+ __kind = "Function representing substring";
+ break;
+ default:
+ __kind = "(corrupted kind field!)";
+ }
+#ifdef __GC
+ printf("%s %p (depth = %d, len = %ld) ",
+ __kind, __r, __r->_M_depth, __r->_M_size);
+#else
+ printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
+ __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size);
+#endif
+ if (_S_is_one_byte_char_type((_CharT*)0))
+ {
+ const int __max_len = 40;
+ _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
+ _CharT __buffer[__max_len + 1];
+ bool __too_big = __r->_M_size > __prefix->_M_size;
+
+ _S_flatten(__prefix, __buffer);
+ __buffer[__prefix->_M_size] = _S_eos((_CharT*)0);
+ printf("%s%s\n", (char*)__buffer,
+ __too_big? "...\n" : "\n");
+ }
+ else
+ printf("\n");
+ }
+ }
+
+ template <class _CharT, class _Alloc>
+ const unsigned long
+ rope<_CharT, _Alloc>::
+ _S_min_len[int(__detail::_S_max_rope_depth) + 1] = {
+ /* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,
+ /* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,
+ /* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,
+ /* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368,
+ /* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811,
+ /* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309,
+ /* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352,
+ /* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155,
+ /* 39 */165580141, /* 40 */267914296, /* 41 */433494437,
+ /* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903,
+ /* 45 */2971215073u };
+ // These are Fibonacci numbers < 2**32.
+
+ template <class _CharT, class _Alloc>
+ typename rope<_CharT, _Alloc>::_RopeRep*
+ rope<_CharT, _Alloc>::
+ _S_balance(_RopeRep* __r)
+ {
+ _RopeRep* __forest[int(__detail::_S_max_rope_depth) + 1];
+ _RopeRep* __result = 0;
+ int __i;
+ // Invariant:
+ // The concatenation of forest in descending order is equal to __r.
+ // __forest[__i]._M_size >= _S_min_len[__i]
+ // __forest[__i]._M_depth = __i
+ // References from forest are included in refcount.
+
+ for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)
+ __forest[__i] = 0;
+ __try
+ {
+ _S_add_to_forest(__r, __forest);
+ for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)
+ if (0 != __forest[__i])
+ {
+#ifndef __GC
+ _Self_destruct_ptr __old(__result);
+#endif
+ __result = _S_concat(__forest[__i], __result);
+ __forest[__i]->_M_unref_nonnil();
+#if !defined(__GC) && defined(__EXCEPTIONS)
+ __forest[__i] = 0;
+#endif
+ }
+ }
+ __catch(...)
+ {
+ for(__i = 0; __i <= int(__detail::_S_max_rope_depth); __i++)
+ _S_unref(__forest[__i]);
+ __throw_exception_again;
+ }
+
+ if (__result->_M_depth > int(__detail::_S_max_rope_depth))
+ __throw_length_error(__N("rope::_S_balance"));
+ return(__result);
+ }
+
+ template <class _CharT, class _Alloc>
+ void
+ rope<_CharT, _Alloc>::
+ _S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
+ {
+ if (__r->_M_is_balanced)
+ {
+ _S_add_leaf_to_forest(__r, __forest);
+ return;
+ }
+
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+
+ _S_add_to_forest(__c->_M_left, __forest);
+ _S_add_to_forest(__c->_M_right, __forest);
+ }
+ }
+
+
+ template <class _CharT, class _Alloc>
+ void
+ rope<_CharT, _Alloc>::
+ _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
+ {
+ _RopeRep* __insertee; // included in refcount
+ _RopeRep* __too_tiny = 0; // included in refcount
+ int __i; // forest[0..__i-1] is empty
+ size_t __s = __r->_M_size;
+
+ for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i)
+ {
+ if (0 != __forest[__i])
+ {
+#ifndef __GC
+ _Self_destruct_ptr __old(__too_tiny);
+#endif
+ __too_tiny = _S_concat_and_set_balanced(__forest[__i],
+ __too_tiny);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ }
+ }
+ {
+#ifndef __GC
+ _Self_destruct_ptr __old(__too_tiny);
+#endif
+ __insertee = _S_concat_and_set_balanced(__too_tiny, __r);
+ }
+ // Too_tiny dead, and no longer included in refcount.
+ // Insertee is live and included.
+ for (;; ++__i)
+ {
+ if (0 != __forest[__i])
+ {
+#ifndef __GC
+ _Self_destruct_ptr __old(__insertee);
+#endif
+ __insertee = _S_concat_and_set_balanced(__forest[__i],
+ __insertee);
+ __forest[__i]->_M_unref_nonnil();
+ __forest[__i] = 0;
+ }
+ if (__i == int(__detail::_S_max_rope_depth)
+ || __insertee->_M_size < _S_min_len[__i+1])
+ {
+ __forest[__i] = __insertee;
+ // refcount is OK since __insertee is now dead.
+ return;
+ }
+ }
+ }
+
+ template <class _CharT, class _Alloc>
+ _CharT
+ rope<_CharT, _Alloc>::
+ _S_fetch(_RopeRep* __r, size_type __i)
+ {
+ __GC_CONST _CharT* __cstr = __r->_M_c_string;
+
+ if (0 != __cstr)
+ return __cstr[__i];
+ for(;;)
+ {
+ switch(__r->_M_tag)
+ {
+ case __detail::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size;
+
+ if (__i >= __left_len)
+ {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ }
+ else
+ __r = __left;
+ }
+ break;
+ case __detail::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ return __l->_M_data[__i];
+ }
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ {
+ _RopeFunction* __f = (_RopeFunction*)__r;
+ _CharT __result;
+
+ (*(__f->_M_fn))(__i, 1, &__result);
+ return __result;
+ }
+ }
+ }
+ }
+
+#ifndef __GC
+ // Return a uniquely referenced character slot for the given
+ // position, or 0 if that's not possible.
+ template <class _CharT, class _Alloc>
+ _CharT*
+ rope<_CharT, _Alloc>::
+ _S_fetch_ptr(_RopeRep* __r, size_type __i)
+ {
+ _RopeRep* __clrstack[__detail::_S_max_rope_depth];
+ size_t __csptr = 0;
+
+ for(;;)
+ {
+ if (__r->_M_ref_count > 1)
+ return 0;
+ switch(__r->_M_tag)
+ {
+ case __detail::_S_concat:
+ {
+ _RopeConcatenation* __c = (_RopeConcatenation*)__r;
+ _RopeRep* __left = __c->_M_left;
+ size_t __left_len = __left->_M_size;
+
+ if (__c->_M_c_string != 0)
+ __clrstack[__csptr++] = __c;
+ if (__i >= __left_len)
+ {
+ __i -= __left_len;
+ __r = __c->_M_right;
+ }
+ else
+ __r = __left;
+ }
+ break;
+ case __detail::_S_leaf:
+ {
+ _RopeLeaf* __l = (_RopeLeaf*)__r;
+ if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
+ __clrstack[__csptr++] = __l;
+ while (__csptr > 0)
+ {
+ -- __csptr;
+ _RopeRep* __d = __clrstack[__csptr];
+ __d->_M_free_c_string();
+ __d->_M_c_string = 0;
+ }
+ return __l->_M_data + __i;
+ }
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
+ return 0;
+ }
+ }
+ }
+#endif /* __GC */
+
+ // The following could be implemented trivially using
+ // lexicographical_compare_3way.
+ // We do a little more work to avoid dealing with rope iterators for
+ // flat strings.
+ template <class _CharT, class _Alloc>
+ int
+ rope<_CharT, _Alloc>::
+ _S_compare (const _RopeRep* __left, const _RopeRep* __right)
+ {
+ size_t __left_len;
+ size_t __right_len;
+
+ if (0 == __right)
+ return 0 != __left;
+ if (0 == __left)
+ return -1;
+ __left_len = __left->_M_size;
+ __right_len = __right->_M_size;
+ if (__detail::_S_leaf == __left->_M_tag)
+ {
+ _RopeLeaf* __l = (_RopeLeaf*) __left;
+ if (__detail::_S_leaf == __right->_M_tag)
+ {
+ _RopeLeaf* __r = (_RopeLeaf*) __right;
+ return lexicographical_compare_3way(__l->_M_data,
+ __l->_M_data + __left_len,
+ __r->_M_data, __r->_M_data
+ + __right_len);
+ }
+ else
+ {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return lexicographical_compare_3way(__l->_M_data, __l->_M_data
+ + __left_len,
+ __rstart, __rend);
+ }
+ }
+ else
+ {
+ const_iterator __lstart(__left, 0);
+ const_iterator __lend(__left, __left_len);
+ if (__detail::_S_leaf == __right->_M_tag)
+ {
+ _RopeLeaf* __r = (_RopeLeaf*) __right;
+ return lexicographical_compare_3way(__lstart, __lend,
+ __r->_M_data, __r->_M_data
+ + __right_len);
+ }
+ else
+ {
+ const_iterator __rstart(__right, 0);
+ const_iterator __rend(__right, __right_len);
+ return lexicographical_compare_3way(__lstart, __lend,
+ __rstart, __rend);
+ }
+ }
+ }
+
+ // Assignment to reference proxies.
+ template <class _CharT, class _Alloc>
+ _Rope_char_ref_proxy<_CharT, _Alloc>&
+ _Rope_char_ref_proxy<_CharT, _Alloc>::
+ operator=(_CharT __c)
+ {
+ _RopeRep* __old = _M_root->_M_tree_ptr;
+#ifndef __GC
+ // First check for the case in which everything is uniquely
+ // referenced. In that case we can do this destructively.
+ _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
+ if (0 != __ptr)
+ {
+ *__ptr = __c;
+ return *this;
+ }
+#endif
+ _Self_destruct_ptr __left(_My_rope::_S_substring(__old, 0, _M_pos));
+ _Self_destruct_ptr __right(_My_rope::_S_substring(__old, _M_pos + 1,
+ __old->_M_size));
+ _Self_destruct_ptr __result_left(_My_rope::
+ _S_destr_concat_char_iter(__left,
+ &__c, 1));
+
+ _RopeRep* __result = _My_rope::_S_concat(__result_left, __right);
+#ifndef __GC
+ _RopeRep::_S_unref(__old);
+#endif
+ _M_root->_M_tree_ptr = __result;
+ return *this;
+ }
+
+ template <class _CharT, class _Alloc>
+ inline _Rope_char_ref_proxy<_CharT, _Alloc>::
+ operator _CharT() const
+ {
+ if (_M_current_valid)
+ return _M_current;
+ else
+ return _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos);
+ }
+
+ template <class _CharT, class _Alloc>
+ _Rope_char_ptr_proxy<_CharT, _Alloc>
+ _Rope_char_ref_proxy<_CharT, _Alloc>::
+ operator&() const
+ { return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); }
+
+ template <class _CharT, class _Alloc>
+ rope<_CharT, _Alloc>::
+ rope(size_t __n, _CharT __c, const allocator_type& __a)
+ : _Base(__a)
+ {
+ rope<_CharT,_Alloc> __result;
+ const size_t __exponentiate_threshold = 32;
+ size_t __exponent;
+ size_t __rest;
+ _CharT* __rest_buffer;
+ _RopeRep* __remainder;
+ rope<_CharT, _Alloc> __remainder_rope;
+
+ if (0 == __n)
+ return;
+
+ __exponent = __n / __exponentiate_threshold;
+ __rest = __n % __exponentiate_threshold;
+ if (0 == __rest)
+ __remainder = 0;
+ else
+ {
+ __rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest));
+ __uninitialized_fill_n_a(__rest_buffer, __rest, __c,
+ _M_get_allocator());
+ _S_cond_store_eos(__rest_buffer[__rest]);
+ __try
+ { __remainder = _S_new_RopeLeaf(__rest_buffer, __rest,
+ _M_get_allocator()); }
+ __catch(...)
+ {
+ _RopeRep::__STL_FREE_STRING(__rest_buffer, __rest,
+ _M_get_allocator());
+ __throw_exception_again;
+ }
+ }
+ __remainder_rope._M_tree_ptr = __remainder;
+ if (__exponent != 0)
+ {
+ _CharT* __base_buffer =
+ this->_Data_allocate(_S_rounded_up_size(__exponentiate_threshold));
+ _RopeLeaf* __base_leaf;
+ rope __base_rope;
+ __uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,
+ _M_get_allocator());
+ _S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
+ __try
+ {
+ __base_leaf = _S_new_RopeLeaf(__base_buffer,
+ __exponentiate_threshold,
+ _M_get_allocator());
+ }
+ __catch(...)
+ {
+ _RopeRep::__STL_FREE_STRING(__base_buffer,
+ __exponentiate_threshold,
+ _M_get_allocator());
+ __throw_exception_again;
+ }
+ __base_rope._M_tree_ptr = __base_leaf;
+ if (1 == __exponent)
+ __result = __base_rope;
+ else
+ __result = power(__base_rope, __exponent,
+ _Rope_Concat_fn<_CharT, _Alloc>());
+
+ if (0 != __remainder)
+ __result += __remainder_rope;
+ }
+ else
+ __result = __remainder_rope;
+
+ this->_M_tree_ptr = __result._M_tree_ptr;
+ this->_M_tree_ptr->_M_ref_nonnil();
+ }
+
+ template<class _CharT, class _Alloc>
+ _CharT
+ rope<_CharT, _Alloc>::_S_empty_c_str[1];
+
+ template<class _CharT, class _Alloc>
+ const _CharT*
+ rope<_CharT, _Alloc>::
+ c_str() const
+ {
+ if (0 == this->_M_tree_ptr)
+ {
+ _S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant,
+ // but probably fast.
+ return _S_empty_c_str;
+ }
+ __gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock);
+ __GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
+ if (0 == __result)
+ {
+ size_t __s = size();
+ __result = this->_Data_allocate(__s + 1);
+ _S_flatten(this->_M_tree_ptr, __result);
+ __result[__s] = _S_eos((_CharT*)0);
+ this->_M_tree_ptr->_M_c_string = __result;
+ }
+ __gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock);
+ return(__result);
+ }
+
+ template<class _CharT, class _Alloc>
+ const _CharT* rope<_CharT, _Alloc>::
+ replace_with_c_str()
+ {
+ if (0 == this->_M_tree_ptr)
+ {
+ _S_empty_c_str[0] = _S_eos((_CharT*)0);
+ return _S_empty_c_str;
+ }
+ __GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string;
+ if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag
+ && 0 != __old_c_string)
+ return(__old_c_string);
+ size_t __s = size();
+ _CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s));
+ _S_flatten(this->_M_tree_ptr, __result);
+ __result[__s] = _S_eos((_CharT*)0);
+ this->_M_tree_ptr->_M_unref_nonnil();
+ this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s,
+ this->_M_get_allocator());
+ return(__result);
+ }
+
+ // Algorithm specializations. More should be added.
+
+ template<class _Rope_iterator> // was templated on CharT and Alloc
+ void // VC++ workaround
+ _Rope_rotate(_Rope_iterator __first,
+ _Rope_iterator __middle,
+ _Rope_iterator __last)
+ {
+ typedef typename _Rope_iterator::value_type _CharT;
+ typedef typename _Rope_iterator::_allocator_type _Alloc;
+
+ rope<_CharT, _Alloc>& __r(__first.container());
+ rope<_CharT, _Alloc> __prefix = __r.substr(0, __first.index());
+ rope<_CharT, _Alloc> __suffix =
+ __r.substr(__last.index(), __r.size() - __last.index());
+ rope<_CharT, _Alloc> __part1 =
+ __r.substr(__middle.index(), __last.index() - __middle.index());
+ rope<_CharT, _Alloc> __part2 =
+ __r.substr(__first.index(), __middle.index() - __first.index());
+ __r = __prefix;
+ __r += __part1;
+ __r += __part2;
+ __r += __suffix;
+ }
+
+#if !defined(__GNUC__)
+ // Appears to confuse g++
+ inline void
+ rotate(_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __first,
+ _Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __middle,
+ _Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __last)
+ { _Rope_rotate(__first, __middle, __last); }
+#endif
+
+# if 0
+ // Probably not useful for several reasons:
+ // - for SGIs 7.1 compiler and probably some others,
+ // this forces lots of rope<wchar_t, ...> instantiations, creating a
+ // code bloat and compile time problem. (Fixed in 7.2.)
+ // - wchar_t is 4 bytes wide on most UNIX platforms, making it
+ // unattractive for unicode strings. Unsigned short may be a better
+ // character type.
+ inline void
+ rotate(_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __first,
+ _Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __middle,
+ _Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __last)
+ { _Rope_rotate(__first, __middle, __last); }
+# endif
+
+_GLIBCXX_END_NAMESPACE
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/slist b/gcc-4.4.0/libstdc++-v3/include/ext/slist
new file mode 100644
index 000000000..a34e36e31
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/slist
@@ -0,0 +1,1077 @@
+// Singly-linked list implementation -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file ext/slist
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _SLIST
+#define _SLIST 1
+
+#include <algorithm>
+#include <bits/allocator.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/concept_check.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+ using std::_Construct;
+ using std::_Destroy;
+ using std::allocator;
+ using std::__true_type;
+ using std::__false_type;
+
+ struct _Slist_node_base
+ {
+ _Slist_node_base* _M_next;
+ };
+
+ inline _Slist_node_base*
+ __slist_make_link(_Slist_node_base* __prev_node,
+ _Slist_node_base* __new_node)
+ {
+ __new_node->_M_next = __prev_node->_M_next;
+ __prev_node->_M_next = __new_node;
+ return __new_node;
+ }
+
+ inline _Slist_node_base*
+ __slist_previous(_Slist_node_base* __head,
+ const _Slist_node_base* __node)
+ {
+ while (__head && __head->_M_next != __node)
+ __head = __head->_M_next;
+ return __head;
+ }
+
+ inline const _Slist_node_base*
+ __slist_previous(const _Slist_node_base* __head,
+ const _Slist_node_base* __node)
+ {
+ while (__head && __head->_M_next != __node)
+ __head = __head->_M_next;
+ return __head;
+ }
+
+ inline void
+ __slist_splice_after(_Slist_node_base* __pos,
+ _Slist_node_base* __before_first,
+ _Slist_node_base* __before_last)
+ {
+ if (__pos != __before_first && __pos != __before_last)
+ {
+ _Slist_node_base* __first = __before_first->_M_next;
+ _Slist_node_base* __after = __pos->_M_next;
+ __before_first->_M_next = __before_last->_M_next;
+ __pos->_M_next = __first;
+ __before_last->_M_next = __after;
+ }
+ }
+
+ inline void
+ __slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __head)
+ {
+ _Slist_node_base* __before_last = __slist_previous(__head, 0);
+ if (__before_last != __head)
+ {
+ _Slist_node_base* __after = __pos->_M_next;
+ __pos->_M_next = __head->_M_next;
+ __head->_M_next = 0;
+ __before_last->_M_next = __after;
+ }
+ }
+
+ inline _Slist_node_base*
+ __slist_reverse(_Slist_node_base* __node)
+ {
+ _Slist_node_base* __result = __node;
+ __node = __node->_M_next;
+ __result->_M_next = 0;
+ while(__node)
+ {
+ _Slist_node_base* __next = __node->_M_next;
+ __node->_M_next = __result;
+ __result = __node;
+ __node = __next;
+ }
+ return __result;
+ }
+
+ inline size_t
+ __slist_size(_Slist_node_base* __node)
+ {
+ size_t __result = 0;
+ for (; __node != 0; __node = __node->_M_next)
+ ++__result;
+ return __result;
+ }
+
+ template <class _Tp>
+ struct _Slist_node : public _Slist_node_base
+ {
+ _Tp _M_data;
+ };
+
+ struct _Slist_iterator_base
+ {
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Slist_node_base* _M_node;
+
+ _Slist_iterator_base(_Slist_node_base* __x)
+ : _M_node(__x) {}
+
+ void
+ _M_incr()
+ { _M_node = _M_node->_M_next; }
+
+ bool
+ operator==(const _Slist_iterator_base& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Slist_iterator_base& __x) const
+ { return _M_node != __x._M_node; }
+ };
+
+ template <class _Tp, class _Ref, class _Ptr>
+ struct _Slist_iterator : public _Slist_iterator_base
+ {
+ typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
+ typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
+ typedef _Slist_iterator<_Tp, _Ref, _Ptr> _Self;
+
+ typedef _Tp value_type;
+ typedef _Ptr pointer;
+ typedef _Ref reference;
+ typedef _Slist_node<_Tp> _Node;
+
+ explicit
+ _Slist_iterator(_Node* __x)
+ : _Slist_iterator_base(__x) {}
+
+ _Slist_iterator()
+ : _Slist_iterator_base(0) {}
+
+ _Slist_iterator(const iterator& __x)
+ : _Slist_iterator_base(__x._M_node) {}
+
+ reference
+ operator*() const
+ { return ((_Node*) _M_node)->_M_data; }
+
+ pointer
+ operator->() const
+ { return &(operator*()); }
+
+ _Self&
+ operator++()
+ {
+ _M_incr();
+ return *this;
+ }
+
+ _Self
+ operator++(int)
+ {
+ _Self __tmp = *this;
+ _M_incr();
+ return __tmp;
+ }
+ };
+
+ template <class _Tp, class _Alloc>
+ struct _Slist_base
+ : public _Alloc::template rebind<_Slist_node<_Tp> >::other
+ {
+ typedef typename _Alloc::template rebind<_Slist_node<_Tp> >::other
+ _Node_alloc;
+ typedef _Alloc allocator_type;
+
+ allocator_type
+ get_allocator() const
+ { return *static_cast<const _Node_alloc*>(this); }
+
+ _Slist_base(const allocator_type& __a)
+ : _Node_alloc(__a)
+ { this->_M_head._M_next = 0; }
+
+ ~_Slist_base()
+ { _M_erase_after(&this->_M_head, 0); }
+
+ protected:
+ _Slist_node_base _M_head;
+
+ _Slist_node<_Tp>*
+ _M_get_node()
+ { return _Node_alloc::allocate(1); }
+
+ void
+ _M_put_node(_Slist_node<_Tp>* __p)
+ { _Node_alloc::deallocate(__p, 1); }
+
+ protected:
+ _Slist_node_base* _M_erase_after(_Slist_node_base* __pos)
+ {
+ _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next);
+ _Slist_node_base* __next_next = __next->_M_next;
+ __pos->_M_next = __next_next;
+ get_allocator().destroy(&__next->_M_data);
+ _M_put_node(__next);
+ return __next_next;
+ }
+ _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
+ };
+
+ template <class _Tp, class _Alloc>
+ _Slist_node_base*
+ _Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
+ _Slist_node_base* __last_node)
+ {
+ _Slist_node<_Tp>* __cur = (_Slist_node<_Tp>*) (__before_first->_M_next);
+ while (__cur != __last_node)
+ {
+ _Slist_node<_Tp>* __tmp = __cur;
+ __cur = (_Slist_node<_Tp>*) __cur->_M_next;
+ get_allocator().destroy(&__tmp->_M_data);
+ _M_put_node(__tmp);
+ }
+ __before_first->_M_next = __last_node;
+ return __last_node;
+ }
+
+ /**
+ * This is an SGI extension.
+ * @ingroup SGIextensions
+ * @doctodo
+ */
+ template <class _Tp, class _Alloc = allocator<_Tp> >
+ class slist : private _Slist_base<_Tp,_Alloc>
+ {
+ // concept requirements
+ __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
+
+ private:
+ typedef _Slist_base<_Tp,_Alloc> _Base;
+
+ public:
+ typedef _Tp value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
+ typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
+
+ typedef typename _Base::allocator_type allocator_type;
+
+ allocator_type
+ get_allocator() const
+ { return _Base::get_allocator(); }
+
+ private:
+ typedef _Slist_node<_Tp> _Node;
+ typedef _Slist_node_base _Node_base;
+ typedef _Slist_iterator_base _Iterator_base;
+
+ _Node*
+ _M_create_node(const value_type& __x)
+ {
+ _Node* __node = this->_M_get_node();
+ __try
+ {
+ get_allocator().construct(&__node->_M_data, __x);
+ __node->_M_next = 0;
+ }
+ __catch(...)
+ {
+ this->_M_put_node(__node);
+ __throw_exception_again;
+ }
+ return __node;
+ }
+
+ _Node*
+ _M_create_node()
+ {
+ _Node* __node = this->_M_get_node();
+ __try
+ {
+ get_allocator().construct(&__node->_M_data, value_type());
+ __node->_M_next = 0;
+ }
+ __catch(...)
+ {
+ this->_M_put_node(__node);
+ __throw_exception_again;
+ }
+ return __node;
+ }
+
+ public:
+ explicit
+ slist(const allocator_type& __a = allocator_type())
+ : _Base(__a) {}
+
+ slist(size_type __n, const value_type& __x,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ { _M_insert_after_fill(&this->_M_head, __n, __x); }
+
+ explicit
+ slist(size_type __n)
+ : _Base(allocator_type())
+ { _M_insert_after_fill(&this->_M_head, __n, value_type()); }
+
+ // We don't need any dispatching tricks here, because
+ // _M_insert_after_range already does them.
+ template <class _InputIterator>
+ slist(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type())
+ : _Base(__a)
+ { _M_insert_after_range(&this->_M_head, __first, __last); }
+
+ slist(const slist& __x)
+ : _Base(__x.get_allocator())
+ { _M_insert_after_range(&this->_M_head, __x.begin(), __x.end()); }
+
+ slist&
+ operator= (const slist& __x);
+
+ ~slist() {}
+
+ public:
+ // assign(), a generalized assignment member function. Two
+ // versions: one that takes a count, and one that takes a range.
+ // The range version is a member template, so we dispatch on whether
+ // or not the type is an integer.
+
+ void
+ assign(size_type __n, const _Tp& __val)
+ { _M_fill_assign(__n, __val); }
+
+ void
+ _M_fill_assign(size_type __n, const _Tp& __val);
+
+ template <class _InputIterator>
+ void
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ _M_assign_dispatch(__first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void
+ _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ { _M_fill_assign((size_type) __n, (_Tp) __val); }
+
+ template <class _InputIterator>
+ void
+ _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+ __false_type);
+
+ public:
+
+ iterator
+ begin()
+ { return iterator((_Node*)this->_M_head._M_next); }
+
+ const_iterator
+ begin() const
+ { return const_iterator((_Node*)this->_M_head._M_next);}
+
+ iterator
+ end()
+ { return iterator(0); }
+
+ const_iterator
+ end() const
+ { return const_iterator(0); }
+
+ // Experimental new feature: before_begin() returns a
+ // non-dereferenceable iterator that, when incremented, yields
+ // begin(). This iterator may be used as the argument to
+ // insert_after, erase_after, etc. Note that even for an empty
+ // slist, before_begin() is not the same iterator as end(). It
+ // is always necessary to increment before_begin() at least once to
+ // obtain end().
+ iterator
+ before_begin()
+ { return iterator((_Node*) &this->_M_head); }
+
+ const_iterator
+ before_begin() const
+ { return const_iterator((_Node*) &this->_M_head); }
+
+ size_type
+ size() const
+ { return __slist_size(this->_M_head._M_next); }
+
+ size_type
+ max_size() const
+ { return size_type(-1); }
+
+ bool
+ empty() const
+ { return this->_M_head._M_next == 0; }
+
+ void
+ swap(slist& __x)
+ { std::swap(this->_M_head._M_next, __x._M_head._M_next); }
+
+ public:
+
+ reference
+ front()
+ { return ((_Node*) this->_M_head._M_next)->_M_data; }
+
+ const_reference
+ front() const
+ { return ((_Node*) this->_M_head._M_next)->_M_data; }
+
+ void
+ push_front(const value_type& __x)
+ { __slist_make_link(&this->_M_head, _M_create_node(__x)); }
+
+ void
+ push_front()
+ { __slist_make_link(&this->_M_head, _M_create_node()); }
+
+ void
+ pop_front()
+ {
+ _Node* __node = (_Node*) this->_M_head._M_next;
+ this->_M_head._M_next = __node->_M_next;
+ get_allocator().destroy(&__node->_M_data);
+ this->_M_put_node(__node);
+ }
+
+ iterator
+ previous(const_iterator __pos)
+ { return iterator((_Node*) __slist_previous(&this->_M_head,
+ __pos._M_node)); }
+
+ const_iterator
+ previous(const_iterator __pos) const
+ { return const_iterator((_Node*) __slist_previous(&this->_M_head,
+ __pos._M_node)); }
+
+ private:
+ _Node*
+ _M_insert_after(_Node_base* __pos, const value_type& __x)
+ { return (_Node*) (__slist_make_link(__pos, _M_create_node(__x))); }
+
+ _Node*
+ _M_insert_after(_Node_base* __pos)
+ { return (_Node*) (__slist_make_link(__pos, _M_create_node())); }
+
+ void
+ _M_insert_after_fill(_Node_base* __pos,
+ size_type __n, const value_type& __x)
+ {
+ for (size_type __i = 0; __i < __n; ++__i)
+ __pos = __slist_make_link(__pos, _M_create_node(__x));
+ }
+
+ // Check whether it's an integral type. If so, it's not an iterator.
+ template <class _InIterator>
+ void
+ _M_insert_after_range(_Node_base* __pos,
+ _InIterator __first, _InIterator __last)
+ {
+ typedef typename std::__is_integer<_InIterator>::__type _Integral;
+ _M_insert_after_range(__pos, __first, __last, _Integral());
+ }
+
+ template <class _Integer>
+ void
+ _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
+ __true_type)
+ { _M_insert_after_fill(__pos, __n, __x); }
+
+ template <class _InIterator>
+ void
+ _M_insert_after_range(_Node_base* __pos,
+ _InIterator __first, _InIterator __last,
+ __false_type)
+ {
+ while (__first != __last)
+ {
+ __pos = __slist_make_link(__pos, _M_create_node(*__first));
+ ++__first;
+ }
+ }
+
+ public:
+ iterator
+ insert_after(iterator __pos, const value_type& __x)
+ { return iterator(_M_insert_after(__pos._M_node, __x)); }
+
+ iterator
+ insert_after(iterator __pos)
+ { return insert_after(__pos, value_type()); }
+
+ void
+ insert_after(iterator __pos, size_type __n, const value_type& __x)
+ { _M_insert_after_fill(__pos._M_node, __n, __x); }
+
+ // We don't need any dispatching tricks here, because
+ // _M_insert_after_range already does them.
+ template <class _InIterator>
+ void
+ insert_after(iterator __pos, _InIterator __first, _InIterator __last)
+ { _M_insert_after_range(__pos._M_node, __first, __last); }
+
+ iterator
+ insert(iterator __pos, const value_type& __x)
+ { return iterator(_M_insert_after(__slist_previous(&this->_M_head,
+ __pos._M_node),
+ __x)); }
+
+ iterator
+ insert(iterator __pos)
+ { return iterator(_M_insert_after(__slist_previous(&this->_M_head,
+ __pos._M_node),
+ value_type())); }
+
+ void
+ insert(iterator __pos, size_type __n, const value_type& __x)
+ { _M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node),
+ __n, __x); }
+
+ // We don't need any dispatching tricks here, because
+ // _M_insert_after_range already does them.
+ template <class _InIterator>
+ void
+ insert(iterator __pos, _InIterator __first, _InIterator __last)
+ { _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node),
+ __first, __last); }
+
+ public:
+ iterator
+ erase_after(iterator __pos)
+ { return iterator((_Node*) this->_M_erase_after(__pos._M_node)); }
+
+ iterator
+ erase_after(iterator __before_first, iterator __last)
+ {
+ return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
+ __last._M_node));
+ }
+
+ iterator
+ erase(iterator __pos)
+ {
+ return iterator((_Node*) this->_M_erase_after
+ (__slist_previous(&this->_M_head, __pos._M_node)));
+ }
+
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ return iterator((_Node*) this->_M_erase_after
+ (__slist_previous(&this->_M_head, __first._M_node),
+ __last._M_node));
+ }
+
+ void
+ resize(size_type new_size, const _Tp& __x);
+
+ void
+ resize(size_type new_size)
+ { resize(new_size, _Tp()); }
+
+ void
+ clear()
+ { this->_M_erase_after(&this->_M_head, 0); }
+
+ public:
+ // Moves the range [__before_first + 1, __before_last + 1) to *this,
+ // inserting it immediately after __pos. This is constant time.
+ void
+ splice_after(iterator __pos,
+ iterator __before_first, iterator __before_last)
+ {
+ if (__before_first != __before_last)
+ __slist_splice_after(__pos._M_node, __before_first._M_node,
+ __before_last._M_node);
+ }
+
+ // Moves the element that follows __prev to *this, inserting it
+ // immediately after __pos. This is constant time.
+ void
+ splice_after(iterator __pos, iterator __prev)
+ { __slist_splice_after(__pos._M_node,
+ __prev._M_node, __prev._M_node->_M_next); }
+
+ // Removes all of the elements from the list __x to *this, inserting
+ // them immediately after __pos. __x must not be *this. Complexity:
+ // linear in __x.size().
+ void
+ splice_after(iterator __pos, slist& __x)
+ { __slist_splice_after(__pos._M_node, &__x._M_head); }
+
+ // Linear in distance(begin(), __pos), and linear in __x.size().
+ void
+ splice(iterator __pos, slist& __x)
+ {
+ if (__x._M_head._M_next)
+ __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),
+ &__x._M_head,
+ __slist_previous(&__x._M_head, 0)); }
+
+ // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
+ void
+ splice(iterator __pos, slist& __x, iterator __i)
+ { __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),
+ __slist_previous(&__x._M_head, __i._M_node),
+ __i._M_node); }
+
+ // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
+ // and in distance(__first, __last).
+ void
+ splice(iterator __pos, slist& __x, iterator __first, iterator __last)
+ {
+ if (__first != __last)
+ __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),
+ __slist_previous(&__x._M_head, __first._M_node),
+ __slist_previous(__first._M_node,
+ __last._M_node));
+ }
+
+ public:
+ void
+ reverse()
+ {
+ if (this->_M_head._M_next)
+ this->_M_head._M_next = __slist_reverse(this->_M_head._M_next);
+ }
+
+ void
+ remove(const _Tp& __val);
+
+ void
+ unique();
+
+ void
+ merge(slist& __x);
+
+ void
+ sort();
+
+ template <class _Predicate>
+ void
+ remove_if(_Predicate __pred);
+
+ template <class _BinaryPredicate>
+ void
+ unique(_BinaryPredicate __pred);
+
+ template <class _StrictWeakOrdering>
+ void
+ merge(slist&, _StrictWeakOrdering);
+
+ template <class _StrictWeakOrdering>
+ void
+ sort(_StrictWeakOrdering __comp);
+ };
+
+ template <class _Tp, class _Alloc>
+ slist<_Tp, _Alloc>&
+ slist<_Tp, _Alloc>::operator=(const slist<_Tp, _Alloc>& __x)
+ {
+ if (&__x != this)
+ {
+ _Node_base* __p1 = &this->_M_head;
+ _Node* __n1 = (_Node*) this->_M_head._M_next;
+ const _Node* __n2 = (const _Node*) __x._M_head._M_next;
+ while (__n1 && __n2)
+ {
+ __n1->_M_data = __n2->_M_data;
+ __p1 = __n1;
+ __n1 = (_Node*) __n1->_M_next;
+ __n2 = (const _Node*) __n2->_M_next;
+ }
+ if (__n2 == 0)
+ this->_M_erase_after(__p1, 0);
+ else
+ _M_insert_after_range(__p1, const_iterator((_Node*)__n2),
+ const_iterator(0));
+ }
+ return *this;
+ }
+
+ template <class _Tp, class _Alloc>
+ void
+ slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val)
+ {
+ _Node_base* __prev = &this->_M_head;
+ _Node* __node = (_Node*) this->_M_head._M_next;
+ for (; __node != 0 && __n > 0; --__n)
+ {
+ __node->_M_data = __val;
+ __prev = __node;
+ __node = (_Node*) __node->_M_next;
+ }
+ if (__n > 0)
+ _M_insert_after_fill(__prev, __n, __val);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+
+ template <class _Tp, class _Alloc>
+ template <class _InputIterator>
+ void
+ slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first,
+ _InputIterator __last,
+ __false_type)
+ {
+ _Node_base* __prev = &this->_M_head;
+ _Node* __node = (_Node*) this->_M_head._M_next;
+ while (__node != 0 && __first != __last)
+ {
+ __node->_M_data = *__first;
+ __prev = __node;
+ __node = (_Node*) __node->_M_next;
+ ++__first;
+ }
+ if (__first != __last)
+ _M_insert_after_range(__prev, __first, __last);
+ else
+ this->_M_erase_after(__prev, 0);
+ }
+
+ template <class _Tp, class _Alloc>
+ inline bool
+ operator==(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
+ {
+ typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
+ const_iterator __end1 = _SL1.end();
+ const_iterator __end2 = _SL2.end();
+
+ const_iterator __i1 = _SL1.begin();
+ const_iterator __i2 = _SL2.begin();
+ while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)
+ {
+ ++__i1;
+ ++__i2;
+ }
+ return __i1 == __end1 && __i2 == __end2;
+ }
+
+
+ template <class _Tp, class _Alloc>
+ inline bool
+ operator<(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
+ { return std::lexicographical_compare(_SL1.begin(), _SL1.end(),
+ _SL2.begin(), _SL2.end()); }
+
+ template <class _Tp, class _Alloc>
+ inline bool
+ operator!=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
+ { return !(_SL1 == _SL2); }
+
+ template <class _Tp, class _Alloc>
+ inline bool
+ operator>(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
+ { return _SL2 < _SL1; }
+
+ template <class _Tp, class _Alloc>
+ inline bool
+ operator<=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
+ { return !(_SL2 < _SL1); }
+
+ template <class _Tp, class _Alloc>
+ inline bool
+ operator>=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)
+ { return !(_SL1 < _SL2); }
+
+ template <class _Tp, class _Alloc>
+ inline void
+ swap(slist<_Tp, _Alloc>& __x, slist<_Tp, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template <class _Tp, class _Alloc>
+ void
+ slist<_Tp, _Alloc>::resize(size_type __len, const _Tp& __x)
+ {
+ _Node_base* __cur = &this->_M_head;
+ while (__cur->_M_next != 0 && __len > 0)
+ {
+ --__len;
+ __cur = __cur->_M_next;
+ }
+ if (__cur->_M_next)
+ this->_M_erase_after(__cur, 0);
+ else
+ _M_insert_after_fill(__cur, __len, __x);
+ }
+
+ template <class _Tp, class _Alloc>
+ void
+ slist<_Tp, _Alloc>::remove(const _Tp& __val)
+ {
+ _Node_base* __cur = &this->_M_head;
+ while (__cur && __cur->_M_next)
+ {
+ if (((_Node*) __cur->_M_next)->_M_data == __val)
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ void
+ slist<_Tp, _Alloc>::unique()
+ {
+ _Node_base* __cur = this->_M_head._M_next;
+ if (__cur)
+ {
+ while (__cur->_M_next)
+ {
+ if (((_Node*)__cur)->_M_data
+ == ((_Node*)(__cur->_M_next))->_M_data)
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ void
+ slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x)
+ {
+ _Node_base* __n1 = &this->_M_head;
+ while (__n1->_M_next && __x._M_head._M_next)
+ {
+ if (((_Node*) __x._M_head._M_next)->_M_data
+ < ((_Node*) __n1->_M_next)->_M_data)
+ __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
+ __n1 = __n1->_M_next;
+ }
+ if (__x._M_head._M_next)
+ {
+ __n1->_M_next = __x._M_head._M_next;
+ __x._M_head._M_next = 0;
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ void
+ slist<_Tp, _Alloc>::sort()
+ {
+ if (this->_M_head._M_next && this->_M_head._M_next->_M_next)
+ {
+ slist __carry;
+ slist __counter[64];
+ int __fill = 0;
+ while (!empty())
+ {
+ __slist_splice_after(&__carry._M_head,
+ &this->_M_head, this->_M_head._M_next);
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty())
+ {
+ __counter[__i].merge(__carry);
+ __carry.swap(__counter[__i]);
+ ++__i;
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill)
+ ++__fill;
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ __counter[__i].merge(__counter[__i-1]);
+ this->swap(__counter[__fill-1]);
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ template <class _Predicate>
+ void slist<_Tp, _Alloc>::remove_if(_Predicate __pred)
+ {
+ _Node_base* __cur = &this->_M_head;
+ while (__cur->_M_next)
+ {
+ if (__pred(((_Node*) __cur->_M_next)->_M_data))
+ this->_M_erase_after(__cur);
+ else
+ __cur = __cur->_M_next;
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ template <class _BinaryPredicate>
+ void
+ slist<_Tp, _Alloc>::unique(_BinaryPredicate __pred)
+ {
+ _Node* __cur = (_Node*) this->_M_head._M_next;
+ if (__cur)
+ {
+ while (__cur->_M_next)
+ {
+ if (__pred(((_Node*)__cur)->_M_data,
+ ((_Node*)(__cur->_M_next))->_M_data))
+ this->_M_erase_after(__cur);
+ else
+ __cur = (_Node*) __cur->_M_next;
+ }
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ template <class _StrictWeakOrdering>
+ void
+ slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x,
+ _StrictWeakOrdering __comp)
+ {
+ _Node_base* __n1 = &this->_M_head;
+ while (__n1->_M_next && __x._M_head._M_next)
+ {
+ if (__comp(((_Node*) __x._M_head._M_next)->_M_data,
+ ((_Node*) __n1->_M_next)->_M_data))
+ __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
+ __n1 = __n1->_M_next;
+ }
+ if (__x._M_head._M_next)
+ {
+ __n1->_M_next = __x._M_head._M_next;
+ __x._M_head._M_next = 0;
+ }
+ }
+
+ template <class _Tp, class _Alloc>
+ template <class _StrictWeakOrdering>
+ void
+ slist<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp)
+ {
+ if (this->_M_head._M_next && this->_M_head._M_next->_M_next)
+ {
+ slist __carry;
+ slist __counter[64];
+ int __fill = 0;
+ while (!empty())
+ {
+ __slist_splice_after(&__carry._M_head,
+ &this->_M_head, this->_M_head._M_next);
+ int __i = 0;
+ while (__i < __fill && !__counter[__i].empty())
+ {
+ __counter[__i].merge(__carry, __comp);
+ __carry.swap(__counter[__i]);
+ ++__i;
+ }
+ __carry.swap(__counter[__i]);
+ if (__i == __fill)
+ ++__fill;
+ }
+
+ for (int __i = 1; __i < __fill; ++__i)
+ __counter[__i].merge(__counter[__i-1], __comp);
+ this->swap(__counter[__fill-1]);
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Specialization of insert_iterator so that insertions will be constant
+ // time rather than linear time.
+ template <class _Tp, class _Alloc>
+ class insert_iterator<__gnu_cxx::slist<_Tp, _Alloc> >
+ {
+ protected:
+ typedef __gnu_cxx::slist<_Tp, _Alloc> _Container;
+ _Container* container;
+ typename _Container::iterator iter;
+
+ public:
+ typedef _Container container_type;
+ typedef output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ insert_iterator(_Container& __x, typename _Container::iterator __i)
+ : container(&__x)
+ {
+ if (__i == __x.begin())
+ iter = __x.before_begin();
+ else
+ iter = __x.previous(__i);
+ }
+
+ insert_iterator<_Container>&
+ operator=(const typename _Container::value_type& __value)
+ {
+ iter = container->insert_after(iter, __value);
+ return *this;
+ }
+
+ insert_iterator<_Container>&
+ operator*()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++()
+ { return *this; }
+
+ insert_iterator<_Container>&
+ operator++(int)
+ { return *this; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/sso_string_base.h b/gcc-4.4.0/libstdc++-v3/include/ext/sso_string_base.h
new file mode 100644
index 000000000..ee704f51d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/sso_string_base.h
@@ -0,0 +1,575 @@
+// Short-string-optimized versatile string base -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/sso_string_base.h
+ * This file is a GNU extension to the Standard C++ Library.
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _SSO_STRING_BASE_H
+#define _SSO_STRING_BASE_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __sso_string_base
+ : protected __vstring_utility<_CharT, _Traits, _Alloc>
+ {
+ public:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+
+ typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
+ typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+
+ private:
+ // Data Members:
+ typename _Util_Base::template _Alloc_hider<_CharT_alloc_type>
+ _M_dataplus;
+ size_type _M_string_length;
+
+ enum { _S_local_capacity = 15 };
+
+ union
+ {
+ _CharT _M_local_data[_S_local_capacity + 1];
+ size_type _M_allocated_capacity;
+ };
+
+ void
+ _M_data(_CharT* __p)
+ { _M_dataplus._M_p = __p; }
+
+ void
+ _M_length(size_type __length)
+ { _M_string_length = __length; }
+
+ void
+ _M_capacity(size_type __capacity)
+ { _M_allocated_capacity = __capacity; }
+
+ bool
+ _M_is_local() const
+ { return _M_data() == _M_local_data; }
+
+ // Create & Destroy
+ _CharT*
+ _M_create(size_type&, size_type);
+
+ void
+ _M_dispose()
+ {
+ if (!_M_is_local())
+ _M_destroy(_M_allocated_capacity);
+#if __google_stl_debug_string
+ else {
+ // Wipe local storage for destructed string with 0xCD.
+ // This mimics what DebugAllocation does to free()d memory.
+ __builtin_memset(_M_local_data, 0xcd, sizeof(_M_local_data));
+ }
+#endif
+ }
+
+ void
+ _M_destroy(size_type __size) throw()
+ { _M_get_allocator().deallocate(_M_data(), __size + 1); }
+
+ // _M_construct_aux is used to implement the 21.3.1 para 15 which
+ // requires special behaviour if _InIterator is an integral type
+ template<typename _InIterator>
+ void
+ _M_construct_aux(_InIterator __beg, _InIterator __end,
+ std::__false_type)
+ {
+ typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
+ _M_construct(__beg, __end, _Tag());
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 438. Ambiguity in the "do the right thing" clause
+ template<typename _Integer>
+ void
+ _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
+ { _M_construct(static_cast<size_type>(__beg), __end); }
+
+ template<typename _InIterator>
+ void
+ _M_construct(_InIterator __beg, _InIterator __end)
+ {
+ typedef typename std::__is_integer<_InIterator>::__type _Integral;
+ _M_construct_aux(__beg, __end, _Integral());
+ }
+
+ // For Input Iterators, used in istreambuf_iterators, etc.
+ template<typename _InIterator>
+ void
+ _M_construct(_InIterator __beg, _InIterator __end,
+ std::input_iterator_tag);
+
+ // For forward_iterators up to random_access_iterators, used for
+ // string::iterator, _CharT*, etc.
+ template<typename _FwdIterator>
+ void
+ _M_construct(_FwdIterator __beg, _FwdIterator __end,
+ std::forward_iterator_tag);
+
+ void
+ _M_construct(size_type __req, _CharT __c);
+
+ public:
+ size_type
+ _M_max_size() const
+ { return (_M_get_allocator().max_size() - 1) / 2; }
+
+ _CharT*
+ _M_data() const
+ { return _M_dataplus._M_p; }
+
+ size_type
+ _M_length() const
+ { return _M_string_length; }
+
+ size_type
+ _M_capacity() const
+ {
+ return _M_is_local() ? size_type(_S_local_capacity)
+ : _M_allocated_capacity;
+ }
+
+ bool
+ _M_is_shared() const
+ { return false; }
+
+ void
+ _M_set_leaked() { }
+
+ void
+ _M_leak() { }
+
+ void
+ _M_set_length(size_type __n)
+ {
+ _M_length(__n);
+ traits_type::assign(_M_data()[__n], _CharT());
+ }
+
+ __sso_string_base()
+ : _M_dataplus(_M_local_data)
+ { _M_set_length(0); }
+
+ __sso_string_base(const _Alloc& __a);
+
+ __sso_string_base(const __sso_string_base& __rcs);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ __sso_string_base(__sso_string_base&& __rcs);
+#endif
+
+ __sso_string_base(size_type __n, _CharT __c, const _Alloc& __a);
+
+ template<typename _InputIterator>
+ __sso_string_base(_InputIterator __beg, _InputIterator __end,
+ const _Alloc& __a);
+
+ ~__sso_string_base()
+ { _M_dispose(); }
+
+ _CharT_alloc_type&
+ _M_get_allocator()
+ { return _M_dataplus; }
+
+ const _CharT_alloc_type&
+ _M_get_allocator() const
+ { return _M_dataplus; }
+
+ void
+ _M_swap(__sso_string_base& __rcs);
+
+ void
+ _M_assign(const __sso_string_base& __rcs);
+
+ void
+ _M_reserve(size_type __res);
+
+ void
+ _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
+ size_type __len2);
+
+ void
+ _M_erase(size_type __pos, size_type __n);
+
+ void
+ _M_clear()
+ { _M_set_length(0); }
+
+ bool
+ _M_compare(const __sso_string_base&) const
+ { return false; }
+ };
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_swap(__sso_string_base& __rcs)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<_CharT_alloc_type>::_S_do_it(_M_get_allocator(),
+ __rcs._M_get_allocator());
+
+ if (_M_is_local())
+ if (__rcs._M_is_local())
+ {
+ if (_M_length() && __rcs._M_length())
+ {
+ _CharT __tmp_data[_S_local_capacity + 1];
+ traits_type::copy(__tmp_data, __rcs._M_local_data,
+ _S_local_capacity + 1);
+ traits_type::copy(__rcs._M_local_data, _M_local_data,
+ _S_local_capacity + 1);
+ traits_type::copy(_M_local_data, __tmp_data,
+ _S_local_capacity + 1);
+ }
+ else if (__rcs._M_length())
+ {
+ traits_type::copy(_M_local_data, __rcs._M_local_data,
+ _S_local_capacity + 1);
+ _M_length(__rcs._M_length());
+ __rcs._M_set_length(0);
+ return;
+ }
+ else if (_M_length())
+ {
+ traits_type::copy(__rcs._M_local_data, _M_local_data,
+ _S_local_capacity + 1);
+ __rcs._M_length(_M_length());
+ _M_set_length(0);
+ return;
+ }
+ }
+ else
+ {
+ const size_type __tmp_capacity = __rcs._M_allocated_capacity;
+ traits_type::copy(__rcs._M_local_data, _M_local_data,
+ _S_local_capacity + 1);
+ _M_data(__rcs._M_data());
+ __rcs._M_data(__rcs._M_local_data);
+ _M_capacity(__tmp_capacity);
+ }
+ else
+ {
+ const size_type __tmp_capacity = _M_allocated_capacity;
+ if (__rcs._M_is_local())
+ {
+ traits_type::copy(_M_local_data, __rcs._M_local_data,
+ _S_local_capacity + 1);
+ __rcs._M_data(_M_data());
+ _M_data(_M_local_data);
+ }
+ else
+ {
+ _CharT* __tmp_ptr = _M_data();
+ _M_data(__rcs._M_data());
+ __rcs._M_data(__tmp_ptr);
+ _M_capacity(__rcs._M_allocated_capacity);
+ }
+ __rcs._M_capacity(__tmp_capacity);
+ }
+
+ const size_type __tmp_length = _M_length();
+ _M_length(__rcs._M_length());
+ __rcs._M_length(__tmp_length);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ _CharT*
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_create(size_type& __capacity, size_type __old_capacity)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 83. String::npos vs. string::max_size()
+ if (__capacity > _M_max_size())
+ std::__throw_length_error(__N("__sso_string_base::_M_create"));
+
+ // The below implements an exponential growth policy, necessary to
+ // meet amortized linear time requirements of the library: see
+ // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
+ if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
+ {
+ __capacity = 2 * __old_capacity;
+ // Never allocate a string bigger than max_size.
+ if (__capacity > _M_max_size())
+ __capacity = _M_max_size();
+ }
+
+ // NB: Need an array of char_type[__capacity], plus a terminating
+ // null char_type() element.
+ return _M_get_allocator().allocate(__capacity + 1);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ __sso_string_base(const _Alloc& __a)
+ : _M_dataplus(__a, _M_local_data)
+ { _M_set_length(0); }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ __sso_string_base(const __sso_string_base& __rcs)
+ : _M_dataplus(__rcs._M_get_allocator(), _M_local_data)
+ { _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ __sso_string_base(__sso_string_base&& __rcs)
+ : _M_dataplus(__rcs._M_get_allocator(), _M_local_data)
+ {
+ if (__rcs._M_is_local())
+ {
+ if (__rcs._M_length())
+ traits_type::copy(_M_local_data, __rcs._M_local_data,
+ _S_local_capacity + 1);
+ }
+ else
+ {
+ _M_data(__rcs._M_data());
+ _M_capacity(__rcs._M_allocated_capacity);
+ }
+
+ _M_length(__rcs._M_length());
+ __rcs._M_length(0);
+ __rcs._M_data(__rcs._M_local_data);
+ }
+#endif
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ __sso_string_base(size_type __n, _CharT __c, const _Alloc& __a)
+ : _M_dataplus(__a, _M_local_data)
+ { _M_construct(__n, __c); }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InputIterator>
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ __sso_string_base(_InputIterator __beg, _InputIterator __end,
+ const _Alloc& __a)
+ : _M_dataplus(__a, _M_local_data)
+ { _M_construct(__beg, __end); }
+
+ // NB: This is the special case for Input Iterators, used in
+ // istreambuf_iterators, etc.
+ // Input Iterators have a cost structure very different from
+ // pointers, calling for a different coding style.
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InIterator>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_construct(_InIterator __beg, _InIterator __end,
+ std::input_iterator_tag)
+ {
+ size_type __len = 0;
+ size_type __capacity = size_type(_S_local_capacity);
+
+ while (__beg != __end && __len < __capacity)
+ {
+ _M_data()[__len++] = *__beg;
+ ++__beg;
+ }
+
+ __try
+ {
+ while (__beg != __end)
+ {
+ if (__len == __capacity)
+ {
+ // Allocate more space.
+ __capacity = __len + 1;
+ _CharT* __another = _M_create(__capacity, __len);
+ _S_copy(__another, _M_data(), __len);
+ _M_dispose();
+ _M_data(__another);
+ _M_capacity(__capacity);
+ }
+ _M_data()[__len++] = *__beg;
+ ++__beg;
+ }
+ }
+ __catch(...)
+ {
+ _M_dispose();
+ __throw_exception_again;
+ }
+
+ _M_set_length(__len);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ template<typename _InIterator>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_construct(_InIterator __beg, _InIterator __end,
+ std::forward_iterator_tag)
+ {
+ // NB: Not required, but considered best practice.
+ if (__builtin_expect(__is_null_pointer(__beg) && __beg != __end, 0))
+ std::__throw_logic_error(__N("__sso_string_base::"
+ "_M_construct NULL not valid"));
+
+ size_type __dnew = static_cast<size_type>(std::distance(__beg, __end));
+
+ if (__dnew > size_type(_S_local_capacity))
+ {
+ _M_data(_M_create(__dnew, size_type(0)));
+ _M_capacity(__dnew);
+ }
+
+ // Check for out_of_range and length_error exceptions.
+ __try
+ { _S_copy_chars(_M_data(), __beg, __end); }
+ __catch(...)
+ {
+ _M_dispose();
+ __throw_exception_again;
+ }
+
+ _M_set_length(__dnew);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_construct(size_type __n, _CharT __c)
+ {
+ if (__n > size_type(_S_local_capacity))
+ {
+ _M_data(_M_create(__n, size_type(0)));
+ _M_capacity(__n);
+ }
+
+ if (__n)
+ _S_assign(_M_data(), __n, __c);
+
+ _M_set_length(__n);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_assign(const __sso_string_base& __rcs)
+ {
+ if (this != &__rcs)
+ {
+ const size_type __rsize = __rcs._M_length();
+ const size_type __capacity = _M_capacity();
+
+ if (__rsize > __capacity)
+ {
+ size_type __new_capacity = __rsize;
+ _CharT* __tmp = _M_create(__new_capacity, __capacity);
+ _M_dispose();
+ _M_data(__tmp);
+ _M_capacity(__new_capacity);
+ }
+
+ if (__rsize)
+ _S_copy(_M_data(), __rcs._M_data(), __rsize);
+
+ _M_set_length(__rsize);
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_reserve(size_type __res)
+ {
+ // Make sure we don't shrink below the current size.
+ if (__res < _M_length())
+ __res = _M_length();
+
+ const size_type __capacity = _M_capacity();
+ if (__res != __capacity)
+ {
+ if (__res > __capacity
+ || __res > size_type(_S_local_capacity))
+ {
+ _CharT* __tmp = _M_create(__res, __capacity);
+ _S_copy(__tmp, _M_data(), _M_length() + 1);
+ _M_dispose();
+ _M_data(__tmp);
+ _M_capacity(__res);
+ }
+ else if (!_M_is_local())
+ {
+ _S_copy(_M_local_data, _M_data(), _M_length() + 1);
+ _M_destroy(__capacity);
+ _M_data(_M_local_data);
+ }
+ }
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,
+ const size_type __len2)
+ {
+ const size_type __how_much = _M_length() - __pos - __len1;
+
+ size_type __new_capacity = _M_length() + __len2 - __len1;
+ _CharT* __r = _M_create(__new_capacity, _M_capacity());
+
+ if (__pos)
+ _S_copy(__r, _M_data(), __pos);
+ if (__s && __len2)
+ _S_copy(__r + __pos, __s, __len2);
+ if (__how_much)
+ _S_copy(__r + __pos + __len2,
+ _M_data() + __pos + __len1, __how_much);
+
+ _M_dispose();
+ _M_data(__r);
+ _M_capacity(__new_capacity);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __sso_string_base<_CharT, _Traits, _Alloc>::
+ _M_erase(size_type __pos, size_type __n)
+ {
+ const size_type __how_much = _M_length() - __pos - __n;
+
+ if (__how_much && __n)
+ _S_move(_M_data() + __pos, _M_data() + __pos + __n,
+ __how_much);
+
+ _M_set_length(_M_length() - __n);
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _SSO_STRING_BASE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/stdio_filebuf.h b/gcc-4.4.0/libstdc++-v3/include/ext/stdio_filebuf.h
new file mode 100644
index 000000000..6efe4ea12
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/stdio_filebuf.h
@@ -0,0 +1,157 @@
+// File descriptor layer for filebuf -*- C++ -*-
+
+// Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/stdio_filebuf.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _STDIO_FILEBUF_H
+#define _STDIO_FILEBUF_H 1
+
+#pragma GCC system_header
+
+#include <fstream>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /**
+ * @brief Provides a layer of compatibility for C/POSIX.
+ *
+ * This GNU extension provides extensions for working with standard C
+ * FILE*'s and POSIX file descriptors. It must be instantiated by the
+ * user with the type of character used in the file stream, e.g.,
+ * stdio_filebuf<char>.
+ */
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
+ class stdio_filebuf : public std::basic_filebuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ typedef std::size_t size_t;
+
+ public:
+ /**
+ * deferred initialization
+ */
+ stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {}
+
+ /**
+ * @param fd An open file descriptor.
+ * @param mode Same meaning as in a standard filebuf.
+ * @param size Optimal or preferred size of internal buffer, in chars.
+ *
+ * This constructor associates a file stream buffer with an open
+ * POSIX file descriptor. The file descriptor will be automatically
+ * closed when the stdio_filebuf is closed/destroyed.
+ */
+ stdio_filebuf(int __fd, std::ios_base::openmode __mode,
+ size_t __size = static_cast<size_t>(BUFSIZ));
+
+ /**
+ * @param f An open @c FILE*.
+ * @param mode Same meaning as in a standard filebuf.
+ * @param size Optimal or preferred size of internal buffer, in chars.
+ * Defaults to system's @c BUFSIZ.
+ *
+ * This constructor associates a file stream buffer with an open
+ * C @c FILE*. The @c FILE* will not be automatically closed when the
+ * stdio_filebuf is closed/destroyed.
+ */
+ stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
+ size_t __size = static_cast<size_t>(BUFSIZ));
+
+ /**
+ * Closes the external data stream if the file descriptor constructor
+ * was used.
+ */
+ virtual
+ ~stdio_filebuf();
+
+ /**
+ * @return The underlying file descriptor.
+ *
+ * Once associated with an external data stream, this function can be
+ * used to access the underlying POSIX file descriptor. Note that
+ * there is no way for the library to track what you do with the
+ * descriptor, so be careful.
+ */
+ int
+ fd() { return this->_M_file.fd(); }
+
+ /**
+ * @return The underlying FILE*.
+ *
+ * This function can be used to access the underlying "C" file pointer.
+ * Note that there is no way for the library to track what you do
+ * with the file, so be careful.
+ */
+ std::__c_file*
+ file() { return this->_M_file.file(); }
+ };
+
+ template<typename _CharT, typename _Traits>
+ stdio_filebuf<_CharT, _Traits>::~stdio_filebuf()
+ { }
+
+ template<typename _CharT, typename _Traits>
+ stdio_filebuf<_CharT, _Traits>::
+ stdio_filebuf(int __fd, std::ios_base::openmode __mode, size_t __size)
+ {
+ this->_M_file.sys_open(__fd, __mode);
+ if (this->is_open())
+ {
+ this->_M_mode = __mode;
+ this->_M_buf_size = __size;
+ this->_M_allocate_internal_buffer();
+ this->_M_reading = false;
+ this->_M_writing = false;
+ this->_M_set_buffer(-1);
+ }
+ }
+
+ template<typename _CharT, typename _Traits>
+ stdio_filebuf<_CharT, _Traits>::
+ stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
+ size_t __size)
+ {
+ this->_M_file.sys_open(__f, __mode);
+ if (this->is_open())
+ {
+ this->_M_mode = __mode;
+ this->_M_buf_size = __size;
+ this->_M_allocate_internal_buffer();
+ this->_M_reading = false;
+ this->_M_writing = false;
+ this->_M_set_buffer(-1);
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/stdio_sync_filebuf.h b/gcc-4.4.0/libstdc++-v3/include/ext/stdio_sync_filebuf.h
new file mode 100644
index 000000000..9407e96e1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/stdio_sync_filebuf.h
@@ -0,0 +1,279 @@
+// Iostreams wrapper for stdio FILE* -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/stdio_sync_filebuf.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _STDIO_SYNC_FILEBUF_H
+#define _STDIO_SYNC_FILEBUF_H 1
+
+#pragma GCC system_header
+
+#include <streambuf>
+#include <unistd.h>
+#include <cstdio>
+#include <bits/c++io.h> // For __c_file
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+#include <cwchar>
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /// class stdio_sync_filebuf.
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
+ class stdio_sync_filebuf : public std::basic_streambuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ private:
+ // Underlying stdio FILE
+ std::__c_file* const _M_file;
+
+ // Last character gotten. This is used when pbackfail is
+ // called from basic_streambuf::sungetc()
+ int_type _M_unget_buf;
+
+ public:
+ explicit
+ stdio_sync_filebuf(std::__c_file* __f)
+ : _M_file(__f), _M_unget_buf(traits_type::eof())
+ { }
+
+ /**
+ * @return The underlying FILE*.
+ *
+ * This function can be used to access the underlying "C" file pointer.
+ * Note that there is no way for the library to track what you do
+ * with the file, so be careful.
+ */
+ std::__c_file* const
+ file() { return this->_M_file; }
+
+ protected:
+ int_type
+ syncgetc();
+
+ int_type
+ syncungetc(int_type __c);
+
+ int_type
+ syncputc(int_type __c);
+
+ virtual int_type
+ underflow()
+ {
+ int_type __c = this->syncgetc();
+ return this->syncungetc(__c);
+ }
+
+ virtual int_type
+ uflow()
+ {
+ // Store the gotten character in case we need to unget it.
+ _M_unget_buf = this->syncgetc();
+ return _M_unget_buf;
+ }
+
+ virtual int_type
+ pbackfail(int_type __c = traits_type::eof())
+ {
+ int_type __ret;
+ const int_type __eof = traits_type::eof();
+
+ // Check if the unget or putback was requested
+ if (traits_type::eq_int_type(__c, __eof)) // unget
+ {
+ if (!traits_type::eq_int_type(_M_unget_buf, __eof))
+ __ret = this->syncungetc(_M_unget_buf);
+ else // buffer invalid, fail.
+ __ret = __eof;
+ }
+ else // putback
+ __ret = this->syncungetc(__c);
+
+ // The buffered character is no longer valid, discard it.
+ _M_unget_buf = __eof;
+ return __ret;
+ }
+
+ virtual std::streamsize
+ xsgetn(char_type* __s, std::streamsize __n);
+
+ virtual int_type
+ overflow(int_type __c = traits_type::eof())
+ {
+ int_type __ret;
+ if (traits_type::eq_int_type(__c, traits_type::eof()))
+ {
+ if (std::fflush(_M_file))
+ __ret = traits_type::eof();
+ else
+ __ret = traits_type::not_eof(__c);
+ }
+ else
+ __ret = this->syncputc(__c);
+ return __ret;
+ }
+
+ virtual std::streamsize
+ xsputn(const char_type* __s, std::streamsize __n);
+
+ virtual int
+ sync()
+ { return std::fflush(_M_file); }
+
+ virtual std::streampos
+ seekoff(std::streamoff __off, std::ios_base::seekdir __dir,
+ std::ios_base::openmode = std::ios_base::in | std::ios_base::out)
+ {
+ std::streampos __ret(std::streamoff(-1));
+ int __whence;
+ if (__dir == std::ios_base::beg)
+ __whence = SEEK_SET;
+ else if (__dir == std::ios_base::cur)
+ __whence = SEEK_CUR;
+ else
+ __whence = SEEK_END;
+#ifdef _GLIBCXX_USE_LFS
+ if (!fseeko64(_M_file, __off, __whence))
+ __ret = std::streampos(ftello64(_M_file));
+#else
+ if (!fseek(_M_file, __off, __whence))
+ __ret = std::streampos(std::ftell(_M_file));
+#endif
+ return __ret;
+ }
+
+ virtual std::streampos
+ seekpos(std::streampos __pos,
+ std::ios_base::openmode __mode =
+ std::ios_base::in | std::ios_base::out)
+ { return seekoff(std::streamoff(__pos), std::ios_base::beg, __mode); }
+ };
+
+ template<>
+ inline stdio_sync_filebuf<char>::int_type
+ stdio_sync_filebuf<char>::syncgetc()
+ { return std::getc(_M_file); }
+
+ template<>
+ inline stdio_sync_filebuf<char>::int_type
+ stdio_sync_filebuf<char>::syncungetc(int_type __c)
+ { return std::ungetc(__c, _M_file); }
+
+ template<>
+ inline stdio_sync_filebuf<char>::int_type
+ stdio_sync_filebuf<char>::syncputc(int_type __c)
+ { return std::putc(__c, _M_file); }
+
+ template<>
+ inline std::streamsize
+ stdio_sync_filebuf<char>::xsgetn(char* __s, std::streamsize __n)
+ {
+ std::streamsize __ret = std::fread(__s, 1, __n, _M_file);
+ if (__ret > 0)
+ _M_unget_buf = traits_type::to_int_type(__s[__ret - 1]);
+ else
+ _M_unget_buf = traits_type::eof();
+ return __ret;
+ }
+
+ template<>
+ inline std::streamsize
+ stdio_sync_filebuf<char>::xsputn(const char* __s, std::streamsize __n)
+ { return std::fwrite(__s, 1, __n, _M_file); }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ inline stdio_sync_filebuf<wchar_t>::int_type
+ stdio_sync_filebuf<wchar_t>::syncgetc()
+ { return std::getwc(_M_file); }
+
+ template<>
+ inline stdio_sync_filebuf<wchar_t>::int_type
+ stdio_sync_filebuf<wchar_t>::syncungetc(int_type __c)
+ { return std::ungetwc(__c, _M_file); }
+
+ template<>
+ inline stdio_sync_filebuf<wchar_t>::int_type
+ stdio_sync_filebuf<wchar_t>::syncputc(int_type __c)
+ { return std::putwc(__c, _M_file); }
+
+ template<>
+ inline std::streamsize
+ stdio_sync_filebuf<wchar_t>::xsgetn(wchar_t* __s, std::streamsize __n)
+ {
+ std::streamsize __ret = 0;
+ const int_type __eof = traits_type::eof();
+ while (__n--)
+ {
+ int_type __c = this->syncgetc();
+ if (traits_type::eq_int_type(__c, __eof))
+ break;
+ __s[__ret] = traits_type::to_char_type(__c);
+ ++__ret;
+ }
+
+ if (__ret > 0)
+ _M_unget_buf = traits_type::to_int_type(__s[__ret - 1]);
+ else
+ _M_unget_buf = traits_type::eof();
+ return __ret;
+ }
+
+ template<>
+ inline std::streamsize
+ stdio_sync_filebuf<wchar_t>::xsputn(const wchar_t* __s,
+ std::streamsize __n)
+ {
+ std::streamsize __ret = 0;
+ const int_type __eof = traits_type::eof();
+ while (__n--)
+ {
+ if (traits_type::eq_int_type(this->syncputc(*__s++), __eof))
+ break;
+ ++__ret;
+ }
+ return __ret;
+ }
+#endif
+
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template class stdio_sync_filebuf<char>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template class stdio_sync_filebuf<wchar_t>;
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/string_conversions.h b/gcc-4.4.0/libstdc++-v3/include/ext/string_conversions.h
new file mode 100644
index 000000000..36c19e0a9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/string_conversions.h
@@ -0,0 +1,94 @@
+// String Conversions -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef _STRING_CONVERSIONS_H
+#define _STRING_CONVERSIONS_H 1
+
+#pragma GCC system_header
+
+#include <ext/numeric_traits.h>
+#include <bits/functexcept.h>
+#include <cstddef>
+#include <cstdlib>
+#include <cwchar>
+#include <cstdio>
+#include <cerrno>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Helper for all the sto* functions.
+ template<typename _TRet, typename _Ret = _TRet, typename _CharT,
+ typename... _Base>
+ _Ret
+ __stoa(_TRet (*__convf) (const _CharT*, _CharT**, _Base...),
+ const char* __name, const _CharT* __str, std::size_t* __idx,
+ _Base... __base)
+ {
+ _Ret __ret;
+
+ _CharT* __endptr;
+ errno = 0;
+ const _TRet __tmp = __convf(__str, &__endptr, __base...);
+
+ if (__endptr == __str)
+ std::__throw_invalid_argument(__name);
+ else if (errno == ERANGE
+ || (std::__are_same<_Ret, int>::__value
+ && (__tmp < __numeric_traits<int>::__min
+ || __tmp > __numeric_traits<int>::__max)))
+ std::__throw_out_of_range(__name);
+ else
+ __ret = __tmp;
+
+ if (__idx)
+ *__idx = __endptr - __str;
+
+ return __ret;
+ }
+
+ // Helper for the to_string / to_wstring functions.
+ template<typename _String, typename _CharT = typename _String::value_type>
+ _String
+ __to_xstring(int (*__convf) (_CharT*, std::size_t, const _CharT*,
+ __builtin_va_list), std::size_t __n,
+ const _CharT* __fmt, ...)
+ {
+ // XXX Eventually the result will be constructed in place in
+ // the C++0x string, likely with the help of internal hooks.
+ _CharT* __s = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
+ * __n));
+
+ __builtin_va_list __args;
+ __builtin_va_start(__args, __fmt);
+
+ const int __len = __convf(__s, __n, __fmt, __args);
+
+ __builtin_va_end(__args);
+
+ return _String(__s, __s + __len);
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _STRING_CONVERSIONS_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/throw_allocator.h b/gcc-4.4.0/libstdc++-v3/include/ext/throw_allocator.h
new file mode 100644
index 000000000..c87408fd9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/throw_allocator.h
@@ -0,0 +1,448 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice
+// and this permission notice appear in supporting documentation. None
+// of the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied
+// warranty.
+
+/** @file ext/throw_allocator.h
+ * This file is a GNU extension to the Standard C++ Library.
+ *
+ * Contains an exception-throwing allocator, useful for testing
+ * exception safety. In addition, allocation addresses are stored and
+ * sanity checked.
+ */
+
+#ifndef _THROW_ALLOCATOR_H
+#define _THROW_ALLOCATOR_H 1
+
+#include <cmath>
+#include <ctime>
+#include <map>
+#include <set>
+#include <string>
+#include <ostream>
+#include <stdexcept>
+#include <utility>
+#include <tr1/random>
+#include <bits/functexcept.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ class twister_rand_gen
+ {
+ private:
+ std::tr1::mt19937 _M_generator;
+
+ public:
+ twister_rand_gen(unsigned int s = static_cast<unsigned int>(std::time(0)));
+
+ void
+ init(unsigned int);
+
+ double
+ get_prob();
+ };
+
+ /**
+ * @brief Thown by throw_allocator.
+ * @ingroup exceptions
+ */
+ struct forced_exception_error : public std::exception
+ { };
+
+ // Substitute for concurrence_error object in the case of -fno-exceptions.
+ inline void
+ __throw_forced_exception_error()
+ {
+#if __EXCEPTIONS
+ throw forced_exception_error();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ /// Base class.
+ class throw_allocator_base
+ {
+ public:
+ void
+ init(unsigned long seed);
+
+ static void
+ set_throw_prob(double throw_prob);
+
+ static double
+ get_throw_prob();
+
+ static void
+ set_label(size_t l);
+
+ static bool
+ empty();
+
+ struct group_throw_prob_adjustor
+ {
+ group_throw_prob_adjustor(size_t size) : _M_throw_prob_orig(_S_throw_prob)
+ {
+ _S_throw_prob =
+ 1 - std::pow(double(1 - _S_throw_prob), double(0.5 / (size + 1)));
+ }
+
+ ~group_throw_prob_adjustor()
+ { _S_throw_prob = _M_throw_prob_orig; }
+
+ private:
+ const double _M_throw_prob_orig;
+ };
+
+ struct zero_throw_prob_adjustor
+ {
+ zero_throw_prob_adjustor() : _M_throw_prob_orig(_S_throw_prob)
+ { _S_throw_prob = 0; }
+
+ ~zero_throw_prob_adjustor()
+ { _S_throw_prob = _M_throw_prob_orig; }
+
+ private:
+ const double _M_throw_prob_orig;
+ };
+
+ protected:
+ static void
+ insert(void*, size_t);
+
+ static void
+ erase(void*, size_t);
+
+ static void
+ throw_conditionally();
+
+ // See if a particular address and size has been allocated by this
+ // allocator.
+ static void
+ check_allocated(void*, size_t);
+
+ // See if a given label has been allocated by this allocator.
+ static void
+ check_allocated(size_t);
+
+ private:
+ typedef std::pair<size_t, size_t> alloc_data_type;
+ typedef std::map<void*, alloc_data_type> map_type;
+ typedef map_type::value_type entry_type;
+ typedef map_type::const_iterator const_iterator;
+ typedef map_type::const_reference const_reference;
+
+ friend std::ostream&
+ operator<<(std::ostream&, const throw_allocator_base&);
+
+ static entry_type
+ make_entry(void*, size_t);
+
+ static void
+ print_to_string(std::string&);
+
+ static void
+ print_to_string(std::string&, const_reference);
+
+ static twister_rand_gen _S_g;
+ static map_type _S_map;
+ static double _S_throw_prob;
+ static size_t _S_label;
+ };
+
+ /**
+ * @brief Allocator class with logging and exception control.
+ * @ingroup allocators
+ */
+ template<typename T>
+ class throw_allocator : public throw_allocator_base
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+
+ template<typename U>
+ struct rebind
+ {
+ typedef throw_allocator<U> other;
+ };
+
+ throw_allocator() throw() { }
+
+ throw_allocator(const throw_allocator&) throw() { }
+
+ template<typename U>
+ throw_allocator(const throw_allocator<U>&) throw() { }
+
+ ~throw_allocator() throw() { }
+
+ size_type
+ max_size() const throw()
+ { return std::allocator<value_type>().max_size(); }
+
+ pointer
+ allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
+ {
+ if (__builtin_expect(__n > this->max_size(), false))
+ std::__throw_bad_alloc();
+
+ throw_conditionally();
+ value_type* const a = std::allocator<value_type>().allocate(__n, hint);
+ insert(a, sizeof(value_type) * __n);
+ return a;
+ }
+
+ void
+ construct(pointer __p, const T& val)
+ { return std::allocator<value_type>().construct(__p, val); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ {
+ return std::allocator<value_type>().
+ construct(__p, std::forward<_Args>(__args)...);
+ }
+#endif
+
+ void
+ destroy(pointer __p)
+ { std::allocator<value_type>().destroy(__p); }
+
+ void
+ deallocate(pointer __p, size_type __n)
+ {
+ erase(__p, sizeof(value_type) * __n);
+ std::allocator<value_type>().deallocate(__p, __n);
+ }
+
+ void
+ check_allocated(pointer __p, size_type __n)
+ { throw_allocator_base::check_allocated(__p, sizeof(value_type) * __n); }
+
+ void
+ check_allocated(size_type label)
+ { throw_allocator_base::check_allocated(label); }
+ };
+
+ template<typename T>
+ inline bool
+ operator==(const throw_allocator<T>&, const throw_allocator<T>&)
+ { return true; }
+
+ template<typename T>
+ inline bool
+ operator!=(const throw_allocator<T>&, const throw_allocator<T>&)
+ { return false; }
+
+ std::ostream&
+ operator<<(std::ostream& os, const throw_allocator_base& alloc)
+ {
+ std::string error;
+ throw_allocator_base::print_to_string(error);
+ os << error;
+ return os;
+ }
+
+ // XXX Should be in .cc.
+ twister_rand_gen::
+ twister_rand_gen(unsigned int seed) : _M_generator(seed) { }
+
+ void
+ twister_rand_gen::
+ init(unsigned int seed)
+ { _M_generator.seed(seed); }
+
+ double
+ twister_rand_gen::
+ get_prob()
+ {
+ const double min = _M_generator.min();
+ const double res = static_cast<const double>(_M_generator() - min);
+ const double range = static_cast<const double>(_M_generator.max() - min);
+ const double ret = res / range;
+ _GLIBCXX_DEBUG_ASSERT(ret >= 0 && ret <= 1);
+ return ret;
+ }
+
+ twister_rand_gen throw_allocator_base::_S_g;
+
+ throw_allocator_base::map_type
+ throw_allocator_base::_S_map;
+
+ double throw_allocator_base::_S_throw_prob;
+
+ size_t throw_allocator_base::_S_label = 0;
+
+ throw_allocator_base::entry_type
+ throw_allocator_base::make_entry(void* p, size_t size)
+ { return std::make_pair(p, alloc_data_type(_S_label, size)); }
+
+ void
+ throw_allocator_base::init(unsigned long seed)
+ { _S_g.init(seed); }
+
+ void
+ throw_allocator_base::set_throw_prob(double throw_prob)
+ { _S_throw_prob = throw_prob; }
+
+ double
+ throw_allocator_base::get_throw_prob()
+ { return _S_throw_prob; }
+
+ void
+ throw_allocator_base::set_label(size_t l)
+ { _S_label = l; }
+
+ void
+ throw_allocator_base::insert(void* p, size_t size)
+ {
+ const_iterator found_it = _S_map.find(p);
+ if (found_it != _S_map.end())
+ {
+ std::string error("throw_allocator_base::insert");
+ error += "double insert!";
+ error += '\n';
+ print_to_string(error, make_entry(p, size));
+ print_to_string(error, *found_it);
+ std::__throw_logic_error(error.c_str());
+ }
+ _S_map.insert(make_entry(p, size));
+ }
+
+ bool
+ throw_allocator_base::empty()
+ { return _S_map.empty(); }
+
+ void
+ throw_allocator_base::erase(void* p, size_t size)
+ {
+ check_allocated(p, size);
+ _S_map.erase(p);
+ }
+
+ void
+ throw_allocator_base::check_allocated(void* p, size_t size)
+ {
+ const_iterator found_it = _S_map.find(p);
+ if (found_it == _S_map.end())
+ {
+ std::string error("throw_allocator_base::check_allocated by value ");
+ error += "null erase!";
+ error += '\n';
+ print_to_string(error, make_entry(p, size));
+ std::__throw_logic_error(error.c_str());
+ }
+
+ if (found_it->second.second != size)
+ {
+ std::string error("throw_allocator_base::check_allocated by value ");
+ error += "wrong-size erase!";
+ error += '\n';
+ print_to_string(error, make_entry(p, size));
+ print_to_string(error, *found_it);
+ std::__throw_logic_error(error.c_str());
+ }
+ }
+
+ void
+ throw_allocator_base::check_allocated(size_t label)
+ {
+ std::string found;
+ const_iterator it = _S_map.begin();
+ while (it != _S_map.end())
+ {
+ if (it->second.first == label)
+ {
+ print_to_string(found, *it);
+ }
+ ++it;
+ }
+
+ if (!found.empty())
+ {
+ std::string error("throw_allocator_base::check_allocated by label ");
+ error += '\n';
+ error += found;
+ std::__throw_logic_error(error.c_str());
+ }
+ }
+
+ void
+ throw_allocator_base::throw_conditionally()
+ {
+ if (_S_g.get_prob() < _S_throw_prob)
+ __throw_forced_exception_error();
+ }
+
+ void
+ throw_allocator_base::print_to_string(std::string& s)
+ {
+ const_iterator begin = throw_allocator_base::_S_map.begin();
+ const_iterator end = throw_allocator_base::_S_map.end();
+ for (; begin != end; ++begin)
+ print_to_string(s, *begin);
+ }
+
+ void
+ throw_allocator_base::print_to_string(std::string& s, const_reference ref)
+ {
+ char buf[40];
+ const char tab('\t');
+ s += "address: ";
+ __builtin_sprintf(buf, "%p", ref.first);
+ s += buf;
+ s += tab;
+ s += "label: ";
+ unsigned long l = static_cast<unsigned long>(ref.second.first);
+ __builtin_sprintf(buf, "%lu", l);
+ s += buf;
+ s += tab;
+ s += "size: ";
+ l = static_cast<unsigned long>(ref.second.second);
+ __builtin_sprintf(buf, "%lu", l);
+ s += buf;
+ s += '\n';
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/type_traits.h b/gcc-4.4.0/libstdc++-v3/include/ext/type_traits.h
new file mode 100644
index 000000000..b24ce4e5b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/type_traits.h
@@ -0,0 +1,204 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/type_traits.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _EXT_TYPE_TRAITS
+#define _EXT_TYPE_TRAITS 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // Define a nested type if some predicate holds.
+ template<bool, typename>
+ struct __enable_if
+ { };
+
+ template<typename _Tp>
+ struct __enable_if<true, _Tp>
+ { typedef _Tp __type; };
+
+
+ // Conditional expression for types. If true, first, if false, second.
+ template<bool _Cond, typename _Iftrue, typename _Iffalse>
+ struct __conditional_type
+ { typedef _Iftrue __type; };
+
+ template<typename _Iftrue, typename _Iffalse>
+ struct __conditional_type<false, _Iftrue, _Iffalse>
+ { typedef _Iffalse __type; };
+
+
+ // Given an integral builtin type, return the corresponding unsigned type.
+ template<typename _Tp>
+ struct __add_unsigned
+ {
+ private:
+ typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
+
+ public:
+ typedef typename __if_type::__type __type;
+ };
+
+ template<>
+ struct __add_unsigned<char>
+ { typedef unsigned char __type; };
+
+ template<>
+ struct __add_unsigned<signed char>
+ { typedef unsigned char __type; };
+
+ template<>
+ struct __add_unsigned<short>
+ { typedef unsigned short __type; };
+
+ template<>
+ struct __add_unsigned<int>
+ { typedef unsigned int __type; };
+
+ template<>
+ struct __add_unsigned<long>
+ { typedef unsigned long __type; };
+
+ template<>
+ struct __add_unsigned<long long>
+ { typedef unsigned long long __type; };
+
+ // Declare but don't define.
+ template<>
+ struct __add_unsigned<bool>;
+
+ template<>
+ struct __add_unsigned<wchar_t>;
+
+
+ // Given an integral builtin type, return the corresponding signed type.
+ template<typename _Tp>
+ struct __remove_unsigned
+ {
+ private:
+ typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
+
+ public:
+ typedef typename __if_type::__type __type;
+ };
+
+ template<>
+ struct __remove_unsigned<char>
+ { typedef signed char __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned char>
+ { typedef signed char __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned short>
+ { typedef short __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned int>
+ { typedef int __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned long>
+ { typedef long __type; };
+
+ template<>
+ struct __remove_unsigned<unsigned long long>
+ { typedef long long __type; };
+
+ // Declare but don't define.
+ template<>
+ struct __remove_unsigned<bool>;
+
+ template<>
+ struct __remove_unsigned<wchar_t>;
+
+
+ // For use in string and vstring.
+ template<typename _Type>
+ inline bool
+ __is_null_pointer(_Type* __ptr)
+ { return __ptr == 0; }
+
+ template<typename _Type>
+ inline bool
+ __is_null_pointer(_Type)
+ { return false; }
+
+
+ // For complex and cmath
+ template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
+ struct __promote
+ { typedef double __type; };
+
+ template<typename _Tp>
+ struct __promote<_Tp, false>
+ { typedef _Tp __type; };
+
+ template<typename _Tp, typename _Up>
+ struct __promote_2
+ {
+ private:
+ typedef typename __promote<_Tp>::__type __type1;
+ typedef typename __promote<_Up>::__type __type2;
+
+ public:
+ typedef __typeof__(__type1() + __type2()) __type;
+ };
+
+ template<typename _Tp, typename _Up, typename _Vp>
+ struct __promote_3
+ {
+ private:
+ typedef typename __promote<_Tp>::__type __type1;
+ typedef typename __promote<_Up>::__type __type2;
+ typedef typename __promote<_Vp>::__type __type3;
+
+ public:
+ typedef __typeof__(__type1() + __type2() + __type3()) __type;
+ };
+
+ template<typename _Tp, typename _Up, typename _Vp, typename _Wp>
+ struct __promote_4
+ {
+ private:
+ typedef typename __promote<_Tp>::__type __type1;
+ typedef typename __promote<_Up>::__type __type2;
+ typedef typename __promote<_Vp>::__type __type3;
+ typedef typename __promote<_Wp>::__type __type4;
+
+ public:
+ typedef __typeof__(__type1() + __type2() + __type3() + __type4()) __type;
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/typelist.h b/gcc-4.4.0/libstdc++-v3/include/ext/typelist.h
new file mode 100644
index 000000000..ff1cac7ee
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/typelist.h
@@ -0,0 +1,544 @@
+// -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
+
+// Permission to use, copy, modify, sell, and distribute this software
+// is hereby granted without fee, provided that the above copyright
+// notice appears in all copies, and that both that copyright notice and
+// this permission notice appear in supporting documentation. None of
+// the above authors, nor IBM Haifa Research Laboratories, make any
+// representation about the suitability of this software for any
+// purpose. It is provided "as is" without express or implied warranty.
+
+/**
+ * @file typelist.h
+ * Contains typelist_chain definitions.
+ * Typelists are an idea by Andrei Alexandrescu.
+ */
+
+#ifndef _TYPELIST_H
+#define _TYPELIST_H 1
+
+#include <ext/type_traits.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+/** @namespace __gnu_cxx::typelist
+ * @brief GNU typelist extensions for public compile-time use.
+*/
+namespace typelist
+{
+ struct null_type { };
+
+ template<typename Root>
+ struct node
+ {
+ typedef Root root;
+ };
+
+ // Forward declarations of functors.
+ template<typename Hd, typename Typelist>
+ struct chain
+ {
+ typedef Hd head;
+ typedef Typelist tail;
+ };
+
+ // Apply all typelist types to unary functor.
+ template<typename Fn, typename Typelist>
+ void
+ apply(Fn&, Typelist);
+
+ /// Apply all typelist types to generator functor.
+ template<typename Gn, typename Typelist>
+ void
+ apply_generator(Gn&, Typelist);
+
+ // Apply all typelist types and values to generator functor.
+ template<typename Gn, typename TypelistT, typename TypelistV>
+ void
+ apply_generator(Gn&, TypelistT, TypelistV);
+
+ template<typename Typelist0, typename Typelist1>
+ struct append;
+
+ template<typename Typelist_Typelist>
+ struct append_typelist;
+
+ template<typename Typelist, typename T>
+ struct contains;
+
+ template<typename Typelist, template<typename T> class Pred>
+ struct filter;
+
+ template<typename Typelist, int i>
+ struct at_index;
+
+ template<typename Typelist, template<typename T> class Transform>
+ struct transform;
+
+ template<typename Typelist_Typelist>
+ struct flatten;
+
+ template<typename Typelist>
+ struct from_first;
+
+ template<typename T1>
+ struct create1;
+
+ template<typename T1, typename T2>
+ struct create2;
+
+ template<typename T1, typename T2, typename T3>
+ struct create3;
+
+ template<typename T1, typename T2, typename T3, typename T4>
+ struct create4;
+
+ template<typename T1, typename T2, typename T3, typename T4, typename T5>
+ struct create5;
+
+ template<typename T1, typename T2, typename T3,
+ typename T4, typename T5, typename T6>
+ struct create6;
+} // namespace typelist
+
+_GLIBCXX_END_NAMESPACE
+
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+namespace typelist
+{
+namespace detail
+{
+ template<typename Fn, typename Typelist_Chain>
+ struct apply_;
+
+ template<typename Fn, typename Hd, typename Tl>
+ struct apply_<Fn, chain<Hd, Tl> >
+ {
+ void
+ operator()(Fn& f)
+ {
+ f.operator()(Hd());
+ apply_<Fn, Tl> next;
+ next(f);
+ }
+ };
+
+ template<typename Fn>
+ struct apply_<Fn, null_type>
+ {
+ void
+ operator()(Fn&) { }
+ };
+
+ template<typename Gn, typename Typelist_Chain>
+ struct apply_generator1_;
+
+ template<typename Gn, typename Hd, typename Tl>
+ struct apply_generator1_<Gn, chain<Hd, Tl> >
+ {
+ void
+ operator()(Gn& g)
+ {
+ g.template operator()<Hd>();
+ apply_generator1_<Gn, Tl> next;
+ next(g);
+ }
+ };
+
+ template<typename Gn>
+ struct apply_generator1_<Gn, null_type>
+ {
+ void
+ operator()(Gn&) { }
+ };
+
+ template<typename Gn, typename TypelistT_Chain, typename TypelistV_Chain>
+ struct apply_generator2_;
+
+ template<typename Gn, typename Hd1, typename TlT, typename Hd2, typename TlV>
+ struct apply_generator2_<Gn, chain<Hd1, TlT>, chain<Hd2, TlV> >
+ {
+ void
+ operator()(Gn& g)
+ {
+ g.template operator()<Hd1, Hd2>();
+ apply_generator2_<Gn, TlT, TlV> next;
+ next(g);
+ }
+ };
+
+ template<typename Gn>
+ struct apply_generator2_<Gn, null_type, null_type>
+ {
+ void
+ operator()(Gn&) { }
+ };
+
+ template<typename Typelist_Chain0, typename Typelist_Chain1>
+ struct append_;
+
+ template<typename Hd, typename Tl, typename Typelist_Chain>
+ struct append_<chain<Hd, Tl>, Typelist_Chain>
+ {
+ private:
+ typedef append_<Tl, Typelist_Chain> append_type;
+
+ public:
+ typedef chain<Hd, typename append_type::type> type;
+ };
+
+ template<typename Typelist_Chain>
+ struct append_<null_type, Typelist_Chain>
+ {
+ typedef Typelist_Chain type;
+ };
+
+ template<typename Typelist_Chain>
+ struct append_<Typelist_Chain, null_type>
+ {
+ typedef Typelist_Chain type;
+ };
+
+ template<>
+ struct append_<null_type, null_type>
+ {
+ typedef null_type type;
+ };
+
+ template<typename Typelist_Typelist_Chain>
+ struct append_typelist_;
+
+ template<typename Hd>
+ struct append_typelist_<chain<Hd, null_type> >
+ {
+ typedef chain<Hd, null_type> type;
+ };
+
+ template<typename Hd, typename Tl>
+ struct append_typelist_<chain< Hd, Tl> >
+ {
+ private:
+ typedef typename append_typelist_<Tl>::type rest_type;
+
+ public:
+ typedef typename append<Hd, node<rest_type> >::type::root type;
+ };
+
+ template<typename Typelist_Chain, typename T>
+ struct contains_;
+
+ template<typename T>
+ struct contains_<null_type, T>
+ {
+ enum
+ {
+ value = false
+ };
+ };
+
+ template<typename Hd, typename Tl, typename T>
+ struct contains_<chain<Hd, Tl>, T>
+ {
+ enum
+ {
+ value = contains_<Tl, T>::value
+ };
+ };
+
+ template<typename Tl, typename T>
+ struct contains_<chain<T, Tl>, T>
+ {
+ enum
+ {
+ value = true
+ };
+ };
+
+ template<typename Typelist_Chain, template<typename T> class Pred>
+ struct chain_filter_;
+
+ template<template<typename T> class Pred>
+ struct chain_filter_<null_type, Pred>
+ {
+ typedef null_type type;
+ };
+
+ template<typename Hd, typename Tl, template<typename T> class Pred>
+ struct chain_filter_<chain<Hd, Tl>, Pred>
+ {
+ private:
+ enum
+ {
+ include_hd = Pred<Hd>::value
+ };
+
+ typedef typename chain_filter_<Tl, Pred>::type rest_type;
+ typedef chain<Hd, rest_type> chain_type;
+
+ public:
+ typedef typename __conditional_type<include_hd, chain_type, rest_type>::__type type;
+ };
+
+ template<typename Typelist_Chain, int i>
+ struct chain_at_index_;
+
+ template<typename Hd, typename Tl>
+ struct chain_at_index_<chain<Hd, Tl>, 0>
+ {
+ typedef Hd type;
+ };
+
+ template<typename Hd, typename Tl, int i>
+ struct chain_at_index_<chain<Hd, Tl>, i>
+ {
+ typedef typename chain_at_index_<Tl, i - 1>::type type;
+ };
+
+ template<class Typelist_Chain, template<typename T> class Transform>
+ struct chain_transform_;
+
+ template<template<typename T> class Transform>
+ struct chain_transform_<null_type, Transform>
+ {
+ typedef null_type type;
+ };
+
+ template<class Hd, class Tl, template<typename T> class Transform>
+ struct chain_transform_<chain<Hd, Tl>, Transform>
+ {
+ private:
+ typedef typename chain_transform_<Tl, Transform>::type rest_type;
+ typedef typename Transform<Hd>::type transform_type;
+
+ public:
+ typedef chain<transform_type, rest_type> type;
+ };
+
+ template<typename Typelist_Typelist_Chain>
+ struct chain_flatten_;
+
+ template<typename Hd_Tl>
+ struct chain_flatten_<chain<Hd_Tl, null_type> >
+ {
+ typedef typename Hd_Tl::root type;
+ };
+
+ template<typename Hd_Typelist, class Tl_Typelist>
+ struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> >
+ {
+ private:
+ typedef typename chain_flatten_<Tl_Typelist>::type rest_type;
+ typedef append<Hd_Typelist, node<rest_type> > append_type;
+ public:
+ typedef typename append_type::type::root type;
+ };
+} // namespace detail
+} // namespace typelist
+
+_GLIBCXX_END_NAMESPACE
+
+#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type>
+#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >
+#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >
+#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >
+#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >
+#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
+#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
+#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
+#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
+#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
+#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
+#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
+#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
+#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
+#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+namespace typelist
+{
+ template<typename Fn, typename Typelist>
+ void
+ apply(Fn& fn, Typelist)
+ {
+ detail::apply_<Fn, typename Typelist::root> a;
+ a(fn);
+ }
+
+ template<typename Fn, typename Typelist>
+ void
+ apply_generator(Fn& fn, Typelist)
+ {
+ detail::apply_generator1_<Fn, typename Typelist::root> a;
+ a(fn);
+ }
+
+ template<typename Fn, typename TypelistT, typename TypelistV>
+ void
+ apply_generator(Fn& fn, TypelistT, TypelistV)
+ {
+ typedef typename TypelistT::root rootT;
+ typedef typename TypelistV::root rootV;
+ detail::apply_generator2_<Fn, rootT, rootV> a;
+ a(fn);
+ }
+
+ template<typename Typelist0, typename Typelist1>
+ struct append
+ {
+ private:
+ typedef typename Typelist0::root root0_type;
+ typedef typename Typelist1::root root1_type;
+ typedef detail::append_<root0_type, root1_type> append_type;
+
+ public:
+ typedef node<typename append_type::type> type;
+ };
+
+ template<typename Typelist_Typelist>
+ struct append_typelist
+ {
+ private:
+ typedef typename Typelist_Typelist::root root_type;
+ typedef detail::append_typelist_<root_type> append_type;
+
+ public:
+ typedef node<typename append_type::type> type;
+ };
+
+ template<typename Typelist, typename T>
+ struct contains
+ {
+ private:
+ typedef typename Typelist::root root_type;
+
+ public:
+ enum
+ {
+ value = detail::contains_<root_type, T>::value
+ };
+ };
+
+ template<typename Typelist, template<typename T> class Pred>
+ struct filter
+ {
+ private:
+ typedef typename Typelist::root root_type;
+ typedef detail::chain_filter_<root_type, Pred> filter_type;
+
+ public:
+ typedef node<typename filter_type::type> type;
+ };
+
+ template<typename Typelist, int i>
+ struct at_index
+ {
+ private:
+ typedef typename Typelist::root root_type;
+ typedef detail::chain_at_index_<root_type, i> index_type;
+
+ public:
+ typedef typename index_type::type type;
+ };
+
+ template<typename Typelist, template<typename T> class Transform>
+ struct transform
+ {
+ private:
+ typedef typename Typelist::root root_type;
+ typedef detail::chain_transform_<root_type, Transform> transform_type;
+
+ public:
+ typedef node<typename transform_type::type> type;
+ };
+
+ template<typename Typelist_Typelist>
+ struct flatten
+ {
+ private:
+ typedef typename Typelist_Typelist::root root_type;
+ typedef typename detail::chain_flatten_<root_type>::type flatten_type;
+
+ public:
+ typedef node<flatten_type> type;
+ };
+
+ template<typename Typelist>
+ struct from_first
+ {
+ private:
+ typedef typename at_index<Typelist, 0>::type first_type;
+
+ public:
+ typedef node<chain<first_type, null_type> > type;
+ };
+
+ template<typename T1>
+ struct create1
+ {
+ typedef node<_GLIBCXX_TYPELIST_CHAIN1(T1)> type;
+ };
+
+ template<typename T1, typename T2>
+ struct create2
+ {
+ typedef node<_GLIBCXX_TYPELIST_CHAIN2(T1,T2)> type;
+ };
+
+ template<typename T1, typename T2, typename T3>
+ struct create3
+ {
+ typedef node<_GLIBCXX_TYPELIST_CHAIN3(T1,T2,T3)> type;
+ };
+
+ template<typename T1, typename T2, typename T3, typename T4>
+ struct create4
+ {
+ typedef node<_GLIBCXX_TYPELIST_CHAIN4(T1,T2,T3,T4)> type;
+ };
+
+ template<typename T1, typename T2, typename T3,
+ typename T4, typename T5>
+ struct create5
+ {
+ typedef node<_GLIBCXX_TYPELIST_CHAIN5(T1,T2,T3,T4,T5)> type;
+ };
+
+ template<typename T1, typename T2, typename T3,
+ typename T4, typename T5, typename T6>
+ struct create6
+ {
+ typedef node<_GLIBCXX_TYPELIST_CHAIN6(T1,T2,T3,T4,T5,T6)> type;
+ };
+} // namespace typelist
+_GLIBCXX_END_NAMESPACE
+
+
+#endif
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/vstring.h b/gcc-4.4.0/libstdc++-v3/include/ext/vstring.h
new file mode 100644
index 000000000..e445ecd77
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/vstring.h
@@ -0,0 +1,2596 @@
+// Versatile string -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/vstring.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _VSTRING_H
+#define _VSTRING_H 1
+
+#pragma GCC system_header
+
+#include <initializer_list>
+#include <ext/vstring_util.h>
+#include <ext/rc_string_base.h>
+#include <ext/sso_string_base.h>
+
+#if __google_stl_debug_string && !defined(_GLIBCXX_DEBUG)
+# undef _GLIBCXX_DEBUG_ASSERT
+# undef _GLIBCXX_DEBUG_PEDASSERT
+// Perform additional checks (but only in this file).
+# define _GLIBCXX_DEBUG_ASSERT(_Condition) \
+ if (! (_Condition)) { \
+ __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __FILE__, \
+ __LINE__, __func__, # _Condition); \
+ __builtin_abort(); \
+ }
+# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ /**
+ * @class __versa_string vstring.h
+ * @brief Managing sequences of characters and character-like objects.
+ */
+
+ // Template class __versa_string
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ class __versa_string
+ : private _Base<_CharT, _Traits, _Alloc>
+ {
+ typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
+ typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
+
+ // Types:
+ public:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef _Alloc allocator_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ typedef typename _CharT_alloc_type::difference_type difference_type;
+ typedef typename _CharT_alloc_type::reference reference;
+ typedef typename _CharT_alloc_type::const_reference const_reference;
+ typedef typename _CharT_alloc_type::pointer pointer;
+ typedef typename _CharT_alloc_type::const_pointer const_pointer;
+ typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
+ typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
+ const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+
+ // Data Member (public):
+ /// Value returned by various member functions when they fail.
+ static const size_type npos = static_cast<size_type>(-1);
+
+ private:
+ size_type
+ _M_check(size_type __pos, const char* __s) const
+ {
+ if (__pos > this->size())
+ std::__throw_out_of_range(__N(__s));
+ return __pos;
+ }
+
+ void
+ _M_check_length(size_type __n1, size_type __n2, const char* __s) const
+ {
+ if (this->max_size() - (this->size() - __n1) < __n2)
+ std::__throw_length_error(__N(__s));
+ }
+
+ // NB: _M_limit doesn't check for a bad __pos value.
+ size_type
+ _M_limit(size_type __pos, size_type __off) const
+ {
+ const bool __testoff = __off < this->size() - __pos;
+ return __testoff ? __off : this->size() - __pos;
+ }
+
+ // True if _Rep and source do not overlap.
+ bool
+ _M_disjunct(const _CharT* __s) const
+ {
+ return (std::less<const _CharT*>()(__s, this->_M_data())
+ || std::less<const _CharT*>()(this->_M_data()
+ + this->size(), __s));
+ }
+
+ // For the internal use we have functions similar to `begin'/`end'
+ // but they do not call _M_leak.
+ iterator
+ _M_ibegin() const
+ { return iterator(this->_M_data()); }
+
+ iterator
+ _M_iend() const
+ { return iterator(this->_M_data() + this->_M_length()); }
+
+ public:
+ // Construct/copy/destroy:
+ // NB: We overload ctors in some cases instead of using default
+ // arguments, per 17.4.4.4 para. 2 item 2.
+
+ /**
+ * @brief Default constructor creates an empty string.
+ */
+ __versa_string()
+ : __vstring_base() { }
+
+ /**
+ * @brief Construct an empty string using allocator @a a.
+ */
+ explicit
+ __versa_string(const _Alloc& __a)
+ : __vstring_base(__a) { }
+
+ // NB: per LWG issue 42, semantics different from IS:
+ /**
+ * @brief Construct string with copy of value of @a str.
+ * @param __str Source string.
+ */
+ __versa_string(const __versa_string& __str)
+ : __vstring_base(__str) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief String move constructor.
+ * @param __str Source string.
+ *
+ * The newly-constructed %string contains the exact contents of
+ * @a str. The contents of @a str are a valid, but unspecified
+ * string.
+ */
+ __versa_string(__versa_string&& __str)
+ : __vstring_base(std::forward<__vstring_base>(__str)) { }
+
+ /**
+ * @brief Construct string from an initializer list.
+ * @param __l std::initializer_list of characters.
+ * @param __a Allocator to use (default is default allocator).
+ */
+ __versa_string(std::initializer_list<_CharT> __l,
+ const _Alloc& __a = _Alloc())
+ : __vstring_base(__l.begin(), __l.end(), __a) { }
+#endif
+
+ /**
+ * @brief Construct string as copy of a substring.
+ * @param __str Source string.
+ * @param __pos Index of first character to copy from.
+ * @param __n Number of characters to copy (default remainder).
+ */
+ __versa_string(const __versa_string& __str, size_type __pos,
+ size_type __n = npos)
+ : __vstring_base(__str._M_data()
+ + __str._M_check(__pos,
+ "__versa_string::__versa_string"),
+ __str._M_data() + __str._M_limit(__pos, __n)
+ + __pos, _Alloc()) { }
+
+ /**
+ * @brief Construct string as copy of a substring.
+ * @param __str Source string.
+ * @param __pos Index of first character to copy from.
+ * @param __n Number of characters to copy.
+ * @param __a Allocator to use.
+ */
+ __versa_string(const __versa_string& __str, size_type __pos,
+ size_type __n, const _Alloc& __a)
+ : __vstring_base(__str._M_data()
+ + __str._M_check(__pos,
+ "__versa_string::__versa_string"),
+ __str._M_data() + __str._M_limit(__pos, __n)
+ + __pos, __a) { }
+
+ /**
+ * @brief Construct string initialized by a character array.
+ * @param __s Source character array.
+ * @param __n Number of characters to copy.
+ * @param __a Allocator to use (default is default allocator).
+ *
+ * NB: @a __s must have at least @a __n characters, '\\0' has no special
+ * meaning.
+ */
+ __versa_string(const _CharT* __s, size_type __n,
+ const _Alloc& __a = _Alloc())
+ : __vstring_base(__s, __s + __n, __a) { }
+
+ /**
+ * @brief Construct string as copy of a C string.
+ * @param __s Source C string.
+ * @param __a Allocator to use (default is default allocator).
+ */
+ __versa_string(const _CharT* __s, const _Alloc& __a = _Alloc())
+ : __vstring_base(__s, __s ? __s + traits_type::length(__s) :
+ __s + npos, __a) { }
+
+ /**
+ * @brief Construct string as multiple characters.
+ * @param __n Number of characters.
+ * @param __c Character to use.
+ * @param __a Allocator to use (default is default allocator).
+ */
+ __versa_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
+ : __vstring_base(__n, __c, __a) { }
+
+ /**
+ * @brief Construct string as copy of a range.
+ * @param __beg Start of range.
+ * @param __end End of range.
+ * @param __a Allocator to use (default is default allocator).
+ */
+ template<class _InputIterator>
+ __versa_string(_InputIterator __beg, _InputIterator __end,
+ const _Alloc& __a = _Alloc())
+ : __vstring_base(__beg, __end, __a) { }
+
+ /**
+ * @brief Destroy the string instance.
+ */
+ ~__versa_string() { }
+
+ /**
+ * @brief Assign the value of @a str to this string.
+ * @param __str Source string.
+ */
+ __versa_string&
+ operator=(const __versa_string& __str)
+ { return this->assign(__str); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief String move assignment operator.
+ * @param __str Source string.
+ *
+ * The contents of @a __str are moved into this string (without
+ * copying). @a __str is a valid, but unspecified string.
+ */
+ __versa_string&
+ operator=(__versa_string&& __str)
+ {
+ if (this != &__str)
+ this->swap(__str);
+ return *this;
+ }
+
+ /**
+ * @brief Set value to string constructed from initializer list.
+ * @param __l std::initializer_list.
+ */
+ __versa_string&
+ operator=(std::initializer_list<_CharT> __l)
+ {
+ this->assign(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+
+ /**
+ * @brief Copy contents of @a __s into this string.
+ * @param __s Source null-terminated string.
+ */
+ __versa_string&
+ operator=(const _CharT* __s)
+ { return this->assign(__s); }
+
+ /**
+ * @brief Set value to string of length 1.
+ * @param __c Source character.
+ *
+ * Assigning to a character makes this string length 1 and
+ * (*this)[0] == @a __c.
+ */
+ __versa_string&
+ operator=(_CharT __c)
+ {
+ this->assign(1, __c);
+ return *this;
+ }
+
+ // Iterators:
+ /**
+ * Returns a read/write iterator that points to the first character in
+ * the %string. Unshares the string.
+ */
+ iterator
+ begin()
+ {
+ this->_M_leak();
+ return iterator(this->_M_data());
+ }
+
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * character in the %string.
+ */
+ const_iterator
+ begin() const
+ { return const_iterator(this->_M_data()); }
+
+ /**
+ * Returns a read/write iterator that points one past the last
+ * character in the %string. Unshares the string.
+ */
+ iterator
+ end()
+ {
+ this->_M_leak();
+ return iterator(this->_M_data() + this->size());
+ }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the
+ * last character in the %string.
+ */
+ const_iterator
+ end() const
+ { return const_iterator(this->_M_data() + this->size()); }
+
+ /**
+ * Returns a read/write reverse iterator that points to the last
+ * character in the %string. Iteration is done in reverse element
+ * order. Unshares the string.
+ */
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(this->end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last character in the %string. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(this->end()); }
+
+ /**
+ * Returns a read/write reverse iterator that points to one before the
+ * first character in the %string. Iteration is done in reverse
+ * element order. Unshares the string.
+ */
+ reverse_iterator
+ rend()
+ { return reverse_iterator(this->begin()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first character in the %string. Iteration
+ * is done in reverse element order.
+ */
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(this->begin()); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read-only (constant) iterator that points to the first
+ * character in the %string.
+ */
+ const_iterator
+ cbegin() const
+ { return const_iterator(this->_M_data()); }
+
+ /**
+ * Returns a read-only (constant) iterator that points one past the
+ * last character in the %string.
+ */
+ const_iterator
+ cend() const
+ { return const_iterator(this->_M_data() + this->size()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to the last character in the %string. Iteration is done in
+ * reverse element order.
+ */
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(this->end()); }
+
+ /**
+ * Returns a read-only (constant) reverse iterator that points
+ * to one before the first character in the %string. Iteration
+ * is done in reverse element order.
+ */
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(this->begin()); }
+#endif
+
+ public:
+ // Capacity:
+ /// Returns the number of characters in the string, not including any
+ /// null-termination.
+ size_type
+ size() const
+ { return this->_M_length(); }
+
+ /// Returns the number of characters in the string, not including any
+ /// null-termination.
+ size_type
+ length() const
+ { return this->_M_length(); }
+
+ /// Returns the size() of the largest possible %string.
+ size_type
+ max_size() const
+ { return this->_M_max_size(); }
+
+ /**
+ * @brief Resizes the %string to the specified number of characters.
+ * @param __n Number of characters the %string should contain.
+ * @param __c Character to fill any new elements.
+ *
+ * This function will %resize the %string to the specified
+ * number of characters. If the number is smaller than the
+ * %string's current size the %string is truncated, otherwise
+ * the %string is extended and new elements are set to @a __c.
+ */
+ void
+ resize(size_type __n, _CharT __c);
+
+ /**
+ * @brief Resizes the %string to the specified number of characters.
+ * @param __n Number of characters the %string should contain.
+ *
+ * This function will resize the %string to the specified
+ * length. If the new size is smaller than the %string's
+ * current size the %string is truncated, otherwise the %string
+ * is extended and new characters are default-constructed. For
+ * basic types such as char, this means setting them to 0.
+ */
+ void
+ resize(size_type __n)
+ { this->resize(__n, _CharT()); }
+
+ /**
+ * Returns the total number of characters that the %string can
+ * hold before needing to allocate more memory.
+ */
+ size_type
+ capacity() const
+ { return this->_M_capacity(); }
+
+ /**
+ * @brief Attempt to preallocate enough memory for specified number of
+ * characters.
+ * @param __res_arg Number of characters required.
+ * @throw std::length_error If @a __res_arg exceeds @c max_size().
+ *
+ * This function attempts to reserve enough memory for the
+ * %string to hold the specified number of characters. If the
+ * number requested is more than max_size(), length_error is
+ * thrown.
+ *
+ * The advantage of this function is that if optimal code is a
+ * necessity and the user can determine the string length that
+ * will be required, the user can reserve the memory in
+ * %advance, and thus prevent a possible reallocation of memory
+ * and copying of %string data.
+ */
+ void
+ reserve(size_type __res_arg = 0)
+ { this->_M_reserve(__res_arg); }
+
+ /**
+ * Erases the string, making it empty.
+ */
+ void
+ clear()
+ { this->_M_clear(); }
+
+ /**
+ * Returns true if the %string is empty. Equivalent to *this == "".
+ */
+ bool
+ empty() const
+ { return this->size() == 0; }
+
+ // Element access:
+ /**
+ * @brief Subscript access to the data contained in the %string.
+ * @param __pos The index of the character to access.
+ * @return Read-only (constant) reference to the character.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().)
+ */
+ const_reference
+ operator[] (size_type __pos) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
+ return this->_M_data()[__pos];
+ }
+
+ /**
+ * @brief Subscript access to the data contained in the %string.
+ * @param __pos The index of the character to access.
+ * @return Read/write reference to the character.
+ *
+ * This operator allows for easy, array-style, data access.
+ * Note that data access with this operator is unchecked and
+ * out_of_range lookups are not defined. (For checked lookups
+ * see at().) Unshares the string.
+ */
+ reference
+ operator[](size_type __pos)
+ {
+ // allow pos == size() as v3 extension:
+ _GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
+ // but be strict in pedantic mode:
+ _GLIBCXX_DEBUG_PEDASSERT(__pos < this->size());
+ this->_M_leak();
+ return this->_M_data()[__pos];
+ }
+
+ /**
+ * @brief Provides access to the data contained in the %string.
+ * @param __n The index of the character to access.
+ * @return Read-only (const) reference to the character.
+ * @throw std::out_of_range If @a __n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter
+ * is first checked that it is in the range of the string. The
+ * function throws out_of_range if the check fails.
+ */
+ const_reference
+ at(size_type __n) const
+ {
+ if (__n >= this->size())
+ std::__throw_out_of_range(__N("__versa_string::at"));
+ return this->_M_data()[__n];
+ }
+
+ /**
+ * @brief Provides access to the data contained in the %string.
+ * @param __n The index of the character to access.
+ * @return Read/write reference to the character.
+ * @throw std::out_of_range If @a __n is an invalid index.
+ *
+ * This function provides for safer data access. The parameter
+ * is first checked that it is in the range of the string. The
+ * function throws out_of_range if the check fails. Success
+ * results in unsharing the string.
+ */
+ reference
+ at(size_type __n)
+ {
+ if (__n >= this->size())
+ std::__throw_out_of_range(__N("__versa_string::at"));
+ this->_M_leak();
+ return this->_M_data()[__n];
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %string.
+ */
+ reference
+ front()
+ { return *begin(); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %string.
+ */
+ const_reference
+ front() const
+ { return *begin(); }
+
+ /**
+ * Returns a read/write reference to the data at the last
+ * element of the %string.
+ */
+ reference
+ back()
+ { return *(end() - 1); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the
+ * last element of the %string.
+ */
+ const_reference
+ back() const
+ { return *(end() - 1); }
+#endif
+
+ // Modifiers:
+ /**
+ * @brief Append a string to this string.
+ * @param __str The string to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ operator+=(const __versa_string& __str)
+ { return this->append(__str); }
+
+ /**
+ * @brief Append a C string.
+ * @param __s The C string to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ operator+=(const _CharT* __s)
+ { return this->append(__s); }
+
+ /**
+ * @brief Append a character.
+ * @param __c The character to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ operator+=(_CharT __c)
+ {
+ this->push_back(__c);
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param __l The initializer_list of characters to be appended.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ operator+=(std::initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Append a string to this string.
+ * @param __str The string to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ append(const __versa_string& __str)
+ { return _M_append(__str._M_data(), __str.size()); }
+
+ /**
+ * @brief Append a substring.
+ * @param __str The string to append.
+ * @param __pos Index of the first character of str to append.
+ * @param __n The number of characters to append.
+ * @return Reference to this string.
+ * @throw std::out_of_range if @a pos is not a valid index.
+ *
+ * This function appends @a __n characters from @a __str
+ * starting at @a __pos to this string. If @a __n is is larger
+ * than the number of available characters in @a __str, the
+ * remainder of @a __str is appended.
+ */
+ __versa_string&
+ append(const __versa_string& __str, size_type __pos, size_type __n)
+ { return _M_append(__str._M_data()
+ + __str._M_check(__pos, "__versa_string::append"),
+ __str._M_limit(__pos, __n)); }
+
+ /**
+ * @brief Append a C substring.
+ * @param __s The C string to append.
+ * @param __n The number of characters to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ append(const _CharT* __s, size_type __n)
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ _M_check_length(size_type(0), __n, "__versa_string::append");
+ return _M_append(__s, __n);
+ }
+
+ /**
+ * @brief Append a C string.
+ * @param __s The C string to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ append(const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ const size_type __n = traits_type::length(__s);
+ _M_check_length(size_type(0), __n, "__versa_string::append");
+ return _M_append(__s, __n);
+ }
+
+ /**
+ * @brief Append multiple characters.
+ * @param __n The number of characters to append.
+ * @param __c The character to use.
+ * @return Reference to this string.
+ *
+ * Appends n copies of c to this string.
+ */
+ __versa_string&
+ append(size_type __n, _CharT __c)
+ { return _M_replace_aux(this->size(), size_type(0), __n, __c); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Append an initializer_list of characters.
+ * @param __l The initializer_list of characters to append.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ append(std::initializer_list<_CharT> __l)
+ { return this->append(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Append a range of characters.
+ * @param __first Iterator referencing the first character to append.
+ * @param __last Iterator marking the end of the range.
+ * @return Reference to this string.
+ *
+ * Appends characters in the range [first,last) to this string.
+ */
+ template<class _InputIterator>
+ __versa_string&
+ append(_InputIterator __first, _InputIterator __last)
+ { return this->replace(_M_iend(), _M_iend(), __first, __last); }
+
+ /**
+ * @brief Append a single character.
+ * @param __c Character to append.
+ */
+ void
+ push_back(_CharT __c)
+ {
+ const size_type __size = this->size();
+ if (__size + 1 > this->capacity() || this->_M_is_shared())
+ this->_M_mutate(__size, size_type(0), 0, size_type(1));
+ traits_type::assign(this->_M_data()[__size], __c);
+ this->_M_set_length(__size + 1);
+ }
+
+ /**
+ * @brief Set value to contents of another string.
+ * @param __str Source string to use.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ assign(const __versa_string& __str)
+ {
+ this->_M_assign(__str);
+ return *this;
+ }
+
+ /**
+ * @brief Set value to a substring of a string.
+ * @param __str The string to use.
+ * @param __pos Index of the first character of str.
+ * @param __n Number of characters to use.
+ * @return Reference to this string.
+ * @throw std::out_of_range if @a __pos is not a valid index.
+ *
+ * This function sets this string to the substring of @a __str
+ * consisting of @a __n characters at @a __pos. If @a __n is
+ * is larger than the number of available characters in @a
+ * __str, the remainder of @a __str is used.
+ */
+ __versa_string&
+ assign(const __versa_string& __str, size_type __pos, size_type __n)
+ { return _M_replace(size_type(0), this->size(), __str._M_data()
+ + __str._M_check(__pos, "__versa_string::assign"),
+ __str._M_limit(__pos, __n)); }
+
+ /**
+ * @brief Set value to a C substring.
+ * @param __s The C string to use.
+ * @param __n Number of characters to use.
+ * @return Reference to this string.
+ *
+ * This function sets the value of this string to the first @a
+ * __n characters of @a __s. If @a __n is is larger than the
+ * number of available characters in @a __s, the remainder of
+ * @a __s is used.
+ */
+ __versa_string&
+ assign(const _CharT* __s, size_type __n)
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ return _M_replace(size_type(0), this->size(), __s, __n);
+ }
+
+ /**
+ * @brief Set value to contents of a C string.
+ * @param __s The C string to use.
+ * @return Reference to this string.
+ *
+ * This function sets the value of this string to the value of
+ * @a __s. The data is copied, so there is no dependence on @a
+ * __s once the function returns.
+ */
+ __versa_string&
+ assign(const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return _M_replace(size_type(0), this->size(), __s,
+ traits_type::length(__s));
+ }
+
+ /**
+ * @brief Set value to multiple characters.
+ * @param __n Length of the resulting string.
+ * @param __c The character to use.
+ * @return Reference to this string.
+ *
+ * This function sets the value of this string to @a __n copies of
+ * character @a __c.
+ */
+ __versa_string&
+ assign(size_type __n, _CharT __c)
+ { return _M_replace_aux(size_type(0), this->size(), __n, __c); }
+
+ /**
+ * @brief Set value to a range of characters.
+ * @param __first Iterator referencing the first character to append.
+ * @param __last Iterator marking the end of the range.
+ * @return Reference to this string.
+ *
+ * Sets value of string to characters in the range
+ * [first,last).
+ */
+ template<class _InputIterator>
+ __versa_string&
+ assign(_InputIterator __first, _InputIterator __last)
+ { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Set value to an initializer_list of characters.
+ * @param __l The initializer_list of characters to assign.
+ * @return Reference to this string.
+ */
+ __versa_string&
+ assign(std::initializer_list<_CharT> __l)
+ { return this->assign(__l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Insert multiple characters.
+ * @param __p Iterator referencing location in string to insert at.
+ * @param __n Number of characters to insert
+ * @param __c The character to insert.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts @a __n copies of character @a __c starting at the
+ * position referenced by iterator @a __p. If adding
+ * characters causes the length to exceed max_size(),
+ * length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ void
+ insert(iterator __p, size_type __n, _CharT __c)
+ { this->replace(__p, __p, __n, __c); }
+
+ /**
+ * @brief Insert a range of characters.
+ * @param __p Iterator referencing location in string to insert at.
+ * @param __beg Start of range.
+ * @param __end End of range.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts characters in range [beg,end). If adding characters
+ * causes the length to exceed max_size(), length_error is
+ * thrown. The value of the string doesn't change if an error
+ * is thrown.
+ */
+ template<class _InputIterator>
+ void
+ insert(iterator __p, _InputIterator __beg, _InputIterator __end)
+ { this->replace(__p, __p, __beg, __end); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Insert an initializer_list of characters.
+ * @param __p Iterator referencing location in string to insert at.
+ * @param __l The initializer_list of characters to insert.
+ * @throw std::length_error If new length exceeds @c max_size().
+ */
+ void
+ insert(iterator __p, std::initializer_list<_CharT> __l)
+ { this->insert(__p, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ /**
+ * @brief Insert value of a string.
+ * @param __pos1 Iterator referencing location in string to insert at.
+ * @param __str The string to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts value of @a __str starting at @a __pos1. If adding
+ * characters causes the length to exceed max_size(),
+ * length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ __versa_string&
+ insert(size_type __pos1, const __versa_string& __str)
+ { return this->replace(__pos1, size_type(0),
+ __str._M_data(), __str.size()); }
+
+ /**
+ * @brief Insert a substring.
+ * @param __pos1 Iterator referencing location in string to insert at.
+ * @param __str The string to insert.
+ * @param __pos2 Start of characters in str to insert.
+ * @param __n Number of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a __pos1 > size() or
+ * @a __pos2 > @a __str.size().
+ *
+ * Starting at @a __pos1, insert @a __n character of @a __str
+ * beginning with @a __pos2. If adding characters causes the
+ * length to exceed max_size(), length_error is thrown. If @a
+ * __pos1 is beyond the end of this string or @a __pos2 is
+ * beyond the end of @a __str, out_of_range is thrown. The
+ * value of the string doesn't change if an error is thrown.
+ */
+ __versa_string&
+ insert(size_type __pos1, const __versa_string& __str,
+ size_type __pos2, size_type __n)
+ { return this->replace(__pos1, size_type(0), __str._M_data()
+ + __str._M_check(__pos2, "__versa_string::insert"),
+ __str._M_limit(__pos2, __n)); }
+
+ /**
+ * @brief Insert a C substring.
+ * @param __pos Iterator referencing location in string to insert at.
+ * @param __s The C string to insert.
+ * @param __n The number of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a __pos is beyond the end of this
+ * string.
+ *
+ * Inserts the first @a __n characters of @a __s starting at @a
+ * __pos. If adding characters causes the length to exceed
+ * max_size(), length_error is thrown. If @a __pos is beyond
+ * end(), out_of_range is thrown. The value of the string
+ * doesn't change if an error is thrown.
+ */
+ __versa_string&
+ insert(size_type __pos, const _CharT* __s, size_type __n)
+ { return this->replace(__pos, size_type(0), __s, __n); }
+
+ /**
+ * @brief Insert a C string.
+ * @param __pos Iterator referencing location in string to insert at.
+ * @param __s The C string to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a __pos is beyond the end of this
+ * string.
+ *
+ * Inserts the first @a __n characters of @a __s starting at @a
+ * __pos. If adding characters causes the length to exceed
+ * max_size(), length_error is thrown. If @a __pos is beyond
+ * end(), out_of_range is thrown. The value of the string
+ * doesn't change if an error is thrown.
+ */
+ __versa_string&
+ insert(size_type __pos, const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->replace(__pos, size_type(0), __s,
+ traits_type::length(__s));
+ }
+
+ /**
+ * @brief Insert multiple characters.
+ * @param __pos Index in string to insert at.
+ * @param __n Number of characters to insert
+ * @param __c The character to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ * @throw std::out_of_range If @a __pos is beyond the end of this
+ * string.
+ *
+ * Inserts @a __n copies of character @a __c starting at index
+ * @a __pos. If adding characters causes the length to exceed
+ * max_size(), length_error is thrown. If @a __pos > length(),
+ * out_of_range is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ __versa_string&
+ insert(size_type __pos, size_type __n, _CharT __c)
+ { return _M_replace_aux(_M_check(__pos, "__versa_string::insert"),
+ size_type(0), __n, __c); }
+
+ /**
+ * @brief Insert one character.
+ * @param __p Iterator referencing position in string to insert at.
+ * @param __c The character to insert.
+ * @return Iterator referencing newly inserted char.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Inserts character @a __c at position referenced by @a __p.
+ * If adding character causes the length to exceed max_size(),
+ * length_error is thrown. If @a __p is beyond end of string,
+ * out_of_range is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ iterator
+ insert(iterator __p, _CharT __c)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
+ const size_type __pos = __p - _M_ibegin();
+ _M_replace_aux(__pos, size_type(0), size_type(1), __c);
+ this->_M_set_leaked();
+ return iterator(this->_M_data() + __pos);
+ }
+
+ /**
+ * @brief Remove characters.
+ * @param __pos Index of first character to remove (default 0).
+ * @param __n Number of characters to remove (default remainder).
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a __pos is beyond the end of this
+ * string.
+ *
+ * Removes @a __n characters from this string starting at @a
+ * __pos. The length of the string is reduced by @a __n. If
+ * there are < @a __n characters to remove, the remainder of
+ * the string is truncated. If @a __p is beyond end of string,
+ * out_of_range is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ __versa_string&
+ erase(size_type __pos = 0, size_type __n = npos)
+ {
+ this->_M_erase(_M_check(__pos, "__versa_string::erase"),
+ _M_limit(__pos, __n));
+ return *this;
+ }
+
+ /**
+ * @brief Remove one character.
+ * @param __position Iterator referencing the character to remove.
+ * @return iterator referencing same location after removal.
+ *
+ * Removes the character at @a __position from this string. The
+ * value of the string doesn't change if an error is thrown.
+ */
+ iterator
+ erase(iterator __position)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
+ && __position < _M_iend());
+ const size_type __pos = __position - _M_ibegin();
+ this->_M_erase(__pos, size_type(1));
+ this->_M_set_leaked();
+ return iterator(this->_M_data() + __pos);
+ }
+
+ /**
+ * @brief Remove a range of characters.
+ * @param __first Iterator referencing the first character to remove.
+ * @param __last Iterator referencing the end of the range.
+ * @return Iterator referencing location of first after removal.
+ *
+ * Removes the characters in the range [first,last) from this
+ * string. The value of the string doesn't change if an error
+ * is thrown.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
+ && __last <= _M_iend());
+ const size_type __pos = __first - _M_ibegin();
+ this->_M_erase(__pos, __last - __first);
+ this->_M_set_leaked();
+ return iterator(this->_M_data() + __pos);
+ }
+
+ /**
+ * @brief Replace characters with value from another string.
+ * @param __pos Index of first character to replace.
+ * @param __n Number of characters to be replaced.
+ * @param __str String to insert.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a __pos is beyond the end of this
+ * string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos+n) from this
+ * string. In place, the value of @a __str is inserted. If @a
+ * __pos is beyond end of string, out_of_range is thrown. If
+ * the length of the result exceeds max_size(), length_error is
+ * thrown. The value of the string doesn't change if an error
+ * is thrown.
+ */
+ __versa_string&
+ replace(size_type __pos, size_type __n, const __versa_string& __str)
+ { return this->replace(__pos, __n, __str._M_data(), __str.size()); }
+
+ /**
+ * @brief Replace characters with value from another string.
+ * @param __pos1 Index of first character to replace.
+ * @param __n1 Number of characters to be replaced.
+ * @param __str String to insert.
+ * @param __pos2 Index of first character of str to use.
+ * @param __n2 Number of characters from str to use.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 >
+ * str.size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos1,pos1 + n) from
+ * this string. In place, the value of @a __str is inserted.
+ * If @a __pos is beyond end of string, out_of_range is thrown.
+ * If the length of the result exceeds max_size(), length_error
+ * is thrown. The value of the string doesn't change if an
+ * error is thrown.
+ */
+ __versa_string&
+ replace(size_type __pos1, size_type __n1, const __versa_string& __str,
+ size_type __pos2, size_type __n2)
+ {
+ return this->replace(__pos1, __n1, __str._M_data()
+ + __str._M_check(__pos2,
+ "__versa_string::replace"),
+ __str._M_limit(__pos2, __n2));
+ }
+
+ /**
+ * @brief Replace characters with value of a C substring.
+ * @param __pos Index of first character to replace.
+ * @param __n1 Number of characters to be replaced.
+ * @param __s C string to insert.
+ * @param __n2 Number of characters from @a __s to use.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a __pos1 > size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos + n1) from this
+ * string. In place, the first @a __n2 characters of @a __s
+ * are inserted, or all of @a __s if @a __n2 is too large. If
+ * @a __pos is beyond end of string, out_of_range is thrown.
+ * If the length of result exceeds max_size(), length_error is
+ * thrown. The value of the string doesn't change if an error
+ * is thrown.
+ */
+ __versa_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2)
+ {
+ __glibcxx_requires_string_len(__s, __n2);
+ return _M_replace(_M_check(__pos, "__versa_string::replace"),
+ _M_limit(__pos, __n1), __s, __n2);
+ }
+
+ /**
+ * @brief Replace characters with value of a C string.
+ * @param __pos Index of first character to replace.
+ * @param __n1 Number of characters to be replaced.
+ * @param __s C string to insert.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a __pos > size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos + n1) from this
+ * string. In place, the first @a __n characters of @a __s are
+ * inserted. If @a pos is beyond end of string, out_of_range
+ * is thrown. If the length of result exceeds max_size(),
+ * length_error is thrown. The value of the string doesn't
+ * change if an error is thrown.
+ */
+ __versa_string&
+ replace(size_type __pos, size_type __n1, const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->replace(__pos, __n1, __s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Replace characters with multiple characters.
+ * @param __pos Index of first character to replace.
+ * @param __n1 Number of characters to be replaced.
+ * @param __n2 Number of characters to insert.
+ * @param __c Character to insert.
+ * @return Reference to this string.
+ * @throw std::out_of_range If @a __pos > size().
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [pos,pos + n1) from this
+ * string. In place, @a __n2 copies of @a __c are inserted.
+ * If @a __pos is beyond end of string, out_of_range is thrown.
+ * If the length of result exceeds max_size(), length_error is
+ * thrown. The value of the string doesn't change if an error
+ * is thrown.
+ */
+ __versa_string&
+ replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
+ { return _M_replace_aux(_M_check(__pos, "__versa_string::replace"),
+ _M_limit(__pos, __n1), __n2, __c); }
+
+ /**
+ * @brief Replace range of characters with string.
+ * @param __i1 Iterator referencing start of range to replace.
+ * @param __i2 Iterator referencing end of range to replace.
+ * @param __str String value to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, the
+ * value of @a __str is inserted. If the length of result
+ * exceeds max_size(), length_error is thrown. The value of
+ * the string doesn't change if an error is thrown.
+ */
+ __versa_string&
+ replace(iterator __i1, iterator __i2, const __versa_string& __str)
+ { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }
+
+ /**
+ * @brief Replace range of characters with C substring.
+ * @param __i1 Iterator referencing start of range to replace.
+ * @param __i2 Iterator referencing end of range to replace.
+ * @param __s C string value to insert.
+ * @param __n Number of characters from s to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, the
+ * first @a n characters of @a __s are inserted. If the length
+ * of result exceeds max_size(), length_error is thrown. The
+ * value of the string doesn't change if an error is thrown.
+ */
+ __versa_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
+ }
+
+ /**
+ * @brief Replace range of characters with C string.
+ * @param __i1 Iterator referencing start of range to replace.
+ * @param __i2 Iterator referencing end of range to replace.
+ * @param __s C string value to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, the
+ * characters of @a __s are inserted. If the length of result
+ * exceeds max_size(), length_error is thrown. The value of
+ * the string doesn't change if an error is thrown.
+ */
+ __versa_string&
+ replace(iterator __i1, iterator __i2, const _CharT* __s)
+ {
+ __glibcxx_requires_string(__s);
+ return this->replace(__i1, __i2, __s, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Replace range of characters with multiple characters
+ * @param __i1 Iterator referencing start of range to replace.
+ * @param __i2 Iterator referencing end of range to replace.
+ * @param __n Number of characters to insert.
+ * @param __c Character to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place, @a
+ * __n copies of @a __c are inserted. If the length of result
+ * exceeds max_size(), length_error is thrown. The value of
+ * the string doesn't change if an error is thrown.
+ */
+ __versa_string&
+ replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
+ }
+
+ /**
+ * @brief Replace range of characters with range.
+ * @param __i1 Iterator referencing start of range to replace.
+ * @param __i2 Iterator referencing end of range to replace.
+ * @param __k1 Iterator referencing start of range to insert.
+ * @param __k2 Iterator referencing end of range to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place,
+ * characters in the range [k1,k2) are inserted. If the length
+ * of result exceeds max_size(), length_error is thrown. The
+ * value of the string doesn't change if an error is thrown.
+ */
+ template<class _InputIterator>
+ __versa_string&
+ replace(iterator __i1, iterator __i2,
+ _InputIterator __k1, _InputIterator __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
+ return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
+ }
+
+ // Specializations for the common case of pointer and iterator:
+ // useful to avoid the overhead of temporary buffering in _M_replace.
+ __versa_string&
+ replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1, __k2 - __k1);
+ }
+
+ __versa_string&
+ replace(iterator __i1, iterator __i2,
+ const _CharT* __k1, const _CharT* __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1, __k2 - __k1);
+ }
+
+ __versa_string&
+ replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1.base(), __k2 - __k1);
+ }
+
+ __versa_string&
+ replace(iterator __i1, iterator __i2,
+ const_iterator __k1, const_iterator __k2)
+ {
+ _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
+ && __i2 <= _M_iend());
+ __glibcxx_requires_valid_range(__k1, __k2);
+ return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
+ __k1.base(), __k2 - __k1);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Replace range of characters with initializer_list.
+ * @param __i1 Iterator referencing start of range to replace.
+ * @param __i2 Iterator referencing end of range to replace.
+ * @param __l The initializer_list of characters to insert.
+ * @return Reference to this string.
+ * @throw std::length_error If new length exceeds @c max_size().
+ *
+ * Removes the characters in the range [i1,i2). In place,
+ * characters in the range [k1,k2) are inserted. If the length
+ * of result exceeds max_size(), length_error is thrown. The
+ * value of the string doesn't change if an error is thrown.
+ */
+ __versa_string& replace(iterator __i1, iterator __i2,
+ std::initializer_list<_CharT> __l)
+ { return this->replace(__i1, __i2, __l.begin(), __l.end()); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+ private:
+ template<class _Integer>
+ __versa_string&
+ _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
+ _Integer __val, std::__true_type)
+ { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
+
+ template<class _InputIterator>
+ __versa_string&
+ _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
+ _InputIterator __k2, std::__false_type);
+
+ __versa_string&
+ _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
+ _CharT __c);
+
+ __versa_string&
+ _M_replace(size_type __pos, size_type __len1, const _CharT* __s,
+ const size_type __len2);
+
+ __versa_string&
+ _M_append(const _CharT* __s, size_type __n);
+
+ public:
+
+ /**
+ * @brief Copy substring into C string.
+ * @param __s C string to copy value into.
+ * @param __n Number of characters to copy.
+ * @param __pos Index of first character to copy.
+ * @return Number of characters actually copied
+ * @throw std::out_of_range If pos > size().
+ *
+ * Copies up to @a __n characters starting at @a __pos into the
+ * C string @a s. If @a __pos is greater than size(),
+ * out_of_range is thrown.
+ */
+ size_type
+ copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
+
+ /**
+ * @brief Swap contents with another string.
+ * @param __s String to swap with.
+ *
+ * Exchanges the contents of this string with that of @a __s in
+ * constant time.
+ */
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(__versa_string&& __s)
+#else
+ swap(__versa_string& __s)
+#endif
+ { this->_M_swap(__s); }
+
+ // String operations:
+ /**
+ * @brief Return const pointer to null-terminated contents.
+ *
+ * This is a handle to internal data. Do not modify or dire things may
+ * happen.
+ */
+ const _CharT*
+ c_str() const
+ { return this->_M_data(); }
+
+ /**
+ * @brief Return const pointer to contents.
+ *
+ * This is a handle to internal data. Do not modify or dire things may
+ * happen.
+ */
+ const _CharT*
+ data() const
+ { return this->_M_data(); }
+
+ /**
+ * @brief Return copy of allocator used to construct this string.
+ */
+ allocator_type
+ get_allocator() const
+ { return allocator_type(this->_M_get_allocator()); }
+
+ /**
+ * @brief Find position of a C substring.
+ * @param __s C string to locate.
+ * @param __pos Index of character to search from.
+ * @param __n Number of characters from @a __s to search for.
+ * @return Index of start of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for the first @a
+ * __n characters in @a __s within this string. If found,
+ * returns the index where it begins. If not found, returns
+ * npos.
+ */
+ size_type
+ find(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find position of a string.
+ * @param __str String to locate.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of start of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for value of @a
+ * __str within this string. If found, returns the index where
+ * it begins. If not found, returns npos.
+ */
+ size_type
+ find(const __versa_string& __str, size_type __pos = 0) const
+ { return this->find(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find position of a C string.
+ * @param __s C string to locate.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of start of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for the value of @a
+ * __s within this string. If found, returns the index where
+ * it begins. If not found, returns npos.
+ */
+ size_type
+ find(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find position of a character.
+ * @param __c Character to locate.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for @a __c within
+ * this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find(_CharT __c, size_type __pos = 0) const;
+
+ /**
+ * @brief Find last position of a string.
+ * @param __str String to locate.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of start of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for value of @a
+ * __str within this string. If found, returns the index where
+ * it begins. If not found, returns npos.
+ */
+ size_type
+ rfind(const __versa_string& __str, size_type __pos = npos) const
+ { return this->rfind(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find last position of a C substring.
+ * @param __s C string to locate.
+ * @param __pos Index of character to search back from.
+ * @param __n Number of characters from s to search for.
+ * @return Index of start of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for the first @a
+ * __n characters in @a __s within this string. If found,
+ * returns the index where it begins. If not found, returns
+ * npos.
+ */
+ size_type
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find last position of a C string.
+ * @param __s C string to locate.
+ * @param __pos Index of character to start search at (default end).
+ * @return Index of start of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for the value of
+ * @a __s within this string. If found, returns the index
+ * where it begins. If not found, returns npos.
+ */
+ size_type
+ rfind(const _CharT* __s, size_type __pos = npos) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->rfind(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find last position of a character.
+ * @param __c Character to locate.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for @a __c within
+ * this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ rfind(_CharT __c, size_type __pos = npos) const;
+
+ /**
+ * @brief Find position of a character of string.
+ * @param __str String containing characters to locate.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for one of the characters of
+ * @a __str within this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_first_of(const __versa_string& __str, size_type __pos = 0) const
+ { return this->find_first_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find position of a character of C substring.
+ * @param __s String containing characters to locate.
+ * @param __pos Index of character to search from.
+ * @param __n Number of characters from s to search for.
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for one of the
+ * first @a __n characters of @a __s within this string. If
+ * found, returns the index where it was found. If not found,
+ * returns npos.
+ */
+ size_type
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find position of a character of C string.
+ * @param __s String containing characters to locate.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for one of the
+ * characters of @a __s within this string. If found, returns
+ * the index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_first_of(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_first_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find position of a character.
+ * @param __c Character to locate.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for the character
+ * @a __c within this string. If found, returns the index
+ * where it was found. If not found, returns npos.
+ *
+ * Note: equivalent to find(c, pos).
+ */
+ size_type
+ find_first_of(_CharT __c, size_type __pos = 0) const
+ { return this->find(__c, __pos); }
+
+ /**
+ * @brief Find last position of a character of string.
+ * @param __str String containing characters to locate.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for one of the
+ * characters of @a __str within this string. If found,
+ * returns the index where it was found. If not found, returns
+ * npos.
+ */
+ size_type
+ find_last_of(const __versa_string& __str, size_type __pos = npos) const
+ { return this->find_last_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find last position of a character of C substring.
+ * @param __s C string containing characters to locate.
+ * @param __pos Index of character to search back from.
+ * @param __n Number of characters from s to search for.
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for one of the
+ * first @a __n characters of @a __s within this string. If
+ * found, returns the index where it was found. If not found,
+ * returns npos.
+ */
+ size_type
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
+
+ /**
+ * @brief Find last position of a character of C string.
+ * @param __s C string containing characters to locate.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for one of the
+ * characters of @a __s within this string. If found, returns
+ * the index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_last_of(const _CharT* __s, size_type __pos = npos) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_last_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find last position of a character.
+ * @param __c Character to locate.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for @a __c within
+ * this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ *
+ * Note: equivalent to rfind(c, pos).
+ */
+ size_type
+ find_last_of(_CharT __c, size_type __pos = npos) const
+ { return this->rfind(__c, __pos); }
+
+ /**
+ * @brief Find position of a character not in string.
+ * @param __str String containing characters to avoid.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for a character not
+ * contained in @a __str within this string. If found, returns
+ * the index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(const __versa_string& __str, size_type __pos = 0) const
+ { return this->find_first_not_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find position of a character not in C substring.
+ * @param __s C string containing characters to avoid.
+ * @param __pos Index of character to search from.
+ * @param __n Number of characters from s to consider.
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for a character not
+ * contained in the first @a __n characters of @a __s within
+ * this string. If found, returns the index where it was
+ * found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const;
+
+ /**
+ * @brief Find position of a character not in C string.
+ * @param __s C string containing characters to avoid.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for a character not
+ * contained in @a __s within this string. If found, returns
+ * the index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(const _CharT* __s, size_type __pos = 0) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_first_not_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find position of a different character.
+ * @param __c Character to avoid.
+ * @param __pos Index of character to search from (default 0).
+ * @return Index of first occurrence.
+ *
+ * Starting from @a __pos, searches forward for a character
+ * other than @a __c within this string. If found, returns the
+ * index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_first_not_of(_CharT __c, size_type __pos = 0) const;
+
+ /**
+ * @brief Find last position of a character not in string.
+ * @param __str String containing characters to avoid.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for a character
+ * not contained in @a __str within this string. If found,
+ * returns the index where it was found. If not found, returns
+ * npos.
+ */
+ size_type
+ find_last_not_of(const __versa_string& __str,
+ size_type __pos = npos) const
+ { return this->find_last_not_of(__str.data(), __pos, __str.size()); }
+
+ /**
+ * @brief Find last position of a character not in C substring.
+ * @param __s C string containing characters to avoid.
+ * @param __pos Index of character to search back from.
+ * @param __n Number of characters from s to consider.
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for a character
+ * not contained in the first @a __n characters of @a __s
+ * within this string. If found, returns the index where it
+ * was found. If not found, returns npos.
+ */
+ size_type
+ find_last_not_of(const _CharT* __s, size_type __pos,
+ size_type __n) const;
+ /**
+ * @brief Find last position of a character not in C string.
+ * @param __s C string containing characters to avoid.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for a character
+ * not contained in @a __s within this string. If found,
+ * returns the index where it was found. If not found, returns
+ * npos.
+ */
+ size_type
+ find_last_not_of(const _CharT* __s, size_type __pos = npos) const
+ {
+ __glibcxx_requires_string(__s);
+ return this->find_last_not_of(__s, __pos, traits_type::length(__s));
+ }
+
+ /**
+ * @brief Find last position of a different character.
+ * @param __c Character to avoid.
+ * @param __pos Index of character to search back from (default end).
+ * @return Index of last occurrence.
+ *
+ * Starting from @a __pos, searches backward for a character
+ * other than @a __c within this string. If found, returns the
+ * index where it was found. If not found, returns npos.
+ */
+ size_type
+ find_last_not_of(_CharT __c, size_type __pos = npos) const;
+
+ /**
+ * @brief Get a substring.
+ * @param __pos Index of first character (default 0).
+ * @param __n Number of characters in substring (default remainder).
+ * @return The new string.
+ * @throw std::out_of_range If pos > size().
+ *
+ * Construct and return a new string using the @a __n
+ * characters starting at @a __pos. If the string is too
+ * short, use the remainder of the characters. If @a __pos is
+ * beyond the end of the string, out_of_range is thrown.
+ */
+ __versa_string
+ substr(size_type __pos = 0, size_type __n = npos) const
+ {
+ return __versa_string(*this, _M_check(__pos, "__versa_string::substr"),
+ __n);
+ }
+
+ /**
+ * @brief Compare to a string.
+ * @param __str String to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Returns an integer < 0 if this string is ordered before @a
+ * __str, 0 if their values are equivalent, or > 0 if this
+ * string is ordered after @a __str. Determines the effective
+ * length rlen of the strings to compare as the smallest of
+ * size() and str.size(). The function then compares the two
+ * strings by calling traits::compare(data(), str.data(),rlen).
+ * If the result of the comparison is nonzero returns it,
+ * otherwise the shorter one is ordered first.
+ */
+ int
+ compare(const __versa_string& __str) const
+ {
+ if (this->_M_compare(__str))
+ return 0;
+
+ const size_type __size = this->size();
+ const size_type __osize = __str.size();
+ const size_type __len = std::min(__size, __osize);
+
+ int __r = traits_type::compare(this->_M_data(), __str.data(), __len);
+ if (!__r)
+ __r = _S_compare(__size, __osize);
+ return __r;
+ }
+
+ /**
+ * @brief Compare substring to a string.
+ * @param __pos Index of first character of substring.
+ * @param __n Number of characters in substring.
+ * @param __str String to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a __n characters
+ * starting at @a __pos. Returns an integer < 0 if the
+ * substring is ordered before @a __str, 0 if their values are
+ * equivalent, or > 0 if the substring is ordered after @a
+ * __str. Determines the effective length rlen of the strings
+ * to compare as the smallest of the length of the substring
+ * and @a __str.size(). The function then compares the two
+ * strings by calling
+ * traits::compare(substring.data(),str.data(),rlen). If the
+ * result of the comparison is nonzero returns it, otherwise
+ * the shorter one is ordered first.
+ */
+ int
+ compare(size_type __pos, size_type __n,
+ const __versa_string& __str) const;
+
+ /**
+ * @brief Compare substring to a substring.
+ * @param __pos1 Index of first character of substring.
+ * @param __n1 Number of characters in substring.
+ * @param __str String to compare against.
+ * @param __pos2 Index of first character of substring of str.
+ * @param __n2 Number of characters in substring of str.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a __n1
+ * characters starting at @a __pos1. Form the substring of @a
+ * __str from the @a __n2 characters starting at @a __pos2.
+ * Returns an integer < 0 if this substring is ordered before
+ * the substring of @a __str, 0 if their values are equivalent,
+ * or > 0 if this substring is ordered after the substring of
+ * @a __str. Determines the effective length rlen of the
+ * strings to compare as the smallest of the lengths of the
+ * substrings. The function then compares the two strings by
+ * calling
+ * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).
+ * If the result of the comparison is nonzero returns it,
+ * otherwise the shorter one is ordered first.
+ */
+ int
+ compare(size_type __pos1, size_type __n1, const __versa_string& __str,
+ size_type __pos2, size_type __n2) const;
+
+ /**
+ * @brief Compare to a C string.
+ * @param __s C string to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Returns an integer < 0 if this string is ordered before @a
+ * __s, 0 if their values are equivalent, or > 0 if this string
+ * is ordered after @a __s. Determines the effective length
+ * rlen of the strings to compare as the smallest of size() and
+ * the length of a string constructed from @a __s. The
+ * function then compares the two strings by calling
+ * traits::compare(data(),s,rlen). If the result of the
+ * comparison is nonzero returns it, otherwise the shorter one
+ * is ordered first.
+ */
+ int
+ compare(const _CharT* __s) const;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 5 String::compare specification questionable
+ /**
+ * @brief Compare substring to a C string.
+ * @param __pos Index of first character of substring.
+ * @param __n1 Number of characters in substring.
+ * @param __s C string to compare against.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a __n1
+ * characters starting at @a __pos. Returns an integer < 0 if
+ * the substring is ordered before @a __s, 0 if their values
+ * are equivalent, or > 0 if the substring is ordered after @a
+ * __s. Determines the effective length rlen of the strings to
+ * compare as the smallest of the length of the substring and
+ * the length of a string constructed from @a __s. The
+ * function then compares the two string by calling
+ * traits::compare(substring.data(),s,rlen). If the result of
+ * the comparison is nonzero returns it, otherwise the shorter
+ * one is ordered first.
+ */
+ int
+ compare(size_type __pos, size_type __n1, const _CharT* __s) const;
+
+ /**
+ * @brief Compare substring against a character array.
+ * @param __pos1 Index of first character of substring.
+ * @param __n1 Number of characters in substring.
+ * @param __s character array to compare against.
+ * @param __n2 Number of characters of s.
+ * @return Integer < 0, 0, or > 0.
+ *
+ * Form the substring of this string from the @a __n1
+ * characters starting at @a __pos1. Form a string from the
+ * first @a __n2 characters of @a __s. Returns an integer < 0
+ * if this substring is ordered before the string from @a __s,
+ * 0 if their values are equivalent, or > 0 if this substring
+ * is ordered after the string from @a __s. Determines the
+ * effective length rlen of the strings to compare as the
+ * smallest of the length of the substring and @a __n2. The
+ * function then compares the two strings by calling
+ * traits::compare(substring.data(),s,rlen). If the result of
+ * the comparison is nonzero returns it, otherwise the shorter
+ * one is ordered first.
+ *
+ * NB: s must have at least n2 characters, '\\0' has no special
+ * meaning.
+ */
+ int
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2) const;
+ };
+
+ // operator+
+ /**
+ * @brief Concatenate two strings.
+ * @param __lhs First string.
+ * @param __rhs Last string.
+ * @return New string with value of @a __lhs followed by @a __rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
+
+ /**
+ * @brief Concatenate C string and string.
+ * @param __lhs First string.
+ * @param __rhs Last string.
+ * @return New string with value of @a __lhs followed by @a __rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
+
+ /**
+ * @brief Concatenate character and string.
+ * @param __lhs First string.
+ * @param __rhs Last string.
+ * @return New string with @a __lhs followed by @a __rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(_CharT __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
+
+ /**
+ * @brief Concatenate string and C string.
+ * @param __lhs First string.
+ * @param __rhs Last string.
+ * @return New string with @a __lhs followed by @a __rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs);
+
+ /**
+ * @brief Concatenate string and character.
+ * @param __lhs First string.
+ * @param __rhs Last string.
+ * @return New string with @a __lhs followed by @a __rhs.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ _CharT __rhs);
+
+ // operator ==
+ /**
+ * @brief Test equivalence of two strings.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ template<typename _CharT,
+ template <typename, typename, typename> class _Base>
+ inline typename __enable_if<std::__is_char<_CharT>::__value, bool>::__type
+ operator==(const __versa_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT>, _Base>& __lhs,
+ const __versa_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT>, _Base>& __rhs)
+ { return (__lhs.size() == __rhs.size()
+ && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(),
+ __lhs.size())); }
+
+ /**
+ * @brief Test equivalence of C string and string.
+ * @param __lhs C string.
+ * @param __rhs String.
+ * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator==(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __rhs.compare(__lhs) == 0; }
+
+ /**
+ * @brief Test equivalence of string and C string.
+ * @param __lhs String.
+ * @param __rhs C string.
+ * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ // operator !=
+ /**
+ * @brief Test difference of two strings.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * @brief Test difference of C string and string.
+ * @param __lhs C string.
+ * @param __rhs String.
+ * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator!=(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * @brief Test difference of string and C string.
+ * @param __lhs String.
+ * @param __rhs C string.
+ * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ { return !(__lhs == __rhs); }
+
+ // operator <
+ /**
+ * @brief Test if string precedes string.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ * @return True if @a __lhs precedes @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Test if string precedes C string.
+ * @param __lhs String.
+ * @param __rhs C string.
+ * @return True if @a __lhs precedes @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Test if C string precedes string.
+ * @param __lhs C string.
+ * @param __rhs String.
+ * @return True if @a __lhs precedes @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator<(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __rhs.compare(__lhs) > 0; }
+
+ // operator >
+ /**
+ * @brief Test if string follows string.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ * @return True if @a __lhs follows @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Test if string follows C string.
+ * @param __lhs String.
+ * @param __rhs C string.
+ * @return True if @a __lhs follows @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Test if C string follows string.
+ * @param __lhs C string.
+ * @param __rhs String.
+ * @return True if @a __lhs follows @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator>(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __rhs.compare(__lhs) < 0; }
+
+ // operator <=
+ /**
+ * @brief Test if string doesn't follow string.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ * @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Test if string doesn't follow C string.
+ * @param __lhs String.
+ * @param __rhs C string.
+ * @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Test if C string doesn't follow string.
+ * @param __lhs C string.
+ * @param __rhs String.
+ * @return True if @a __lhs doesn't follow @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator<=(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __rhs.compare(__lhs) >= 0; }
+
+ // operator >=
+ /**
+ * @brief Test if string doesn't precede string.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ * @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Test if string doesn't precede C string.
+ * @param __lhs String.
+ * @param __rhs C string.
+ * @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Test if C string doesn't precede string.
+ * @param __lhs C string.
+ * @param __rhs String.
+ * @return True if @a __lhs doesn't precede @a __rhs. False otherwise.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline bool
+ operator>=(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { return __rhs.compare(__lhs) <= 0; }
+
+ /**
+ * @brief Swap contents of two strings.
+ * @param __lhs First string.
+ * @param __rhs Second string.
+ *
+ * Exchanges the contents of @a __lhs and @a __rhs in constant time.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline void
+ swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline void
+ swap(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
+ __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline void
+ swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Read stream into a string.
+ * @param __is Input stream.
+ * @param __str Buffer to store into.
+ * @return Reference to the input stream.
+ *
+ * Stores characters from @a __is into @a __str until whitespace is
+ * found, the end of the stream is encountered, or str.max_size()
+ * is reached. If is.width() is non-zero, that is the limit on the
+ * number of characters stored into @a __str. Any previous
+ * contents of @a __str are erased.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is,
+ __gnu_cxx::__versa_string<_CharT, _Traits,
+ _Alloc, _Base>& __str);
+
+ /**
+ * @brief Write string to a stream.
+ * @param __os Output stream.
+ * @param __str String to write out.
+ * @return Reference to the output stream.
+ *
+ * Output characters of @a __str into os following the same rules as for
+ * writing a C string.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc,
+ _Base>& __str)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 586. string inserter not a formatted function
+ return __ostream_insert(__os, __str.data(), __str.size());
+ }
+
+ /**
+ * @brief Read a line from stream into a string.
+ * @param __is Input stream.
+ * @param __str Buffer to store into.
+ * @param __delim Character marking end of line.
+ * @return Reference to the input stream.
+ *
+ * Stores characters from @a __is into @a __str until @a __delim is
+ * found, the end of the stream is encountered, or str.max_size()
+ * is reached. If is.width() is non-zero, that is the limit on the
+ * number of characters stored into @a __str. Any previous
+ * contents of @a __str are erased. If @a delim was encountered,
+ * it is extracted but not stored into @a __str.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __is,
+ __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
+ _CharT __delim);
+
+ /**
+ * @brief Read a line from stream into a string.
+ * @param __is Input stream.
+ * @param __str Buffer to store into.
+ * @return Reference to the input stream.
+ *
+ * Stores characters from is into @a __str until '\n' is found, the
+ * end of the stream is encountered, or str.max_size() is reached.
+ * If is.width() is non-zero, that is the limit on the number of
+ * characters stored into @a __str. Any previous contents of @a
+ * __str are erased. If end of line was encountered, it is
+ * extracted but not stored into @a __str.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ inline basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __is,
+ __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str)
+ { return getline(__is, __str, __is.widen('\n')); }
+
+_GLIBCXX_END_NAMESPACE
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99))
+
+#include <ext/string_conversions.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // 21.4 Numeric Conversions [string.conversions].
+ inline int
+ stoi(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(),
+ __idx, __base); }
+
+ inline long
+ stol(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long
+ stoul(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(),
+ __idx, __base); }
+
+ inline long long
+ stoll(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long long
+ stoull(const __vstring& __str, std::size_t* __idx, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(),
+ __idx, __base); }
+
+ // NB: strtof vs strtod.
+ inline float
+ stof(const __vstring& __str, std::size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); }
+
+ inline double
+ stod(const __vstring& __str, std::size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); }
+
+ inline long double
+ stold(const __vstring& __str, std::size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); }
+
+ // NB: (v)snprintf vs sprintf.
+ inline __vstring
+ to_string(long long __val)
+ { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
+ 4 * sizeof(long long),
+ "%lld", __val); }
+
+ inline __vstring
+ to_string(unsigned long long __val)
+ { return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
+ 4 * sizeof(unsigned long long),
+ "%llu", __val); }
+
+ inline __vstring
+ to_string(long double __val)
+ {
+ const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
+ "%Lf", __val);
+ }
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ inline int
+ stoi(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa<long, int>(&std::wcstol, "stoi", __str.c_str(),
+ __idx, __base); }
+
+ inline long
+ stol(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long
+ stoul(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(),
+ __idx, __base); }
+
+ inline long long
+ stoll(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(),
+ __idx, __base); }
+
+ inline unsigned long long
+ stoull(const __wvstring& __str, std::size_t* __idx = 0, int __base = 10)
+ { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(),
+ __idx, __base); }
+
+ // NB: wcstof vs wcstod.
+ inline float
+ stof(const __wvstring& __str, std::size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); }
+
+ inline double
+ stod(const __wvstring& __str, std::size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); }
+
+ inline long double
+ stold(const __wvstring& __str, std::size_t* __idx = 0)
+ { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); }
+
+ inline __wvstring
+ to_wstring(long long __val)
+ { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
+ 4 * sizeof(long long),
+ L"%lld", __val); }
+
+ inline __wvstring
+ to_wstring(unsigned long long __val)
+ { return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
+ 4 * sizeof(unsigned long long),
+ L"%llu", __val); }
+
+ inline __wvstring
+ to_wstring(long double __val)
+ {
+ const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
+ return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
+ L"%Lf", __val);
+ }
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include "vstring.tcc"
+#endif
+
+#if __google_stl_debug_string && !defined(_GLIBCXX_DEBUG)
+// Undo our defines, so they don't affect anything else.
+# undef _GLIBCXX_DEBUG_ASSERT
+# undef _GLIBCXX_DEBUG_PEDASSERT
+# define _GLIBCXX_DEBUG_ASSERT(_Condition)
+# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
+#endif
+
+#endif /* _VSTRING_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/vstring.tcc b/gcc-4.4.0/libstdc++-v3/include/ext/vstring.tcc
new file mode 100644
index 000000000..99193896b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/vstring.tcc
@@ -0,0 +1,696 @@
+// Versatile string -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/vstring.tcc
+ * This file is a GNU extension to the Standard C++ Library.
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _VSTRING_TCC
+#define _VSTRING_TCC 1
+
+#pragma GCC system_header
+
+#include <cxxabi-forced.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ const typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::npos;
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ void
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ resize(size_type __n, _CharT __c)
+ {
+ const size_type __size = this->size();
+ if (__size < __n)
+ this->append(__n - __size, __c);
+ else if (__n < __size)
+ this->_M_erase(__n, __size - __n);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>&
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ _M_append(const _CharT* __s, size_type __n)
+ {
+ const size_type __len = __n + this->size();
+
+ if (__len <= this->capacity() && !this->_M_is_shared())
+ {
+ if (__n)
+ this->_S_copy(this->_M_data() + this->size(), __s, __n);
+ }
+ else
+ this->_M_mutate(this->size(), size_type(0), __s, __n);
+
+ this->_M_set_length(__len);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ template<typename _InputIterator>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>&
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
+ _InputIterator __k2, std::__false_type)
+ {
+ const __versa_string __s(__k1, __k2);
+ const size_type __n1 = __i2 - __i1;
+ return _M_replace(__i1 - _M_ibegin(), __n1, __s._M_data(),
+ __s.size());
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>&
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
+ _CharT __c)
+ {
+ _M_check_length(__n1, __n2, "__versa_string::_M_replace_aux");
+
+ const size_type __old_size = this->size();
+ const size_type __new_size = __old_size + __n2 - __n1;
+
+ if (__new_size <= this->capacity() && !this->_M_is_shared())
+ {
+ _CharT* __p = this->_M_data() + __pos1;
+
+ const size_type __how_much = __old_size - __pos1 - __n1;
+ if (__how_much && __n1 != __n2)
+ this->_S_move(__p + __n2, __p + __n1, __how_much);
+ }
+ else
+ this->_M_mutate(__pos1, __n1, 0, __n2);
+
+ if (__n2)
+ this->_S_assign(this->_M_data() + __pos1, __n2, __c);
+
+ this->_M_set_length(__new_size);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>&
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ _M_replace(size_type __pos, size_type __len1, const _CharT* __s,
+ const size_type __len2)
+ {
+ _M_check_length(__len1, __len2, "__versa_string::_M_replace");
+
+ const size_type __old_size = this->size();
+ const size_type __new_size = __old_size + __len2 - __len1;
+
+ if (__new_size <= this->capacity() && !this->_M_is_shared())
+ {
+ _CharT* __p = this->_M_data() + __pos;
+
+ const size_type __how_much = __old_size - __pos - __len1;
+ if (_M_disjunct(__s))
+ {
+ if (__how_much && __len1 != __len2)
+ this->_S_move(__p + __len2, __p + __len1, __how_much);
+ if (__len2)
+ this->_S_copy(__p, __s, __len2);
+ }
+ else
+ {
+ // Work in-place.
+ if (__len2 && __len2 <= __len1)
+ this->_S_move(__p, __s, __len2);
+ if (__how_much && __len1 != __len2)
+ this->_S_move(__p + __len2, __p + __len1, __how_much);
+ if (__len2 > __len1)
+ {
+ if (__s + __len2 <= __p + __len1)
+ this->_S_move(__p, __s, __len2);
+ else if (__s >= __p + __len1)
+ this->_S_copy(__p, __s + __len2 - __len1, __len2);
+ else
+ {
+ const size_type __nleft = (__p + __len1) - __s;
+ this->_S_move(__p, __s, __nleft);
+ this->_S_copy(__p + __nleft, __p + __len2,
+ __len2 - __nleft);
+ }
+ }
+ }
+ }
+ else
+ this->_M_mutate(__pos, __len1, __s, __len2);
+
+ this->_M_set_length(__new_size);
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ {
+ __versa_string<_CharT, _Traits, _Alloc, _Base> __str;
+ __str.reserve(__lhs.size() + __rhs.size());
+ __str.append(__lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const _CharT* __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ {
+ __glibcxx_requires_string(__lhs);
+ typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type;
+ typedef typename __string_type::size_type __size_type;
+ const __size_type __len = _Traits::length(__lhs);
+ __string_type __str;
+ __str.reserve(__len + __rhs.size());
+ __str.append(__lhs, __len);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(_CharT __lhs,
+ const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
+ {
+ __versa_string<_CharT, _Traits, _Alloc, _Base> __str;
+ __str.reserve(__rhs.size() + 1);
+ __str.push_back(__lhs);
+ __str.append(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ const _CharT* __rhs)
+ {
+ __glibcxx_requires_string(__rhs);
+ typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type;
+ typedef typename __string_type::size_type __size_type;
+ const __size_type __len = _Traits::length(__rhs);
+ __string_type __str;
+ __str.reserve(__lhs.size() + __len);
+ __str.append(__lhs);
+ __str.append(__rhs, __len);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ __versa_string<_CharT, _Traits, _Alloc, _Base>
+ operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
+ _CharT __rhs)
+ {
+ __versa_string<_CharT, _Traits, _Alloc, _Base> __str;
+ __str.reserve(__lhs.size() + 1);
+ __str.append(__lhs);
+ __str.push_back(__rhs);
+ return __str;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ copy(_CharT* __s, size_type __n, size_type __pos) const
+ {
+ _M_check(__pos, "__versa_string::copy");
+ __n = _M_limit(__pos, __n);
+ __glibcxx_requires_string_len(__s, __n);
+ if (__n)
+ this->_S_copy(__s, this->_M_data() + __pos, __n);
+ // 21.3.5.7 par 3: do not append null. (good.)
+ return __n;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ const size_type __size = this->size();
+ const _CharT* __data = this->_M_data();
+
+ if (__n == 0)
+ return __pos <= __size ? __pos : npos;
+
+ if (__n <= __size)
+ {
+ for (; __pos <= __size - __n; ++__pos)
+ if (traits_type::eq(__data[__pos], __s[0])
+ && traits_type::compare(__data + __pos + 1,
+ __s + 1, __n - 1) == 0)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find(_CharT __c, size_type __pos) const
+ {
+ size_type __ret = npos;
+ const size_type __size = this->size();
+ if (__pos < __size)
+ {
+ const _CharT* __data = this->_M_data();
+ const size_type __n = __size - __pos;
+ const _CharT* __p = traits_type::find(__data + __pos, __n, __c);
+ if (__p)
+ __ret = __p - __data;
+ }
+ return __ret;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ rfind(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ const size_type __size = this->size();
+ if (__n <= __size)
+ {
+ __pos = std::min(size_type(__size - __n), __pos);
+ const _CharT* __data = this->_M_data();
+ do
+ {
+ if (traits_type::compare(__data + __pos, __s, __n) == 0)
+ return __pos;
+ }
+ while (__pos-- > 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ rfind(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ for (++__size; __size-- > 0; )
+ if (traits_type::eq(this->_M_data()[__size], __c))
+ return __size;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ for (; __n && __pos < this->size(); ++__pos)
+ {
+ const _CharT* __p = traits_type::find(__s, __n,
+ this->_M_data()[__pos]);
+ if (__p)
+ return __pos;
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ size_type __size = this->size();
+ if (__size && __n)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (traits_type::find(__s, __n, this->_M_data()[__size]))
+ return __size;
+ }
+ while (__size-- != 0);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ for (; __pos < this->size(); ++__pos)
+ if (!traits_type::find(__s, __n, this->_M_data()[__pos]))
+ return __pos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find_first_not_of(_CharT __c, size_type __pos) const
+ {
+ for (; __pos < this->size(); ++__pos)
+ if (!traits_type::eq(this->_M_data()[__pos], __c))
+ return __pos;
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
+ {
+ __glibcxx_requires_string_len(__s, __n);
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::find(__s, __n, this->_M_data()[__size]))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ find_last_not_of(_CharT __c, size_type __pos) const
+ {
+ size_type __size = this->size();
+ if (__size)
+ {
+ if (--__size > __pos)
+ __size = __pos;
+ do
+ {
+ if (!traits_type::eq(this->_M_data()[__size], __c))
+ return __size;
+ }
+ while (__size--);
+ }
+ return npos;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ int
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ compare(size_type __pos, size_type __n, const __versa_string& __str) const
+ {
+ _M_check(__pos, "__versa_string::compare");
+ __n = _M_limit(__pos, __n);
+ const size_type __osize = __str.size();
+ const size_type __len = std::min(__n, __osize);
+ int __r = traits_type::compare(this->_M_data() + __pos,
+ __str.data(), __len);
+ if (!__r)
+ __r = _S_compare(__n, __osize);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ int
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ compare(size_type __pos1, size_type __n1, const __versa_string& __str,
+ size_type __pos2, size_type __n2) const
+ {
+ _M_check(__pos1, "__versa_string::compare");
+ __str._M_check(__pos2, "__versa_string::compare");
+ __n1 = _M_limit(__pos1, __n1);
+ __n2 = __str._M_limit(__pos2, __n2);
+ const size_type __len = std::min(__n1, __n2);
+ int __r = traits_type::compare(this->_M_data() + __pos1,
+ __str.data() + __pos2, __len);
+ if (!__r)
+ __r = _S_compare(__n1, __n2);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ int
+ __versa_string<_CharT, _Traits, _Alloc, _Base>::
+ compare(const _CharT* __s) const
+ {
+ __glibcxx_requires_string(__s);
+ const size_type __size = this->size();
+ const size_type __osize = traits_type::length(__s);
+ const size_type __len = std::min(__size, __osize);
+ int __r = traits_type::compare(this->_M_data(), __s, __len);
+ if (!__r)
+ __r = _S_compare(__size, __osize);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ int
+ __versa_string <_CharT, _Traits, _Alloc, _Base>::
+ compare(size_type __pos, size_type __n1, const _CharT* __s) const
+ {
+ __glibcxx_requires_string(__s);
+ _M_check(__pos, "__versa_string::compare");
+ __n1 = _M_limit(__pos, __n1);
+ const size_type __osize = traits_type::length(__s);
+ const size_type __len = std::min(__n1, __osize);
+ int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);
+ if (!__r)
+ __r = _S_compare(__n1, __osize);
+ return __r;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ int
+ __versa_string <_CharT, _Traits, _Alloc, _Base>::
+ compare(size_type __pos, size_type __n1, const _CharT* __s,
+ size_type __n2) const
+ {
+ __glibcxx_requires_string_len(__s, __n2);
+ _M_check(__pos, "__versa_string::compare");
+ __n1 = _M_limit(__pos, __n1);
+ const size_type __len = std::min(__n1, __n2);
+ int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);
+ if (!__r)
+ __r = _S_compare(__n1, __n2);
+ return __r;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in,
+ __gnu_cxx::__versa_string<_CharT, _Traits,
+ _Alloc, _Base>& __str)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+ typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>
+ __string_type;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __string_type::size_type __size_type;
+ typedef ctype<_CharT> __ctype_type;
+ typedef typename __ctype_type::ctype_base __ctype_base;
+
+ __size_type __extracted = 0;
+ typename __ios_base::iostate __err = __ios_base::goodbit;
+ typename __istream_type::sentry __cerb(__in, false);
+ if (__cerb)
+ {
+ __try
+ {
+ // Avoid reallocation for common case.
+ __str.erase();
+ _CharT __buf[128];
+ __size_type __len = 0;
+ const streamsize __w = __in.width();
+ const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)
+ : __str.max_size();
+ const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
+ const __int_type __eof = _Traits::eof();
+ __int_type __c = __in.rdbuf()->sgetc();
+
+ while (__extracted < __n
+ && !_Traits::eq_int_type(__c, __eof)
+ && !__ct.is(__ctype_base::space,
+ _Traits::to_char_type(__c)))
+ {
+ if (__len == sizeof(__buf) / sizeof(_CharT))
+ {
+ __str.append(__buf, sizeof(__buf) / sizeof(_CharT));
+ __len = 0;
+ }
+ __buf[__len++] = _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __in.rdbuf()->snextc();
+ }
+ __str.append(__buf, __len);
+
+ if (_Traits::eq_int_type(__c, __eof))
+ __err |= __ios_base::eofbit;
+ __in.width(0);
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(__ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 91. Description of operator>> and getline() for string<>
+ // might cause endless loop
+ __in._M_setstate(__ios_base::badbit);
+ }
+ }
+ // 211. operator>>(istream&, string&) doesn't set failbit
+ if (!__extracted)
+ __err |= __ios_base::failbit;
+ if (__err)
+ __in.setstate(__err);
+ return __in;
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc,
+ template <typename, typename, typename> class _Base>
+ basic_istream<_CharT, _Traits>&
+ getline(basic_istream<_CharT, _Traits>& __in,
+ __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
+ _CharT __delim)
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+ typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>
+ __string_type;
+ typedef typename __istream_type::int_type __int_type;
+ typedef typename __string_type::size_type __size_type;
+
+ __size_type __extracted = 0;
+ const __size_type __n = __str.max_size();
+ typename __ios_base::iostate __err = __ios_base::goodbit;
+ typename __istream_type::sentry __cerb(__in, true);
+ if (__cerb)
+ {
+ __try
+ {
+ // Avoid reallocation for common case.
+ __str.erase();
+ _CharT __buf[128];
+ __size_type __len = 0;
+ const __int_type __idelim = _Traits::to_int_type(__delim);
+ const __int_type __eof = _Traits::eof();
+ __int_type __c = __in.rdbuf()->sgetc();
+
+ while (__extracted < __n
+ && !_Traits::eq_int_type(__c, __eof)
+ && !_Traits::eq_int_type(__c, __idelim))
+ {
+ if (__len == sizeof(__buf) / sizeof(_CharT))
+ {
+ __str.append(__buf, sizeof(__buf) / sizeof(_CharT));
+ __len = 0;
+ }
+ __buf[__len++] = _Traits::to_char_type(__c);
+ ++__extracted;
+ __c = __in.rdbuf()->snextc();
+ }
+ __str.append(__buf, __len);
+
+ if (_Traits::eq_int_type(__c, __eof))
+ __err |= __ios_base::eofbit;
+ else if (_Traits::eq_int_type(__c, __idelim))
+ {
+ ++__extracted;
+ __in.rdbuf()->sbumpc();
+ }
+ else
+ __err |= __ios_base::failbit;
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __in._M_setstate(__ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 91. Description of operator>> and getline() for string<>
+ // might cause endless loop
+ __in._M_setstate(__ios_base::badbit);
+ }
+ }
+ if (!__extracted)
+ __err |= __ios_base::failbit;
+ if (__err)
+ __in.setstate(__err);
+ return __in;
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _VSTRING_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/vstring_fwd.h b/gcc-4.4.0/libstdc++-v3/include/ext/vstring_fwd.h
new file mode 100644
index 000000000..c2a31d4af
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/vstring_fwd.h
@@ -0,0 +1,87 @@
+// Versatile string forward -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/vstring_fwd.h
+ * This file is a GNU extension to the Standard C++ Library.
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _VSTRING_FWD_H
+#define _VSTRING_FWD_H 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/char_traits.h>
+#include <bits/allocator.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __sso_string_base;
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __rc_string_base;
+
+ template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
+ typename _Alloc = std::allocator<_CharT>,
+ template
+ <typename, typename, typename> class _Base = __sso_string_base>
+ class __versa_string;
+
+ typedef __versa_string<char> __vstring;
+ typedef __vstring __sso_string;
+ typedef
+ __versa_string<char, std::char_traits<char>,
+ std::allocator<char>, __rc_string_base> __rc_string;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef __versa_string<wchar_t> __wvstring;
+ typedef __wvstring __wsso_string;
+ typedef
+ __versa_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t>, __rc_string_base> __wrc_string;
+#endif
+
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+ typedef __versa_string<char16_t> __u16vstring;
+ typedef __u16vstring __u16sso_string;
+ typedef
+ __versa_string<char16_t, std::char_traits<char16_t>,
+ std::allocator<char16_t>, __rc_string_base> __u16rc_string;
+
+ typedef __versa_string<char32_t> __u32vstring;
+ typedef __u32vstring __u32sso_string;
+ typedef
+ __versa_string<char32_t, std::char_traits<char32_t>,
+ std::allocator<char32_t>, __rc_string_base> __u32rc_string;
+
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _VSTRING_FWD_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/ext/vstring_util.h b/gcc-4.4.0/libstdc++-v3/include/ext/vstring_util.h
new file mode 100644
index 000000000..4042f7069
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/ext/vstring_util.h
@@ -0,0 +1,180 @@
+// Versatile string utility -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ext/vstring_util.h
+ * This file is a GNU extension to the Standard C++ Library.
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _VSTRING_UTIL_H
+#define _VSTRING_UTIL_H 1
+
+#pragma GCC system_header
+
+#include <ext/vstring_fwd.h>
+#include <debug/debug.h>
+#include <bits/stl_function.h> // For less
+#include <bits/functexcept.h>
+#include <bits/localefwd.h>
+#include <bits/ostream_insert.h>
+#include <bits/stl_iterator.h>
+#include <ext/numeric_traits.h>
+#include <bits/move.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ struct __vstring_utility
+ {
+ typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
+
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ typedef typename _CharT_alloc_type::difference_type difference_type;
+ typedef typename _CharT_alloc_type::pointer pointer;
+ typedef typename _CharT_alloc_type::const_pointer const_pointer;
+
+ // For __sso_string.
+ typedef __gnu_cxx::
+ __normal_iterator<pointer, __gnu_cxx::
+ __versa_string<_CharT, _Traits, _Alloc,
+ __sso_string_base> >
+ __sso_iterator;
+ typedef __gnu_cxx::
+ __normal_iterator<const_pointer, __gnu_cxx::
+ __versa_string<_CharT, _Traits, _Alloc,
+ __sso_string_base> >
+ __const_sso_iterator;
+
+ // For __rc_string.
+ typedef __gnu_cxx::
+ __normal_iterator<pointer, __gnu_cxx::
+ __versa_string<_CharT, _Traits, _Alloc,
+ __rc_string_base> >
+ __rc_iterator;
+ typedef __gnu_cxx::
+ __normal_iterator<const_pointer, __gnu_cxx::
+ __versa_string<_CharT, _Traits, _Alloc,
+ __rc_string_base> >
+ __const_rc_iterator;
+
+ // NB: When the allocator is empty, deriving from it saves space
+ // (http://www.cantrip.org/emptyopt.html).
+ template<typename _Alloc1>
+ struct _Alloc_hider
+ : public _Alloc1
+ {
+ _Alloc_hider(_CharT* __ptr)
+ : _Alloc1(), _M_p(__ptr) { }
+
+ _Alloc_hider(const _Alloc1& __a, _CharT* __ptr)
+ : _Alloc1(__a), _M_p(__ptr) { }
+
+ _CharT* _M_p; // The actual data.
+ };
+
+ // When __n = 1 way faster than the general multichar
+ // traits_type::copy/move/assign.
+ static void
+ _S_copy(_CharT* __d, const _CharT* __s, size_type __n)
+ {
+ if (__n == 1)
+ traits_type::assign(*__d, *__s);
+ else
+ traits_type::copy(__d, __s, __n);
+ }
+
+ static void
+ _S_move(_CharT* __d, const _CharT* __s, size_type __n)
+ {
+ if (__n == 1)
+ traits_type::assign(*__d, *__s);
+ else
+ traits_type::move(__d, __s, __n);
+ }
+
+ static void
+ _S_assign(_CharT* __d, size_type __n, _CharT __c)
+ {
+ if (__n == 1)
+ traits_type::assign(*__d, __c);
+ else
+ traits_type::assign(__d, __n, __c);
+ }
+
+ // _S_copy_chars is a separate template to permit specialization
+ // to optimize for the common case of pointers as iterators.
+ template<typename _Iterator>
+ static void
+ _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
+ {
+ for (; __k1 != __k2; ++__k1, ++__p)
+ traits_type::assign(*__p, *__k1); // These types are off.
+ }
+
+ static void
+ _S_copy_chars(_CharT* __p, __sso_iterator __k1, __sso_iterator __k2)
+ { _S_copy_chars(__p, __k1.base(), __k2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, __const_sso_iterator __k1,
+ __const_sso_iterator __k2)
+ { _S_copy_chars(__p, __k1.base(), __k2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, __rc_iterator __k1, __rc_iterator __k2)
+ { _S_copy_chars(__p, __k1.base(), __k2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, __const_rc_iterator __k1,
+ __const_rc_iterator __k2)
+ { _S_copy_chars(__p, __k1.base(), __k2.base()); }
+
+ static void
+ _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
+ { _S_copy(__p, __k1, __k2 - __k1); }
+
+ static void
+ _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)
+ { _S_copy(__p, __k1, __k2 - __k1); }
+
+ static int
+ _S_compare(size_type __n1, size_type __n2)
+ {
+ const difference_type __d = difference_type(__n1 - __n2);
+
+ if (__d > __numeric_traits_integer<int>::__max)
+ return __numeric_traits_integer<int>::__max;
+ else if (__d < __numeric_traits_integer<int>::__min)
+ return __numeric_traits_integer<int>::__min;
+ else
+ return int(__d);
+ }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _VSTRING_UTIL_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/algo.h b/gcc-4.4.0/libstdc++-v3/include/parallel/algo.h
new file mode 100644
index 000000000..59106b2d3
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/algo.h
@@ -0,0 +1,2364 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algo.h
+ * @brief Parallel STL function calls corresponding to the stl_algo.h header.
+ *
+ * The functions defined here mainly do case switches and
+ * call the actual parallelized versions in other files.
+ * Inlining policy: Functions that basically only contain one function call,
+ * are declared inline.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_ALGO_H
+#define _GLIBCXX_PARALLEL_ALGO_H 1
+
+#include <parallel/algorithmfwd.h>
+#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h>
+#include <parallel/iterator.h>
+#include <parallel/base.h>
+#include <parallel/sort.h>
+#include <parallel/workstealing.h>
+#include <parallel/par_loop.h>
+#include <parallel/omp_loop.h>
+#include <parallel/omp_loop_static.h>
+#include <parallel/for_each_selectors.h>
+#include <parallel/for_each.h>
+#include <parallel/find.h>
+#include <parallel/find_selectors.h>
+#include <parallel/search.h>
+#include <parallel/random_shuffle.h>
+#include <parallel/partition.h>
+#include <parallel/merge.h>
+#include <parallel/unique_copy.h>
+#include <parallel/set_operations.h>
+
+namespace std
+{
+namespace __parallel
+{
+ // Sequential fallback
+ template<typename InputIterator, typename Function>
+ inline Function
+ for_each(InputIterator begin, InputIterator end, Function f,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::for_each(begin, end, f); }
+
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator, typename Function, typename IteratorTag>
+ inline Function
+ for_each_switch(InputIterator begin, InputIterator end, Function f,
+ IteratorTag)
+ { return for_each(begin, end, f, __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators
+ template<typename RandomAccessIterator, typename Function>
+ Function
+ for_each_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Function f, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().for_each_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ bool dummy;
+ __gnu_parallel::for_each_selector<RandomAccessIterator> functionality;
+
+ return __gnu_parallel::
+ for_each_template_random_access(begin, end, f, functionality,
+ __gnu_parallel::dummy_reduct(),
+ true, dummy, -1, parallelism_tag);
+ }
+ else
+ return for_each(begin, end, f, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface
+ template<typename Iterator, typename Function>
+ inline Function
+ for_each(Iterator begin, Iterator end, Function f,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<Iterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return for_each_switch(begin, end, f, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename Iterator, typename Function>
+ inline Function
+ for_each(Iterator begin, Iterator end, Function f)
+ {
+ typedef std::iterator_traits<Iterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return for_each_switch(begin, end, f, iterator_category());
+ }
+
+
+ // Sequential fallback
+ template<typename InputIterator, typename T>
+ inline InputIterator
+ find(InputIterator begin, InputIterator end, const T& val,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::find(begin, end, val); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator, typename T, typename IteratorTag>
+ inline InputIterator
+ find_switch(InputIterator begin, InputIterator end, const T& val,
+ IteratorTag)
+ { return _GLIBCXX_STD_P::find(begin, end, val); }
+
+ // Parallel find for random access iterators
+ template<typename RandomAccessIterator, typename T>
+ RandomAccessIterator
+ find_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ const T& val, random_access_iterator_tag)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ {
+ binder2nd<__gnu_parallel::equal_to<value_type, T> >
+ comp(__gnu_parallel::equal_to<value_type, T>(), val);
+ return __gnu_parallel::find_template(begin, end, begin, comp,
+ __gnu_parallel::
+ find_if_selector()).first;
+ }
+ else
+ return _GLIBCXX_STD_P::find(begin, end, val);
+ }
+
+ // Public interface
+ template<typename InputIterator, typename T>
+ inline InputIterator
+ find(InputIterator begin, InputIterator end, const T& val)
+ {
+ typedef std::iterator_traits<InputIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return find_switch(begin, end, val, iterator_category());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator, typename Predicate>
+ inline InputIterator
+ find_if(InputIterator begin, InputIterator end, Predicate pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::find_if(begin, end, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator, typename Predicate, typename IteratorTag>
+ inline InputIterator
+ find_if_switch(InputIterator begin, InputIterator end, Predicate pred,
+ IteratorTag)
+ { return _GLIBCXX_STD_P::find_if(begin, end, pred); }
+
+ // Parallel find_if for random access iterators
+ template<typename RandomAccessIterator, typename Predicate>
+ RandomAccessIterator
+ find_if_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Predicate pred, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ return __gnu_parallel::find_template(begin, end, begin, pred,
+ __gnu_parallel::
+ find_if_selector()).first;
+ else
+ return _GLIBCXX_STD_P::find_if(begin, end, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator, typename Predicate>
+ inline InputIterator
+ find_if(InputIterator begin, InputIterator end, Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return find_if_switch(begin, end, pred, iterator_category());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator, typename ForwardIterator>
+ inline InputIterator
+ find_first_of(InputIterator begin1, InputIterator end1,
+ ForwardIterator begin2, ForwardIterator end2,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::find_first_of(begin1, end1, begin2, end2); }
+
+ // Sequential fallback
+ template<typename InputIterator, typename ForwardIterator,
+ typename BinaryPredicate>
+ inline InputIterator
+ find_first_of(InputIterator begin1, InputIterator end1,
+ ForwardIterator begin2, ForwardIterator end2,
+ BinaryPredicate comp, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::find_first_of(begin1, end1, begin2, end2, comp); }
+
+ // Sequential fallback for input iterator type
+ template<typename InputIterator, typename ForwardIterator,
+ typename IteratorTag1, typename IteratorTag2>
+ inline InputIterator
+ find_first_of_switch(InputIterator begin1, InputIterator end1,
+ ForwardIterator begin2, ForwardIterator end2,
+ IteratorTag1, IteratorTag2)
+ { return find_first_of(begin1, end1, begin2, end2,
+ __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators
+ template<typename RandomAccessIterator, typename ForwardIterator,
+ typename BinaryPredicate, typename IteratorTag>
+ inline RandomAccessIterator
+ find_first_of_switch(RandomAccessIterator begin1,
+ RandomAccessIterator end1,
+ ForwardIterator begin2, ForwardIterator end2,
+ BinaryPredicate comp, random_access_iterator_tag,
+ IteratorTag)
+ {
+ return __gnu_parallel::
+ find_template(begin1, end1, begin1, comp,
+ __gnu_parallel::find_first_of_selector
+ <ForwardIterator>(begin2, end2)).first;
+ }
+
+ // Sequential fallback for input iterator type
+ template<typename InputIterator, typename ForwardIterator,
+ typename BinaryPredicate, typename IteratorTag1,
+ typename IteratorTag2>
+ inline InputIterator
+ find_first_of_switch(InputIterator begin1, InputIterator end1,
+ ForwardIterator begin2, ForwardIterator end2,
+ BinaryPredicate comp, IteratorTag1, IteratorTag2)
+ { return find_first_of(begin1, end1, begin2, end2, comp,
+ __gnu_parallel::sequential_tag()); }
+
+ // Public interface
+ template<typename InputIterator, typename ForwardIterator,
+ typename BinaryPredicate>
+ inline InputIterator
+ find_first_of(InputIterator begin1, InputIterator end1,
+ ForwardIterator begin2, ForwardIterator end2,
+ BinaryPredicate comp)
+ {
+ typedef std::iterator_traits<InputIterator> iteratori_traits;
+ typedef std::iterator_traits<ForwardIterator> iteratorf_traits;
+ typedef typename iteratori_traits::iterator_category iteratori_category;
+ typedef typename iteratorf_traits::iterator_category iteratorf_category;
+
+ return find_first_of_switch(begin1, end1, begin2, end2, comp,
+ iteratori_category(), iteratorf_category());
+ }
+
+ // Public interface, insert default comparator
+ template<typename InputIterator, typename ForwardIterator>
+ inline InputIterator
+ find_first_of(InputIterator begin1, InputIterator end1,
+ ForwardIterator begin2, ForwardIterator end2)
+ {
+ typedef std::iterator_traits<InputIterator> iteratori_traits;
+ typedef std::iterator_traits<ForwardIterator> iteratorf_traits;
+ typedef typename iteratori_traits::value_type valuei_type;
+ typedef typename iteratorf_traits::value_type valuef_type;
+
+ return find_first_of(begin1, end1, begin2, end2, __gnu_parallel::
+ equal_to<valuei_type, valuef_type>());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::unique_copy(begin1, end1, out); }
+
+ // Sequential fallback
+ template<typename InputIterator, typename OutputIterator,
+ typename Predicate>
+ inline OutputIterator
+ unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out,
+ Predicate pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::unique_copy(begin1, end1, out, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator, typename OutputIterator,
+ typename Predicate, typename IteratorTag1, typename IteratorTag2>
+ inline OutputIterator
+ unique_copy_switch(InputIterator begin, InputIterator last,
+ OutputIterator out, Predicate pred,
+ IteratorTag1, IteratorTag2)
+ { return _GLIBCXX_STD_P::unique_copy(begin, last, out, pred); }
+
+ // Parallel unique_copy for random access iterators
+ template<typename RandomAccessIterator, typename RandomAccessOutputIterator,
+ typename Predicate>
+ RandomAccessOutputIterator
+ unique_copy_switch(RandomAccessIterator begin, RandomAccessIterator last,
+ RandomAccessOutputIterator out, Predicate pred,
+ random_access_iterator_tag, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(last - begin)
+ > __gnu_parallel::_Settings::get().unique_copy_minimal_n))
+ return __gnu_parallel::parallel_unique_copy(begin, last, out, pred);
+ else
+ return _GLIBCXX_STD_P::unique_copy(begin, last, out, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out)
+ {
+ typedef std::iterator_traits<InputIterator> iteratori_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori_traits::iterator_category iteratori_category;
+ typedef typename iteratori_traits::value_type value_type;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return unique_copy_switch(begin1, end1, out, equal_to<value_type>(),
+ iteratori_category(), iteratoro_category());
+ }
+
+ // Public interface
+ template<typename InputIterator, typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out,
+ Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator> iteratori_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori_traits::iterator_category iteratori_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return unique_copy_switch(begin1, end1, out, pred, iteratori_category(),
+ iteratoro_category());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_union(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_union(begin1, end1, begin2, end2, out); }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_union(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_union(begin1, end1,
+ begin2, end2, out, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate, typename OutputIterator,
+ typename IteratorTag1, typename IteratorTag2, typename IteratorTag3>
+ inline OutputIterator
+ set_union_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator result, Predicate pred, IteratorTag1,
+ IteratorTag2, IteratorTag3)
+ { return _GLIBCXX_STD_P::set_union(begin1, end1,
+ begin2, end2, result, pred); }
+
+ // Parallel set_union for random access iterators
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputRandomAccessIterator, typename Predicate>
+ OutputRandomAccessIterator
+ set_union_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, RandomAccessIterator2 end2,
+ OutputRandomAccessIterator result, Predicate pred,
+ random_access_iterator_tag, random_access_iterator_tag,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1)
+ >= __gnu_parallel::_Settings::get().set_union_minimal_n
+ || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2)
+ >= __gnu_parallel::_Settings::get().set_union_minimal_n))
+ return __gnu_parallel::parallel_set_union(begin1, end1,
+ begin2, end2, result, pred);
+ else
+ return _GLIBCXX_STD_P::set_union(begin1, end1,
+ begin2, end2, result, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_union(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2, OutputIterator out)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+ typedef typename iteratori1_traits::value_type value1_type;
+ typedef typename iteratori2_traits::value_type value2_type;
+
+ return set_union_switch(begin1, end1, begin2, end2, out,
+ __gnu_parallel::less<value1_type, value2_type>(),
+ iteratori1_category(), iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_union(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return set_union_switch(begin1, end1, begin2, end2, out, pred,
+ iteratori1_category(), iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Sequential fallback.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_intersection(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_intersection(begin1, end1,
+ begin2, end2, out); }
+
+ // Sequential fallback.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_intersection(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2, end2,
+ out, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate, typename OutputIterator,
+ typename IteratorTag1, typename IteratorTag2,
+ typename IteratorTag3>
+ inline OutputIterator
+ set_intersection_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator result, Predicate pred,
+ IteratorTag1, IteratorTag2, IteratorTag3)
+ { return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2,
+ end2, result, pred); }
+
+ // Parallel set_intersection for random access iterators
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputRandomAccessIterator, typename Predicate>
+ OutputRandomAccessIterator
+ set_intersection_switch(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2,
+ RandomAccessIterator2 end2,
+ OutputRandomAccessIterator result,
+ Predicate pred,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1)
+ >= __gnu_parallel::_Settings::get().set_union_minimal_n
+ || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2)
+ >= __gnu_parallel::_Settings::get().set_union_minimal_n))
+ return __gnu_parallel::parallel_set_intersection(begin1, end1, begin2,
+ end2, result, pred);
+ else
+ return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2,
+ end2, result, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_intersection(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+ typedef typename iteratori1_traits::value_type value1_type;
+ typedef typename iteratori2_traits::value_type value2_type;
+
+ return set_intersection_switch(begin1, end1, begin2, end2, out,
+ __gnu_parallel::
+ less<value1_type, value2_type>(),
+ iteratori1_category(),
+ iteratori2_category(),
+ iteratoro_category());
+ }
+
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_intersection(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return set_intersection_switch(begin1, end1, begin2, end2, out, pred,
+ iteratori1_category(),
+ iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_symmetric_difference(begin1,end1,
+ begin2, end2, out); }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1, begin2,
+ end2, out, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate, typename OutputIterator,
+ typename IteratorTag1, typename IteratorTag2,
+ typename IteratorTag3>
+ inline OutputIterator
+ set_symmetric_difference_switch(InputIterator1 begin1,
+ InputIterator1 end1,
+ InputIterator2 begin2,
+ InputIterator2 end2,
+ OutputIterator result, Predicate pred,
+ IteratorTag1, IteratorTag2, IteratorTag3)
+ { return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1,
+ begin2, end2,
+ result, pred); }
+
+ // Parallel set_symmetric_difference for random access iterators
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputRandomAccessIterator, typename Predicate>
+ OutputRandomAccessIterator
+ set_symmetric_difference_switch(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2,
+ RandomAccessIterator2 end2,
+ OutputRandomAccessIterator result,
+ Predicate pred,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1)
+ >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n
+ || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2)
+ >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n))
+ return __gnu_parallel::parallel_set_symmetric_difference(begin1, end1,
+ begin2, end2,
+ result, pred);
+ else
+ return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1,
+ begin2, end2,
+ result, pred);
+ }
+
+ // Public interface.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+ typedef typename iteratori1_traits::value_type value1_type;
+ typedef typename iteratori2_traits::value_type value2_type;
+
+ return set_symmetric_difference_switch(begin1, end1, begin2, end2, out,
+ __gnu_parallel::
+ less<value1_type, value2_type>(),
+ iteratori1_category(),
+ iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Public interface.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return set_symmetric_difference_switch(begin1, end1, begin2, end2, out,
+ pred, iteratori1_category(),
+ iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Sequential fallback.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_difference(begin1,end1, begin2, end2, out); }
+
+ // Sequential fallback.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::set_difference(begin1, end1,
+ begin2, end2, out, pred); }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate, typename OutputIterator,
+ typename IteratorTag1, typename IteratorTag2, typename IteratorTag3>
+ inline OutputIterator
+ set_difference_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator result, Predicate pred,
+ IteratorTag1, IteratorTag2, IteratorTag3)
+ { return _GLIBCXX_STD_P::set_difference(begin1, end1,
+ begin2, end2, result, pred); }
+
+ // Parallel set_difference for random access iterators
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputRandomAccessIterator, typename Predicate>
+ OutputRandomAccessIterator
+ set_difference_switch(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2,
+ RandomAccessIterator2 end2,
+ OutputRandomAccessIterator result, Predicate pred,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1)
+ >= __gnu_parallel::_Settings::get().set_difference_minimal_n
+ || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2)
+ >= __gnu_parallel::_Settings::get().set_difference_minimal_n))
+ return __gnu_parallel::parallel_set_difference(begin1, end1,
+ begin2, end2,
+ result, pred);
+ else
+ return _GLIBCXX_STD_P::set_difference(begin1, end1,
+ begin2, end2, result, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ set_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+ typedef typename iteratori1_traits::value_type value1_type;
+ typedef typename iteratori2_traits::value_type value2_type;
+
+ return set_difference_switch(begin1, end1, begin2, end2, out,
+ __gnu_parallel::
+ less<value1_type, value2_type>(),
+ iteratori1_category(),
+ iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Predicate>
+ inline OutputIterator
+ set_difference(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator out, Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return set_difference_switch(begin1, end1, begin2, end2, out, pred,
+ iteratori1_category(),
+ iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Sequential fallback
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ adjacent_find(ForwardIterator begin, ForwardIterator end,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::adjacent_find(begin, end); }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename BinaryPredicate>
+ inline ForwardIterator
+ adjacent_find(ForwardIterator begin, ForwardIterator end,
+ BinaryPredicate binary_pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::adjacent_find(begin, end, binary_pred); }
+
+ // Parallel algorithm for random access iterators
+ template<typename RandomAccessIterator>
+ RandomAccessIterator
+ adjacent_find_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ random_access_iterator_tag)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ {
+ RandomAccessIterator spot = __gnu_parallel::
+ find_template(begin, end - 1, begin, equal_to<value_type>(),
+ __gnu_parallel::adjacent_find_selector()).first;
+ if (spot == (end - 1))
+ return end;
+ else
+ return spot;
+ }
+ else
+ return adjacent_find(begin, end, __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator, typename IteratorTag>
+ inline ForwardIterator
+ adjacent_find_switch(ForwardIterator begin, ForwardIterator end,
+ IteratorTag)
+ { return adjacent_find(begin, end, __gnu_parallel::sequential_tag()); }
+
+ // Public interface
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ adjacent_find(ForwardIterator begin, ForwardIterator end)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return adjacent_find_switch(begin, end, iterator_category());
+ }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator, typename BinaryPredicate,
+ typename IteratorTag>
+ inline ForwardIterator
+ adjacent_find_switch(ForwardIterator begin, ForwardIterator end,
+ BinaryPredicate pred, IteratorTag)
+ { return adjacent_find(begin, end, pred,
+ __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators
+ template<typename RandomAccessIterator, typename BinaryPredicate>
+ RandomAccessIterator
+ adjacent_find_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ BinaryPredicate pred, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ return __gnu_parallel::find_template(begin, end, begin, pred,
+ __gnu_parallel::
+ adjacent_find_selector()).first;
+ else
+ return adjacent_find(begin, end, pred,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface
+ template<typename ForwardIterator, typename BinaryPredicate>
+ inline ForwardIterator
+ adjacent_find(ForwardIterator begin, ForwardIterator end,
+ BinaryPredicate pred)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return adjacent_find_switch(begin, end, pred, iterator_category());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator, typename T>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count(InputIterator begin, InputIterator end, const T& value,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::count(begin, end, value); }
+
+ // Parallel code for random access iterators
+ template<typename RandomAccessIterator, typename T>
+ typename iterator_traits<RandomAccessIterator>::difference_type
+ count_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ const T& value, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_unbalanced)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef __gnu_parallel::sequence_index_t sequence_index_t;
+
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().count_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ __gnu_parallel::count_selector<RandomAccessIterator, difference_type>
+ functionality;
+ difference_type res = 0;
+ __gnu_parallel::
+ for_each_template_random_access(begin, end, value,
+ functionality,
+ std::plus<sequence_index_t>(),
+ res, res, -1, parallelism_tag);
+ return res;
+ }
+ else
+ return count(begin, end, value, __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator, typename T, typename IteratorTag>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count_switch(InputIterator begin, InputIterator end, const T& value,
+ IteratorTag)
+ { return count(begin, end, value, __gnu_parallel::sequential_tag()); }
+
+ // Public interface.
+ template<typename InputIterator, typename T>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count(InputIterator begin, InputIterator end, const T& value,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return count_switch(begin, end, value, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename InputIterator, typename T>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count(InputIterator begin, InputIterator end, const T& value)
+ {
+ typedef iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return count_switch(begin, end, value, iterator_category());
+ }
+
+
+ // Sequential fallback.
+ template<typename InputIterator, typename Predicate>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count_if(InputIterator begin, InputIterator end, Predicate pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::count_if(begin, end, pred); }
+
+ // Parallel count_if for random access iterators
+ template<typename RandomAccessIterator, typename Predicate>
+ typename iterator_traits<RandomAccessIterator>::difference_type
+ count_if_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Predicate pred, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_unbalanced)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef __gnu_parallel::sequence_index_t sequence_index_t;
+
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().count_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ difference_type res = 0;
+ __gnu_parallel::
+ count_if_selector<RandomAccessIterator, difference_type>
+ functionality;
+ __gnu_parallel::
+ for_each_template_random_access(begin, end, pred,
+ functionality,
+ std::plus<sequence_index_t>(),
+ res, res, -1, parallelism_tag);
+ return res;
+ }
+ else
+ return count_if(begin, end, pred, __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator, typename Predicate, typename IteratorTag>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count_if_switch(InputIterator begin, InputIterator end, Predicate pred,
+ IteratorTag)
+ { return count_if(begin, end, pred, __gnu_parallel::sequential_tag()); }
+
+ // Public interface.
+ template<typename InputIterator, typename Predicate>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count_if(InputIterator begin, InputIterator end, Predicate pred,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return count_if_switch(begin, end, pred, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename InputIterator, typename Predicate>
+ inline typename iterator_traits<InputIterator>::difference_type
+ count_if(InputIterator begin, InputIterator end, Predicate pred)
+ {
+ typedef iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return count_if_switch(begin, end, pred, iterator_category());
+ }
+
+
+ // Sequential fallback.
+ template<typename ForwardIterator1, typename ForwardIterator2>
+ inline ForwardIterator1
+ search(ForwardIterator1 begin1, ForwardIterator1 end1,
+ ForwardIterator2 begin2, ForwardIterator2 end2,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::search(begin1, end1, begin2, end2); }
+
+ // Parallel algorithm for random access iterator
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2>
+ RandomAccessIterator1
+ search_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, RandomAccessIterator2 end2,
+ random_access_iterator_tag, random_access_iterator_tag)
+ {
+ typedef std::iterator_traits<RandomAccessIterator1> iterator1_traits;
+ typedef typename iterator1_traits::value_type value1_type;
+ typedef std::iterator_traits<RandomAccessIterator2> iterator2_traits;
+ typedef typename iterator2_traits::value_type value2_type;
+
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ return __gnu_parallel::
+ search_template(begin1, end1, begin2, end2, __gnu_parallel::
+ equal_to<value1_type, value2_type>());
+ else
+ return search(begin1, end1, begin2, end2,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator1, typename ForwardIterator2,
+ typename IteratorTag1, typename IteratorTag2>
+ inline ForwardIterator1
+ search_switch(ForwardIterator1 begin1, ForwardIterator1 end1,
+ ForwardIterator2 begin2, ForwardIterator2 end2,
+ IteratorTag1, IteratorTag2)
+ { return search(begin1, end1, begin2, end2,
+ __gnu_parallel::sequential_tag()); }
+
+ // Public interface.
+ template<typename ForwardIterator1, typename ForwardIterator2>
+ inline ForwardIterator1
+ search(ForwardIterator1 begin1, ForwardIterator1 end1,
+ ForwardIterator2 begin2, ForwardIterator2 end2)
+ {
+ typedef std::iterator_traits<ForwardIterator1> iterator1_traits;
+ typedef typename iterator1_traits::iterator_category iterator1_category;
+ typedef std::iterator_traits<ForwardIterator2> iterator2_traits;
+ typedef typename iterator2_traits::iterator_category iterator2_category;
+
+ return search_switch(begin1, end1, begin2, end2,
+ iterator1_category(), iterator2_category());
+ }
+
+ // Public interface.
+ template<typename ForwardIterator1, typename ForwardIterator2,
+ typename BinaryPredicate>
+ inline ForwardIterator1
+ search(ForwardIterator1 begin1, ForwardIterator1 end1,
+ ForwardIterator2 begin2, ForwardIterator2 end2,
+ BinaryPredicate pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::search(begin1, end1, begin2, end2, pred); }
+
+ // Parallel algorithm for random access iterator.
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename BinaryPredicate>
+ RandomAccessIterator1
+ search_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, RandomAccessIterator2 end2,
+ BinaryPredicate pred,
+ random_access_iterator_tag, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ return __gnu_parallel::search_template(begin1, end1,
+ begin2, end2, pred);
+ else
+ return search(begin1, end1, begin2, end2, pred,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator1, typename ForwardIterator2,
+ typename BinaryPredicate, typename IteratorTag1,
+ typename IteratorTag2>
+ inline ForwardIterator1
+ search_switch(ForwardIterator1 begin1, ForwardIterator1 end1,
+ ForwardIterator2 begin2, ForwardIterator2 end2,
+ BinaryPredicate pred, IteratorTag1, IteratorTag2)
+ { return search(begin1, end1, begin2, end2, pred,
+ __gnu_parallel::sequential_tag()); }
+
+ // Public interface
+ template<typename ForwardIterator1, typename ForwardIterator2,
+ typename BinaryPredicate>
+ inline ForwardIterator1
+ search(ForwardIterator1 begin1, ForwardIterator1 end1,
+ ForwardIterator2 begin2, ForwardIterator2 end2,
+ BinaryPredicate pred)
+ {
+ typedef std::iterator_traits<ForwardIterator1> iterator1_traits;
+ typedef typename iterator1_traits::iterator_category iterator1_category;
+ typedef std::iterator_traits<ForwardIterator2> iterator2_traits;
+ typedef typename iterator2_traits::iterator_category iterator2_category;
+ return search_switch(begin1, end1, begin2, end2, pred,
+ iterator1_category(), iterator2_category());
+ }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename Integer, typename T>
+ inline ForwardIterator
+ search_n(ForwardIterator begin, ForwardIterator end, Integer count,
+ const T& val, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::search_n(begin, end, count, val); }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename Integer, typename T,
+ typename BinaryPredicate>
+ inline ForwardIterator
+ search_n(ForwardIterator begin, ForwardIterator end, Integer count,
+ const T& val, BinaryPredicate binary_pred,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::search_n(begin, end, count, val, binary_pred); }
+
+ // Public interface.
+ template<typename ForwardIterator, typename Integer, typename T>
+ inline ForwardIterator
+ search_n(ForwardIterator begin, ForwardIterator end, Integer count,
+ const T& val)
+ {
+ typedef typename iterator_traits<ForwardIterator>::value_type value_type;
+ return search_n(begin, end, count, val,
+ __gnu_parallel::equal_to<value_type, T>());
+ }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator, typename Integer,
+ typename T, typename BinaryPredicate>
+ RandomAccessIterator
+ search_n_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Integer count, const T& val, BinaryPredicate binary_pred,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ {
+ __gnu_parallel::pseudo_sequence<T, Integer> ps(val, count);
+ return __gnu_parallel::search_template(begin, end, ps.begin(),
+ ps.end(), binary_pred);
+ }
+ else
+ return std::__search_n(begin, end, count, val,
+ binary_pred, random_access_iterator_tag());
+ }
+
+ // Sequential fallback for input iterator case.
+ template<typename ForwardIterator, typename Integer, typename T,
+ typename BinaryPredicate, typename IteratorTag>
+ inline ForwardIterator
+ search_n_switch(ForwardIterator begin, ForwardIterator end, Integer count,
+ const T& val, BinaryPredicate binary_pred, IteratorTag)
+ { return __search_n(begin, end, count, val, binary_pred, IteratorTag()); }
+
+ // Public interface.
+ template<typename ForwardIterator, typename Integer, typename T,
+ typename BinaryPredicate>
+ inline ForwardIterator
+ search_n(ForwardIterator begin, ForwardIterator end, Integer count,
+ const T& val, BinaryPredicate binary_pred)
+ {
+ return search_n_switch(begin, end, count, val, binary_pred,
+ typename std::iterator_traits<ForwardIterator>::
+ iterator_category());
+ }
+
+
+ // Sequential fallback.
+ template<typename InputIterator, typename OutputIterator,
+ typename UnaryOperation>
+ inline OutputIterator
+ transform(InputIterator begin, InputIterator end, OutputIterator result,
+ UnaryOperation unary_op, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::transform(begin, end, result, unary_op); }
+
+ // Parallel unary transform for random access iterators.
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename UnaryOperation>
+ RandomAccessIterator2
+ transform1_switch(RandomAccessIterator1 begin, RandomAccessIterator1 end,
+ RandomAccessIterator2 result, UnaryOperation unary_op,
+ random_access_iterator_tag, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().transform_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ bool dummy = true;
+ typedef __gnu_parallel::iterator_pair<RandomAccessIterator1,
+ RandomAccessIterator2, random_access_iterator_tag> ip;
+ ip begin_pair(begin, result), end_pair(end, result + (end - begin));
+ __gnu_parallel::transform1_selector<ip> functionality;
+ __gnu_parallel::
+ for_each_template_random_access(begin_pair, end_pair,
+ unary_op, functionality,
+ __gnu_parallel::dummy_reduct(),
+ dummy, dummy, -1, parallelism_tag);
+ return functionality.finish_iterator;
+ }
+ else
+ return transform(begin, end, result, unary_op,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case.
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename UnaryOperation, typename IteratorTag1,
+ typename IteratorTag2>
+ inline RandomAccessIterator2
+ transform1_switch(RandomAccessIterator1 begin, RandomAccessIterator1 end,
+ RandomAccessIterator2 result, UnaryOperation unary_op,
+ IteratorTag1, IteratorTag2)
+ { return transform(begin, end, result, unary_op,
+ __gnu_parallel::sequential_tag()); }
+
+ // Public interface.
+ template<typename InputIterator, typename OutputIterator,
+ typename UnaryOperation>
+ inline OutputIterator
+ transform(InputIterator begin, InputIterator end, OutputIterator result,
+ UnaryOperation unary_op,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<InputIterator> iteratori_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori_traits::iterator_category iteratori_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return transform1_switch(begin, end, result, unary_op,
+ iteratori_category(), iteratoro_category(),
+ parallelism_tag);
+ }
+
+ template<typename InputIterator, typename OutputIterator,
+ typename UnaryOperation>
+ inline OutputIterator
+ transform(InputIterator begin, InputIterator end, OutputIterator result,
+ UnaryOperation unary_op)
+ {
+ typedef std::iterator_traits<InputIterator> iteratori_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori_traits::iterator_category iteratori_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return transform1_switch(begin, end, result, unary_op,
+ iteratori_category(), iteratoro_category());
+ }
+
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename BinaryOperation>
+ inline OutputIterator
+ transform(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, OutputIterator result,
+ BinaryOperation binary_op, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::transform(begin1, end1,
+ begin2, result, binary_op); }
+
+ // Parallel binary transform for random access iterators.
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename RandomAccessIterator3, typename BinaryOperation>
+ RandomAccessIterator3
+ transform2_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2,
+ RandomAccessIterator3 result, BinaryOperation binary_op,
+ random_access_iterator_tag, random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ (end1 - begin1) >=
+ __gnu_parallel::_Settings::get().transform_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ bool dummy = true;
+ typedef __gnu_parallel::iterator_triple<RandomAccessIterator1,
+ RandomAccessIterator2, RandomAccessIterator3,
+ random_access_iterator_tag> ip;
+ ip begin_triple(begin1, begin2, result),
+ end_triple(end1, begin2 + (end1 - begin1),
+ result + (end1 - begin1));
+ __gnu_parallel::transform2_selector<ip> functionality;
+ __gnu_parallel::
+ for_each_template_random_access(begin_triple, end_triple,
+ binary_op, functionality,
+ __gnu_parallel::dummy_reduct(),
+ dummy, dummy, -1,
+ parallelism_tag);
+ return functionality.finish_iterator;
+ }
+ else
+ return transform(begin1, end1, begin2, result, binary_op,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename BinaryOperation,
+ typename tag1, typename tag2, typename tag3>
+ inline OutputIterator
+ transform2_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, OutputIterator result,
+ BinaryOperation binary_op, tag1, tag2, tag3)
+ { return transform(begin1, end1, begin2, result, binary_op,
+ __gnu_parallel::sequential_tag()); }
+
+ // Public interface.
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename BinaryOperation>
+ inline OutputIterator
+ transform(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, OutputIterator result,
+ BinaryOperation binary_op,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return transform2_switch(begin1, end1, begin2, result, binary_op,
+ iteratori1_category(), iteratori2_category(),
+ iteratoro_category(), parallelism_tag);
+ }
+
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename BinaryOperation>
+ inline OutputIterator
+ transform(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, OutputIterator result,
+ BinaryOperation binary_op)
+ {
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return transform2_switch(begin1, end1, begin2, result, binary_op,
+ iteratori1_category(), iteratori2_category(),
+ iteratoro_category());
+ }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename T>
+ inline void
+ replace(ForwardIterator begin, ForwardIterator end, const T& old_value,
+ const T& new_value, __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::replace(begin, end, old_value, new_value); }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator, typename T, typename IteratorTag>
+ inline void
+ replace_switch(ForwardIterator begin, ForwardIterator end,
+ const T& old_value, const T& new_value, IteratorTag)
+ { replace(begin, end, old_value, new_value,
+ __gnu_parallel::sequential_tag()); }
+
+ // Parallel replace for random access iterators
+ template<typename RandomAccessIterator, typename T>
+ inline void
+ replace_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ const T& old_value, const T& new_value,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ // XXX parallel version is where?
+ replace(begin, end, old_value, new_value,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface
+ template<typename ForwardIterator, typename T>
+ inline void
+ replace(ForwardIterator begin, ForwardIterator end, const T& old_value,
+ const T& new_value, __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ replace_switch(begin, end, old_value, new_value, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename ForwardIterator, typename T>
+ inline void
+ replace(ForwardIterator begin, ForwardIterator end, const T& old_value,
+ const T& new_value)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ replace_switch(begin, end, old_value, new_value, iterator_category());
+ }
+
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename Predicate, typename T>
+ inline void
+ replace_if(ForwardIterator begin, ForwardIterator end, Predicate pred,
+ const T& new_value, __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::replace_if(begin, end, pred, new_value); }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator, typename Predicate, typename T,
+ typename IteratorTag>
+ inline void
+ replace_if_switch(ForwardIterator begin, ForwardIterator end,
+ Predicate pred, const T& new_value, IteratorTag)
+ { replace_if(begin, end, pred, new_value,
+ __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator, typename Predicate, typename T>
+ void
+ replace_if_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Predicate pred, const T& new_value,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().replace_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ bool dummy;
+ __gnu_parallel::
+ replace_if_selector<RandomAccessIterator, Predicate, T>
+ functionality(new_value);
+ __gnu_parallel::
+ for_each_template_random_access(begin, end, pred,
+ functionality,
+ __gnu_parallel::dummy_reduct(),
+ true, dummy, -1, parallelism_tag);
+ }
+ else
+ replace_if(begin, end, pred, new_value,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename ForwardIterator, typename Predicate, typename T>
+ inline void
+ replace_if(ForwardIterator begin, ForwardIterator end,
+ Predicate pred, const T& new_value,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<ForwardIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ replace_if_switch(begin, end, pred, new_value, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename ForwardIterator, typename Predicate, typename T>
+ inline void
+ replace_if(ForwardIterator begin, ForwardIterator end,
+ Predicate pred, const T& new_value)
+ {
+ typedef std::iterator_traits<ForwardIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ replace_if_switch(begin, end, pred, new_value, iterator_category());
+ }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename Generator>
+ inline void
+ generate(ForwardIterator begin, ForwardIterator end, Generator gen,
+ __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::generate(begin, end, gen); }
+
+ // Sequential fallback for input iterator case.
+ template<typename ForwardIterator, typename Generator, typename IteratorTag>
+ inline void
+ generate_switch(ForwardIterator begin, ForwardIterator end, Generator gen,
+ IteratorTag)
+ { generate(begin, end, gen, __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator, typename Generator>
+ void
+ generate_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Generator gen, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().generate_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ bool dummy;
+ __gnu_parallel::generate_selector<RandomAccessIterator>
+ functionality;
+ __gnu_parallel::
+ for_each_template_random_access(begin, end, gen, functionality,
+ __gnu_parallel::dummy_reduct(),
+ true, dummy, -1, parallelism_tag);
+ }
+ else
+ generate(begin, end, gen, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename ForwardIterator, typename Generator>
+ inline void
+ generate(ForwardIterator begin, ForwardIterator end,
+ Generator gen, __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<ForwardIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ generate_switch(begin, end, gen, iterator_category(), parallelism_tag);
+ }
+
+ template<typename ForwardIterator, typename Generator>
+ inline void
+ generate(ForwardIterator begin, ForwardIterator end, Generator gen)
+ {
+ typedef std::iterator_traits<ForwardIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ generate_switch(begin, end, gen, iterator_category());
+ }
+
+
+ // Sequential fallback.
+ template<typename OutputIterator, typename Size, typename Generator>
+ inline OutputIterator
+ generate_n(OutputIterator begin, Size n, Generator gen,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::generate_n(begin, n, gen); }
+
+ // Sequential fallback for input iterator case.
+ template<typename OutputIterator, typename Size, typename Generator,
+ typename IteratorTag>
+ inline OutputIterator
+ generate_n_switch(OutputIterator begin, Size n, Generator gen, IteratorTag)
+ { return generate_n(begin, n, gen, __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator, typename Size, typename Generator>
+ inline RandomAccessIterator
+ generate_n_switch(RandomAccessIterator begin, Size n, Generator gen,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ // XXX parallel version is where?
+ return generate_n(begin, n, gen, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename OutputIterator, typename Size, typename Generator>
+ inline OutputIterator
+ generate_n(OutputIterator begin, Size n, Generator gen,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<OutputIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return generate_n_switch(begin, n, gen, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename OutputIterator, typename Size, typename Generator>
+ inline OutputIterator
+ generate_n(OutputIterator begin, Size n, Generator gen)
+ {
+ typedef std::iterator_traits<OutputIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return generate_n_switch(begin, n, gen, iterator_category());
+ }
+
+
+ // Sequential fallback.
+ template<typename RandomAccessIterator>
+ inline void
+ random_shuffle(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::random_shuffle(begin, end); }
+
+ // Sequential fallback.
+ template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ inline void
+ random_shuffle(RandomAccessIterator begin, RandomAccessIterator end,
+ RandomNumberGenerator& rand, __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::random_shuffle(begin, end, rand); }
+
+
+ /** @brief Functor wrapper for std::rand(). */
+ template<typename must_be_int = int>
+ struct c_rand_number
+ {
+ int
+ operator()(int limit)
+ { return rand() % limit; }
+ };
+
+ // Fill in random number generator.
+ template<typename RandomAccessIterator>
+ inline void
+ random_shuffle(RandomAccessIterator begin, RandomAccessIterator end)
+ {
+ c_rand_number<> r;
+ // Parallelization still possible.
+ __gnu_parallel::random_shuffle(begin, end, r);
+ }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ void
+ random_shuffle(RandomAccessIterator begin, RandomAccessIterator end,
+ RandomNumberGenerator& rand)
+ {
+ if (begin == end)
+ return;
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().random_shuffle_minimal_n))
+ __gnu_parallel::parallel_random_shuffle(begin, end, rand);
+ else
+ __gnu_parallel::sequential_random_shuffle(begin, end, rand);
+ }
+
+ // Sequential fallback.
+ template<typename ForwardIterator, typename Predicate>
+ inline ForwardIterator
+ partition(ForwardIterator begin, ForwardIterator end,
+ Predicate pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::partition(begin, end, pred); }
+
+ // Sequential fallback for input iterator case.
+ template<typename ForwardIterator, typename Predicate, typename IteratorTag>
+ inline ForwardIterator
+ partition_switch(ForwardIterator begin, ForwardIterator end,
+ Predicate pred, IteratorTag)
+ { return partition(begin, end, pred, __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator, typename Predicate>
+ RandomAccessIterator
+ partition_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Predicate pred, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().partition_minimal_n))
+ {
+ typedef typename std::iterator_traits<RandomAccessIterator>::
+ difference_type difference_type;
+ difference_type middle = __gnu_parallel::
+ parallel_partition(begin, end, pred,
+ __gnu_parallel::get_max_threads());
+ return begin + middle;
+ }
+ else
+ return partition(begin, end, pred, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename ForwardIterator, typename Predicate>
+ inline ForwardIterator
+ partition(ForwardIterator begin, ForwardIterator end, Predicate pred)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return partition_switch(begin, end, pred, iterator_category());
+ }
+
+ // sort interface
+
+ // Sequential fallback
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::sort(begin, end); }
+
+ // Sequential fallback
+ template<typename RandomAccessIterator, typename Comparator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp,
+ __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::sort<RandomAccessIterator, Comparator>(begin, end,
+ comp); }
+
+ // Public interface
+ template<typename RandomAccessIterator, typename Comparator,
+ typename Parallelism>
+ void
+ sort(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp,
+ Parallelism parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+
+ if (begin != end)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin) >=
+ __gnu_parallel::_Settings::get().sort_minimal_n))
+ __gnu_parallel::parallel_sort<false>(begin, end, comp, parallelism);
+ else
+ sort(begin, end, comp, __gnu_parallel::sequential_tag());
+ }
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(),
+ __gnu_parallel::default_parallel_tag());
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::default_parallel_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::parallel_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::multiway_mergesort_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::multiway_mergesort_sampling_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::multiway_mergesort_exact_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::quicksort_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::balanced_quicksort_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface
+ template<typename RandomAccessIterator, typename Comparator>
+ void
+ sort(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ sort(begin, end, comp, __gnu_parallel::default_parallel_tag());
+ }
+
+
+ // stable_sort interface
+
+
+ // Sequential fallback
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::stable_sort(begin, end); }
+
+ // Sequential fallback
+ template<typename RandomAccessIterator, typename Comparator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::stable_sort<RandomAccessIterator, Comparator>(
+ begin, end, comp); }
+
+ // Public interface
+ template<typename RandomAccessIterator, typename Comparator,
+ typename Parallelism>
+ void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, Parallelism parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+
+ if (begin != end)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin) >=
+ __gnu_parallel::_Settings::get().sort_minimal_n))
+ __gnu_parallel::parallel_sort<true>(begin, end, comp, parallelism);
+ else
+ stable_sort(begin, end, comp, __gnu_parallel::sequential_tag());
+ }
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, std::less<value_type>(),
+ __gnu_parallel::default_parallel_tag());
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::default_parallel_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::parallel_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::multiway_mergesort_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::quicksort_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ __gnu_parallel::balanced_quicksort_tag parallelism)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, std::less<value_type>(), parallelism);
+ }
+
+ // Public interface
+ template<typename RandomAccessIterator, typename Comparator>
+ void
+ stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ stable_sort(begin, end, comp, __gnu_parallel::default_parallel_tag());
+ }
+
+
+// // Sequential fallback
+// template<typename RandomAccessIterator>
+// inline void
+// stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+// __gnu_parallel::sequential_tag)
+// { return _GLIBCXX_STD_P::stable_sort(begin, end); }
+//
+// // Sequential fallback
+// template<typename RandomAccessIterator, typename Comparator>
+// inline void
+// stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+// Comparator comp, __gnu_parallel::sequential_tag)
+// { return _GLIBCXX_STD_P::stable_sort(begin, end, comp); }
+//
+// template<typename RandomAccessIterator>
+// void
+// stable_sort(RandomAccessIterator begin, RandomAccessIterator end)
+// {
+// typedef iterator_traits<RandomAccessIterator> traits_type;
+// typedef typename traits_type::value_type value_type;
+// stable_sort(begin, end, std::less<value_type>());
+// }
+//
+// // Parallel algorithm for random access iterators
+// template<typename RandomAccessIterator, typename Comparator>
+// void
+// stable_sort(RandomAccessIterator begin, RandomAccessIterator end,
+// Comparator comp)
+// {
+// if (begin != end)
+// {
+// if (_GLIBCXX_PARALLEL_CONDITION(
+// static_cast<__gnu_parallel::sequence_index_t>(end - begin) >=
+// __gnu_parallel::_Settings::get().sort_minimal_n))
+// __gnu_parallel::parallel_sort(begin, end, comp,
+// __gnu_parallel::parallel_tag());
+// else
+// stable_sort(begin, end, comp, __gnu_parallel::sequential_tag());
+// }
+// }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ InputIterator2 end2, OutputIterator result,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::merge(begin1, end1, begin2, end2, result); }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Comparator>
+ inline OutputIterator
+ merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ InputIterator2 end2, OutputIterator result, Comparator comp,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::merge(begin1, end1, begin2, end2, result, comp); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Comparator,
+ typename IteratorTag1, typename IteratorTag2, typename IteratorTag3>
+ inline OutputIterator
+ merge_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator result, Comparator comp,
+ IteratorTag1, IteratorTag2, IteratorTag3)
+ { return _GLIBCXX_STD_P::merge(begin1, end1, begin2, end2,
+ result, comp); }
+
+ // Parallel algorithm for random access iterators
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Comparator>
+ OutputIterator
+ merge_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ OutputIterator result, Comparator comp,
+ random_access_iterator_tag, random_access_iterator_tag,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ (static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1)
+ >= __gnu_parallel::_Settings::get().merge_minimal_n
+ || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2)
+ >= __gnu_parallel::_Settings::get().merge_minimal_n)))
+ return __gnu_parallel::parallel_merge_advance(begin1, end1,
+ begin2, end2,
+ result, (end1 - begin1)
+ + (end2 - begin2), comp);
+ else
+ return __gnu_parallel::merge_advance(begin1, end1, begin2, end2,
+ result, (end1 - begin1)
+ + (end2 - begin2), comp);
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator, typename Comparator>
+ inline OutputIterator
+ merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ InputIterator2 end2, OutputIterator result, Comparator comp)
+ {
+ typedef typename iterator_traits<InputIterator1>::value_type value_type;
+
+ typedef std::iterator_traits<InputIterator1> iteratori1_traits;
+ typedef std::iterator_traits<InputIterator2> iteratori2_traits;
+ typedef std::iterator_traits<OutputIterator> iteratoro_traits;
+ typedef typename iteratori1_traits::iterator_category
+ iteratori1_category;
+ typedef typename iteratori2_traits::iterator_category
+ iteratori2_category;
+ typedef typename iteratoro_traits::iterator_category iteratoro_category;
+
+ return merge_switch(begin1, end1, begin2, end2, result, comp,
+ iteratori1_category(), iteratori2_category(),
+ iteratoro_category());
+ }
+
+
+ // Public interface, insert default comparator
+ template<typename InputIterator1, typename InputIterator2,
+ typename OutputIterator>
+ inline OutputIterator
+ merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ InputIterator2 end2, OutputIterator result)
+ {
+ typedef std::iterator_traits<InputIterator1> iterator1_traits;
+ typedef std::iterator_traits<InputIterator2> iterator2_traits;
+ typedef typename iterator1_traits::value_type value1_type;
+ typedef typename iterator2_traits::value_type value2_type;
+
+ return merge(begin1, end1, begin2, end2, result,
+ __gnu_parallel::less<value1_type, value2_type>());
+ }
+
+ // Sequential fallback
+ template<typename RandomAccessIterator>
+ inline void
+ nth_element(RandomAccessIterator begin, RandomAccessIterator nth,
+ RandomAccessIterator end, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::nth_element(begin, nth, end); }
+
+ // Sequential fallback
+ template<typename RandomAccessIterator, typename Comparator>
+ inline void
+ nth_element(RandomAccessIterator begin, RandomAccessIterator nth,
+ RandomAccessIterator end, Comparator comp,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::nth_element(begin, nth, end, comp); }
+
+ // Public interface
+ template<typename RandomAccessIterator, typename Comparator>
+ inline void
+ nth_element(RandomAccessIterator begin, RandomAccessIterator nth,
+ RandomAccessIterator end, Comparator comp)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().nth_element_minimal_n))
+ __gnu_parallel::parallel_nth_element(begin, nth, end, comp);
+ else
+ nth_element(begin, nth, end, comp, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ nth_element(RandomAccessIterator begin, RandomAccessIterator nth,
+ RandomAccessIterator end)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ nth_element(begin, nth, end, std::less<value_type>());
+ }
+
+ // Sequential fallback
+ template<typename RandomAccessIterator, typename _Compare>
+ inline void
+ partial_sort(RandomAccessIterator begin, RandomAccessIterator middle,
+ RandomAccessIterator end, _Compare comp,
+ __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::partial_sort(begin, middle, end, comp); }
+
+ // Sequential fallback
+ template<typename RandomAccessIterator>
+ inline void
+ partial_sort(RandomAccessIterator begin, RandomAccessIterator middle,
+ RandomAccessIterator end, __gnu_parallel::sequential_tag)
+ { _GLIBCXX_STD_P::partial_sort(begin, middle, end); }
+
+ // Public interface, parallel algorithm for random access iterators
+ template<typename RandomAccessIterator, typename _Compare>
+ void
+ partial_sort(RandomAccessIterator begin, RandomAccessIterator middle,
+ RandomAccessIterator end, _Compare comp)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().partial_sort_minimal_n))
+ __gnu_parallel::parallel_partial_sort(begin, middle, end, comp);
+ else
+ partial_sort(begin, middle, end, comp,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface, insert default comparator
+ template<typename RandomAccessIterator>
+ inline void
+ partial_sort(RandomAccessIterator begin, RandomAccessIterator middle,
+ RandomAccessIterator end)
+ {
+ typedef iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ partial_sort(begin, middle, end, std::less<value_type>());
+ }
+
+ // Sequential fallback
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ max_element(ForwardIterator begin, ForwardIterator end,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::max_element(begin, end); }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename Comparator>
+ inline ForwardIterator
+ max_element(ForwardIterator begin, ForwardIterator end, Comparator comp,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::max_element(begin, end, comp); }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator, typename Comparator, typename IteratorTag>
+ inline ForwardIterator
+ max_element_switch(ForwardIterator begin, ForwardIterator end,
+ Comparator comp, IteratorTag)
+ { return max_element(begin, end, comp, __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators
+ template<typename RandomAccessIterator, typename Comparator>
+ RandomAccessIterator
+ max_element_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().max_element_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ RandomAccessIterator res(begin);
+ __gnu_parallel::identity_selector<RandomAccessIterator>
+ functionality;
+ __gnu_parallel::
+ for_each_template_random_access(begin, end,
+ __gnu_parallel::nothing(),
+ functionality,
+ __gnu_parallel::
+ max_element_reduct<Comparator,
+ RandomAccessIterator>(comp),
+ res, res, -1, parallelism_tag);
+ return res;
+ }
+ else
+ return max_element(begin, end, comp, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface, insert default comparator
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ max_element(ForwardIterator begin, ForwardIterator end,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef typename iterator_traits<ForwardIterator>::value_type value_type;
+ return max_element(begin, end, std::less<value_type>(), parallelism_tag);
+ }
+
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ max_element(ForwardIterator begin, ForwardIterator end)
+ {
+ typedef typename iterator_traits<ForwardIterator>::value_type value_type;
+ return max_element(begin, end, std::less<value_type>());
+ }
+
+ // Public interface
+ template<typename ForwardIterator, typename Comparator>
+ inline ForwardIterator
+ max_element(ForwardIterator begin, ForwardIterator end, Comparator comp,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return max_element_switch(begin, end, comp, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename ForwardIterator, typename Comparator>
+ inline ForwardIterator
+ max_element(ForwardIterator begin, ForwardIterator end, Comparator comp)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return max_element_switch(begin, end, comp, iterator_category());
+ }
+
+
+ // Sequential fallback
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ min_element(ForwardIterator begin, ForwardIterator end,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::min_element(begin, end); }
+
+ // Sequential fallback
+ template<typename ForwardIterator, typename Comparator>
+ inline ForwardIterator
+ min_element(ForwardIterator begin, ForwardIterator end, Comparator comp,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::min_element(begin, end, comp); }
+
+ // Sequential fallback for input iterator case
+ template<typename ForwardIterator, typename Comparator, typename IteratorTag>
+ inline ForwardIterator
+ min_element_switch(ForwardIterator begin, ForwardIterator end,
+ Comparator comp, IteratorTag)
+ { return min_element(begin, end, comp, __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators
+ template<typename RandomAccessIterator, typename Comparator>
+ RandomAccessIterator
+ min_element_switch(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().min_element_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ RandomAccessIterator res(begin);
+ __gnu_parallel::identity_selector<RandomAccessIterator>
+ functionality;
+ __gnu_parallel::
+ for_each_template_random_access(begin, end,
+ __gnu_parallel::nothing(),
+ functionality,
+ __gnu_parallel::
+ min_element_reduct<Comparator,
+ RandomAccessIterator>(comp),
+ res, res, -1, parallelism_tag);
+ return res;
+ }
+ else
+ return min_element(begin, end, comp, __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface, insert default comparator
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ min_element(ForwardIterator begin, ForwardIterator end,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef typename iterator_traits<ForwardIterator>::value_type value_type;
+ return min_element(begin, end, std::less<value_type>(), parallelism_tag);
+ }
+
+ template<typename ForwardIterator>
+ inline ForwardIterator
+ min_element(ForwardIterator begin, ForwardIterator end)
+ {
+ typedef typename iterator_traits<ForwardIterator>::value_type value_type;
+ return min_element(begin, end, std::less<value_type>());
+ }
+
+ // Public interface
+ template<typename ForwardIterator, typename Comparator>
+ inline ForwardIterator
+ min_element(ForwardIterator begin, ForwardIterator end, Comparator comp,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return min_element_switch(begin, end, comp, iterator_category(),
+ parallelism_tag);
+ }
+
+ template<typename ForwardIterator, typename Comparator>
+ inline ForwardIterator
+ min_element(ForwardIterator begin, ForwardIterator end, Comparator comp)
+ {
+ typedef iterator_traits<ForwardIterator> traits_type;
+ typedef typename traits_type::iterator_category iterator_category;
+ return min_element_switch(begin, end, comp, iterator_category());
+ }
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_ALGO_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/algobase.h b/gcc-4.4.0/libstdc++-v3/include/parallel/algobase.h
new file mode 100644
index 000000000..aaffb3e5f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/algobase.h
@@ -0,0 +1,281 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algobase.h
+ * @brief Parallel STL function calls corresponding to the
+ * stl_algobase.h header. The functions defined here mainly do case
+ * switches and call the actual parallelized versions in other files.
+ * Inlining policy: Functions that basically only contain one
+ * function call, are declared inline.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_ALGOBASE_H
+#define _GLIBCXX_PARALLEL_ALGOBASE_H 1
+
+#include <bits/stl_algobase.h>
+#include <parallel/base.h>
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+#include <parallel/find.h>
+#include <parallel/find_selectors.h>
+
+namespace std
+{
+namespace __parallel
+{
+ // NB: equal and lexicographical_compare require mismatch.
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2>
+ inline pair<InputIterator1, InputIterator2>
+ mismatch(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::mismatch(begin1, end1, begin2); }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate>
+ inline pair<InputIterator1, InputIterator2>
+ mismatch(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ Predicate pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::mismatch(begin1, end1, begin2, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate, typename IteratorTag1, typename IteratorTag2>
+ inline pair<InputIterator1, InputIterator2>
+ mismatch_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, Predicate pred, IteratorTag1,
+ IteratorTag2)
+ { return _GLIBCXX_STD_P::mismatch(begin1, end1, begin2, pred); }
+
+ // Parallel mismatch for random access iterators
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Predicate>
+ pair<RandomAccessIterator1, RandomAccessIterator2>
+ mismatch_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Predicate pred,
+ random_access_iterator_tag, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ {
+ RandomAccessIterator1 res =
+ __gnu_parallel::find_template(begin1, end1, begin2, pred,
+ __gnu_parallel::
+ mismatch_selector()).first;
+ return make_pair(res , begin2 + (res - begin1));
+ }
+ else
+ return _GLIBCXX_STD_P::mismatch(begin1, end1, begin2, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2>
+ inline pair<InputIterator1, InputIterator2>
+ mismatch(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
+ {
+ typedef std::iterator_traits<InputIterator1> iterator1_traits;
+ typedef std::iterator_traits<InputIterator2> iterator2_traits;
+ typedef typename iterator1_traits::value_type value1_type;
+ typedef typename iterator2_traits::value_type value2_type;
+ typedef typename iterator1_traits::iterator_category iterator1_category;
+ typedef typename iterator2_traits::iterator_category iterator2_category;
+
+ typedef __gnu_parallel::equal_to<value1_type, value2_type> equal_to_type;
+
+ return mismatch_switch(begin1, end1, begin2, equal_to_type(),
+ iterator1_category(), iterator2_category());
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate>
+ inline pair<InputIterator1, InputIterator2>
+ mismatch(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ Predicate pred)
+ {
+ typedef std::iterator_traits<InputIterator1> iterator1_traits;
+ typedef std::iterator_traits<InputIterator2> iterator2_traits;
+ typedef typename iterator1_traits::iterator_category iterator1_category;
+ typedef typename iterator2_traits::iterator_category iterator2_category;
+
+ return mismatch_switch(begin1, end1, begin2, pred, iterator1_category(),
+ iterator2_category());
+ }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2>
+ inline bool
+ equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::equal(begin1, end1, begin2); }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate>
+ inline bool
+ equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ Predicate pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::equal(begin1, end1, begin2, pred); }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2>
+ inline bool
+ equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
+ { return mismatch(begin1, end1, begin2).first == end1; }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate>
+ inline bool
+ equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2,
+ Predicate pred)
+ { return mismatch(begin1, end1, begin2, pred).first == end1; }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2>
+ inline bool
+ lexicographical_compare(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::lexicographical_compare(begin1, end1,
+ begin2, end2); }
+
+ // Sequential fallback
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate>
+ inline bool
+ lexicographical_compare(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ Predicate pred, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::lexicographical_compare(begin1, end1,
+ begin2, end2, pred); }
+
+ // Sequential fallback for input iterator case
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate, typename IteratorTag1, typename IteratorTag2>
+ inline bool
+ lexicographical_compare_switch(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ Predicate pred, IteratorTag1, IteratorTag2)
+ { return _GLIBCXX_STD_P::lexicographical_compare(begin1, end1,
+ begin2, end2, pred); }
+
+ // Parallel lexicographical_compare for random access iterators
+ // Limitation: Both valuetypes must be the same
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Predicate>
+ bool
+ lexicographical_compare_switch(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2,
+ RandomAccessIterator2 end2, Predicate pred,
+ random_access_iterator_tag,
+ random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(true))
+ {
+ typedef iterator_traits<RandomAccessIterator1> traits1_type;
+ typedef typename traits1_type::value_type value1_type;
+
+ typedef iterator_traits<RandomAccessIterator2> traits2_type;
+ typedef typename traits2_type::value_type value2_type;
+
+ typedef __gnu_parallel::equal_from_less<Predicate, value1_type,
+ value2_type> equal_type;
+
+ // Longer sequence in first place.
+ if ((end1 - begin1) < (end2 - begin2))
+ {
+ typedef pair<RandomAccessIterator1, RandomAccessIterator2>
+ pair_type;
+ pair_type mm = mismatch_switch(begin1, end1, begin2,
+ equal_type(pred),
+ random_access_iterator_tag(),
+ random_access_iterator_tag());
+
+ return (mm.first == end1) || bool(pred(*mm.first, *mm.second));
+ }
+ else
+ {
+ typedef pair<RandomAccessIterator2, RandomAccessIterator1>
+ pair_type;
+ pair_type mm = mismatch_switch(begin2, end2, begin1,
+ equal_type(pred),
+ random_access_iterator_tag(),
+ random_access_iterator_tag());
+
+ return (mm.first != end2) && bool(pred(*mm.second, *mm.first));
+ }
+ }
+ else
+ return _GLIBCXX_STD_P::lexicographical_compare(begin1, end1,
+ begin2, end2, pred);
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2>
+ inline bool
+ lexicographical_compare(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2)
+ {
+ typedef iterator_traits<InputIterator1> traits1_type;
+ typedef typename traits1_type::value_type value1_type;
+ typedef typename traits1_type::iterator_category iterator1_category;
+
+ typedef iterator_traits<InputIterator2> traits2_type;
+ typedef typename traits2_type::value_type value2_type;
+ typedef typename traits2_type::iterator_category iterator2_category;
+ typedef __gnu_parallel::less<value1_type, value2_type> less_type;
+
+ return lexicographical_compare_switch(begin1, end1, begin2, end2,
+ less_type(), iterator1_category(),
+ iterator2_category());
+ }
+
+ // Public interface
+ template<typename InputIterator1, typename InputIterator2,
+ typename Predicate>
+ inline bool
+ lexicographical_compare(InputIterator1 begin1, InputIterator1 end1,
+ InputIterator2 begin2, InputIterator2 end2,
+ Predicate pred)
+ {
+ typedef iterator_traits<InputIterator1> traits1_type;
+ typedef typename traits1_type::iterator_category iterator1_category;
+
+ typedef iterator_traits<InputIterator2> traits2_type;
+ typedef typename traits2_type::iterator_category iterator2_category;
+
+ return lexicographical_compare_switch(begin1, end1, begin2, end2, pred,
+ iterator1_category(),
+ iterator2_category());
+ }
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_ALGOBASE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/algorithm b/gcc-4.4.0/libstdc++-v3/include/parallel/algorithm
new file mode 100644
index 000000000..3c93d5b68
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/algorithm
@@ -0,0 +1,40 @@
+// Algorithm extensions -*- C++ -*-
+
+// Copyright (C) 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algorithm
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _PARALLEL_ALGORITHM
+#define _PARALLEL_ALGORITHM 1
+
+#pragma GCC system_header
+
+#include <algorithm>
+#include <parallel/algorithmfwd.h>
+#include <parallel/algobase.h>
+#include <parallel/algo.h>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/algorithmfwd.h b/gcc-4.4.0/libstdc++-v3/include/parallel/algorithmfwd.h
new file mode 100644
index 000000000..7c3b3f23f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/algorithmfwd.h
@@ -0,0 +1,898 @@
+// <algorithm> parallel extensions -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algorithmfwd.h
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PARALLEL_ALGORITHMFWD_H
+#define _GLIBCXX_PARALLEL_ALGORITHMFWD_H 1
+
+#pragma GCC system_header
+
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+
+namespace std
+{
+namespace __parallel
+{
+ template<typename _FIter>
+ _FIter
+ adjacent_find(_FIter, _FIter);
+
+ template<typename _FIter>
+ _FIter
+ adjacent_find(_FIter, _FIter, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _IterTag>
+ _FIter
+ adjacent_find_switch(_FIter, _FIter, _IterTag);
+
+ template<typename _RAIter>
+ _RAIter
+ adjacent_find_switch(_RAIter, _RAIter, random_access_iterator_tag);
+
+
+ template<typename _FIter, typename _BiPredicate>
+ _FIter
+ adjacent_find(_FIter, _FIter, _BiPredicate);
+
+ template<typename _FIter, typename _BiPredicate>
+ _FIter
+ adjacent_find(_FIter, _FIter, _BiPredicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _BiPredicate, typename _IterTag>
+ _FIter
+ adjacent_find_switch(_FIter, _FIter, _BiPredicate, _IterTag);
+
+ template<typename _RAIter, typename _BiPredicate>
+ _RAIter
+ adjacent_find_switch(_RAIter, _RAIter, _BiPredicate,
+ random_access_iterator_tag);
+
+
+ template<typename _IIter, typename _Tp>
+ typename iterator_traits<_IIter>::difference_type
+ count(_IIter, _IIter, const _Tp&);
+
+ template<typename _IIter, typename _Tp>
+ typename iterator_traits<_IIter>::difference_type
+ count(_IIter, _IIter, const _Tp&, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _Tp>
+ typename iterator_traits<_IIter>::difference_type
+ count(_IIter, _IIter, const _Tp&, __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _Tp, typename _IterTag>
+ typename iterator_traits<_IIter>::difference_type
+ count_switch(_IIter, _IIter, const _Tp&, _IterTag);
+
+ template<typename _RAIter, typename _Tp>
+ typename iterator_traits<_RAIter>::difference_type
+ count_switch(_RAIter, _RAIter, const _Tp&, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_unbalanced);
+
+
+ template<typename _IIter, typename _Predicate>
+ typename iterator_traits<_IIter>::difference_type
+ count_if(_IIter, _IIter, _Predicate);
+
+ template<typename _IIter, typename _Predicate>
+ typename iterator_traits<_IIter>::difference_type
+ count_if(_IIter, _IIter, _Predicate, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _Predicate>
+ typename iterator_traits<_IIter>::difference_type
+ count_if(_IIter, _IIter, _Predicate, __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _Predicate, typename _IterTag>
+ typename iterator_traits<_IIter>::difference_type
+ count_if_switch(_IIter, _IIter, _Predicate, _IterTag);
+
+ template<typename _RAIter, typename _Predicate>
+ typename iterator_traits<_RAIter>::difference_type
+ count_if_switch(_RAIter, _RAIter, _Predicate, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_unbalanced);
+
+ // algobase.h
+ template<typename _IIter1, typename _IIter2>
+ bool
+ equal(_IIter1, _IIter1, _IIter2, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename Predicate>
+ bool
+ equal(_IIter1, _IIter1, _IIter2, Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2>
+ bool
+ equal(_IIter1, _IIter1, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename Predicate>
+ bool
+ equal(_IIter1, _IIter1, _IIter2, Predicate);
+
+ template<typename _IIter, typename _Tp>
+ _IIter
+ find(_IIter, _IIter, const _Tp&, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _Tp>
+ _IIter
+ find(_IIter, _IIter, const _Tp& val);
+
+ template<typename _IIter, typename _Tp, typename _IterTag>
+ _IIter
+ find_switch(_IIter, _IIter, const _Tp&, _IterTag);
+
+ template<typename _RAIter, typename _Tp>
+ _RAIter
+ find_switch(_RAIter, _RAIter, const _Tp&, random_access_iterator_tag);
+
+ template<typename _IIter, typename _Predicate>
+ _IIter
+ find_if(_IIter, _IIter, _Predicate, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _Predicate>
+ _IIter
+ find_if(_IIter, _IIter, _Predicate);
+
+ template<typename _IIter, typename _Predicate, typename _IterTag>
+ _IIter
+ find_if_switch(_IIter, _IIter, _Predicate, _IterTag);
+
+ template<typename _RAIter, typename _Predicate>
+ _RAIter
+ find_if_switch(_RAIter, _RAIter, _Predicate, random_access_iterator_tag);
+
+ template<typename _IIter, typename _FIter>
+ _IIter
+ find_first_of(_IIter, _IIter, _FIter, _FIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _FIter, typename _BiPredicate>
+ _IIter
+ find_first_of(_IIter, _IIter, _FIter, _FIter, _BiPredicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _FIter, typename _BiPredicate>
+ _IIter
+ find_first_of(_IIter, _IIter, _FIter, _FIter, _BiPredicate);
+
+ template<typename _IIter, typename _FIter>
+ _IIter
+ find_first_of(_IIter, _IIter, _FIter, _FIter);
+
+ template<typename _IIter, typename _FIter,
+ typename _IterTag1, typename _IterTag2>
+ _IIter
+ find_first_of_switch(_IIter, _IIter, _FIter, _FIter, _IterTag1, _IterTag2);
+
+ template<typename _RAIter, typename _FIter, typename _BiPredicate,
+ typename _IterTag>
+ _RAIter
+ find_first_of_switch(_RAIter, _RAIter, _FIter, _FIter, _BiPredicate,
+ random_access_iterator_tag, _IterTag);
+
+ template<typename _IIter, typename _FIter, typename _BiPredicate,
+ typename _IterTag1, typename _IterTag2>
+ _IIter
+ find_first_of_switch(_IIter, _IIter, _FIter, _FIter, _BiPredicate,
+ _IterTag1, _IterTag2);
+
+
+ template<typename _IIter, typename _Function>
+ _Function
+ for_each(_IIter, _IIter, _Function);
+
+ template<typename _IIter, typename _Function>
+ _Function
+ for_each(_IIter, _IIter, _Function, __gnu_parallel::sequential_tag);
+
+ template<typename _Iterator, typename _Function>
+ _Function
+ for_each(_Iterator, _Iterator, _Function, __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _Function, typename _IterTag>
+ _Function
+ for_each_switch(_IIter, _IIter, _Function, _IterTag);
+
+ template<typename _RAIter, typename _Function>
+ _Function
+ for_each_switch(_RAIter, _RAIter, _Function, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+
+ template<typename _FIter, typename _Generator>
+ void
+ generate(_FIter, _FIter, _Generator);
+
+ template<typename _FIter, typename _Generator>
+ void
+ generate(_FIter, _FIter, _Generator, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Generator>
+ void
+ generate(_FIter, _FIter, _Generator, __gnu_parallel::_Parallelism);
+
+ template<typename _FIter, typename _Generator, typename _IterTag>
+ void
+ generate_switch(_FIter, _FIter, _Generator, _IterTag);
+
+ template<typename _RAIter, typename _Generator>
+ void
+ generate_switch(_RAIter, _RAIter, _Generator, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+ template<typename _OIter, typename _Size, typename _Generator>
+ _OIter
+ generate_n(_OIter, _Size, _Generator);
+
+ template<typename _OIter, typename _Size, typename _Generator>
+ _OIter
+ generate_n(_OIter, _Size, _Generator, __gnu_parallel::sequential_tag);
+
+ template<typename _OIter, typename _Size, typename _Generator>
+ _OIter
+ generate_n(_OIter, _Size, _Generator, __gnu_parallel::_Parallelism);
+
+ template<typename _OIter, typename _Size, typename _Generator,
+ typename _IterTag>
+ _OIter
+ generate_n_switch(_OIter, _Size, _Generator, _IterTag);
+
+ template<typename _RAIter, typename _Size, typename _Generator>
+ _RAIter
+ generate_n_switch(_RAIter, _Size, _Generator, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+ template<typename _IIter1, typename _IIter2>
+ bool
+ lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate>
+ bool
+ lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2>
+ bool
+ lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate>
+ bool
+ lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate);
+
+ template<typename _IIter1, typename _IIter2,
+ typename _Predicate, typename _IterTag1, typename _IterTag2>
+ bool
+ lexicographical_compare_switch(_IIter1, _IIter1, _IIter2, _IIter2,
+ _Predicate, _IterTag1, _IterTag2);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Predicate>
+ bool
+ lexicographical_compare_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+ _Predicate, random_access_iterator_tag,
+ random_access_iterator_tag);
+
+ // algo.h
+ template<typename _IIter1, typename _IIter2>
+ pair<_IIter1, _IIter2>
+ mismatch(_IIter1, _IIter1, _IIter2, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate>
+ pair<_IIter1, _IIter2>
+ mismatch(_IIter1, _IIter1, _IIter2, _Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2>
+ pair<_IIter1, _IIter2>
+ mismatch(_IIter1, _IIter1, _IIter2);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate>
+ pair<_IIter1, _IIter2>
+ mismatch(_IIter1, _IIter1, _IIter2, _Predicate);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate,
+ typename _IterTag1, typename _IterTag2>
+ pair<_IIter1, _IIter2>
+ mismatch_switch(_IIter1, _IIter1, _IIter2, _Predicate,
+ _IterTag1, _IterTag2);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Predicate>
+ pair<_RAIter1, _RAIter2>
+ mismatch_switch(_RAIter1, _RAIter1, _RAIter2, _Predicate,
+ random_access_iterator_tag, random_access_iterator_tag);
+
+ template<typename _FIter1, typename _FIter2>
+ _FIter1
+ search(_FIter1, _FIter1, _FIter2, _FIter2, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter1, typename _FIter2>
+ _FIter1
+ search(_FIter1, _FIter1, _FIter2, _FIter2);
+
+ template<typename _FIter1, typename _FIter2, typename _BiPredicate>
+ _FIter1
+ search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _FIter1, typename _FIter2, typename _BiPredicate>
+ _FIter1
+ search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate);
+
+ template<typename _RAIter1, typename _RAIter2>
+ _RAIter1
+ search_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+ random_access_iterator_tag, random_access_iterator_tag);
+
+ template<typename _FIter1, typename _FIter2, typename _IterTag1,
+ typename _IterTag2>
+ _FIter1
+ search_switch(_FIter1, _FIter1, _FIter2, _FIter2, _IterTag1, _IterTag2);
+
+ template<typename _RAIter1, typename _RAIter2, typename _BiPredicate>
+ _RAIter1
+ search_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _BiPredicate,
+ random_access_iterator_tag, random_access_iterator_tag);
+
+ template<typename _FIter1, typename _FIter2, typename _BiPredicate,
+ typename _IterTag1, typename _IterTag2>
+ _FIter1
+ search_switch(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate,
+ _IterTag1, _IterTag2);
+
+ template<typename _FIter, typename _Integer, typename _Tp>
+ _FIter
+ search_n(_FIter, _FIter, _Integer, const _Tp&,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Integer, typename _Tp,
+ typename _BiPredicate>
+ _FIter
+ search_n(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Integer, typename _Tp>
+ _FIter
+ search_n(_FIter, _FIter, _Integer, const _Tp&);
+
+ template<typename _FIter, typename _Integer, typename _Tp,
+ typename _BiPredicate>
+ _FIter
+ search_n(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate);
+
+ template<typename _RAIter, typename _Integer, typename _Tp,
+ typename _BiPredicate>
+ _RAIter
+ search_n_switch(_RAIter, _RAIter, _Integer, const _Tp&,
+ _BiPredicate, random_access_iterator_tag);
+
+ template<typename _FIter, typename _Integer, typename _Tp,
+ typename _BiPredicate, typename _IterTag>
+ _FIter
+ search_n_switch(_FIter, _FIter, _Integer, const _Tp&,
+ _BiPredicate, _IterTag);
+
+
+ template<typename _IIter, typename _OIter, typename UnaryOperation>
+ _OIter
+ transform(_IIter, _IIter, _OIter, UnaryOperation);
+
+ template<typename _IIter, typename _OIter, typename UnaryOperation>
+ _OIter
+ transform(_IIter, _IIter, _OIter, UnaryOperation,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter, typename UnaryOperation>
+ _OIter
+ transform(_IIter, _IIter, _OIter, UnaryOperation,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _OIter, typename UnaryOperation,
+ typename _IterTag1, typename _IterTag2>
+ _OIter
+ transform1_switch(_IIter, _IIter, _OIter, UnaryOperation,
+ _IterTag1, _IterTag2);
+
+
+ template<typename _RAIIter, typename _RAOIter, typename UnaryOperation>
+ _RAOIter
+ transform1_switch(_RAIIter, _RAIIter, _RAOIter, UnaryOperation,
+ random_access_iterator_tag, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _BiOperation>
+ _OIter
+ transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _BiOperation>
+ _OIter
+ transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _BiOperation>
+ _OIter
+ transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _RAIter1, typename _RAIter2, typename _RAIter3,
+ typename _BiOperation>
+ _RAIter3
+ transform2_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter3, _BiOperation,
+ random_access_iterator_tag, random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _BiOperation, typename _Tag1,
+ typename _Tag2, typename _Tag3>
+ _OIter
+ transform2_switch(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation,
+ _Tag1, _Tag2, _Tag3);
+
+
+ template<typename _FIter, typename _Tp>
+ void
+ replace(_FIter, _FIter, const _Tp&, const _Tp&);
+
+ template<typename _FIter, typename _Tp>
+ void
+ replace(_FIter, _FIter, const _Tp&, const _Tp&,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Tp>
+ void
+ replace(_FIter, _FIter, const _Tp&, const _Tp&,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _FIter, typename _Tp, typename _IterTag>
+ void
+ replace_switch(_FIter, _FIter, const _Tp&, const _Tp&, _IterTag);
+
+ template<typename _RAIter, typename _Tp>
+ void
+ replace_switch(_RAIter, _RAIter, const _Tp&, const _Tp&,
+ random_access_iterator_tag, __gnu_parallel::_Parallelism);
+
+
+ template<typename _FIter, typename _Predicate, typename _Tp>
+ void
+ replace_if(_FIter, _FIter, _Predicate, const _Tp&);
+
+ template<typename _FIter, typename _Predicate, typename _Tp>
+ void
+ replace_if(_FIter, _FIter, _Predicate, const _Tp&,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Predicate, typename _Tp>
+ void
+ replace_if(_FIter, _FIter, _Predicate, const _Tp&,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _FIter, typename _Predicate, typename _Tp,
+ typename _IterTag>
+ void
+ replace_if_switch(_FIter, _FIter, _Predicate, const _Tp&, _IterTag);
+
+ template<typename _RAIter, typename _Predicate, typename _Tp>
+ void
+ replace_if_switch(_RAIter, _RAIter, _Predicate, const _Tp&,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism);
+
+
+ template<typename _FIter>
+ _FIter
+ max_element(_FIter, _FIter);
+
+ template<typename _FIter>
+ _FIter
+ max_element(_FIter, _FIter, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter>
+ _FIter
+ max_element(_FIter, _FIter, __gnu_parallel::_Parallelism);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ max_element(_FIter, _FIter, _Compare);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ max_element(_FIter, _FIter, _Compare, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ max_element(_FIter, _FIter, _Compare, __gnu_parallel::_Parallelism);
+
+ template<typename _FIter, typename _Compare, typename _IterTag>
+ _FIter
+ max_element_switch(_FIter, _FIter, _Compare, _IterTag);
+
+ template<typename _RAIter, typename _Compare>
+ _RAIter
+ max_element_switch(_RAIter, _RAIter, _Compare, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare, typename _IterTag1, typename _IterTag2,
+ typename _IterTag3>
+ _OIter
+ merge_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare,
+ _IterTag1, _IterTag2, _IterTag3);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Compare>
+ _OIter
+ merge_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare,
+ random_access_iterator_tag, random_access_iterator_tag,
+ random_access_iterator_tag);
+
+
+ template<typename _FIter>
+ _FIter
+ min_element(_FIter, _FIter);
+
+ template<typename _FIter>
+ _FIter
+ min_element(_FIter, _FIter, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter>
+ _FIter
+ min_element(_FIter, _FIter, __gnu_parallel::_Parallelism parallelism_tag);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ min_element(_FIter, _FIter, _Compare);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ min_element(_FIter, _FIter, _Compare, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename _Compare>
+ _FIter
+ min_element(_FIter, _FIter, _Compare, __gnu_parallel::_Parallelism);
+
+ template<typename _FIter, typename _Compare, typename _IterTag>
+ _FIter
+ min_element_switch(_FIter, _FIter, _Compare, _IterTag);
+
+ template<typename _RAIter, typename _Compare>
+ _RAIter
+ min_element_switch(_RAIter, _RAIter, _Compare, random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_balanced);
+
+ template<typename _RAIter>
+ void
+ nth_element(_RAIter, _RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ nth_element(_RAIter, _RAIter, _RAIter, _Compare,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ nth_element(_RAIter, _RAIter, _RAIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ nth_element(_RAIter, _RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ partial_sort(_RAIter, _RAIter, _RAIter, _Compare,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter>
+ void
+ partial_sort(_RAIter, _RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ partial_sort(_RAIter, _RAIter, _RAIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ partial_sort(_RAIter, _RAIter, _RAIter);
+
+ template<typename _FIter, typename Predicate>
+ _FIter
+ partition(_FIter, _FIter, Predicate, __gnu_parallel::sequential_tag);
+
+ template<typename _FIter, typename Predicate>
+ _FIter
+ partition(_FIter, _FIter, Predicate);
+
+ template<typename _FIter, typename Predicate, typename _IterTag>
+ _FIter
+ partition_switch(_FIter, _FIter, Predicate, _IterTag);
+
+ template<typename _RAIter, typename Predicate>
+ _RAIter
+ partition_switch(_RAIter, _RAIter, Predicate, random_access_iterator_tag);
+
+ template<typename _RAIter>
+ void
+ random_shuffle(_RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter, typename _RandomNumberGenerator>
+ void
+ random_shuffle(_RAIter, _RAIter, _RandomNumberGenerator&,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter>
+ void
+ random_shuffle(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _RandomNumberGenerator>
+ void
+ random_shuffle(_RAIter, _RAIter, _RandomNumberGenerator&);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename Predicate>
+ _OIter
+ set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate,
+ typename _OIter, typename _IterTag1, typename _IterTag2,
+ typename _IterTag3>
+ _OIter
+ set_union_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ _Predicate, _IterTag1, _IterTag2, _IterTag3);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+ typename _Predicate>
+ _Output_RAIter
+ set_union_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Output_RAIter,
+ _Predicate, random_access_iterator_tag,
+ random_access_iterator_tag, random_access_iterator_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate,
+ typename _OIter, typename _IterTag1, typename _IterTag2,
+ typename _IterTag3>
+ _OIter
+ set_intersection_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ _Predicate, _IterTag1, _IterTag2, _IterTag3);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+ typename _Predicate>
+ _Output_RAIter
+ set_intersection_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+ _Output_RAIter, _Predicate,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ random_access_iterator_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ _Predicate, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ _Predicate);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate,
+ typename _OIter, typename _IterTag1, typename _IterTag2,
+ typename _IterTag3>
+ _OIter
+ set_symmetric_difference_switch(_IIter1, _IIter1, _IIter2, _IIter2,
+ _OIter, _Predicate, _IterTag1, _IterTag2,
+ _IterTag3);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+ typename _Predicate>
+ _Output_RAIter
+ set_symmetric_difference_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+ _Output_RAIter, _Predicate,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ random_access_iterator_tag);
+
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter>
+ _OIter
+ set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+ template<typename _IIter1, typename _IIter2, typename _OIter,
+ typename _Predicate>
+ _OIter
+ set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate);
+
+ template<typename _IIter1, typename _IIter2, typename _Predicate,
+ typename _OIter, typename _IterTag1, typename _IterTag2,
+ typename _IterTag3>
+ _OIter
+ set_difference_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+ _Predicate, _IterTag1, _IterTag2, _IterTag3);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+ typename _Predicate>
+ _Output_RAIter
+ set_difference_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+ _Output_RAIter, _Predicate,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ random_access_iterator_tag);
+
+
+ template<typename _RAIter>
+ void
+ sort(_RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ sort(_RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter>
+ void
+ sort(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ sort(_RAIter, _RAIter, _Compare);
+
+ template<typename _RAIter>
+ void
+ stable_sort(_RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ stable_sort(_RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag);
+
+ template<typename _RAIter>
+ void
+ stable_sort(_RAIter, _RAIter);
+
+ template<typename _RAIter, typename _Compare>
+ void
+ stable_sort(_RAIter, _RAIter, _Compare);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ unique_copy(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter, typename _Predicate>
+ _OIter
+ unique_copy(_IIter, _IIter, _OIter, _Predicate,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ unique_copy(_IIter, _IIter, _OIter);
+
+ template<typename _IIter, typename _OIter, typename _Predicate>
+ _OIter
+ unique_copy(_IIter, _IIter, _OIter, _Predicate);
+
+ template<typename _IIter, typename _OIter, typename _Predicate,
+ typename _IterTag1, typename _IterTag2>
+ _OIter
+ unique_copy_switch(_IIter, _IIter, _OIter, _Predicate,
+ _IterTag1, _IterTag2);
+
+ template<typename _RAIter, typename _RandomAccess_OIter, typename _Predicate>
+ _RandomAccess_OIter
+ unique_copy_switch(_RAIter, _RAIter, _RandomAccess_OIter, _Predicate,
+ random_access_iterator_tag, random_access_iterator_tag);
+} // end namespace __parallel
+} // end namespace std
+
+#endif /* _GLIBCXX_PARALLEL_ALGORITHMFWD_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/balanced_quicksort.h b/gcc-4.4.0/libstdc++-v3/include/parallel/balanced_quicksort.h
new file mode 100644
index 000000000..2310110bb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/balanced_quicksort.h
@@ -0,0 +1,477 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/balanced_quicksort.h
+ * @brief Implementation of a dynamically load-balanced parallel quicksort.
+ *
+ * It works in-place and needs only logarithmic extra memory.
+ * The algorithm is similar to the one proposed in
+ *
+ * P. Tsigas and Y. Zhang.
+ * A simple, fast parallel implementation of quicksort and
+ * its performance evaluation on SUN enterprise 10000.
+ * In 11th Euromicro Conference on Parallel, Distributed and
+ * Network-Based Processing, page 372, 2003.
+ *
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H
+#define _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H 1
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_algo.h>
+
+#include <parallel/settings.h>
+#include <parallel/partition.h>
+#include <parallel/random_number.h>
+#include <parallel/queue.h>
+#include <functional>
+
+#if _GLIBCXX_ASSERTIONS
+#include <parallel/checkers.h>
+#endif
+
+namespace __gnu_parallel
+{
+/** @brief Information local to one thread in the parallel quicksort run. */
+template<typename RandomAccessIterator>
+ struct QSBThreadLocal
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ /** @brief Continuous part of the sequence, described by an
+ iterator pair. */
+ typedef std::pair<RandomAccessIterator, RandomAccessIterator> Piece;
+
+ /** @brief Initial piece to work on. */
+ Piece initial;
+
+ /** @brief Work-stealing queue. */
+ RestrictedBoundedConcurrentQueue<Piece> leftover_parts;
+
+ /** @brief Number of threads involved in this algorithm. */
+ thread_index_t num_threads;
+
+ /** @brief Pointer to a counter of elements left over to sort. */
+ volatile difference_type* elements_leftover;
+
+ /** @brief The complete sequence to sort. */
+ Piece global;
+
+ /** @brief Constructor.
+ * @param queue_size Size of the work-stealing queue. */
+ QSBThreadLocal(int queue_size) : leftover_parts(queue_size) { }
+ };
+
+/** @brief Balanced quicksort divide step.
+ * @param begin Begin iterator of subsequence.
+ * @param end End iterator of subsequence.
+ * @param comp Comparator.
+ * @param num_threads Number of threads that are allowed to work on
+ * this part.
+ * @pre @c (end-begin)>=1 */
+template<typename RandomAccessIterator, typename Comparator>
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ qsb_divide(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, thread_index_t num_threads)
+ {
+ _GLIBCXX_PARALLEL_ASSERT(num_threads > 0);
+
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ RandomAccessIterator pivot_pos =
+ median_of_three_iterators(begin, begin + (end - begin) / 2,
+ end - 1, comp);
+
+#if defined(_GLIBCXX_ASSERTIONS)
+ // Must be in between somewhere.
+ difference_type n = end - begin;
+
+ _GLIBCXX_PARALLEL_ASSERT(
+ (!comp(*pivot_pos, *begin) && !comp(*(begin + n / 2), *pivot_pos))
+ || (!comp(*pivot_pos, *begin) && !comp(*(end - 1), *pivot_pos))
+ || (!comp(*pivot_pos, *(begin + n / 2)) && !comp(*begin, *pivot_pos))
+ || (!comp(*pivot_pos, *(begin + n / 2)) && !comp(*(end - 1), *pivot_pos))
+ || (!comp(*pivot_pos, *(end - 1)) && !comp(*begin, *pivot_pos))
+ || (!comp(*pivot_pos, *(end - 1)) && !comp(*(begin + n / 2), *pivot_pos)));
+#endif
+
+ // Swap pivot value to end.
+ if (pivot_pos != (end - 1))
+ std::swap(*pivot_pos, *(end - 1));
+ pivot_pos = end - 1;
+
+ __gnu_parallel::binder2nd<Comparator, value_type, value_type, bool>
+ pred(comp, *pivot_pos);
+
+ // Divide, returning end - begin - 1 in the worst case.
+ difference_type split_pos = parallel_partition(
+ begin, end - 1, pred, num_threads);
+
+ // Swap back pivot to middle.
+ std::swap(*(begin + split_pos), *pivot_pos);
+ pivot_pos = begin + split_pos;
+
+#if _GLIBCXX_ASSERTIONS
+ RandomAccessIterator r;
+ for (r = begin; r != pivot_pos; ++r)
+ _GLIBCXX_PARALLEL_ASSERT(comp(*r, *pivot_pos));
+ for (; r != end; ++r)
+ _GLIBCXX_PARALLEL_ASSERT(!comp(*r, *pivot_pos));
+#endif
+
+ return split_pos;
+ }
+
+/** @brief Quicksort conquer step.
+ * @param tls Array of thread-local storages.
+ * @param begin Begin iterator of subsequence.
+ * @param end End iterator of subsequence.
+ * @param comp Comparator.
+ * @param iam Number of the thread processing this function.
+ * @param num_threads
+ * Number of threads that are allowed to work on this part. */
+template<typename RandomAccessIterator, typename Comparator>
+ void
+ qsb_conquer(QSBThreadLocal<RandomAccessIterator>** tls,
+ RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp,
+ thread_index_t iam, thread_index_t num_threads,
+ bool parent_wait)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+
+ if (num_threads <= 1 || n <= 1)
+ {
+ tls[iam]->initial.first = begin;
+ tls[iam]->initial.second = end;
+
+ qsb_local_sort_with_helping(tls, comp, iam, parent_wait);
+
+ return;
+ }
+
+ // Divide step.
+ difference_type split_pos = qsb_divide(begin, end, comp, num_threads);
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(0 <= split_pos && split_pos < (end - begin));
+#endif
+
+ thread_index_t num_threads_leftside =
+ std::max<thread_index_t>(1, std::min<thread_index_t>(
+ num_threads - 1, split_pos * num_threads / n));
+
+# pragma omp atomic
+ *tls[iam]->elements_leftover -= (difference_type)1;
+
+ // Conquer step.
+# pragma omp parallel num_threads(2)
+ {
+ bool wait;
+ if(omp_get_num_threads() < 2)
+ wait = false;
+ else
+ wait = parent_wait;
+
+# pragma omp sections
+ {
+# pragma omp section
+ {
+ qsb_conquer(tls, begin, begin + split_pos, comp,
+ iam,
+ num_threads_leftside,
+ wait);
+ wait = parent_wait;
+ }
+ // The pivot_pos is left in place, to ensure termination.
+# pragma omp section
+ {
+ qsb_conquer(tls, begin + split_pos + 1, end, comp,
+ iam + num_threads_leftside,
+ num_threads - num_threads_leftside,
+ wait);
+ wait = parent_wait;
+ }
+ }
+ }
+ }
+
+/**
+ * @brief Quicksort step doing load-balanced local sort.
+ * @param tls Array of thread-local storages.
+ * @param comp Comparator.
+ * @param iam Number of the thread processing this function.
+ */
+template<typename RandomAccessIterator, typename Comparator>
+ void
+ qsb_local_sort_with_helping(QSBThreadLocal<RandomAccessIterator>** tls,
+ Comparator& comp, int iam, bool wait)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef std::pair<RandomAccessIterator, RandomAccessIterator> Piece;
+
+ QSBThreadLocal<RandomAccessIterator>& tl = *tls[iam];
+
+ difference_type base_case_n =
+ _Settings::get().sort_qsb_base_case_maximal_n;
+ if (base_case_n < 2)
+ base_case_n = 2;
+ thread_index_t num_threads = tl.num_threads;
+
+ // Every thread has its own random number generator.
+ random_number rng(iam + 1);
+
+ Piece current = tl.initial;
+
+ difference_type elements_done = 0;
+#if _GLIBCXX_ASSERTIONS
+ difference_type total_elements_done = 0;
+#endif
+
+ for (;;)
+ {
+ // Invariant: current must be a valid (maybe empty) range.
+ RandomAccessIterator begin = current.first, end = current.second;
+ difference_type n = end - begin;
+
+ if (n > base_case_n)
+ {
+ // Divide.
+ RandomAccessIterator pivot_pos = begin + rng(n);
+
+ // Swap pivot_pos value to end.
+ if (pivot_pos != (end - 1))
+ std::swap(*pivot_pos, *(end - 1));
+ pivot_pos = end - 1;
+
+ __gnu_parallel::binder2nd
+ <Comparator, value_type, value_type, bool>
+ pred(comp, *pivot_pos);
+
+ // Divide, leave pivot unchanged in last place.
+ RandomAccessIterator split_pos1, split_pos2;
+ split_pos1 = __gnu_sequential::partition(begin, end - 1, pred);
+
+ // Left side: < pivot_pos; right side: >= pivot_pos.
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(begin <= split_pos1 && split_pos1 < end);
+#endif
+ // Swap pivot back to middle.
+ if (split_pos1 != pivot_pos)
+ std::swap(*split_pos1, *pivot_pos);
+ pivot_pos = split_pos1;
+
+ // In case all elements are equal, split_pos1 == 0.
+ if ((split_pos1 + 1 - begin) < (n >> 7)
+ || (end - split_pos1) < (n >> 7))
+ {
+ // Very unequal split, one part smaller than one 128th
+ // elements not strictly larger than the pivot.
+ __gnu_parallel::unary_negate<__gnu_parallel::binder1st
+ <Comparator, value_type, value_type, bool>, value_type>
+ pred(__gnu_parallel::binder1st
+ <Comparator, value_type, value_type, bool>(comp,
+ *pivot_pos));
+
+ // Find other end of pivot-equal range.
+ split_pos2 = __gnu_sequential::partition(split_pos1 + 1,
+ end, pred);
+ }
+ else
+ // Only skip the pivot.
+ split_pos2 = split_pos1 + 1;
+
+ // Elements equal to pivot are done.
+ elements_done += (split_pos2 - split_pos1);
+#if _GLIBCXX_ASSERTIONS
+ total_elements_done += (split_pos2 - split_pos1);
+#endif
+ // Always push larger part onto stack.
+ if (((split_pos1 + 1) - begin) < (end - (split_pos2)))
+ {
+ // Right side larger.
+ if ((split_pos2) != end)
+ tl.leftover_parts.push_front(std::make_pair(split_pos2,
+ end));
+
+ //current.first = begin; //already set anyway
+ current.second = split_pos1;
+ continue;
+ }
+ else
+ {
+ // Left side larger.
+ if (begin != split_pos1)
+ tl.leftover_parts.push_front(std::make_pair(begin,
+ split_pos1));
+
+ current.first = split_pos2;
+ //current.second = end; //already set anyway
+ continue;
+ }
+ }
+ else
+ {
+ __gnu_sequential::sort(begin, end, comp);
+ elements_done += n;
+#if _GLIBCXX_ASSERTIONS
+ total_elements_done += n;
+#endif
+
+ // Prefer own stack, small pieces.
+ if (tl.leftover_parts.pop_front(current))
+ continue;
+
+# pragma omp atomic
+ *tl.elements_leftover -= elements_done;
+
+ elements_done = 0;
+
+#if _GLIBCXX_ASSERTIONS
+ double search_start = omp_get_wtime();
+#endif
+
+ // Look for new work.
+ bool successfully_stolen = false;
+ while (wait && *tl.elements_leftover > 0 && !successfully_stolen
+#if _GLIBCXX_ASSERTIONS
+ // Possible dead-lock.
+ && (omp_get_wtime() < (search_start + 1.0))
+#endif
+ )
+ {
+ thread_index_t victim;
+ victim = rng(num_threads);
+
+ // Large pieces.
+ successfully_stolen = (victim != iam)
+ && tls[victim]->leftover_parts.pop_back(current);
+ if (!successfully_stolen)
+ yield();
+#if !defined(__ICC) && !defined(__ECC)
+# pragma omp flush
+#endif
+ }
+
+#if _GLIBCXX_ASSERTIONS
+ if (omp_get_wtime() >= (search_start + 1.0))
+ {
+ sleep(1);
+ _GLIBCXX_PARALLEL_ASSERT(omp_get_wtime()
+ < (search_start + 1.0));
+ }
+#endif
+ if (!successfully_stolen)
+ {
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(*tl.elements_leftover == 0);
+#endif
+ return;
+ }
+ }
+ }
+ }
+
+/** @brief Top-level quicksort routine.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param comp Comparator.
+ * @param num_threads Number of threads that are allowed to work on
+ * this part.
+ */
+template<typename RandomAccessIterator, typename Comparator>
+ void
+ parallel_sort_qsb(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp,
+ thread_index_t num_threads)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef std::pair<RandomAccessIterator, RandomAccessIterator> Piece;
+
+ typedef QSBThreadLocal<RandomAccessIterator> tls_type;
+
+ difference_type n = end - begin;
+
+ if (n <= 1)
+ return;
+
+ // At least one element per processor.
+ if (num_threads > n)
+ num_threads = static_cast<thread_index_t>(n);
+
+ // Initialize thread local storage
+ tls_type** tls = new tls_type*[num_threads];
+ difference_type queue_size = num_threads * (thread_index_t)(log2(n) + 1);
+ for (thread_index_t t = 0; t < num_threads; ++t)
+ tls[t] = new QSBThreadLocal<RandomAccessIterator>(queue_size);
+
+ // There can never be more than ceil(log2(n)) ranges on the stack, because
+ // 1. Only one processor pushes onto the stack
+ // 2. The largest range has at most length n
+ // 3. Each range is larger than half of the range remaining
+ volatile difference_type elements_leftover = n;
+ for (int i = 0; i < num_threads; ++i)
+ {
+ tls[i]->elements_leftover = &elements_leftover;
+ tls[i]->num_threads = num_threads;
+ tls[i]->global = std::make_pair(begin, end);
+
+ // Just in case nothing is left to assign.
+ tls[i]->initial = std::make_pair(end, end);
+ }
+
+ // Main recursion call.
+ qsb_conquer(tls, begin, begin + n, comp, 0, num_threads, true);
+
+#if _GLIBCXX_ASSERTIONS
+ // All stack must be empty.
+ Piece dummy;
+ for (int i = 1; i < num_threads; ++i)
+ _GLIBCXX_PARALLEL_ASSERT(!tls[i]->leftover_parts.pop_back(dummy));
+#endif
+
+ for (int i = 0; i < num_threads; ++i)
+ delete tls[i];
+ delete[] tls;
+ }
+} // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/base.h b/gcc-4.4.0/libstdc++-v3/include/parallel/base.h
new file mode 100644
index 000000000..7f855dfca
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/base.h
@@ -0,0 +1,471 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/base.h
+ * @brief Sequential helper functions.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_BASE_H
+#define _GLIBCXX_PARALLEL_BASE_H 1
+
+#include <functional>
+#include <omp.h>
+#include <parallel/features.h>
+#include <parallel/basic_iterator.h>
+#include <parallel/parallel.h>
+
+
+// Parallel mode namespaces.
+
+/**
+ * @namespace std::__parallel
+ * @brief GNU parallel code, replaces standard behavior with parallel behavior.
+ */
+namespace std
+{
+ namespace __parallel { }
+}
+
+/**
+ * @namespace __gnu_parallel
+ * @brief GNU parallel code for public use.
+ */
+namespace __gnu_parallel
+{
+ // Import all the parallel versions of components in namespace std.
+ using namespace std::__parallel;
+}
+
+/**
+ * @namespace __gnu_sequential
+ * @brief GNU sequential classes for public use.
+ */
+namespace __gnu_sequential
+{
+ // Import whatever is the serial version.
+#ifdef _GLIBCXX_PARALLEL
+ using namespace std::__norm;
+#else
+ using namespace std;
+#endif
+}
+
+
+namespace __gnu_parallel
+{
+ // NB: Including this file cannot produce (unresolved) symbols from
+ // the OpenMP runtime unless the parallel mode is actually invoked
+ // and active, which imples that the OpenMP runtime is actually
+ // going to be linked in.
+ inline int
+ get_max_threads()
+ {
+ int __i = omp_get_max_threads();
+ return __i > 1 ? __i : 1;
+ }
+
+
+ inline bool
+ is_parallel(const _Parallelism __p) { return __p != sequential; }
+
+
+ // XXX remove std::duplicates from here if possible,
+ // XXX but keep minimal dependencies.
+
+/** @brief Calculates the rounded-down logarithm of @c n for base 2.
+ * @param n Argument.
+ * @return Returns 0 for any argument <1.
+ */
+template<typename Size>
+ inline Size
+ __log2(Size n)
+ {
+ Size k;
+ for (k = 0; n > 1; n >>= 1)
+ ++k;
+ return k;
+ }
+
+/** @brief Encode two integers into one __gnu_parallel::lcas_t.
+ * @param a First integer, to be encoded in the most-significant @c
+ * lcas_t_bits/2 bits.
+ * @param b Second integer, to be encoded in the least-significant
+ * @c lcas_t_bits/2 bits.
+ * @return __gnu_parallel::lcas_t value encoding @c a and @c b.
+ * @see decode2
+ */
+inline lcas_t
+encode2(int a, int b) //must all be non-negative, actually
+{
+ return (((lcas_t)a) << (lcas_t_bits / 2)) | (((lcas_t)b) << 0);
+}
+
+/** @brief Decode two integers from one __gnu_parallel::lcas_t.
+ * @param x __gnu_parallel::lcas_t to decode integers from.
+ * @param a First integer, to be decoded from the most-significant
+ * @c lcas_t_bits/2 bits of @c x.
+ * @param b Second integer, to be encoded in the least-significant
+ * @c lcas_t_bits/2 bits of @c x.
+ * @see encode2
+ */
+inline void
+decode2(lcas_t x, int& a, int& b)
+{
+ a = (int)((x >> (lcas_t_bits / 2)) & lcas_t_mask);
+ b = (int)((x >> 0 ) & lcas_t_mask);
+}
+
+/** @brief Equivalent to std::min. */
+template<typename T>
+ const T&
+ min(const T& a, const T& b)
+ { return (a < b) ? a : b; }
+
+/** @brief Equivalent to std::max. */
+template<typename T>
+ const T&
+ max(const T& a, const T& b)
+ { return (a > b) ? a : b; }
+
+/** @brief Constructs predicate for equality from strict weak
+ * ordering predicate
+ */
+// XXX comparator at the end, as per others
+template<typename Comparator, typename T1, typename T2>
+ class equal_from_less : public std::binary_function<T1, T2, bool>
+ {
+ private:
+ Comparator& comp;
+
+ public:
+ equal_from_less(Comparator& _comp) : comp(_comp) { }
+
+ bool operator()(const T1& a, const T2& b)
+ {
+ return !comp(a, b) && !comp(b, a);
+ }
+ };
+
+
+/** @brief Similar to std::binder1st,
+ * but giving the argument types explicitly. */
+template<typename _Predicate, typename argument_type>
+ class unary_negate
+ : public std::unary_function<argument_type, bool>
+ {
+ protected:
+ _Predicate _M_pred;
+
+ public:
+ explicit
+ unary_negate(const _Predicate& __x) : _M_pred(__x) { }
+
+ bool
+ operator()(const argument_type& __x)
+ { return !_M_pred(__x); }
+ };
+
+/** @brief Similar to std::binder1st,
+ * but giving the argument types explicitly. */
+template<typename _Operation, typename first_argument_type,
+ typename second_argument_type, typename result_type>
+ class binder1st
+ : public std::unary_function<second_argument_type, result_type>
+ {
+ protected:
+ _Operation op;
+ first_argument_type value;
+
+ public:
+ binder1st(const _Operation& __x,
+ const first_argument_type& __y)
+ : op(__x), value(__y) { }
+
+ result_type
+ operator()(const second_argument_type& __x)
+ { return op(value, __x); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 109. Missing binders for non-const sequence elements
+ result_type
+ operator()(second_argument_type& __x) const
+ { return op(value, __x); }
+ };
+
+/**
+ * @brief Similar to std::binder2nd, but giving the argument types
+ * explicitly.
+ */
+template<typename _Operation, typename first_argument_type,
+ typename second_argument_type, typename result_type>
+ class binder2nd
+ : public std::unary_function<first_argument_type, result_type>
+ {
+ protected:
+ _Operation op;
+ second_argument_type value;
+
+ public:
+ binder2nd(const _Operation& __x,
+ const second_argument_type& __y)
+ : op(__x), value(__y) { }
+
+ result_type
+ operator()(const first_argument_type& __x) const
+ { return op(__x, value); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 109. Missing binders for non-const sequence elements
+ result_type
+ operator()(first_argument_type& __x)
+ { return op(__x, value); }
+ };
+
+/** @brief Similar to std::equal_to, but allows two different types. */
+template<typename T1, typename T2>
+ struct equal_to : std::binary_function<T1, T2, bool>
+ {
+ bool operator()(const T1& t1, const T2& t2) const
+ { return t1 == t2; }
+ };
+
+/** @brief Similar to std::less, but allows two different types. */
+template<typename T1, typename T2>
+ struct less : std::binary_function<T1, T2, bool>
+ {
+ bool
+ operator()(const T1& t1, const T2& t2) const
+ { return t1 < t2; }
+
+ bool
+ operator()(const T2& t2, const T1& t1) const
+ { return t2 < t1; }
+ };
+
+// Partial specialization for one type. Same as std::less.
+template<typename _Tp>
+struct less<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x < __y; }
+ };
+
+
+ /** @brief Similar to std::plus, but allows two different types. */
+template<typename _Tp1, typename _Tp2>
+ struct plus : public std::binary_function<_Tp1, _Tp2, _Tp1>
+ {
+ typedef __typeof__(*static_cast<_Tp1*>(NULL)
+ + *static_cast<_Tp2*>(NULL)) result;
+
+ result
+ operator()(const _Tp1& __x, const _Tp2& __y) const
+ { return __x + __y; }
+ };
+
+// Partial specialization for one type. Same as std::plus.
+template<typename _Tp>
+ struct plus<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, _Tp>
+ {
+ typedef __typeof__(*static_cast<_Tp*>(NULL)
+ + *static_cast<_Tp*>(NULL)) result;
+
+ result
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x + __y; }
+ };
+
+
+/** @brief Similar to std::multiplies, but allows two different types. */
+template<typename _Tp1, typename _Tp2>
+ struct multiplies : public std::binary_function<_Tp1, _Tp2, _Tp1>
+ {
+ typedef __typeof__(*static_cast<_Tp1*>(NULL)
+ * *static_cast<_Tp2*>(NULL)) result;
+
+ result
+ operator()(const _Tp1& __x, const _Tp2& __y) const
+ { return __x * __y; }
+ };
+
+// Partial specialization for one type. Same as std::multiplies.
+template<typename _Tp>
+ struct multiplies<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, _Tp>
+ {
+ typedef __typeof__(*static_cast<_Tp*>(NULL)
+ * *static_cast<_Tp*>(NULL)) result;
+
+ result
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x * __y; }
+ };
+
+
+template<typename T, typename _DifferenceTp>
+ class pseudo_sequence;
+
+/** @brief Iterator associated with __gnu_parallel::pseudo_sequence.
+ * If features the usual random-access iterator functionality.
+ * @param T Sequence value type.
+ * @param difference_type Sequence difference type.
+ */
+template<typename T, typename _DifferenceTp>
+ class pseudo_sequence_iterator
+ {
+ public:
+ typedef _DifferenceTp difference_type;
+
+ private:
+ typedef pseudo_sequence_iterator<T, _DifferenceTp> type;
+
+ const T& val;
+ difference_type pos;
+
+ public:
+ pseudo_sequence_iterator(const T& val, difference_type pos)
+ : val(val), pos(pos) { }
+
+ // Pre-increment operator.
+ type&
+ operator++()
+ {
+ ++pos;
+ return *this;
+ }
+
+ // Post-increment operator.
+ const type
+ operator++(int)
+ { return type(pos++); }
+
+ const T&
+ operator*() const
+ { return val; }
+
+ const T&
+ operator[](difference_type) const
+ { return val; }
+
+ bool
+ operator==(const type& i2)
+ { return pos == i2.pos; }
+
+ difference_type
+ operator!=(const type& i2)
+ { return pos != i2.pos; }
+
+ difference_type
+ operator-(const type& i2)
+ { return pos - i2.pos; }
+ };
+
+/** @brief Sequence that conceptually consists of multiple copies of
+ the same element.
+ * The copies are not stored explicitly, of course.
+ * @param T Sequence value type.
+ * @param difference_type Sequence difference type.
+ */
+template<typename T, typename _DifferenceTp>
+ class pseudo_sequence
+ {
+ typedef pseudo_sequence<T, _DifferenceTp> type;
+
+ public:
+ typedef _DifferenceTp difference_type;
+
+ // Better case down to uint64, than up to _DifferenceTp.
+ typedef pseudo_sequence_iterator<T, uint64> iterator;
+
+ /** @brief Constructor.
+ * @param val Element of the sequence.
+ * @param count Number of (virtual) copies.
+ */
+ pseudo_sequence(const T& val, difference_type count)
+ : val(val), count(count) { }
+
+ /** @brief Begin iterator. */
+ iterator
+ begin() const
+ { return iterator(val, 0); }
+
+ /** @brief End iterator. */
+ iterator
+ end() const
+ { return iterator(val, count); }
+
+ private:
+ const T& val;
+ difference_type count;
+ };
+
+/** @brief Functor that does nothing */
+template<typename _ValueTp>
+ class void_functor
+ {
+ inline void
+ operator()(const _ValueTp& v) const { }
+ };
+
+/** @brief Compute the median of three referenced elements,
+ according to @c comp.
+ * @param a First iterator.
+ * @param b Second iterator.
+ * @param c Third iterator.
+ * @param comp Comparator.
+ */
+template<typename RandomAccessIterator, typename Comparator>
+ RandomAccessIterator
+ median_of_three_iterators(RandomAccessIterator a, RandomAccessIterator b,
+ RandomAccessIterator c, Comparator& comp)
+ {
+ if (comp(*a, *b))
+ if (comp(*b, *c))
+ return b;
+ else
+ if (comp(*a, *c))
+ return c;
+ else
+ return a;
+ else
+ {
+ // Just swap a and b.
+ if (comp(*a, *c))
+ return a;
+ else
+ if (comp(*b, *c))
+ return c;
+ else
+ return b;
+ }
+ }
+
+#define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert(_Condition)
+
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_BASE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/basic_iterator.h b/gcc-4.4.0/libstdc++-v3/include/parallel/basic_iterator.h
new file mode 100644
index 000000000..c5c067a0b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/basic_iterator.h
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/basic_iterator.h
+ * @brief Includes the original header files concerned with iterators
+ * except for stream iterators.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_BASIC_ITERATOR_H
+#define _GLIBCXX_PARALLEL_BASIC_ITERATOR_H 1
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/stl_iterator.h>
+
+#endif /* _GLIBCXX_PARALLEL_BASIC_ITERATOR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/checkers.h b/gcc-4.4.0/libstdc++-v3/include/parallel/checkers.h
new file mode 100644
index 000000000..819e8ad26
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/checkers.h
@@ -0,0 +1,154 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/checkers.h
+ * @brief Routines for checking the correctness of algorithm results.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_CHECKERS_H
+#define _GLIBCXX_PARALLEL_CHECKERS_H 1
+
+#include <functional>
+#include <cstdio>
+#include <bits/stl_algobase.h>
+
+namespace __gnu_parallel
+{
+ /**
+ * @brief Check whether @c [begin, @c end) is sorted according to @c comp.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param comp Comparator.
+ * @return @c true if sorted, @c false otherwise.
+ */
+ // XXX Comparator default template argument
+ template<typename InputIterator, typename Comparator>
+ bool
+ is_sorted(InputIterator begin, InputIterator end,
+ Comparator comp
+ = std::less<typename std::iterator_traits<InputIterator>::
+ value_type>())
+ {
+ if (begin == end)
+ return true;
+
+ InputIterator current(begin), recent(begin);
+
+ unsigned long long position = 1;
+ for (current++; current != end; current++)
+ {
+ if (comp(*current, *recent))
+ {
+ printf("is_sorted: check failed before position %i.\n",
+ position);
+ return false;
+ }
+ recent = current;
+ position++;
+ }
+
+ return true;
+ }
+
+ /**
+ * @brief Check whether @c [begin, @c end) is sorted according to @c comp.
+ * Prints the position in case an unordered pair is found.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param first_failure The first failure is returned in this variable.
+ * @param comp Comparator.
+ * @return @c true if sorted, @c false otherwise.
+ */
+ // XXX Comparator default template argument
+ template<typename InputIterator, typename Comparator>
+ bool
+ is_sorted_failure(InputIterator begin, InputIterator end,
+ InputIterator& first_failure,
+ Comparator comp
+ = std::less<typename std::iterator_traits<InputIterator>::
+ value_type>())
+ {
+ if (begin == end)
+ return true;
+
+ InputIterator current(begin), recent(begin);
+
+ unsigned long long position = 1;
+ for (current++; current != end; current++)
+ {
+ if (comp(*current, *recent))
+ {
+ first_failure = current;
+ printf("is_sorted: check failed before position %lld.\n",
+ position);
+ return false;
+ }
+ recent = current;
+ position++;
+ }
+
+ first_failure = end;
+ return true;
+ }
+
+ /**
+ * @brief Check whether @c [begin, @c end) is sorted according to @c comp.
+ * Prints all unordered pair, including the surrounding two elements.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param comp Comparator.
+ * @return @c true if sorted, @c false otherwise.
+ */
+ template<typename InputIterator, typename Comparator>
+ bool
+ // XXX Comparator default template argument
+ is_sorted_print_failures(InputIterator begin, InputIterator end,
+ Comparator comp
+ = std::less<typename std::iterator_traits
+ <InputIterator>::value_type>())
+ {
+ if (begin == end)
+ return true;
+
+ InputIterator recent(begin);
+ bool ok = true;
+
+ for (InputIterator pos(begin + 1); pos != end; pos++)
+ {
+ if (comp(*pos, *recent))
+ {
+ printf("%ld: %d %d %d %d\n", pos - begin, *(pos - 2),
+ *(pos- 1), *pos, *(pos + 1));
+ ok = false;
+ }
+ recent = pos;
+ }
+ return ok;
+ }
+}
+
+#endif /* _GLIBCXX_PARALLEL_CHECKERS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/compatibility.h b/gcc-4.4.0/libstdc++-v3/include/parallel/compatibility.h
new file mode 100644
index 000000000..a5726dd35
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/compatibility.h
@@ -0,0 +1,350 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/compatibility.h
+ * @brief Compatibility layer, mostly concerned with atomic operations.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_COMPATIBILITY_H
+#define _GLIBCXX_PARALLEL_COMPATIBILITY_H 1
+
+#include <parallel/types.h>
+#include <parallel/base.h>
+
+#if defined(__SUNPRO_CC) && defined(__sparc)
+#include <sys/atomic.h>
+#endif
+
+#if !defined(_WIN32) || defined (__CYGWIN__)
+#include <sched.h>
+#endif
+
+#if defined(_MSC_VER)
+#include <Windows.h>
+#include <intrin.h>
+#undef max
+#undef min
+#endif
+
+#ifdef __MINGW32__
+// Including <windows.h> will drag in all the windows32 names. Since
+// that can cause user code portability problems, we just declare the
+// one needed function here.
+extern "C"
+__attribute((dllimport)) void __attribute__((stdcall)) Sleep (unsigned long);
+#endif
+
+namespace __gnu_parallel
+{
+#if defined(__ICC)
+ template<typename must_be_int = int>
+ int32 faa32(int32* x, int32 inc)
+ {
+ asm volatile("lock xadd %0,%1"
+ : "=r" (inc), "=m" (*x)
+ : "0" (inc)
+ : "memory");
+ return inc;
+ }
+#if defined(__x86_64)
+ template<typename must_be_int = int>
+ int64 faa64(int64* x, int64 inc)
+ {
+ asm volatile("lock xadd %0,%1"
+ : "=r" (inc), "=m" (*x)
+ : "0" (inc)
+ : "memory");
+ return inc;
+ }
+#endif
+#endif
+
+ // atomic functions only work on integers
+
+ /** @brief Add a value to a variable, atomically.
+ *
+ * Implementation is heavily platform-dependent.
+ * @param ptr Pointer to a 32-bit signed integer.
+ * @param addend Value to add.
+ */
+ inline int32
+ fetch_and_add_32(volatile int32* ptr, int32 addend)
+ {
+#if defined(__ICC) //x86 version
+ return _InterlockedExchangeAdd((void*)ptr, addend);
+#elif defined(__ECC) //IA-64 version
+ return _InterlockedExchangeAdd((void*)ptr, addend);
+#elif defined(__ICL) || defined(_MSC_VER)
+ return _InterlockedExchangeAdd(reinterpret_cast<volatile long*>(ptr),
+ addend);
+#elif defined(__GNUC__)
+ return __sync_fetch_and_add(ptr, addend);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+ volatile int32 before, after;
+ do
+ {
+ before = *ptr;
+ after = before + addend;
+ } while (atomic_cas_32((volatile unsigned int*)ptr, before,
+ after) != before);
+ return before;
+#else //fallback, slow
+#pragma message("slow fetch_and_add_32")
+ int32 res;
+#pragma omp critical
+ {
+ res = *ptr;
+ *(ptr) += addend;
+ }
+ return res;
+#endif
+ }
+
+ /** @brief Add a value to a variable, atomically.
+ *
+ * Implementation is heavily platform-dependent.
+ * @param ptr Pointer to a 64-bit signed integer.
+ * @param addend Value to add.
+ */
+ inline int64
+ fetch_and_add_64(volatile int64* ptr, int64 addend)
+ {
+#if defined(__ICC) && defined(__x86_64) //x86 version
+ return faa64<int>((int64*)ptr, addend);
+#elif defined(__ECC) //IA-64 version
+ return _InterlockedExchangeAdd64((void*)ptr, addend);
+#elif defined(__ICL) || defined(_MSC_VER)
+#ifndef _WIN64
+ _GLIBCXX_PARALLEL_ASSERT(false); //not available in this case
+ return 0;
+#else
+ return _InterlockedExchangeAdd64(ptr, addend);
+#endif
+#elif defined(__GNUC__) && defined(__x86_64)
+ return __sync_fetch_and_add(ptr, addend);
+#elif defined(__GNUC__) && defined(__i386) && \
+ (defined(__i686) || defined(__pentium4) || defined(__athlon))
+ return __sync_fetch_and_add(ptr, addend);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+ volatile int64 before, after;
+ do
+ {
+ before = *ptr;
+ after = before + addend;
+ } while (atomic_cas_64((volatile unsigned long long*)ptr, before,
+ after) != before);
+ return before;
+#else //fallback, slow
+#if defined(__GNUC__) && defined(__i386)
+ // XXX doesn't work with -march=native
+ //#warning "please compile with -march=i686 or better"
+#endif
+#pragma message("slow fetch_and_add_64")
+ int64 res;
+#pragma omp critical
+ {
+ res = *ptr;
+ *(ptr) += addend;
+ }
+ return res;
+#endif
+ }
+
+ /** @brief Add a value to a variable, atomically.
+ *
+ * Implementation is heavily platform-dependent.
+ * @param ptr Pointer to a signed integer.
+ * @param addend Value to add.
+ */
+ template<typename T>
+ inline T
+ fetch_and_add(volatile T* ptr, T addend)
+ {
+ if (sizeof(T) == sizeof(int32))
+ return (T)fetch_and_add_32((volatile int32*) ptr, (int32)addend);
+ else if (sizeof(T) == sizeof(int64))
+ return (T)fetch_and_add_64((volatile int64*) ptr, (int64)addend);
+ else
+ _GLIBCXX_PARALLEL_ASSERT(false);
+ }
+
+
+#if defined(__ICC)
+
+ template<typename must_be_int = int>
+ inline int32
+ cas32(volatile int32* ptr, int32 old, int32 nw)
+ {
+ int32 before;
+ __asm__ __volatile__("lock; cmpxchgl %1,%2"
+ : "=a"(before)
+ : "q"(nw), "m"(*(volatile long long*)(ptr)), "0"(old)
+ : "memory");
+ return before;
+ }
+
+#if defined(__x86_64)
+ template<typename must_be_int = int>
+ inline int64
+ cas64(volatile int64 *ptr, int64 old, int64 nw)
+ {
+ int64 before;
+ __asm__ __volatile__("lock; cmpxchgq %1,%2"
+ : "=a"(before)
+ : "q"(nw), "m"(*(volatile long long*)(ptr)), "0"(old)
+ : "memory");
+ return before;
+ }
+#endif
+
+#endif
+
+ /** @brief Compare @c *ptr and @c comparand. If equal, let @c
+ * *ptr=replacement and return @c true, return @c false otherwise.
+ *
+ * Implementation is heavily platform-dependent.
+ * @param ptr Pointer to 32-bit signed integer.
+ * @param comparand Compare value.
+ * @param replacement Replacement value.
+ */
+ inline bool
+ compare_and_swap_32(volatile int32* ptr, int32 comparand, int32 replacement)
+ {
+#if defined(__ICC) //x86 version
+ return _InterlockedCompareExchange((void*)ptr, replacement,
+ comparand) == comparand;
+#elif defined(__ECC) //IA-64 version
+ return _InterlockedCompareExchange((void*)ptr, replacement,
+ comparand) == comparand;
+#elif defined(__ICL) || defined(_MSC_VER)
+ return _InterlockedCompareExchange(reinterpret_cast<volatile long*>(ptr),
+ replacement, comparand) == comparand;
+#elif defined(__GNUC__)
+ return __sync_bool_compare_and_swap(ptr, comparand, replacement);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+ return atomic_cas_32((volatile unsigned int*)ptr, comparand,
+ replacement) == comparand;
+#else
+#pragma message("slow compare_and_swap_32")
+ bool res = false;
+#pragma omp critical
+ {
+ if (*ptr == comparand)
+ {
+ *ptr = replacement;
+ res = true;
+ }
+ }
+ return res;
+#endif
+ }
+
+ /** @brief Compare @c *ptr and @c comparand. If equal, let @c
+ * *ptr=replacement and return @c true, return @c false otherwise.
+ *
+ * Implementation is heavily platform-dependent.
+ * @param ptr Pointer to 64-bit signed integer.
+ * @param comparand Compare value.
+ * @param replacement Replacement value.
+ */
+ inline bool
+ compare_and_swap_64(volatile int64* ptr, int64 comparand, int64 replacement)
+ {
+#if defined(__ICC) && defined(__x86_64) //x86 version
+ return cas64<int>(ptr, comparand, replacement) == comparand;
+#elif defined(__ECC) //IA-64 version
+ return _InterlockedCompareExchange64((void*)ptr, replacement,
+ comparand) == comparand;
+#elif defined(__ICL) || defined(_MSC_VER)
+#ifndef _WIN64
+ _GLIBCXX_PARALLEL_ASSERT(false); //not available in this case
+ return 0;
+#else
+ return _InterlockedCompareExchange64(ptr, replacement,
+ comparand) == comparand;
+#endif
+
+#elif defined(__GNUC__) && defined(__x86_64)
+ return __sync_bool_compare_and_swap(ptr, comparand, replacement);
+#elif defined(__GNUC__) && defined(__i386) && \
+ (defined(__i686) || defined(__pentium4) || defined(__athlon))
+ return __sync_bool_compare_and_swap(ptr, comparand, replacement);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+ return atomic_cas_64((volatile unsigned long long*)ptr,
+ comparand, replacement) == comparand;
+#else
+#if defined(__GNUC__) && defined(__i386)
+ // XXX -march=native
+ //#warning "please compile with -march=i686 or better"
+#endif
+#pragma message("slow compare_and_swap_64")
+ bool res = false;
+#pragma omp critical
+ {
+ if (*ptr == comparand)
+ {
+ *ptr = replacement;
+ res = true;
+ }
+ }
+ return res;
+#endif
+ }
+
+ /** @brief Compare @c *ptr and @c comparand. If equal, let @c
+ * *ptr=replacement and return @c true, return @c false otherwise.
+ *
+ * Implementation is heavily platform-dependent.
+ * @param ptr Pointer to signed integer.
+ * @param comparand Compare value.
+ * @param replacement Replacement value. */
+ template<typename T>
+ inline bool
+ compare_and_swap(volatile T* ptr, T comparand, T replacement)
+ {
+ if (sizeof(T) == sizeof(int32))
+ return compare_and_swap_32((volatile int32*) ptr, (int32)comparand, (int32)replacement);
+ else if (sizeof(T) == sizeof(int64))
+ return compare_and_swap_64((volatile int64*) ptr, (int64)comparand, (int64)replacement);
+ else
+ _GLIBCXX_PARALLEL_ASSERT(false);
+ }
+
+ /** @brief Yield the control to another thread, without waiting for
+ the end to the time slice. */
+ inline void
+ yield()
+ {
+#if defined (_WIN32) && !defined (__CYGWIN__)
+ Sleep(0);
+#else
+ sched_yield();
+#endif
+ }
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_COMPATIBILITY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/compiletime_settings.h b/gcc-4.4.0/libstdc++-v3/include/parallel/compiletime_settings.h
new file mode 100644
index 000000000..e7e31d068
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/compiletime_settings.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/compiletime_settings.h
+ * @brief Defines on options concerning debugging and performance, at
+ * compile-time.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#include <cstdio>
+
+/** @brief Determine verbosity level of the parallel mode.
+ * Level 1 prints a message each time a parallel-mode function is entered. */
+#define _GLIBCXX_VERBOSE_LEVEL 0
+
+/** @def _GLIBCXX_CALL
+ * @brief Macro to produce log message when entering a function.
+ * @param n Input size.
+ * @see _GLIBCXX_VERBOSE_LEVEL */
+#if (_GLIBCXX_VERBOSE_LEVEL == 0)
+#define _GLIBCXX_CALL(n)
+#endif
+#if (_GLIBCXX_VERBOSE_LEVEL == 1)
+#define _GLIBCXX_CALL(n) \
+ printf(" %s:\niam = %d, n = %ld, num_threads = %d\n", \
+ __PRETTY_FUNCTION__, omp_get_thread_num(), (n), get_max_threads());
+#endif
+
+#ifndef _GLIBCXX_SCALE_DOWN_FPU
+/** @brief Use floating-point scaling instead of modulo for mapping
+ * random numbers to a range. This can be faster on certain CPUs. */
+#define _GLIBCXX_SCALE_DOWN_FPU 0
+#endif
+
+#ifndef _GLIBCXX_ASSERTIONS
+/** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code.
+ * Should be switched on only locally. */
+#define _GLIBCXX_ASSERTIONS 0
+#endif
+
+#ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+/** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code.
+ * Consider the size of the L1 cache for
+ * __gnu_parallel::parallel_random_shuffle(). */
+#define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 0
+#endif
+#ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+/** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code.
+ * Consider the size of the TLB for
+ * __gnu_parallel::parallel_random_shuffle(). */
+#define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB 0
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/equally_split.h b/gcc-4.4.0/libstdc++-v3/include/parallel/equally_split.h
new file mode 100644
index 000000000..ee4bfeeeb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/equally_split.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/equally_split.h
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H
+#define _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H 1
+
+namespace __gnu_parallel
+{
+/** @brief Function to split a sequence into parts of almost equal size.
+ *
+ * The resulting sequence s of length num_threads+1 contains the splitting
+ * positions when splitting the range [0,n) into parts of almost
+ * equal size (plus minus 1). The first entry is 0, the last one
+ * n. There may result empty parts.
+ * @param n Number of elements
+ * @param num_threads Number of parts
+ * @param s Splitters
+ * @returns End of splitter sequence, i. e. @c s+num_threads+1 */
+template<typename difference_type, typename OutputIterator>
+ OutputIterator
+ equally_split(difference_type n, thread_index_t num_threads, OutputIterator s)
+ {
+ difference_type chunk_length = n / num_threads;
+ difference_type num_longer_chunks = n % num_threads;
+ difference_type pos = 0;
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ {
+ *s++ = pos;
+ pos += (i < num_longer_chunks) ? (chunk_length + 1) : chunk_length;
+ }
+ *s++ = n;
+ return s;
+ }
+
+
+/** @brief Function to split a sequence into parts of almost equal size.
+ *
+ * Returns the position of the splitting point between
+ * thread number thread_no (included) and
+ * thread number thread_no+1 (excluded).
+ * @param n Number of elements
+ * @param num_threads Number of parts
+ * @returns _SplittingAlgorithm point */
+template<typename difference_type>
+ difference_type
+ equally_split_point(difference_type n,
+ thread_index_t num_threads,
+ thread_index_t thread_no)
+ {
+ difference_type chunk_length = n / num_threads;
+ difference_type num_longer_chunks = n % num_threads;
+ if (thread_no < num_longer_chunks)
+ return thread_no * (chunk_length + 1);
+ else
+ return num_longer_chunks * (chunk_length + 1)
+ + (thread_no - num_longer_chunks) * chunk_length;
+ }
+}
+
+#endif /* _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/features.h b/gcc-4.4.0/libstdc++-v3/include/parallel/features.h
new file mode 100644
index 000000000..417606ea7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/features.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/features.h
+ * @brief Defines on whether to include algorithm variants.
+ *
+ * Less variants reduce executable size and compile time.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_FEATURES_H
+#define _GLIBCXX_PARALLEL_FEATURES_H 1
+
+#ifndef _GLIBCXX_MERGESORT
+/** @def _GLIBCXX_MERGESORT
+ * @brief Include parallel multi-way mergesort.
+ * @see __gnu_parallel::_Settings::sort_algorithm */
+#define _GLIBCXX_MERGESORT 1
+#endif
+
+#ifndef _GLIBCXX_QUICKSORT
+/** @def _GLIBCXX_QUICKSORT
+ * @brief Include parallel unbalanced quicksort.
+ * @see __gnu_parallel::_Settings::sort_algorithm */
+#define _GLIBCXX_QUICKSORT 1
+#endif
+
+#ifndef _GLIBCXX_BAL_QUICKSORT
+/** @def _GLIBCXX_BAL_QUICKSORT
+ * @brief Include parallel dynamically load-balanced quicksort.
+ * @see __gnu_parallel::_Settings::sort_algorithm */
+#define _GLIBCXX_BAL_QUICKSORT 1
+#endif
+
+#ifndef _GLIBCXX_FIND_GROWING_BLOCKS
+/** @brief Include the growing blocks variant for std::find.
+ * @see __gnu_parallel::_Settings::find_algorithm */
+#define _GLIBCXX_FIND_GROWING_BLOCKS 1
+#endif
+
+#ifndef _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS
+/** @brief Include the equal-sized blocks variant for std::find.
+ * @see __gnu_parallel::_Settings::find_algorithm */
+#define _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS 1
+#endif
+
+#ifndef _GLIBCXX_FIND_EQUAL_SPLIT
+/** @def _GLIBCXX_FIND_EQUAL_SPLIT
+ * @brief Include the equal splitting variant for std::find.
+ * @see __gnu_parallel::_Settings::find_algorithm */
+#define _GLIBCXX_FIND_EQUAL_SPLIT 1
+#endif
+
+
+#ifndef _GLIBCXX_TREE_INITIAL_SPLITTING
+/** @def _GLIBCXX_TREE_INITIAL_SPLITTING
+ * @brief Include the initial splitting variant for
+ * _Rb_tree::insert_unique(InputIterator beg, InputIterator end).
+ * @see __gnu_parallel::_Rb_tree */
+#define _GLIBCXX_TREE_INITIAL_SPLITTING 1
+#endif
+
+#ifndef _GLIBCXX_TREE_DYNAMIC_BALANCING
+/** @def _GLIBCXX_TREE_DYNAMIC_BALANCING
+ * @brief Include the dynamic balancing variant for
+ * _Rb_tree::insert_unique(InputIterator beg, InputIterator end).
+ * @see __gnu_parallel::_Rb_tree */
+#define _GLIBCXX_TREE_DYNAMIC_BALANCING 1
+#endif
+
+#ifndef _GLIBCXX_TREE_FULL_COPY
+/** @def _GLIBCXX_TREE_FULL_COPY
+ * @brief In order to sort the input sequence of
+ * _Rb_tree::insert_unique(InputIterator beg, InputIterator end) a
+ * full copy of the input elements is done.
+ * @see __gnu_parallel::_Rb_tree */
+#define _GLIBCXX_TREE_FULL_COPY 1
+#endif
+
+
+#endif /* _GLIBCXX_PARALLEL_FEATURES_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/find.h b/gcc-4.4.0/libstdc++-v3/include/parallel/find.h
new file mode 100644
index 000000000..0597cc58e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/find.h
@@ -0,0 +1,401 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/find.h
+ * @brief Parallel implementation base for std::find(), std::equal()
+ * and related functions.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze and Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_FIND_H
+#define _GLIBCXX_PARALLEL_FIND_H 1
+
+#include <bits/stl_algobase.h>
+
+#include <parallel/features.h>
+#include <parallel/parallel.h>
+#include <parallel/compatibility.h>
+#include <parallel/equally_split.h>
+
+namespace __gnu_parallel
+{
+/**
+ * @brief Parallel std::find, switch for different algorithms.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence. Must have same
+ * length as first sequence.
+ * @param pred Find predicate.
+ * @param selector Functionality (e. g. std::find_if (), std::equal(),...)
+ * @return Place of finding in both sequences.
+ */
+template<typename RandomAccessIterator1,
+ typename RandomAccessIterator2,
+ typename Pred,
+ typename Selector>
+ inline std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ find_template(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred, Selector selector)
+ {
+ switch (_Settings::get().find_algorithm)
+ {
+ case GROWING_BLOCKS:
+ return find_template(begin1, end1, begin2, pred, selector,
+ growing_blocks_tag());
+ case CONSTANT_SIZE_BLOCKS:
+ return find_template(begin1, end1, begin2, pred, selector,
+ constant_size_blocks_tag());
+ case EQUAL_SPLIT:
+ return find_template(begin1, end1, begin2, pred, selector,
+ equal_split_tag());
+ default:
+ _GLIBCXX_PARALLEL_ASSERT(false);
+ return std::make_pair(begin1, begin2);
+ }
+ }
+
+#if _GLIBCXX_FIND_EQUAL_SPLIT
+
+/**
+ * @brief Parallel std::find, equal splitting variant.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence. Second sequence
+ * must have same length as first sequence.
+ * @param pred Find predicate.
+ * @param selector Functionality (e. g. std::find_if (), std::equal(),...)
+ * @return Place of finding in both sequences.
+ */
+template<typename RandomAccessIterator1,
+ typename RandomAccessIterator2,
+ typename Pred,
+ typename Selector>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ find_template(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2,
+ Pred pred,
+ Selector selector,
+ equal_split_tag)
+ {
+ _GLIBCXX_CALL(end1 - begin1)
+
+ typedef std::iterator_traits<RandomAccessIterator1> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename traits_type::value_type value_type;
+
+ difference_type length = end1 - begin1;
+ difference_type result = length;
+ difference_type* borders;
+
+ omp_lock_t result_lock;
+ omp_init_lock(&result_lock);
+
+ thread_index_t num_threads = get_max_threads();
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ borders = new difference_type[num_threads + 1];
+ equally_split(length, num_threads, borders);
+ } //single
+
+ thread_index_t iam = omp_get_thread_num();
+ difference_type start = borders[iam], stop = borders[iam + 1];
+
+ RandomAccessIterator1 i1 = begin1 + start;
+ RandomAccessIterator2 i2 = begin2 + start;
+ for (difference_type pos = start; pos < stop; ++pos)
+ {
+ #pragma omp flush(result)
+ // Result has been set to something lower.
+ if (result < pos)
+ break;
+
+ if (selector(i1, i2, pred))
+ {
+ omp_set_lock(&result_lock);
+ if (pos < result)
+ result = pos;
+ omp_unset_lock(&result_lock);
+ break;
+ }
+ ++i1;
+ ++i2;
+ }
+ } //parallel
+
+ omp_destroy_lock(&result_lock);
+ delete[] borders;
+
+ return
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>(begin1 + result,
+ begin2 + result);
+ }
+
+#endif
+
+#if _GLIBCXX_FIND_GROWING_BLOCKS
+
+/**
+ * @brief Parallel std::find, growing block size variant.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence. Second sequence
+ * must have same length as first sequence.
+ * @param pred Find predicate.
+ * @param selector Functionality (e. g. std::find_if (), std::equal(),...)
+ * @return Place of finding in both sequences.
+ * @see __gnu_parallel::_Settings::find_sequential_search_size
+ * @see __gnu_parallel::_Settings::find_initial_block_size
+ * @see __gnu_parallel::_Settings::find_maximum_block_size
+ * @see __gnu_parallel::_Settings::find_increasing_factor
+ *
+ * There are two main differences between the growing blocks and
+ * the constant-size blocks variants.
+ * 1. For GB, the block size grows; for CSB, the block size is fixed.
+
+ * 2. For GB, the blocks are allocated dynamically;
+ * for CSB, the blocks are allocated in a predetermined manner,
+ * namely spacial round-robin.
+ */
+template<typename RandomAccessIterator1,
+ typename RandomAccessIterator2,
+ typename Pred,
+ typename Selector>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ find_template(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred, Selector selector,
+ growing_blocks_tag)
+ {
+ _GLIBCXX_CALL(end1 - begin1)
+
+ typedef std::iterator_traits<RandomAccessIterator1> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename traits_type::value_type value_type;
+
+ const _Settings& __s = _Settings::get();
+
+ difference_type length = end1 - begin1;
+
+ difference_type sequential_search_size =
+ std::min<difference_type>(length, __s.find_sequential_search_size);
+
+ // Try it sequentially first.
+ std::pair<RandomAccessIterator1, RandomAccessIterator2> find_seq_result =
+ selector.sequential_algorithm(
+ begin1, begin1 + sequential_search_size, begin2, pred);
+
+ if (find_seq_result.first != (begin1 + sequential_search_size))
+ return find_seq_result;
+
+ // Index of beginning of next free block (after sequential find).
+ difference_type next_block_start = sequential_search_size;
+ difference_type result = length;
+
+ omp_lock_t result_lock;
+ omp_init_lock(&result_lock);
+
+ thread_index_t num_threads = get_max_threads();
+# pragma omp parallel shared(result) num_threads(num_threads)
+ {
+# pragma omp single
+ num_threads = omp_get_num_threads();
+
+ // Not within first k elements -> start parallel.
+ thread_index_t iam = omp_get_thread_num();
+
+ difference_type block_size = __s.find_initial_block_size;
+ difference_type start =
+ fetch_and_add<difference_type>(&next_block_start, block_size);
+
+ // Get new block, update pointer to next block.
+ difference_type stop =
+ std::min<difference_type>(length, start + block_size);
+
+ std::pair<RandomAccessIterator1, RandomAccessIterator2> local_result;
+
+ while (start < length)
+ {
+# pragma omp flush(result)
+ // Get new value of result.
+ if (result < start)
+ {
+ // No chance to find first element.
+ break;
+ }
+
+ local_result = selector.sequential_algorithm(
+ begin1 + start, begin1 + stop, begin2 + start, pred);
+ if (local_result.first != (begin1 + stop))
+ {
+ omp_set_lock(&result_lock);
+ if ((local_result.first - begin1) < result)
+ {
+ result = local_result.first - begin1;
+
+ // Result cannot be in future blocks, stop algorithm.
+ fetch_and_add<difference_type>(&next_block_start, length);
+ }
+ omp_unset_lock(&result_lock);
+ }
+
+ block_size =
+ std::min<difference_type>(block_size * __s.find_increasing_factor,
+ __s.find_maximum_block_size);
+
+ // Get new block, update pointer to next block.
+ start =
+ fetch_and_add<difference_type>(&next_block_start, block_size);
+ stop = ((length < (start + block_size))
+ ? length : (start + block_size));
+ }
+ } //parallel
+
+ omp_destroy_lock(&result_lock);
+
+ // Return iterator on found element.
+ return
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>(begin1 + result,
+ begin2 + result);
+ }
+
+#endif
+
+#if _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS
+
+/**
+ * @brief Parallel std::find, constant block size variant.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence. Second sequence
+ * must have same length as first sequence.
+ * @param pred Find predicate.
+ * @param selector Functionality (e. g. std::find_if (), std::equal(),...)
+ * @return Place of finding in both sequences.
+ * @see __gnu_parallel::_Settings::find_sequential_search_size
+ * @see __gnu_parallel::_Settings::find_block_size
+ * There are two main differences between the growing blocks and the
+ * constant-size blocks variants.
+ * 1. For GB, the block size grows; for CSB, the block size is fixed.
+ * 2. For GB, the blocks are allocated dynamically; for CSB, the
+ * blocks are allocated in a predetermined manner, namely spacial
+ * round-robin.
+ */
+template<typename RandomAccessIterator1,
+ typename RandomAccessIterator2,
+ typename Pred,
+ typename Selector>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ find_template(RandomAccessIterator1 begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred, Selector selector,
+ constant_size_blocks_tag)
+ {
+ _GLIBCXX_CALL(end1 - begin1)
+ typedef std::iterator_traits<RandomAccessIterator1> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename traits_type::value_type value_type;
+
+ const _Settings& __s = _Settings::get();
+
+ difference_type length = end1 - begin1;
+
+ difference_type sequential_search_size = std::min<difference_type>(
+ length, __s.find_sequential_search_size);
+
+ // Try it sequentially first.
+ std::pair<RandomAccessIterator1, RandomAccessIterator2> find_seq_result =
+ selector.sequential_algorithm(begin1, begin1 + sequential_search_size,
+ begin2, pred);
+
+ if (find_seq_result.first != (begin1 + sequential_search_size))
+ return find_seq_result;
+
+ difference_type result = length;
+ omp_lock_t result_lock;
+ omp_init_lock(&result_lock);
+
+ // Not within first sequential_search_size elements -> start parallel.
+
+ thread_index_t num_threads = get_max_threads();
+# pragma omp parallel shared(result) num_threads(num_threads)
+ {
+# pragma omp single
+ num_threads = omp_get_num_threads();
+
+ thread_index_t iam = omp_get_thread_num();
+ difference_type block_size = __s.find_initial_block_size;
+
+ // First element of thread's current iteration.
+ difference_type iteration_start = sequential_search_size;
+
+ // Where to work (initialization).
+ difference_type start = iteration_start + iam * block_size;
+ difference_type stop =
+ std::min<difference_type>(length, start + block_size);
+
+ std::pair<RandomAccessIterator1, RandomAccessIterator2> local_result;
+
+ while (start < length)
+ {
+ // Get new value of result.
+# pragma omp flush(result)
+ // No chance to find first element.
+ if (result < start)
+ break;
+ local_result = selector.sequential_algorithm(
+ begin1 + start, begin1 + stop,
+ begin2 + start, pred);
+ if (local_result.first != (begin1 + stop))
+ {
+ omp_set_lock(&result_lock);
+ if ((local_result.first - begin1) < result)
+ result = local_result.first - begin1;
+ omp_unset_lock(&result_lock);
+ // Will not find better value in its interval.
+ break;
+ }
+
+ iteration_start += num_threads * block_size;
+
+ // Where to work.
+ start = iteration_start + iam * block_size;
+ stop = std::min<difference_type>(length, start + block_size);
+ }
+ } //parallel
+
+ omp_destroy_lock(&result_lock);
+
+ // Return iterator on found element.
+ return
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>(begin1 + result,
+ begin2 + result);
+ }
+#endif
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_FIND_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/find_selectors.h b/gcc-4.4.0/libstdc++-v3/include/parallel/find_selectors.h
new file mode 100644
index 000000000..3cbc1b80e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/find_selectors.h
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/find_selectors.h
+ * @brief Function objects representing different tasks to be plugged
+ * into the parallel find algorithm.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_FIND_SELECTORS_H
+#define _GLIBCXX_PARALLEL_FIND_SELECTORS_H 1
+
+#include <parallel/tags.h>
+#include <parallel/basic_iterator.h>
+#include <bits/stl_pair.h>
+
+namespace __gnu_parallel
+{
+ /** @brief Base class of all __gnu_parallel::find_template selectors. */
+ struct generic_find_selector
+ { };
+
+ /**
+ * @brief Test predicate on a single element, used for std::find()
+ * and std::find_if ().
+ */
+ struct find_if_selector : public generic_find_selector
+ {
+ /** @brief Test on one position.
+ * @param i1 Iterator on first sequence.
+ * @param i2 Iterator on second sequence (unused).
+ * @param pred Find predicate.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ bool
+ operator()(RandomAccessIterator1 i1, RandomAccessIterator2 i2, Pred pred)
+ { return pred(*i1); }
+
+ /** @brief Corresponding sequential algorithm on a sequence.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param pred Find predicate.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ sequential_algorithm(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred)
+ { return std::make_pair(find_if(begin1, end1, pred,
+ sequential_tag()), begin2); }
+ };
+
+ /** @brief Test predicate on two adjacent elements. */
+ struct adjacent_find_selector : public generic_find_selector
+ {
+ /** @brief Test on one position.
+ * @param i1 Iterator on first sequence.
+ * @param i2 Iterator on second sequence (unused).
+ * @param pred Find predicate.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ bool
+ operator()(RandomAccessIterator1 i1, RandomAccessIterator2 i2, Pred pred)
+ {
+ // Passed end iterator is one short.
+ return pred(*i1, *(i1 + 1));
+ }
+
+ /** @brief Corresponding sequential algorithm on a sequence.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param pred Find predicate.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ sequential_algorithm(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred)
+ {
+ // Passed end iterator is one short.
+ RandomAccessIterator1 spot = adjacent_find(begin1, end1 + 1,
+ pred, sequential_tag());
+ if (spot == (end1 + 1))
+ spot = end1;
+ return std::make_pair(spot, begin2);
+ }
+ };
+
+ /** @brief Test inverted predicate on a single element. */
+ struct mismatch_selector : public generic_find_selector
+ {
+ /**
+ * @brief Test on one position.
+ * @param i1 Iterator on first sequence.
+ * @param i2 Iterator on second sequence (unused).
+ * @param pred Find predicate.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ bool
+ operator()(RandomAccessIterator1 i1, RandomAccessIterator2 i2, Pred pred)
+ { return !pred(*i1, *i2); }
+
+ /**
+ * @brief Corresponding sequential algorithm on a sequence.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param pred Find predicate.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ sequential_algorithm(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred)
+ { return mismatch(begin1, end1, begin2, pred, sequential_tag()); }
+ };
+
+
+ /** @brief Test predicate on several elements. */
+ template<typename ForwardIterator>
+ struct find_first_of_selector : public generic_find_selector
+ {
+ ForwardIterator begin;
+ ForwardIterator end;
+
+ explicit find_first_of_selector(ForwardIterator begin, ForwardIterator end)
+ : begin(begin), end(end) { }
+
+ /** @brief Test on one position.
+ * @param i1 Iterator on first sequence.
+ * @param i2 Iterator on second sequence (unused).
+ * @param pred Find predicate. */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ bool
+ operator()(RandomAccessIterator1 i1, RandomAccessIterator2 i2, Pred pred)
+ {
+ for (ForwardIterator pos_in_candidates = begin;
+ pos_in_candidates != end; ++pos_in_candidates)
+ if (pred(*i1, *pos_in_candidates))
+ return true;
+ return false;
+ }
+
+ /** @brief Corresponding sequential algorithm on a sequence.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param pred Find predicate. */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename Pred>
+ std::pair<RandomAccessIterator1, RandomAccessIterator2>
+ sequential_algorithm(RandomAccessIterator1 begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2 begin2, Pred pred)
+ { return std::make_pair(find_first_of(begin1, end1, begin, end, pred,
+ sequential_tag()), begin2); }
+ };
+}
+
+#endif /* _GLIBCXX_PARALLEL_FIND_SELECTORS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/for_each.h b/gcc-4.4.0/libstdc++-v3/include/parallel/for_each.h
new file mode 100644
index 000000000..61158f865
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/for_each.h
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/for_each.h
+ * @brief Main interface for embarrassingly parallel functions.
+ *
+ * The explicit implementation are in other header files, like
+ * workstealing.h, par_loop.h, omp_loop.h, and omp_loop_static.h.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_FOR_EACH_H
+#define _GLIBCXX_PARALLEL_FOR_EACH_H 1
+
+#include <parallel/settings.h>
+#include <parallel/par_loop.h>
+#include <parallel/omp_loop.h>
+#include <parallel/workstealing.h>
+
+namespace __gnu_parallel
+{
+ /** @brief Chose the desired algorithm by evaluating @c parallelism_tag.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param user_op A user-specified functor (comparator, predicate,
+ * associative operator,...)
+ * @param functionality functor to "process" an element with
+ * user_op (depends on desired functionality, e. g. accumulate,
+ * for_each,...
+ * @param reduction Reduction functor.
+ * @param reduction_start Initial value for reduction.
+ * @param output Output iterator.
+ * @param bound Maximum number of elements processed.
+ * @param parallelism_tag Parallelization method */
+ template<typename InputIterator, typename UserOp,
+ typename Functionality, typename Red, typename Result>
+ UserOp
+ for_each_template_random_access(InputIterator begin, InputIterator end,
+ UserOp user_op,
+ Functionality& functionality,
+ Red reduction, Result reduction_start,
+ Result& output, typename
+ std::iterator_traits<InputIterator>::
+ difference_type bound,
+ _Parallelism parallelism_tag)
+ {
+ if (parallelism_tag == parallel_unbalanced)
+ return for_each_template_random_access_ed(begin, end, user_op,
+ functionality, reduction,
+ reduction_start,
+ output, bound);
+ else if (parallelism_tag == parallel_omp_loop)
+ return for_each_template_random_access_omp_loop(begin, end, user_op,
+ functionality,
+ reduction,
+ reduction_start,
+ output, bound);
+ else if (parallelism_tag == parallel_omp_loop_static)
+ return for_each_template_random_access_omp_loop(begin, end, user_op,
+ functionality,
+ reduction,
+ reduction_start,
+ output, bound);
+ else //e. g. parallel_balanced
+ return for_each_template_random_access_workstealing(begin, end,
+ user_op,
+ functionality,
+ reduction,
+ reduction_start,
+ output, bound);
+ }
+}
+
+#endif /* _GLIBCXX_PARALLEL_FOR_EACH_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/for_each_selectors.h b/gcc-4.4.0/libstdc++-v3/include/parallel/for_each_selectors.h
new file mode 100644
index 000000000..b46d30f51
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/for_each_selectors.h
@@ -0,0 +1,360 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/for_each_selectors.h
+ * @brief Functors representing different tasks to be plugged into the
+ * generic parallelization methods for embarrassingly parallel functions.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H
+#define _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H 1
+
+#include <parallel/basic_iterator.h>
+
+namespace __gnu_parallel
+{
+
+ /** @brief Generic selector for embarrassingly parallel functions. */
+ template<typename It>
+ struct generic_for_each_selector
+ {
+ /** @brief Iterator on last element processed; needed for some
+ * algorithms (e. g. std::transform()).
+ */
+ It finish_iterator;
+ };
+
+
+ /** @brief std::for_each() selector. */
+ template<typename It>
+ struct for_each_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator.
+ * @param i Iterator referencing object. */
+ template<typename Op>
+ bool
+ operator()(Op& o, It i)
+ {
+ o(*i);
+ return true;
+ }
+ };
+
+ /** @brief std::generate() selector. */
+ template<typename It>
+ struct generate_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator.
+ * @param i Iterator referencing object. */
+ template<typename Op>
+ bool
+ operator()(Op& o, It i)
+ {
+ *i = o();
+ return true;
+ }
+ };
+
+ /** @brief std::fill() selector. */
+ template<typename It>
+ struct fill_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param v Current value.
+ * @param i Iterator referencing object. */
+ template<typename Val>
+ bool
+ operator()(Val& v, It i)
+ {
+ *i = v;
+ return true;
+ }
+ };
+
+ /** @brief std::transform() selector, one input sequence variant. */
+ template<typename It>
+ struct transform1_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator.
+ * @param i Iterator referencing object. */
+ template<typename Op>
+ bool
+ operator()(Op& o, It i)
+ {
+ *i.second = o(*i.first);
+ return true;
+ }
+ };
+
+ /** @brief std::transform() selector, two input sequences variant. */
+ template<typename It>
+ struct transform2_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator.
+ * @param i Iterator referencing object. */
+ template<typename Op>
+ bool
+ operator()(Op& o, It i)
+ {
+ *i.third = o(*i.first, *i.second);
+ return true;
+ }
+ };
+
+ /** @brief std::replace() selector. */
+ template<typename It, typename T>
+ struct replace_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Value to replace with. */
+ const T& new_val;
+
+ /** @brief Constructor
+ * @param new_val Value to replace with. */
+ explicit
+ replace_selector(const T &new_val) : new_val(new_val) {}
+
+ /** @brief Functor execution.
+ * @param v Current value.
+ * @param i Iterator referencing object. */
+ bool
+ operator()(T& v, It i)
+ {
+ if (*i == v)
+ *i = new_val;
+ return true;
+ }
+ };
+
+ /** @brief std::replace() selector. */
+ template<typename It, typename Op, typename T>
+ struct replace_if_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Value to replace with. */
+ const T& new_val;
+
+ /** @brief Constructor.
+ * @param new_val Value to replace with. */
+ explicit
+ replace_if_selector(const T &new_val) : new_val(new_val) { }
+
+ /** @brief Functor execution.
+ * @param o Operator.
+ * @param i Iterator referencing object. */
+ bool
+ operator()(Op& o, It i)
+ {
+ if (o(*i))
+ *i = new_val;
+ return true;
+ }
+ };
+
+ /** @brief std::count() selector. */
+ template<typename It, typename Diff>
+ struct count_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param v Current value.
+ * @param i Iterator referencing object.
+ * @return 1 if count, 0 if does not count. */
+ template<typename Val>
+ Diff
+ operator()(Val& v, It i)
+ { return (v == *i) ? 1 : 0; }
+ };
+
+ /** @brief std::count_if () selector. */
+ template<typename It, typename Diff>
+ struct count_if_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator.
+ * @param i Iterator referencing object.
+ * @return 1 if count, 0 if does not count. */
+ template<typename Op>
+ Diff
+ operator()(Op& o, It i)
+ { return (o(*i)) ? 1 : 0; }
+ };
+
+ /** @brief std::accumulate() selector. */
+ template<typename It>
+ struct accumulate_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator (unused).
+ * @param i Iterator referencing object.
+ * @return The current value. */
+ template<typename Op>
+ typename std::iterator_traits<It>::value_type operator()(Op o, It i)
+ { return *i; }
+ };
+
+ /** @brief std::inner_product() selector. */
+ template<typename It, typename It2, typename T>
+ struct inner_product_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Begin iterator of first sequence. */
+ It begin1_iterator;
+
+ /** @brief Begin iterator of second sequence. */
+ It2 begin2_iterator;
+
+ /** @brief Constructor.
+ * @param b1 Begin iterator of first sequence.
+ * @param b2 Begin iterator of second sequence. */
+ explicit
+ inner_product_selector(It b1, It2 b2)
+ : begin1_iterator(b1), begin2_iterator(b2) { }
+
+ /** @brief Functor execution.
+ * @param mult Multiplication functor.
+ * @param current Iterator referencing object.
+ * @return Inner product elemental result. */
+ template<typename Op>
+ T
+ operator()(Op mult, It current)
+ {
+ typename std::iterator_traits<It>::difference_type position
+ = current - begin1_iterator;
+ return mult(*current, *(begin2_iterator + position));
+ }
+ };
+
+ /** @brief Selector that just returns the passed iterator. */
+ template<typename It>
+ struct identity_selector : public generic_for_each_selector<It>
+ {
+ /** @brief Functor execution.
+ * @param o Operator (unused).
+ * @param i Iterator referencing object.
+ * @return Passed iterator. */
+ template<typename Op>
+ It
+ operator()(Op o, It i)
+ { return i; }
+ };
+
+ /** @brief Selector that returns the difference between two adjacent
+ * elements.
+ */
+ template<typename It>
+ struct adjacent_difference_selector : public generic_for_each_selector<It>
+ {
+ template<typename Op>
+ bool
+ operator()(Op& o, It i)
+ {
+ typename It::first_type go_back_one = i.first;
+ --go_back_one;
+ *i.second = o(*i.first, *go_back_one);
+ return true;
+ }
+ };
+
+ // XXX move into type_traits?
+ /** @brief Functor doing nothing
+ *
+ * For some reduction tasks (this is not a function object, but is
+ * passed as selector dummy parameter.
+ */
+ struct nothing
+ {
+ /** @brief Functor execution.
+ * @param i Iterator referencing object. */
+ template<typename It>
+ void
+ operator()(It i) { }
+ };
+
+ /** @brief Reduction function doing nothing. */
+ struct dummy_reduct
+ {
+ bool
+ operator()(bool /*x*/, bool /*y*/) const
+ { return true; }
+ };
+
+ /** @brief Reduction for finding the maximum element, using a comparator. */
+ template<typename Comp, typename It>
+ struct min_element_reduct
+ {
+ Comp& comp;
+
+ explicit
+ min_element_reduct(Comp &c) : comp(c) { }
+
+ It
+ operator()(It x, It y)
+ {
+ if (comp(*x, *y))
+ return x;
+ else
+ return y;
+ }
+ };
+
+ /** @brief Reduction for finding the maximum element, using a comparator. */
+ template<typename Comp, typename It>
+ struct max_element_reduct
+ {
+ Comp& comp;
+
+ explicit
+ max_element_reduct(Comp& c) : comp(c) { }
+
+ It
+ operator()(It x, It y)
+ {
+ if (comp(*x, *y))
+ return y;
+ else
+ return x;
+ }
+ };
+
+ /** @brief General reduction, using a binary operator. */
+ template<typename BinOp>
+ struct accumulate_binop_reduct
+ {
+ BinOp& binop;
+
+ explicit
+ accumulate_binop_reduct(BinOp& b) : binop(b) { }
+
+ template<typename Result, typename Addend>
+ Result
+ operator()(const Result& x, const Addend& y)
+ { return binop(x, y); }
+ };
+}
+
+#endif /* _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/iterator.h b/gcc-4.4.0/libstdc++-v3/include/parallel/iterator.h
new file mode 100644
index 000000000..c9bfd5a2f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/iterator.h
@@ -0,0 +1,200 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/iterator.h
+ * @brief Helper iterator classes for the std::transform() functions.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_ITERATOR_H
+#define _GLIBCXX_PARALLEL_ITERATOR_H 1
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_pair.h>
+
+namespace __gnu_parallel
+{
+ /** @brief A pair of iterators. The usual iterator operations are
+ * applied to both child iterators.
+ */
+ template<typename Iterator1, typename Iterator2, typename IteratorCategory>
+ class iterator_pair : public std::pair<Iterator1, Iterator2>
+ {
+ private:
+ typedef iterator_pair<Iterator1, Iterator2, IteratorCategory> type;
+ typedef std::pair<Iterator1, Iterator2> base_type;
+
+ public:
+ typedef IteratorCategory iterator_category;
+ typedef void value_type;
+
+ typedef std::iterator_traits<Iterator1> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef type* pointer;
+ typedef type& reference;
+
+ iterator_pair() { }
+
+ iterator_pair(const Iterator1& first, const Iterator2& second)
+ : base_type(first, second) { }
+
+ // Pre-increment operator.
+ type&
+ operator++()
+ {
+ ++base_type::first;
+ ++base_type::second;
+ return *this;
+ }
+
+ // Post-increment operator.
+ const type
+ operator++(int)
+ { return type(base_type::first++, base_type::second++); }
+
+ // Pre-decrement operator.
+ type&
+ operator--()
+ {
+ --base_type::first;
+ --base_type::second;
+ return *this;
+ }
+
+ // Post-decrement operator.
+ const type
+ operator--(int)
+ { return type(base_type::first--, base_type::second--); }
+
+ // Type conversion.
+ operator Iterator2() const
+ { return base_type::second; }
+
+ type&
+ operator=(const type& other)
+ {
+ base_type::first = other.first;
+ base_type::second = other.second;
+ return *this;
+ }
+
+ type
+ operator+(difference_type delta) const
+ { return type(base_type::first + delta, base_type::second + delta); }
+
+ difference_type
+ operator-(const type& other) const
+ { return base_type::first - other.first; }
+ };
+
+
+ /** @brief A triple of iterators. The usual iterator operations are
+ applied to all three child iterators.
+ */
+ template<typename Iterator1, typename Iterator2, typename Iterator3,
+ typename IteratorCategory>
+ class iterator_triple
+ {
+ private:
+ typedef iterator_triple<Iterator1, Iterator2, Iterator3,
+ IteratorCategory> type;
+
+ public:
+ typedef IteratorCategory iterator_category;
+ typedef void value_type;
+ typedef typename std::iterator_traits<Iterator1>::difference_type
+ difference_type;
+ typedef type* pointer;
+ typedef type& reference;
+
+ Iterator1 first;
+ Iterator2 second;
+ Iterator3 third;
+
+ iterator_triple() { }
+
+ iterator_triple(const Iterator1& _first, const Iterator2& _second,
+ const Iterator3& _third)
+ {
+ first = _first;
+ second = _second;
+ third = _third;
+ }
+
+ // Pre-increment operator.
+ type&
+ operator++()
+ {
+ ++first;
+ ++second;
+ ++third;
+ return *this;
+ }
+
+ // Post-increment operator.
+ const type
+ operator++(int)
+ { return type(first++, second++, third++); }
+
+ // Pre-decrement operator.
+ type&
+ operator--()
+ {
+ --first;
+ --second;
+ --third;
+ return *this;
+ }
+
+ // Post-decrement operator.
+ const type
+ operator--(int)
+ { return type(first--, second--, third--); }
+
+ // Type conversion.
+ operator Iterator3() const
+ { return third; }
+
+ type&
+ operator=(const type& other)
+ {
+ first = other.first;
+ second = other.second;
+ third = other.third;
+ return *this;
+ }
+
+ type
+ operator+(difference_type delta) const
+ { return type(first + delta, second + delta, third + delta); }
+
+ difference_type
+ operator-(const type& other) const
+ { return first - other.first; }
+ };
+}
+
+#endif /* _GLIBCXX_PARALLEL_ITERATOR_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/list_partition.h b/gcc-4.4.0/libstdc++-v3/include/parallel/list_partition.h
new file mode 100644
index 000000000..a359a3f3a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/list_partition.h
@@ -0,0 +1,176 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/list_partition.h
+ * @brief Functionality to split sequence referenced by only input
+ * iterators.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Leonor Frias Moya and Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_LIST_PARTITION_H
+#define _GLIBCXX_PARALLEL_LIST_PARTITION_H 1
+
+#include <parallel/parallel.h>
+#include <vector>
+
+namespace __gnu_parallel
+{
+ /** @brief Shrinks and doubles the ranges.
+ * @param os_starts Start positions worked on (oversampled).
+ * @param count_to_two Counts up to 2.
+ * @param range_length Current length of a chunk.
+ * @param make_twice Whether the @c os_starts is allowed to be
+ * grown or not
+ */
+ template<typename InputIterator>
+ void
+ shrink_and_double(std::vector<InputIterator>& os_starts,
+ size_t& count_to_two, size_t& range_length,
+ const bool make_twice)
+ {
+ ++count_to_two;
+ if (not make_twice or count_to_two < 2)
+ shrink(os_starts, count_to_two, range_length);
+ else
+ {
+ os_starts.resize((os_starts.size() - 1) * 2 + 1);
+ count_to_two = 0;
+ }
+ }
+
+ /** @brief Combines two ranges into one and thus halves the number of ranges.
+ * @param os_starts Start positions worked on (oversampled).
+ * @param count_to_two Counts up to 2.
+ * @param range_length Current length of a chunk. */
+ template<typename InputIterator>
+ void
+ shrink(std::vector<InputIterator>& os_starts, size_t& count_to_two,
+ size_t& range_length)
+ {
+ for (typename std::vector<InputIterator>::size_type i = 0;
+ i <= (os_starts.size() / 2); ++i)
+ os_starts[i] = os_starts[i * 2];
+ range_length *= 2;
+ }
+
+ /** @brief Splits a sequence given by input iterators into parts of
+ * almost equal size
+ *
+ * The function needs only one pass over the sequence.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param starts Start iterators for the resulting parts, dimension
+ * @c num_parts+1. For convenience, @c starts @c [num_parts]
+ * contains the end iterator of the sequence.
+ * @param lengths Length of the resulting parts.
+ * @param num_parts Number of parts to split the sequence into.
+ * @param f Functor to be applied to each element by traversing it
+ * @param oversampling Oversampling factor. If 0, then the
+ * partitions will differ in at most @f$ \sqrt{\mathrm{end} -
+ * \mathrm{begin}} @f$ elements. Otherwise, the ratio between the
+ * longest and the shortest part is bounded by @f$
+ * 1/(\mathrm{oversampling} \cdot \mathrm{num\_parts}) @f$.
+ * @return Length of the whole sequence.
+ */
+ template<typename InputIterator, typename FunctorType>
+ size_t
+ list_partition(const InputIterator begin, const InputIterator end,
+ InputIterator* starts, size_t* lengths, const int num_parts,
+ FunctorType& f, int oversampling = 0)
+ {
+ bool make_twice = false;
+
+ // The resizing algorithm is chosen according to the oversampling factor.
+ if (oversampling == 0)
+ {
+ make_twice = true;
+ oversampling = 1;
+ }
+
+ std::vector<InputIterator> os_starts(2 * oversampling * num_parts + 1);
+
+ os_starts[0]= begin;
+ InputIterator prev = begin, it = begin;
+ size_t dist_limit = 0, dist = 0;
+ size_t cur = 1, next = 1;
+ size_t range_length = 1;
+ size_t count_to_two = 0;
+ while (it != end)
+ {
+ cur = next;
+ for (; cur < os_starts.size() and it != end; ++cur)
+ {
+ for (dist_limit += range_length;
+ dist < dist_limit and it != end; ++dist)
+ {
+ f(it);
+ ++it;
+ }
+ os_starts[cur] = it;
+ }
+
+ // Must compare for end and not cur < os_starts.size() , because
+ // cur could be == os_starts.size() as well
+ if (it == end)
+ break;
+
+ shrink_and_double(os_starts, count_to_two, range_length, make_twice);
+ next = os_starts.size() / 2 + 1;
+ }
+
+ // Calculation of the parts (one must be extracted from current
+ // because the partition beginning at end, consists only of
+ // itself).
+ size_t size_part = (cur - 1) / num_parts;
+ int size_greater = static_cast<int>((cur - 1) % num_parts);
+ starts[0] = os_starts[0];
+
+ size_t index = 0;
+
+ // Smallest partitions.
+ for (int i = 1; i < (num_parts + 1 - size_greater); ++i)
+ {
+ lengths[i - 1] = size_part * range_length;
+ index += size_part;
+ starts[i] = os_starts[index];
+ }
+
+ // Biggest partitions.
+ for (int i = num_parts + 1 - size_greater; i <= num_parts; ++i)
+ {
+ lengths[i - 1] = (size_part+1) * range_length;
+ index += (size_part+1);
+ starts[i] = os_starts[index];
+ }
+
+ // Correction of the end size (the end iteration has not finished).
+ lengths[num_parts - 1] -= (dist_limit - dist);
+
+ return dist;
+ }
+}
+
+#endif /* _GLIBCXX_PARALLEL_LIST_PARTITION_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/losertree.h b/gcc-4.4.0/libstdc++-v3/include/parallel/losertree.h
new file mode 100644
index 000000000..6dbd59288
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/losertree.h
@@ -0,0 +1,1021 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/losertree.h
+* @brief Many generic loser tree variants.
+* This file is a GNU parallel extension to the Standard C++ Library.
+*/
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_LOSERTREE_H
+#define _GLIBCXX_PARALLEL_LOSERTREE_H 1
+
+#include <functional>
+
+#include <bits/stl_algobase.h>
+#include <parallel/features.h>
+#include <parallel/base.h>
+
+namespace __gnu_parallel
+{
+
+/**
+ * @brief Guarded loser/tournament tree.
+ *
+ * The smallest element is at the top.
+ *
+ * Guarding is done explicitly through one flag sup per element,
+ * inf is not needed due to a better initialization routine. This
+ * is a well-performing variant.
+ *
+ * @param T the element type
+ * @param Comparator the comparator to use, defaults to std::less<T>
+ */
+template<typename T, typename Comparator>
+class LoserTreeBase
+{
+protected:
+ /** @brief Internal representation of a LoserTree element. */
+ struct Loser
+ {
+ /** @brief flag, true iff this is a "maximum" sentinel. */
+ bool sup;
+ /** @brief index of the source sequence. */
+ int source;
+ /** @brief key of the element in the LoserTree. */
+ T key;
+ };
+
+ unsigned int ik, k, offset;
+
+ /** log_2{k} */
+ unsigned int _M_log_k;
+
+ /** @brief LoserTree elements. */
+ Loser* losers;
+
+ /** @brief Comparator to use. */
+ Comparator comp;
+
+ /**
+ * @brief State flag that determines whether the LoserTree is empty.
+ *
+ * Only used for building the LoserTree.
+ */
+ bool first_insert;
+
+public:
+ /**
+ * @brief The constructor.
+ *
+ * @param _k The number of sequences to merge.
+ * @param _comp The comparator to use.
+ */
+ LoserTreeBase(unsigned int _k, Comparator _comp)
+ : comp(_comp)
+ {
+ ik = _k;
+
+ // Compute log_2{k} for the Loser Tree
+ _M_log_k = __log2(ik - 1) + 1;
+
+ // Next greater power of 2.
+ k = 1 << _M_log_k;
+ offset = k;
+
+ // Avoid default-constructing losers[].key
+ losers = static_cast<Loser*>(::operator new(2 * k * sizeof(Loser)));
+ for (unsigned int i = ik - 1; i < k; ++i)
+ losers[i + k].sup = true;
+
+ first_insert = true;
+ }
+
+ /**
+ * @brief The destructor.
+ */
+ ~LoserTreeBase()
+ { ::operator delete(losers); }
+
+ /**
+ * @brief Initializes the sequence "source" with the element "key".
+ *
+ * @param key the element to insert
+ * @param source index of the source sequence
+ * @param sup flag that determines whether the value to insert is an
+ * explicit supremum.
+ */
+ inline void
+ insert_start(const T& key, int source, bool sup)
+ {
+ unsigned int pos = k + source;
+
+ if(first_insert)
+ {
+ // Construct all keys, so we can easily deconstruct them.
+ for (unsigned int i = 0; i < (2 * k); ++i)
+ new(&(losers[i].key)) T(key);
+ first_insert = false;
+ }
+ else
+ new(&(losers[pos].key)) T(key);
+
+ losers[pos].sup = sup;
+ losers[pos].source = source;
+ }
+
+ /**
+ * @return the index of the sequence with the smallest element.
+ */
+ int get_min_source()
+ { return losers[0].source; }
+};
+
+/**
+ * @brief Stable LoserTree variant.
+ *
+ * Provides the stable implementations of insert_start, init_winner,
+ * init and delete_min_insert.
+ *
+ * Unstable variant is done using partial specialisation below.
+ */
+template<bool stable/* default == true */, typename T, typename Comparator>
+class LoserTree : public LoserTreeBase<T, Comparator>
+{
+ typedef LoserTreeBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+ using Base::first_insert;
+
+public:
+ LoserTree(unsigned int _k, Comparator _comp)
+ : Base::LoserTreeBase(_k, _comp)
+ {}
+
+ unsigned int
+ init_winner(unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+ if (losers[right].sup
+ || (!losers[left].sup
+ && !comp(losers[right].key, losers[left].key)))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ void init()
+ { losers[0] = losers[init_winner(1)]; }
+
+ /**
+ * @brief Delete the smallest element and insert a new element from
+ * the previously smallest element's sequence.
+ *
+ * This implementation is stable.
+ */
+ // Do not pass a const reference since key will be used as local variable.
+ void delete_min_insert(T key, bool sup)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted, ties are broken by source.
+ if ((sup && (!losers[pos].sup || losers[pos].source < source))
+ || (!sup && !losers[pos].sup
+ && ((comp(losers[pos].key, key))
+ || (!comp(key, losers[pos].key)
+ && losers[pos].source < source))))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].sup, sup);
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].key, key);
+ }
+ }
+
+ losers[0].sup = sup;
+ losers[0].source = source;
+ losers[0].key = key;
+ }
+};
+
+/**
+ * @brief Unstable LoserTree variant.
+ *
+ * Stability (non-stable here) is selected with partial specialization.
+ */
+template<typename T, typename Comparator>
+class LoserTree</* stable == */false, T, Comparator> :
+ public LoserTreeBase<T, Comparator>
+{
+ typedef LoserTreeBase<T, Comparator> Base;
+ using Base::_M_log_k;
+ using Base::k;
+ using Base::losers;
+ using Base::first_insert;
+
+public:
+ LoserTree(unsigned int _k, Comparator _comp)
+ : Base::LoserTreeBase(_k, _comp)
+ {}
+
+ /**
+ * Computes the winner of the competition at position "root".
+ *
+ * Called recursively (starting at 0) to build the initial tree.
+ *
+ * @param root index of the "game" to start.
+ */
+ unsigned int
+ init_winner (unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+ if (losers[right].sup ||
+ (!losers[left].sup
+ && !comp(losers[right].key, losers[left].key)))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ inline void
+ init()
+ { losers[0] = losers[init_winner(1)]; }
+
+ /**
+ * Delete the key smallest element and insert the element key instead.
+ *
+ * @param key the key to insert
+ * @param sup true iff key is an explicitly marked supremum
+ */
+ // Do not pass a const reference since key will be used as local variable.
+ inline void
+ delete_min_insert(T key, bool sup)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted.
+ if (sup || (!losers[pos].sup && comp(losers[pos].key, key)))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].sup, sup);
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].key, key);
+ }
+ }
+
+ losers[0].sup = sup;
+ losers[0].source = source;
+ losers[0].key = key;
+ }
+};
+
+
+/**
+ * @brief Base class of Loser Tree implementation using pointers.
+ */
+template<typename T, typename Comparator>
+class LoserTreePointerBase
+{
+protected:
+ /** @brief Internal representation of LoserTree elements. */
+ struct Loser
+ {
+ bool sup;
+ int source;
+ const T* keyp;
+ };
+
+ unsigned int ik, k, offset;
+ Loser* losers;
+ Comparator comp;
+
+public:
+ LoserTreePointerBase(unsigned int _k, Comparator _comp = std::less<T>())
+ : comp(_comp)
+ {
+ ik = _k;
+
+ // Next greater power of 2.
+ k = 1 << (__log2(ik - 1) + 1);
+ offset = k;
+ losers = new Loser[k * 2];
+ for (unsigned int i = ik - 1; i < k; i++)
+ losers[i + k].sup = true;
+ }
+
+ ~LoserTreePointerBase()
+ { ::operator delete[](losers); }
+
+ int get_min_source()
+ { return losers[0].source; }
+
+ void insert_start(const T& key, int source, bool sup)
+ {
+ unsigned int pos = k + source;
+
+ losers[pos].sup = sup;
+ losers[pos].source = source;
+ losers[pos].keyp = &key;
+ }
+};
+
+/**
+ * @brief Stable LoserTree implementation.
+ *
+ * The unstable variant is implemented using partial instantiation below.
+ */
+template<bool stable/* default == true */, typename T, typename Comparator>
+class LoserTreePointer : public LoserTreePointerBase<T, Comparator>
+{
+ typedef LoserTreePointerBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+
+public:
+ LoserTreePointer(unsigned int _k, Comparator _comp = std::less<T>())
+ : Base::LoserTreePointerBase(_k, _comp)
+ {}
+
+ unsigned int
+ init_winner(unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+ if (losers[right].sup
+ || (!losers[left].sup && !comp(*losers[right].keyp,
+ *losers[left].keyp)))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ void init()
+ { losers[0] = losers[init_winner(1)]; }
+
+ void delete_min_insert(const T& key, bool sup)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ const T* keyp = &key;
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted, ties are broken by source.
+ if ((sup && (!losers[pos].sup || losers[pos].source < source)) ||
+ (!sup && !losers[pos].sup &&
+ ((comp(*losers[pos].keyp, *keyp)) ||
+ (!comp(*keyp, *losers[pos].keyp)
+ && losers[pos].source < source))))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].sup, sup);
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].keyp, keyp);
+ }
+ }
+
+ losers[0].sup = sup;
+ losers[0].source = source;
+ losers[0].keyp = keyp;
+ }
+};
+
+/**
+ * @brief Unstable LoserTree implementation.
+ *
+ * The stable variant is above.
+ */
+template<typename T, typename Comparator>
+class LoserTreePointer</* stable == */false, T, Comparator> :
+ public LoserTreePointerBase<T, Comparator>
+{
+ typedef LoserTreePointerBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+
+public:
+ LoserTreePointer(unsigned int _k, Comparator _comp = std::less<T>())
+ : Base::LoserTreePointerBase(_k, _comp)
+ {}
+
+ unsigned int
+ init_winner(unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+ if (losers[right].sup
+ || (!losers[left].sup
+ && !comp(*losers[right].keyp, *losers[left].keyp)))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ void init()
+ { losers[0] = losers[init_winner(1)]; }
+
+ void delete_min_insert(const T& key, bool sup)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ const T* keyp = &key;
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted.
+ if (sup || (!losers[pos].sup && comp(*losers[pos].keyp, *keyp)))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].sup, sup);
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].keyp, keyp);
+ }
+ }
+
+ losers[0].sup = sup;
+ losers[0].source = source;
+ losers[0].keyp = keyp;
+ }
+};
+
+/** @brief Base class for unguarded LoserTree implementation.
+ *
+ * The whole element is copied into the tree structure.
+ *
+ * No guarding is done, therefore not a single input sequence must
+ * run empty. Unused sequence heads are marked with a sentinel which
+ * is &gt; all elements that are to be merged.
+ *
+ * This is a very fast variant.
+ */
+template<typename T, typename Comparator>
+class LoserTreeUnguardedBase
+{
+protected:
+ struct Loser
+ {
+ int source;
+ T key;
+ };
+
+ unsigned int ik, k, offset;
+ Loser* losers;
+ Comparator comp;
+
+public:
+ inline
+ LoserTreeUnguardedBase(unsigned int _k, const T _sentinel,
+ Comparator _comp = std::less<T>())
+ : comp(_comp)
+ {
+ ik = _k;
+
+ // Next greater power of 2.
+ k = 1 << (__log2(ik - 1) + 1);
+ offset = k;
+ // Avoid default-constructing losers[].key
+ losers = static_cast<Loser*>(::operator new(2 * k * sizeof(Loser)));
+
+ for (unsigned int i = k + ik - 1; i < (2 * k); ++i)
+ {
+ losers[i].key = _sentinel;
+ losers[i].source = -1;
+ }
+ }
+
+ inline ~LoserTreeUnguardedBase()
+ { ::operator delete(losers); }
+
+ inline int
+ get_min_source()
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+ return losers[0].source;
+ }
+
+ inline void
+ insert_start(const T& key, int source, bool)
+ {
+ unsigned int pos = k + source;
+
+ new(&(losers[pos].key)) T(key);
+ losers[pos].source = source;
+ }
+};
+
+/**
+ * @brief Stable implementation of unguarded LoserTree.
+ *
+ * Unstable variant is selected below with partial specialization.
+ */
+template<bool stable/* default == true */, typename T, typename Comparator>
+class LoserTreeUnguarded : public LoserTreeUnguardedBase<T, Comparator>
+{
+ typedef LoserTreeUnguardedBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+
+public:
+ LoserTreeUnguarded(unsigned int _k, const T _sentinel,
+ Comparator _comp = std::less<T>())
+ : Base::LoserTreeUnguardedBase(_k, _sentinel, _comp)
+ {}
+
+ unsigned int
+ init_winner(unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+ if (!comp(losers[right].key, losers[left].key))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ inline void
+ init()
+ {
+ losers[0] = losers[init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top at the beginning (0 sequences!)
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+ }
+
+ // Do not pass a const reference since key will be used as local variable.
+ inline void
+ delete_min_insert(T key, bool)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted, ties are broken by source.
+ if (comp(losers[pos].key, key)
+ || (!comp(key, losers[pos].key) && losers[pos].source < source))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].key, key);
+ }
+ }
+
+ losers[0].source = source;
+ losers[0].key = key;
+ }
+};
+
+/**
+ * @brief Non-Stable implementation of unguarded LoserTree.
+ *
+ * Stable implementation is above.
+ */
+template<typename T, typename Comparator>
+class LoserTreeUnguarded</* stable == */false, T, Comparator> :
+ public LoserTreeUnguardedBase<T, Comparator>
+{
+ typedef LoserTreeUnguardedBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+
+public:
+ LoserTreeUnguarded(unsigned int _k, const T _sentinel,
+ Comparator _comp = std::less<T>())
+ : Base::LoserTreeUnguardedBase(_k, _sentinel, _comp)
+ {}
+
+ unsigned int
+ init_winner (unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+
+#if _GLIBCXX_ASSERTIONS
+ // If left one is sentinel then right one must be, too.
+ if (losers[left].source == -1)
+ _GLIBCXX_PARALLEL_ASSERT(losers[right].source == -1);
+#endif
+
+ if (!comp(losers[right].key, losers[left].key))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ inline void
+ init()
+ {
+ losers[0] = losers[init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top at the beginning (0 sequences!)
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+ }
+
+ // Do not pass a const reference since key will be used as local variable.
+ inline void
+ delete_min_insert(T key, bool)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted.
+ if (comp(losers[pos].key, key))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].key, key);
+ }
+ }
+
+ losers[0].source = source;
+ losers[0].key = key;
+ }
+};
+
+/** @brief Unguarded loser tree, keeping only pointers to the
+* elements in the tree structure.
+*
+* No guarding is done, therefore not a single input sequence must
+* run empty. This is a very fast variant.
+*/
+template<typename T, typename Comparator>
+class LoserTreePointerUnguardedBase
+{
+protected:
+ struct Loser
+ {
+ int source;
+ const T* keyp;
+ };
+
+ unsigned int ik, k, offset;
+ Loser* losers;
+ Comparator comp;
+
+public:
+
+ inline
+ LoserTreePointerUnguardedBase(unsigned int _k, const T& _sentinel,
+ Comparator _comp = std::less<T>())
+ : comp(_comp)
+ {
+ ik = _k;
+
+ // Next greater power of 2.
+ k = 1 << (__log2(ik - 1) + 1);
+ offset = k;
+ // Avoid default-constructing losers[].key
+ losers = new Loser[2 * k];
+
+ for (unsigned int i = k + ik - 1; i < (2 * k); ++i)
+ {
+ losers[i].keyp = &_sentinel;
+ losers[i].source = -1;
+ }
+ }
+
+ inline ~LoserTreePointerUnguardedBase()
+ { delete[] losers; }
+
+ inline int
+ get_min_source()
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+ return losers[0].source;
+ }
+
+ inline void
+ insert_start(const T& key, int source, bool)
+ {
+ unsigned int pos = k + source;
+
+ losers[pos].keyp = &key;
+ losers[pos].source = source;
+ }
+};
+
+/**
+ * @brief Stable unguarded LoserTree variant storing pointers.
+ *
+ * Unstable variant is implemented below using partial specialization.
+ */
+template<bool stable/* default == true */, typename T, typename Comparator>
+class LoserTreePointerUnguarded :
+ public LoserTreePointerUnguardedBase<T, Comparator>
+{
+ typedef LoserTreePointerUnguardedBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+
+public:
+ LoserTreePointerUnguarded(unsigned int _k, const T& _sentinel,
+ Comparator _comp = std::less<T>())
+ : Base::LoserTreePointerUnguardedBase(_k, _sentinel, _comp)
+ {}
+
+ unsigned int
+ init_winner(unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+ if (!comp(*losers[right].keyp, *losers[left].keyp))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ inline void
+ init()
+ {
+ losers[0] = losers[init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top at the beginning (0 sequences!)
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+ }
+
+ inline void
+ delete_min_insert(const T& key, bool sup)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ const T* keyp = &key;
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted, ties are broken by source.
+ if (comp(*losers[pos].keyp, *keyp)
+ || (!comp(*keyp, *losers[pos].keyp) && losers[pos].source < source))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].keyp, keyp);
+ }
+ }
+
+ losers[0].source = source;
+ losers[0].keyp = keyp;
+ }
+};
+
+/**
+ * @brief Unstable unguarded LoserTree variant storing pointers.
+ *
+ * Stable variant is above.
+ */
+template<typename T, typename Comparator>
+class LoserTreePointerUnguarded</* stable == */false, T, Comparator> :
+ public LoserTreePointerUnguardedBase<T, Comparator>
+{
+ typedef LoserTreePointerUnguardedBase<T, Comparator> Base;
+ using Base::k;
+ using Base::losers;
+
+public:
+ LoserTreePointerUnguarded(unsigned int _k, const T& _sentinel,
+ Comparator _comp = std::less<T>())
+ : Base::LoserTreePointerUnguardedBase(_k, _sentinel, _comp)
+ {}
+
+ unsigned int
+ init_winner(unsigned int root)
+ {
+ if (root >= k)
+ {
+ return root;
+ }
+ else
+ {
+ unsigned int left = init_winner (2 * root);
+ unsigned int right = init_winner (2 * root + 1);
+
+#if _GLIBCXX_ASSERTIONS
+ // If left one is sentinel then right one must be, too.
+ if (losers[left].source == -1)
+ _GLIBCXX_PARALLEL_ASSERT(losers[right].source == -1);
+#endif
+
+ if (!comp(*losers[right].keyp, *losers[left].keyp))
+ {
+ // Left one is less or equal.
+ losers[root] = losers[right];
+ return left;
+ }
+ else
+ {
+ // Right one is less.
+ losers[root] = losers[left];
+ return right;
+ }
+ }
+ }
+
+ inline void
+ init()
+ {
+ losers[0] = losers[init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top at the beginning (0 sequences!)
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+ }
+
+ inline void
+ delete_min_insert(const T& key, bool sup)
+ {
+#if _GLIBCXX_ASSERTIONS
+ // no dummy sequence can ever be at the top!
+ _GLIBCXX_PARALLEL_ASSERT(losers[0].source != -1);
+#endif
+
+ const T* keyp = &key;
+ int source = losers[0].source;
+ for (unsigned int pos = (k + source) / 2; pos > 0; pos /= 2)
+ {
+ // The smaller one gets promoted.
+ if (comp(*(losers[pos].keyp), *keyp))
+ {
+ // The other one is smaller.
+ std::swap(losers[pos].source, source);
+ std::swap(losers[pos].keyp, keyp);
+ }
+ }
+
+ losers[0].source = source;
+ losers[0].keyp = keyp;
+ }
+};
+
+} // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_LOSERTREE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/merge.h b/gcc-4.4.0/libstdc++-v3/include/parallel/merge.h
new file mode 100644
index 000000000..d947e258a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/merge.h
@@ -0,0 +1,261 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/merge.h
+ * @brief Parallel implementation of std::merge().
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_MERGE_H
+#define _GLIBCXX_PARALLEL_MERGE_H 1
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_algo.h>
+
+namespace __gnu_parallel
+{
+ /** @brief Merge routine being able to merge only the @c max_length
+ * smallest elements.
+ *
+ * The @c begin iterators are advanced accordingly, they might not
+ * reach @c end, in contrast to the usual variant.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param end2 End iterator of second sequence.
+ * @param target Target begin iterator.
+ * @param max_length Maximum number of elements to merge.
+ * @param comp Comparator.
+ * @return Output end iterator. */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputIterator, typename _DifferenceTp,
+ typename Comparator>
+ OutputIterator
+ merge_advance_usual(RandomAccessIterator1& begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2& begin2,
+ RandomAccessIterator2 end2, OutputIterator target,
+ _DifferenceTp max_length, Comparator comp)
+ {
+ typedef _DifferenceTp difference_type;
+ while (begin1 != end1 && begin2 != end2 && max_length > 0)
+ {
+ // array1[i1] < array0[i0]
+ if (comp(*begin2, *begin1))
+ *target++ = *begin2++;
+ else
+ *target++ = *begin1++;
+ --max_length;
+ }
+
+ if (begin1 != end1)
+ {
+ target = std::copy(begin1, begin1 + max_length, target);
+ begin1 += max_length;
+ }
+ else
+ {
+ target = std::copy(begin2, begin2 + max_length, target);
+ begin2 += max_length;
+ }
+ return target;
+ }
+
+ /** @brief Merge routine being able to merge only the @c max_length
+ * smallest elements.
+ *
+ * The @c begin iterators are advanced accordingly, they might not
+ * reach @c end, in contrast to the usual variant.
+ * Specially designed code should allow the compiler to generate
+ * conditional moves instead of branches.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param end2 End iterator of second sequence.
+ * @param target Target begin iterator.
+ * @param max_length Maximum number of elements to merge.
+ * @param comp Comparator.
+ * @return Output end iterator. */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputIterator, typename _DifferenceTp,
+ typename Comparator>
+ OutputIterator
+ merge_advance_movc(RandomAccessIterator1& begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2& begin2,
+ RandomAccessIterator2 end2,
+ OutputIterator target,
+ _DifferenceTp max_length, Comparator comp)
+ {
+ typedef _DifferenceTp difference_type;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type1;
+ typedef typename std::iterator_traits<RandomAccessIterator2>::value_type
+ value_type2;
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(max_length >= 0);
+#endif
+
+ while (begin1 != end1 && begin2 != end2 && max_length > 0)
+ {
+ RandomAccessIterator1 next1 = begin1 + 1;
+ RandomAccessIterator2 next2 = begin2 + 1;
+ value_type1 element1 = *begin1;
+ value_type2 element2 = *begin2;
+
+ if (comp(element2, element1))
+ {
+ element1 = element2;
+ begin2 = next2;
+ }
+ else
+ begin1 = next1;
+
+ *target = element1;
+
+ ++target;
+ --max_length;
+ }
+ if (begin1 != end1)
+ {
+ target = std::copy(begin1, begin1 + max_length, target);
+ begin1 += max_length;
+ }
+ else
+ {
+ target = std::copy(begin2, begin2 + max_length, target);
+ begin2 += max_length;
+ }
+ return target;
+ }
+
+ /** @brief Merge routine being able to merge only the @c max_length
+ * smallest elements.
+ *
+ * The @c begin iterators are advanced accordingly, they might not
+ * reach @c end, in contrast to the usual variant.
+ * Static switch on whether to use the conditional-move variant.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param end2 End iterator of second sequence.
+ * @param target Target begin iterator.
+ * @param max_length Maximum number of elements to merge.
+ * @param comp Comparator.
+ * @return Output end iterator. */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename OutputIterator, typename _DifferenceTp,
+ typename Comparator>
+ inline OutputIterator
+ merge_advance(RandomAccessIterator1& begin1, RandomAccessIterator1 end1,
+ RandomAccessIterator2& begin2, RandomAccessIterator2 end2,
+ OutputIterator target, _DifferenceTp max_length,
+ Comparator comp)
+ {
+ _GLIBCXX_CALL(max_length)
+
+ return merge_advance_movc(begin1, end1, begin2, end2, target,
+ max_length, comp);
+ }
+
+ /** @brief Merge routine fallback to sequential in case the
+ iterators of the two input sequences are of different type.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param end2 End iterator of second sequence.
+ * @param target Target begin iterator.
+ * @param max_length Maximum number of elements to merge.
+ * @param comp Comparator.
+ * @return Output end iterator. */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename RandomAccessIterator3, typename Comparator>
+ inline RandomAccessIterator3
+ parallel_merge_advance(RandomAccessIterator1& begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator2& begin2,
+ // different iterators, parallel implementation
+ // not available
+ RandomAccessIterator2 end2,
+ RandomAccessIterator3 target, typename
+ std::iterator_traits<RandomAccessIterator1>::
+ difference_type max_length, Comparator comp)
+ { return merge_advance(begin1, end1, begin2, end2, target,
+ max_length, comp); }
+
+ /** @brief Parallel merge routine being able to merge only the @c
+ * max_length smallest elements.
+ *
+ * The @c begin iterators are advanced accordingly, they might not
+ * reach @c end, in contrast to the usual variant.
+ * The functionality is projected onto parallel_multiway_merge.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param end2 End iterator of second sequence.
+ * @param target Target begin iterator.
+ * @param max_length Maximum number of elements to merge.
+ * @param comp Comparator.
+ * @return Output end iterator.
+ */
+ template<typename RandomAccessIterator1, typename RandomAccessIterator3,
+ typename Comparator>
+ inline RandomAccessIterator3
+ parallel_merge_advance(RandomAccessIterator1& begin1,
+ RandomAccessIterator1 end1,
+ RandomAccessIterator1& begin2,
+ RandomAccessIterator1 end2,
+ RandomAccessIterator3 target, typename
+ std::iterator_traits<RandomAccessIterator1>::
+ difference_type max_length, Comparator comp)
+ {
+ typedef typename
+ std::iterator_traits<RandomAccessIterator1>::value_type value_type;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::
+ difference_type difference_type1 /* == difference_type2 */;
+ typedef typename std::iterator_traits<RandomAccessIterator3>::
+ difference_type difference_type3;
+ typedef typename std::pair<RandomAccessIterator1, RandomAccessIterator1>
+ iterator_pair;
+
+ iterator_pair
+ seqs[2] = { std::make_pair(begin1, end1),
+ std::make_pair(begin2, end2) };
+ RandomAccessIterator3
+ target_end = parallel_multiway_merge
+ < /* stable = */ true, /* sentinels = */ false>(
+ seqs, seqs + 2, target,
+ multiway_merge_exact_splitting
+ < /* stable = */ true, iterator_pair*,
+ Comparator, difference_type1>,
+ max_length, comp, omp_get_max_threads());
+
+ return target_end;
+ }
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_MERGE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/multiseq_selection.h b/gcc-4.4.0/libstdc++-v3/include/parallel/multiseq_selection.h
new file mode 100644
index 000000000..6ef3d22b1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/multiseq_selection.h
@@ -0,0 +1,633 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/multiseq_selection.h
+ * @brief Functions to find elements of a certain global rank in
+ * multiple sorted sequences. Also serves for splitting such
+ * sequence sets.
+ *
+ * The algorithm description can be found in
+ *
+ * P. J. Varman, S. D. Scheufler, B. R. Iyer, and G. R. Ricard.
+ * Merging Multiple Lists on Hierarchical-Memory Multiprocessors.
+ * Journal of Parallel and Distributed Computing, 12(2):171–177, 1991.
+ *
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H
+#define _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H 1
+
+#include <vector>
+#include <queue>
+
+#include <bits/stl_algo.h>
+
+#include <parallel/sort.h>
+
+namespace __gnu_parallel
+{
+ /** @brief Compare a pair of types lexicographically, ascending. */
+ template<typename T1, typename T2, typename Comparator>
+ class lexicographic
+ : public std::binary_function<std::pair<T1, T2>, std::pair<T1, T2>, bool>
+ {
+ private:
+ Comparator& comp;
+
+ public:
+ lexicographic(Comparator& _comp) : comp(_comp) { }
+
+ bool
+ operator()(const std::pair<T1, T2>& p1,
+ const std::pair<T1, T2>& p2) const
+ {
+ if (comp(p1.first, p2.first))
+ return true;
+
+ if (comp(p2.first, p1.first))
+ return false;
+
+ // Firsts are equal.
+ return p1.second < p2.second;
+ }
+ };
+
+ /** @brief Compare a pair of types lexicographically, descending. */
+ template<typename T1, typename T2, typename Comparator>
+ class lexicographic_reverse : public std::binary_function<T1, T2, bool>
+ {
+ private:
+ Comparator& comp;
+
+ public:
+ lexicographic_reverse(Comparator& _comp) : comp(_comp) { }
+
+ bool
+ operator()(const std::pair<T1, T2>& p1,
+ const std::pair<T1, T2>& p2) const
+ {
+ if (comp(p2.first, p1.first))
+ return true;
+
+ if (comp(p1.first, p2.first))
+ return false;
+
+ // Firsts are equal.
+ return p2.second < p1.second;
+ }
+ };
+
+ /**
+ * @brief Splits several sorted sequences at a certain global rank,
+ * resulting in a splitting point for each sequence.
+ * The sequences are passed via a sequence of random-access
+ * iterator pairs, none of the sequences may be empty. If there
+ * are several equal elements across the split, the ones on the
+ * left side will be chosen from sequences with smaller number.
+ * @param begin_seqs Begin of the sequence of iterator pairs.
+ * @param end_seqs End of the sequence of iterator pairs.
+ * @param rank The global rank to partition at.
+ * @param begin_offsets A random-access sequence begin where the
+ * result will be stored in. Each element of the sequence is an
+ * iterator that points to the first element on the greater part of
+ * the respective sequence.
+ * @param comp The ordering functor, defaults to std::less<T>.
+ */
+ template<typename RanSeqs, typename RankType, typename RankIterator,
+ typename Comparator>
+ void
+ multiseq_partition(RanSeqs begin_seqs, RanSeqs end_seqs,
+ RankType rank,
+ RankIterator begin_offsets,
+ Comparator comp = std::less<
+ typename std::iterator_traits<typename
+ std::iterator_traits<RanSeqs>::value_type::
+ first_type>::value_type>()) // std::less<T>
+ {
+ _GLIBCXX_CALL(end_seqs - begin_seqs)
+
+ typedef typename std::iterator_traits<RanSeqs>::value_type::first_type
+ It;
+ typedef typename std::iterator_traits<It>::difference_type
+ difference_type;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+
+ lexicographic<value_type, int, Comparator> lcomp(comp);
+ lexicographic_reverse<value_type, int, Comparator> lrcomp(comp);
+
+ // Number of sequences, number of elements in total (possibly
+ // including padding).
+ difference_type m = std::distance(begin_seqs, end_seqs), N = 0,
+ nmax, n, r;
+
+ for (int i = 0; i < m; i++)
+ {
+ N += std::distance(begin_seqs[i].first, begin_seqs[i].second);
+ _GLIBCXX_PARALLEL_ASSERT(
+ std::distance(begin_seqs[i].first, begin_seqs[i].second) > 0);
+ }
+
+ if (rank == N)
+ {
+ for (int i = 0; i < m; i++)
+ begin_offsets[i] = begin_seqs[i].second; // Very end.
+ // Return m - 1;
+ return;
+ }
+
+ _GLIBCXX_PARALLEL_ASSERT(m != 0);
+ _GLIBCXX_PARALLEL_ASSERT(N != 0);
+ _GLIBCXX_PARALLEL_ASSERT(rank >= 0);
+ _GLIBCXX_PARALLEL_ASSERT(rank < N);
+
+ difference_type* ns = new difference_type[m];
+ difference_type* a = new difference_type[m];
+ difference_type* b = new difference_type[m];
+ difference_type l;
+
+ ns[0] = std::distance(begin_seqs[0].first, begin_seqs[0].second);
+ nmax = ns[0];
+ for (int i = 0; i < m; i++)
+ {
+ ns[i] = std::distance(begin_seqs[i].first, begin_seqs[i].second);
+ nmax = std::max(nmax, ns[i]);
+ }
+
+ r = __log2(nmax) + 1;
+
+ // Pad all lists to this length, at least as long as any ns[i],
+ // equality iff nmax = 2^k - 1.
+ l = (1ULL << r) - 1;
+
+ // From now on, including padding.
+ N = l * m;
+
+ for (int i = 0; i < m; i++)
+ {
+ a[i] = 0;
+ b[i] = l;
+ }
+ n = l / 2;
+
+ // Invariants:
+ // 0 <= a[i] <= ns[i], 0 <= b[i] <= l
+
+#define S(i) (begin_seqs[i].first)
+
+ // Initial partition.
+ std::vector<std::pair<value_type, int> > sample;
+
+ for (int i = 0; i < m; i++)
+ if (n < ns[i]) //sequence long enough
+ sample.push_back(std::make_pair(S(i)[n], i));
+ __gnu_sequential::sort(sample.begin(), sample.end(), lcomp);
+
+ for (int i = 0; i < m; i++) //conceptual infinity
+ if (n >= ns[i]) //sequence too short, conceptual infinity
+ sample.push_back(std::make_pair(S(i)[0] /*dummy element*/, i));
+
+ difference_type localrank = rank * m / N ;
+
+ int j;
+ for (j = 0; j < localrank && ((n + 1) <= ns[sample[j].second]); ++j)
+ a[sample[j].second] += n + 1;
+ for (; j < m; j++)
+ b[sample[j].second] -= n + 1;
+
+ // Further refinement.
+ while (n > 0)
+ {
+ n /= 2;
+
+ int lmax_seq = -1; // to avoid warning
+ const value_type* lmax = NULL; // impossible to avoid the warning?
+ for (int i = 0; i < m; i++)
+ {
+ if (a[i] > 0)
+ {
+ if (!lmax)
+ {
+ lmax = &(S(i)[a[i] - 1]);
+ lmax_seq = i;
+ }
+ else
+ {
+ // Max, favor rear sequences.
+ if (!comp(S(i)[a[i] - 1], *lmax))
+ {
+ lmax = &(S(i)[a[i] - 1]);
+ lmax_seq = i;
+ }
+ }
+ }
+ }
+
+ int i;
+ for (i = 0; i < m; i++)
+ {
+ difference_type middle = (b[i] + a[i]) / 2;
+ if (lmax && middle < ns[i] &&
+ lcomp(std::make_pair(S(i)[middle], i),
+ std::make_pair(*lmax, lmax_seq)))
+ a[i] = std::min(a[i] + n + 1, ns[i]);
+ else
+ b[i] -= n + 1;
+ }
+
+ difference_type leftsize = 0, total = 0;
+ for (int i = 0; i < m; i++)
+ {
+ leftsize += a[i] / (n + 1);
+ total += l / (n + 1);
+ }
+
+ difference_type skew = static_cast<difference_type>
+ (static_cast<uint64>(total) * rank / N - leftsize);
+
+ if (skew > 0)
+ {
+ // Move to the left, find smallest.
+ std::priority_queue<std::pair<value_type, int>,
+ std::vector<std::pair<value_type, int> >,
+ lexicographic_reverse<value_type, int, Comparator> >
+ pq(lrcomp);
+
+ for (int i = 0; i < m; i++)
+ if (b[i] < ns[i])
+ pq.push(std::make_pair(S(i)[b[i]], i));
+
+ for (; skew != 0 && !pq.empty(); --skew)
+ {
+ int source = pq.top().second;
+ pq.pop();
+
+ a[source] = std::min(a[source] + n + 1, ns[source]);
+ b[source] += n + 1;
+
+ if (b[source] < ns[source])
+ pq.push(std::make_pair(S(source)[b[source]], source));
+ }
+ }
+ else if (skew < 0)
+ {
+ // Move to the right, find greatest.
+ std::priority_queue<std::pair<value_type, int>,
+ std::vector<std::pair<value_type, int> >,
+ lexicographic<value_type, int, Comparator> > pq(lcomp);
+
+ for (int i = 0; i < m; i++)
+ if (a[i] > 0)
+ pq.push(std::make_pair(S(i)[a[i] - 1], i));
+
+ for (; skew != 0; ++skew)
+ {
+ int source = pq.top().second;
+ pq.pop();
+
+ a[source] -= n + 1;
+ b[source] -= n + 1;
+
+ if (a[source] > 0)
+ pq.push(std::make_pair(S(source)[a[source] - 1], source));
+ }
+ }
+ }
+
+ // Postconditions:
+ // a[i] == b[i] in most cases, except when a[i] has been clamped
+ // because of having reached the boundary
+
+ // Now return the result, calculate the offset.
+
+ // Compare the keys on both edges of the border.
+
+ // Maximum of left edge, minimum of right edge.
+ value_type* maxleft = NULL;
+ value_type* minright = NULL;
+ for (int i = 0; i < m; i++)
+ {
+ if (a[i] > 0)
+ {
+ if (!maxleft)
+ maxleft = &(S(i)[a[i] - 1]);
+ else
+ {
+ // Max, favor rear sequences.
+ if (!comp(S(i)[a[i] - 1], *maxleft))
+ maxleft = &(S(i)[a[i] - 1]);
+ }
+ }
+ if (b[i] < ns[i])
+ {
+ if (!minright)
+ minright = &(S(i)[b[i]]);
+ else
+ {
+ // Min, favor fore sequences.
+ if (comp(S(i)[b[i]], *minright))
+ minright = &(S(i)[b[i]]);
+ }
+ }
+ }
+
+ int seq = 0;
+ for (int i = 0; i < m; i++)
+ begin_offsets[i] = S(i) + a[i];
+
+ delete[] ns;
+ delete[] a;
+ delete[] b;
+ }
+
+
+ /**
+ * @brief Selects the element at a certain global rank from several
+ * sorted sequences.
+ *
+ * The sequences are passed via a sequence of random-access
+ * iterator pairs, none of the sequences may be empty.
+ * @param begin_seqs Begin of the sequence of iterator pairs.
+ * @param end_seqs End of the sequence of iterator pairs.
+ * @param rank The global rank to partition at.
+ * @param offset The rank of the selected element in the global
+ * subsequence of elements equal to the selected element. If the
+ * selected element is unique, this number is 0.
+ * @param comp The ordering functor, defaults to std::less.
+ */
+ template<typename T, typename RanSeqs, typename RankType,
+ typename Comparator>
+ T
+ multiseq_selection(RanSeqs begin_seqs, RanSeqs end_seqs, RankType rank,
+ RankType& offset, Comparator comp = std::less<T>())
+ {
+ _GLIBCXX_CALL(end_seqs - begin_seqs)
+
+ typedef typename std::iterator_traits<RanSeqs>::value_type::first_type
+ It;
+ typedef typename std::iterator_traits<It>::difference_type
+ difference_type;
+
+ lexicographic<T, int, Comparator> lcomp(comp);
+ lexicographic_reverse<T, int, Comparator> lrcomp(comp);
+
+ // Number of sequences, number of elements in total (possibly
+ // including padding).
+ difference_type m = std::distance(begin_seqs, end_seqs);
+ difference_type N = 0;
+ difference_type nmax, n, r;
+
+ for (int i = 0; i < m; i++)
+ N += std::distance(begin_seqs[i].first, begin_seqs[i].second);
+
+ if (m == 0 || N == 0 || rank < 0 || rank >= N)
+ {
+ // Result undefined when there is no data or rank is outside bounds.
+ throw std::exception();
+ }
+
+
+ difference_type* ns = new difference_type[m];
+ difference_type* a = new difference_type[m];
+ difference_type* b = new difference_type[m];
+ difference_type l;
+
+ ns[0] = std::distance(begin_seqs[0].first, begin_seqs[0].second);
+ nmax = ns[0];
+ for (int i = 0; i < m; ++i)
+ {
+ ns[i] = std::distance(begin_seqs[i].first, begin_seqs[i].second);
+ nmax = std::max(nmax, ns[i]);
+ }
+
+ r = __log2(nmax) + 1;
+
+ // Pad all lists to this length, at least as long as any ns[i],
+ // equality iff nmax = 2^k - 1
+ l = pow2(r) - 1;
+
+ // From now on, including padding.
+ N = l * m;
+
+ for (int i = 0; i < m; ++i)
+ {
+ a[i] = 0;
+ b[i] = l;
+ }
+ n = l / 2;
+
+ // Invariants:
+ // 0 <= a[i] <= ns[i], 0 <= b[i] <= l
+
+#define S(i) (begin_seqs[i].first)
+
+ // Initial partition.
+ std::vector<std::pair<T, int> > sample;
+
+ for (int i = 0; i < m; i++)
+ if (n < ns[i])
+ sample.push_back(std::make_pair(S(i)[n], i));
+ __gnu_sequential::sort(sample.begin(), sample.end(),
+ lcomp, sequential_tag());
+
+ // Conceptual infinity.
+ for (int i = 0; i < m; i++)
+ if (n >= ns[i])
+ sample.push_back(std::make_pair(S(i)[0] /*dummy element*/, i));
+
+ difference_type localrank = rank * m / N ;
+
+ int j;
+ for (j = 0; j < localrank && ((n + 1) <= ns[sample[j].second]); ++j)
+ a[sample[j].second] += n + 1;
+ for (; j < m; ++j)
+ b[sample[j].second] -= n + 1;
+
+ // Further refinement.
+ while (n > 0)
+ {
+ n /= 2;
+
+ const T* lmax = NULL;
+ for (int i = 0; i < m; ++i)
+ {
+ if (a[i] > 0)
+ {
+ if (!lmax)
+ lmax = &(S(i)[a[i] - 1]);
+ else
+ {
+ if (comp(*lmax, S(i)[a[i] - 1])) //max
+ lmax = &(S(i)[a[i] - 1]);
+ }
+ }
+ }
+
+ int i;
+ for (i = 0; i < m; i++)
+ {
+ difference_type middle = (b[i] + a[i]) / 2;
+ if (lmax && middle < ns[i] && comp(S(i)[middle], *lmax))
+ a[i] = std::min(a[i] + n + 1, ns[i]);
+ else
+ b[i] -= n + 1;
+ }
+
+ difference_type leftsize = 0, total = 0;
+ for (int i = 0; i < m; ++i)
+ {
+ leftsize += a[i] / (n + 1);
+ total += l / (n + 1);
+ }
+
+ difference_type skew = ((unsigned long long)total * rank / N
+ - leftsize);
+
+ if (skew > 0)
+ {
+ // Move to the left, find smallest.
+ std::priority_queue<std::pair<T, int>,
+ std::vector<std::pair<T, int> >,
+ lexicographic_reverse<T, int, Comparator> > pq(lrcomp);
+
+ for (int i = 0; i < m; ++i)
+ if (b[i] < ns[i])
+ pq.push(std::make_pair(S(i)[b[i]], i));
+
+ for (; skew != 0 && !pq.empty(); --skew)
+ {
+ int source = pq.top().second;
+ pq.pop();
+
+ a[source] = std::min(a[source] + n + 1, ns[source]);
+ b[source] += n + 1;
+
+ if (b[source] < ns[source])
+ pq.push(std::make_pair(S(source)[b[source]], source));
+ }
+ }
+ else if (skew < 0)
+ {
+ // Move to the right, find greatest.
+ std::priority_queue<std::pair<T, int>,
+ std::vector<std::pair<T, int> >,
+ lexicographic<T, int, Comparator> > pq(lcomp);
+
+ for (int i = 0; i < m; ++i)
+ if (a[i] > 0)
+ pq.push(std::make_pair(S(i)[a[i] - 1], i));
+
+ for (; skew != 0; ++skew)
+ {
+ int source = pq.top().second;
+ pq.pop();
+
+ a[source] -= n + 1;
+ b[source] -= n + 1;
+
+ if (a[source] > 0)
+ pq.push(std::make_pair(S(source)[a[source] - 1], source));
+ }
+ }
+ }
+
+ // Postconditions:
+ // a[i] == b[i] in most cases, except when a[i] has been clamped
+ // because of having reached the boundary
+
+ // Now return the result, calculate the offset.
+
+ // Compare the keys on both edges of the border.
+
+ // Maximum of left edge, minimum of right edge.
+ bool maxleftset = false, minrightset = false;
+
+ // Impossible to avoid the warning?
+ T maxleft, minright;
+ for (int i = 0; i < m; ++i)
+ {
+ if (a[i] > 0)
+ {
+ if (!maxleftset)
+ {
+ maxleft = S(i)[a[i] - 1];
+ maxleftset = true;
+ }
+ else
+ {
+ // Max.
+ if (comp(maxleft, S(i)[a[i] - 1]))
+ maxleft = S(i)[a[i] - 1];
+ }
+ }
+ if (b[i] < ns[i])
+ {
+ if (!minrightset)
+ {
+ minright = S(i)[b[i]];
+ minrightset = true;
+ }
+ else
+ {
+ // Min.
+ if (comp(S(i)[b[i]], minright))
+ minright = S(i)[b[i]];
+ }
+ }
+ }
+
+ // Minright is the splitter, in any case.
+
+ if (!maxleftset || comp(minright, maxleft))
+ {
+ // Good luck, everything is split unambiguously.
+ offset = 0;
+ }
+ else
+ {
+ // We have to calculate an offset.
+ offset = 0;
+
+ for (int i = 0; i < m; ++i)
+ {
+ difference_type lb = std::lower_bound(S(i), S(i) + ns[i],
+ minright,
+ comp) - S(i);
+ offset += a[i] - lb;
+ }
+ }
+
+ delete[] ns;
+ delete[] a;
+ delete[] b;
+
+ return minright;
+ }
+}
+
+#undef S
+
+#endif /* _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/multiway_merge.h b/gcc-4.4.0/libstdc++-v3/include/parallel/multiway_merge.h
new file mode 100644
index 000000000..bacff8dba
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/multiway_merge.h
@@ -0,0 +1,2145 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/multiway_merge.h
+* @brief Implementation of sequential and parallel multiway merge.
+*
+* Explanations on the high-speed merging routines in the appendix of
+*
+* P. Sanders.
+* Fast priority queues for cached memory.
+* ACM Journal of Experimental Algorithmics, 5, 2000.
+*
+* This file is a GNU parallel extension to the Standard C++ Library.
+*/
+
+// Written by Johannes Singler and Manuel Holtgrewe.
+
+#ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H
+#define _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H
+
+#include <vector>
+
+#include <bits/stl_algo.h>
+#include <parallel/features.h>
+#include <parallel/parallel.h>
+#include <parallel/losertree.h>
+#if _GLIBCXX_ASSERTIONS
+#include <parallel/checkers.h>
+#endif
+
+/** @brief Length of a sequence described by a pair of iterators. */
+#define _GLIBCXX_PARALLEL_LENGTH(s) ((s).second - (s).first)
+
+namespace __gnu_parallel
+{
+
+// Announce guarded and unguarded iterator.
+
+template<typename RandomAccessIterator, typename Comparator>
+ class guarded_iterator;
+
+// Making the arguments const references seems to dangerous,
+// the user-defined comparator might not be const.
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<(guarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ guarded_iterator<RandomAccessIterator, Comparator>& bi2);
+
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<=(guarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ guarded_iterator<RandomAccessIterator, Comparator>& bi2);
+
+/** @brief Iterator wrapper supporting an implicit supremum at the end
+ * of the sequence, dominating all comparisons.
+ *
+ * The implicit supremum comes with a performance cost.
+ *
+ * Deriving from RandomAccessIterator is not possible since
+ * RandomAccessIterator need not be a class.
+ */
+template<typename RandomAccessIterator, typename Comparator>
+ class guarded_iterator
+ {
+ private:
+ /** @brief Current iterator position. */
+ RandomAccessIterator current;
+
+ /** @brief End iterator of the sequence. */
+ RandomAccessIterator end;
+
+ /** @brief Comparator. */
+ Comparator& comp;
+
+ public:
+ /** @brief Constructor. Sets iterator to beginning of sequence.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param comp Comparator provided for associated overloaded
+ * compare operators. */
+ guarded_iterator(RandomAccessIterator begin,
+ RandomAccessIterator end, Comparator& comp)
+ : current(begin), end(end), comp(comp)
+ { }
+
+ /** @brief Pre-increment operator.
+ * @return This. */
+ guarded_iterator<RandomAccessIterator, Comparator>&
+ operator++()
+ {
+ ++current;
+ return *this;
+ }
+
+ /** @brief Dereference operator.
+ * @return Referenced element. */
+ typename std::iterator_traits<RandomAccessIterator>::value_type&
+ operator*()
+ { return *current; }
+
+ /** @brief Convert to wrapped iterator.
+ * @return Wrapped iterator. */
+ operator RandomAccessIterator()
+ { return current; }
+
+ friend bool
+ operator< <RandomAccessIterator, Comparator>(
+ guarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ guarded_iterator<RandomAccessIterator, Comparator>& bi2);
+
+ friend bool
+ operator<= <RandomAccessIterator, Comparator>(
+ guarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ guarded_iterator<RandomAccessIterator, Comparator>& bi2);
+ };
+
+/** @brief Compare two elements referenced by guarded iterators.
+ * @param bi1 First iterator.
+ * @param bi2 Second iterator.
+ * @return @c True if less. */
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<(guarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ guarded_iterator<RandomAccessIterator, Comparator>& bi2)
+ {
+ if (bi1.current == bi1.end) //bi1 is sup
+ return bi2.current == bi2.end; //bi2 is not sup
+ if (bi2.current == bi2.end) //bi2 is sup
+ return true;
+ return (bi1.comp)(*bi1, *bi2); //normal compare
+ }
+
+/** @brief Compare two elements referenced by guarded iterators.
+ * @param bi1 First iterator.
+ * @param bi2 Second iterator.
+ * @return @c True if less equal. */
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<=(guarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ guarded_iterator<RandomAccessIterator, Comparator>& bi2)
+ {
+ if (bi2.current == bi2.end) //bi1 is sup
+ return bi1.current != bi1.end; //bi2 is not sup
+ if (bi1.current == bi1.end) //bi2 is sup
+ return false;
+ return !(bi1.comp)(*bi2, *bi1); //normal compare
+ }
+
+template<typename RandomAccessIterator, typename Comparator>
+ class unguarded_iterator;
+
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<(unguarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi2);
+
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<=(unguarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi2);
+
+template<typename RandomAccessIterator, typename Comparator>
+ class unguarded_iterator
+ {
+ private:
+ /** @brief Current iterator position. */
+ RandomAccessIterator current;
+ /** @brief Comparator. */
+ mutable Comparator& comp;
+
+ public:
+ /** @brief Constructor. Sets iterator to beginning of sequence.
+ * @param begin Begin iterator of sequence.
+ * @param end Unused, only for compatibility.
+ * @param comp Unused, only for compatibility. */
+ unguarded_iterator(RandomAccessIterator begin,
+ RandomAccessIterator end, Comparator& comp)
+ : current(begin), comp(comp)
+ { }
+
+ /** @brief Pre-increment operator.
+ * @return This. */
+ unguarded_iterator<RandomAccessIterator, Comparator>&
+ operator++()
+ {
+ ++current;
+ return *this;
+ }
+
+ /** @brief Dereference operator.
+ * @return Referenced element. */
+ typename std::iterator_traits<RandomAccessIterator>::value_type&
+ operator*()
+ { return *current; }
+
+ /** @brief Convert to wrapped iterator.
+ * @return Wrapped iterator. */
+ operator RandomAccessIterator()
+ { return current; }
+
+ friend bool
+ operator< <RandomAccessIterator, Comparator>(
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi2);
+
+ friend bool
+ operator<= <RandomAccessIterator, Comparator>(
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi2);
+ };
+
+/** @brief Compare two elements referenced by unguarded iterators.
+ * @param bi1 First iterator.
+ * @param bi2 Second iterator.
+ * @return @c True if less. */
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<(unguarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi2)
+ {
+ // Normal compare.
+ return (bi1.comp)(*bi1, *bi2);
+ }
+
+/** @brief Compare two elements referenced by unguarded iterators.
+ * @param bi1 First iterator.
+ * @param bi2 Second iterator.
+ * @return @c True if less equal. */
+template<typename RandomAccessIterator, typename Comparator>
+ inline bool
+ operator<=(unguarded_iterator<RandomAccessIterator, Comparator>& bi1,
+ unguarded_iterator<RandomAccessIterator, Comparator>& bi2)
+ {
+ // Normal compare.
+ return !(bi1.comp)(*bi2, *bi1);
+ }
+
+/** @brief Highly efficient 3-way merging procedure.
+ *
+ * Merging is done with the algorithm implementation described by Peter
+ * Sanders. Basically, the idea is to minimize the number of necessary
+ * comparison after merging out an element. The implementation trick
+ * that makes this fast is that the order of the sequences is stored
+ * in the instruction pointer (translated into labels in C++).
+ *
+ * This works well for merging up to 4 sequences.
+ *
+ * Note that making the merging stable does <em>not</em> come at a
+ * performance hit.
+ *
+ * Whether the merging is done guarded or unguarded is selected by the
+ * used iterator class.
+ *
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, less equal than the
+ * total number of elements available.
+ *
+ * @return End iterator of output sequence.
+ */
+template<template<typename RAI, typename C> class iterator,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+ RandomAccessIterator3
+ multiway_merge_3_variant(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ _GLIBCXX_CALL(length);
+
+ typedef _DifferenceTp difference_type;
+
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ if (length == 0)
+ return target;
+
+#if _GLIBCXX_ASSERTIONS
+ _DifferenceTp orig_length = length;
+#endif
+
+ iterator<RandomAccessIterator1, Comparator>
+ seq0(seqs_begin[0].first, seqs_begin[0].second, comp),
+ seq1(seqs_begin[1].first, seqs_begin[1].second, comp),
+ seq2(seqs_begin[2].first, seqs_begin[2].second, comp);
+
+ if (seq0 <= seq1)
+ {
+ if (seq1 <= seq2)
+ goto s012;
+ else
+ if (seq2 < seq0)
+ goto s201;
+ else
+ goto s021;
+ }
+ else
+ {
+ if (seq1 <= seq2)
+ {
+ if (seq0 <= seq2)
+ goto s102;
+ else
+ goto s120;
+ }
+ else
+ goto s210;
+ }
+#define _GLIBCXX_PARALLEL_MERGE_3_CASE(a,b,c,c0,c1) \
+ s ## a ## b ## c : \
+ *target = *seq ## a; \
+ ++target; \
+ --length; \
+ ++seq ## a; \
+ if (length == 0) goto finish; \
+ if (seq ## a c0 seq ## b) goto s ## a ## b ## c; \
+ if (seq ## a c1 seq ## c) goto s ## b ## a ## c; \
+ goto s ## b ## c ## a;
+
+ _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 1, 2, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 2, 0, <=, < );
+ _GLIBCXX_PARALLEL_MERGE_3_CASE(2, 0, 1, < , < );
+ _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 0, 2, < , <=);
+ _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 2, 1, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_3_CASE(2, 1, 0, < , < );
+
+#undef _GLIBCXX_PARALLEL_MERGE_3_CASE
+
+ finish:
+ ;
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(
+ ((RandomAccessIterator1)seq0 - seqs_begin[0].first) +
+ ((RandomAccessIterator1)seq1 - seqs_begin[1].first) +
+ ((RandomAccessIterator1)seq2 - seqs_begin[2].first)
+ == orig_length);
+#endif
+
+ seqs_begin[0].first = seq0;
+ seqs_begin[1].first = seq1;
+ seqs_begin[2].first = seq2;
+
+ return target;
+ }
+
+/**
+ * @brief Highly efficient 4-way merging procedure.
+ *
+ * Merging is done with the algorithm implementation described by Peter
+ * Sanders. Basically, the idea is to minimize the number of necessary
+ * comparison after merging out an element. The implementation trick
+ * that makes this fast is that the order of the sequences is stored
+ * in the instruction pointer (translated into goto labels in C++).
+ *
+ * This works well for merging up to 4 sequences.
+ *
+ * Note that making the merging stable does <em>not</em> come at a
+ * performance hit.
+ *
+ * Whether the merging is done guarded or unguarded is selected by the
+ * used iterator class.
+ *
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, less equal than the
+ * total number of elements available.
+ *
+ * @return End iterator of output sequence.
+ */
+template<template<typename RAI, typename C> class iterator,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+ RandomAccessIterator3
+ multiway_merge_4_variant(RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ _GLIBCXX_CALL(length);
+ typedef _DifferenceTp difference_type;
+
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ iterator<RandomAccessIterator1, Comparator>
+ seq0(seqs_begin[0].first, seqs_begin[0].second, comp),
+ seq1(seqs_begin[1].first, seqs_begin[1].second, comp),
+ seq2(seqs_begin[2].first, seqs_begin[2].second, comp),
+ seq3(seqs_begin[3].first, seqs_begin[3].second, comp);
+
+#define _GLIBCXX_PARALLEL_DECISION(a,b,c,d) { \
+ if (seq ## d < seq ## a) goto s ## d ## a ## b ## c; \
+ if (seq ## d < seq ## b) goto s ## a ## d ## b ## c; \
+ if (seq ## d < seq ## c) goto s ## a ## b ## d ## c; \
+ goto s ## a ## b ## c ## d; }
+
+ if (seq0 <= seq1)
+ {
+ if (seq1 <= seq2)
+ _GLIBCXX_PARALLEL_DECISION(0,1,2,3)
+ else
+ if (seq2 < seq0)
+ _GLIBCXX_PARALLEL_DECISION(2,0,1,3)
+ else
+ _GLIBCXX_PARALLEL_DECISION(0,2,1,3)
+ }
+ else
+ {
+ if (seq1 <= seq2)
+ {
+ if (seq0 <= seq2)
+ _GLIBCXX_PARALLEL_DECISION(1,0,2,3)
+ else
+ _GLIBCXX_PARALLEL_DECISION(1,2,0,3)
+ }
+ else
+ _GLIBCXX_PARALLEL_DECISION(2,1,0,3)
+ }
+
+#define _GLIBCXX_PARALLEL_MERGE_4_CASE(a,b,c,d,c0,c1,c2) \
+ s ## a ## b ## c ## d: \
+ if (length == 0) goto finish; \
+ *target = *seq ## a; \
+ ++target; \
+ --length; \
+ ++seq ## a; \
+ if (seq ## a c0 seq ## b) goto s ## a ## b ## c ## d; \
+ if (seq ## a c1 seq ## c) goto s ## b ## a ## c ## d; \
+ if (seq ## a c2 seq ## d) goto s ## b ## c ## a ## d; \
+ goto s ## b ## c ## d ## a;
+
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 1, 2, 3, <=, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 1, 3, 2, <=, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 2, 1, 3, <=, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 2, 3, 1, <=, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 3, 1, 2, <=, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 3, 2, 1, <=, <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 0, 2, 3, < , <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 0, 3, 2, < , <=, <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 2, 0, 3, <=, < , <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 2, 3, 0, <=, <=, < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 3, 0, 2, <=, < , <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 3, 2, 0, <=, <=, < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 0, 1, 3, < , < , <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 0, 3, 1, < , <=, < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 1, 0, 3, < , < , <=);
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 1, 3, 0, < , <=, < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 3, 0, 1, <=, < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 3, 1, 0, <=, < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 0, 1, 2, < , < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 0, 2, 1, < , < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 1, 0, 2, < , < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 1, 2, 0, < , < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 2, 0, 1, < , < , < );
+ _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 2, 1, 0, < , < , < );
+
+#undef _GLIBCXX_PARALLEL_MERGE_4_CASE
+#undef _GLIBCXX_PARALLEL_DECISION
+
+ finish:
+ ;
+
+ seqs_begin[0].first = seq0;
+ seqs_begin[1].first = seq1;
+ seqs_begin[2].first = seq2;
+ seqs_begin[3].first = seq3;
+
+ return target;
+ }
+
+/** @brief Multi-way merging procedure for a high branching factor,
+ * guarded case.
+ *
+ * This merging variant uses a LoserTree class as selected by <tt>LT</tt>.
+ *
+ * Stability is selected through the used LoserTree class <tt>LT</tt>.
+ *
+ * At least one non-empty sequence is required.
+ *
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, less equal than the
+ * total number of elements available.
+ *
+ * @return End iterator of output sequence.
+ */
+template<typename LT,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+ RandomAccessIterator3
+ multiway_merge_loser_tree(RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ _GLIBCXX_CALL(length)
+
+ typedef _DifferenceTp difference_type;
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ int k = static_cast<int>(seqs_end - seqs_begin);
+
+ LT lt(k, comp);
+
+ // Default value for potentially non-default-constructible types.
+ value_type* arbitrary_element = NULL;
+
+ for (int t = 0; t < k; ++t)
+ {
+ if(arbitrary_element == NULL
+ && _GLIBCXX_PARALLEL_LENGTH(seqs_begin[t]) > 0)
+ arbitrary_element = &(*seqs_begin[t].first);
+ }
+
+ for (int t = 0; t < k; ++t)
+ {
+ if (seqs_begin[t].first == seqs_begin[t].second)
+ lt.insert_start(*arbitrary_element, t, true);
+ else
+ lt.insert_start(*seqs_begin[t].first, t, false);
+ }
+
+ lt.init();
+
+ int source;
+
+ for (difference_type i = 0; i < length; ++i)
+ {
+ //take out
+ source = lt.get_min_source();
+
+ *(target++) = *(seqs_begin[source].first++);
+
+ // Feed.
+ if (seqs_begin[source].first == seqs_begin[source].second)
+ lt.delete_min_insert(*arbitrary_element, true);
+ else
+ // Replace from same source.
+ lt.delete_min_insert(*seqs_begin[source].first, false);
+ }
+
+ return target;
+ }
+
+/** @brief Multi-way merging procedure for a high branching factor,
+ * unguarded case.
+ *
+ * Merging is done using the LoserTree class <tt>LT</tt>.
+ *
+ * Stability is selected by the used LoserTrees.
+ *
+ * @pre No input will run out of elements during the merge.
+ *
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, less equal than the
+ * total number of elements available.
+ *
+ * @return End iterator of output sequence.
+ */
+template<typename LT,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp, typename Comparator>
+ RandomAccessIterator3
+ multiway_merge_loser_tree_unguarded(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ const typename std::iterator_traits<typename std::iterator_traits<
+ RandomAccessIteratorIterator>::value_type::first_type>::value_type&
+ sentinel,
+ _DifferenceTp length,
+ Comparator comp)
+ {
+ _GLIBCXX_CALL(length)
+ typedef _DifferenceTp difference_type;
+
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ int k = seqs_end - seqs_begin;
+
+ LT lt(k, sentinel, comp);
+
+ for (int t = 0; t < k; ++t)
+ {
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(seqs_begin[t].first != seqs_begin[t].second);
+#endif
+ lt.insert_start(*seqs_begin[t].first, t, false);
+ }
+
+ lt.init();
+
+ int source;
+
+#if _GLIBCXX_ASSERTIONS
+ difference_type i = 0;
+#endif
+
+ RandomAccessIterator3 target_end = target + length;
+ while (target < target_end)
+ {
+ // Take out.
+ source = lt.get_min_source();
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(0 <= source && source < k);
+ _GLIBCXX_PARALLEL_ASSERT(i == 0
+ || !comp(*(seqs_begin[source].first), *(target - 1)));
+#endif
+
+ // Feed.
+ *(target++) = *(seqs_begin[source].first++);
+
+#if _GLIBCXX_ASSERTIONS
+ ++i;
+#endif
+ // Replace from same source.
+ lt.delete_min_insert(*seqs_begin[source].first, false);
+ }
+
+ return target;
+ }
+
+
+/** @brief Multi-way merging procedure for a high branching factor,
+ * requiring sentinels to exist.
+ *
+ * @param stable The value must the same as for the used LoserTrees.
+ * @param UnguardedLoserTree Loser Tree variant to use for the unguarded
+ * merging.
+ * @param GuardedLoserTree Loser Tree variant to use for the guarded
+ * merging.
+ *
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, less equal than the
+ * total number of elements available.
+ *
+ * @return End iterator of output sequence.
+ */
+template<
+ typename UnguardedLoserTree,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+ RandomAccessIterator3
+ multiway_merge_loser_tree_sentinel(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ const typename std::iterator_traits<typename std::iterator_traits<
+ RandomAccessIteratorIterator>::value_type::first_type>::value_type&
+ sentinel,
+ _DifferenceTp length,
+ Comparator comp)
+ {
+ _GLIBCXX_CALL(length)
+
+ typedef _DifferenceTp difference_type;
+ typedef std::iterator_traits<RandomAccessIteratorIterator> traits_type;
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ RandomAccessIterator3 target_end;
+
+ for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s)
+ // Move the sequends end behind the sentinel spots. This has the
+ // effect that the sentinel appears to be within the sequence. Then,
+ // we can use the unguarded variant if we merge out as many
+ // non-sentinel elements as we have.
+ ++((*s).second);
+
+ target_end = multiway_merge_loser_tree_unguarded
+ <UnguardedLoserTree>
+ (seqs_begin, seqs_end, target, sentinel, length, comp);
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(target_end == target + length);
+ _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target_end, comp));
+#endif
+
+ // Restore the sequence ends so the sentinels are not contained in the
+ // sequence any more (see comment in loop above).
+ for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s)
+ --((*s).second);
+
+ return target_end;
+ }
+
+/**
+ * @brief Traits for determining whether the loser tree should
+ * use pointers or copies.
+ *
+ * The field "use_pointer" is used to determine whether to use pointers in
+ * the loser trees or whether to copy the values into the loser tree.
+ *
+ * The default behavior is to use pointers if the data type is 4 times as
+ * big as the pointer to it.
+ *
+ * Specialize for your data type to customize the behavior.
+ *
+ * Example:
+ *
+ * template<>
+ * struct loser_tree_traits<int>
+ * { static const bool use_pointer = false; };
+ *
+ * template<>
+ * struct loser_tree_traits<heavyweight_type>
+ * { static const bool use_pointer = true; };
+ *
+ * @param T type to give the loser tree traits for.
+ */
+template <typename T>
+struct loser_tree_traits
+{
+ /**
+ * @brief True iff to use pointers instead of values in loser trees.
+ *
+ * The default behavior is to use pointers if the data type is four
+ * times as big as the pointer to it.
+ */
+ static const bool use_pointer = (sizeof(T) > 4 * sizeof(T*));
+};
+
+/**
+ * @brief Switch for 3-way merging with sentinels turned off.
+ *
+ * Note that 3-way merging is always stable!
+ */
+template<
+ bool sentinels /*default == false*/,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+struct multiway_merge_3_variant_sentinel_switch
+{
+ RandomAccessIterator3 operator()(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ return multiway_merge_3_variant<guarded_iterator>(
+ seqs_begin, seqs_end, target, length, comp);
+ }
+};
+
+/**
+ * @brief Switch for 3-way merging with sentinels turned on.
+ *
+ * Note that 3-way merging is always stable!
+ */
+template<
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+struct multiway_merge_3_variant_sentinel_switch
+ <true, RandomAccessIteratorIterator, RandomAccessIterator3,
+ _DifferenceTp, Comparator>
+{
+ RandomAccessIterator3 operator()(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ return multiway_merge_3_variant<unguarded_iterator>(
+ seqs_begin, seqs_end, target, length, comp);
+ }
+};
+
+/**
+ * @brief Switch for 4-way merging with sentinels turned off.
+ *
+ * Note that 4-way merging is always stable!
+ */
+template<
+ bool sentinels /*default == false*/,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+struct multiway_merge_4_variant_sentinel_switch
+{
+ RandomAccessIterator3 operator()(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ return multiway_merge_4_variant<guarded_iterator>(
+ seqs_begin, seqs_end, target, length, comp);
+ }
+};
+
+/**
+ * @brief Switch for 4-way merging with sentinels turned on.
+ *
+ * Note that 4-way merging is always stable!
+ */
+template<
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+struct multiway_merge_4_variant_sentinel_switch
+ <true, RandomAccessIteratorIterator, RandomAccessIterator3,
+ _DifferenceTp, Comparator>
+{
+ RandomAccessIterator3 operator()(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ _DifferenceTp length, Comparator comp)
+ {
+ return multiway_merge_4_variant<unguarded_iterator>(
+ seqs_begin, seqs_end, target, length, comp);
+ }
+};
+
+/**
+ * @brief Switch for k-way merging with sentinels turned on.
+ */
+template<
+ bool sentinels,
+ bool stable,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+struct multiway_merge_k_variant_sentinel_switch
+{
+ RandomAccessIterator3 operator()(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ const typename std::iterator_traits<typename std::iterator_traits<
+ RandomAccessIteratorIterator>::value_type::first_type>::value_type&
+ sentinel,
+ _DifferenceTp length, Comparator comp)
+ {
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ return multiway_merge_loser_tree_sentinel<
+ typename __gnu_cxx::__conditional_type<
+ loser_tree_traits<value_type>::use_pointer
+ , LoserTreePointerUnguarded<stable, value_type, Comparator>
+ , LoserTreeUnguarded<stable, value_type, Comparator>
+ >::__type>(seqs_begin, seqs_end, target, sentinel, length, comp);
+ }
+};
+
+/**
+ * @brief Switch for k-way merging with sentinels turned off.
+ */
+template<
+ bool stable,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+struct multiway_merge_k_variant_sentinel_switch
+ <false, stable, RandomAccessIteratorIterator, RandomAccessIterator3,
+ _DifferenceTp, Comparator>
+{
+ RandomAccessIterator3 operator()(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ const typename std::iterator_traits<typename std::iterator_traits<
+ RandomAccessIteratorIterator>::value_type::first_type>::value_type&
+ sentinel,
+ _DifferenceTp length, Comparator comp)
+ {
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ return multiway_merge_loser_tree<
+ typename __gnu_cxx::__conditional_type<
+ loser_tree_traits<value_type>::use_pointer
+ , LoserTreePointer<stable, value_type, Comparator>
+ , LoserTree<stable, value_type, Comparator>
+ >::__type >(seqs_begin, seqs_end, target, length, comp);
+ }
+};
+
+/** @brief Sequential multi-way merging switch.
+ *
+ * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor and
+ * runtime settings.
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, possibly larger than the
+ * number of elements available.
+ * @param stable Stable merging incurs a performance penalty.
+ * @param sentinel The sequences have a sentinel element.
+ * @return End iterator of output sequence. */
+template<
+ bool stable,
+ bool sentinels,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Comparator>
+ RandomAccessIterator3
+ sequential_multiway_merge(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ const typename std::iterator_traits<typename std::iterator_traits<
+ RandomAccessIteratorIterator>::value_type::first_type>::value_type&
+ sentinel,
+ _DifferenceTp length, Comparator comp)
+ {
+ _GLIBCXX_CALL(length)
+
+ typedef _DifferenceTp difference_type;
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+#if _GLIBCXX_ASSERTIONS
+ for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s)
+ {
+ _GLIBCXX_PARALLEL_ASSERT(is_sorted((*s).first, (*s).second, comp));
+ }
+#endif
+
+ _DifferenceTp total_length = 0;
+ for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s)
+ total_length += _GLIBCXX_PARALLEL_LENGTH(*s);
+
+ length = std::min<_DifferenceTp>(length, total_length);
+
+ if(length == 0)
+ return target;
+
+ RandomAccessIterator3 return_target = target;
+ int k = static_cast<int>(seqs_end - seqs_begin);
+
+ switch (k)
+ {
+ case 0:
+ break;
+ case 1:
+ return_target = std::copy(seqs_begin[0].first,
+ seqs_begin[0].first + length,
+ target);
+ seqs_begin[0].first += length;
+ break;
+ case 2:
+ return_target = merge_advance(seqs_begin[0].first,
+ seqs_begin[0].second,
+ seqs_begin[1].first,
+ seqs_begin[1].second,
+ target, length, comp);
+ break;
+ case 3:
+ return_target = multiway_merge_3_variant_sentinel_switch<
+ sentinels
+ , RandomAccessIteratorIterator
+ , RandomAccessIterator3
+ , _DifferenceTp
+ , Comparator>()(seqs_begin, seqs_end, target, length, comp);
+ break;
+ case 4:
+ return_target = multiway_merge_4_variant_sentinel_switch<
+ sentinels
+ , RandomAccessIteratorIterator
+ , RandomAccessIterator3
+ , _DifferenceTp
+ , Comparator>()(seqs_begin, seqs_end, target, length, comp);
+ break;
+ default:
+ return_target = multiway_merge_k_variant_sentinel_switch<
+ sentinels
+ , stable
+ , RandomAccessIteratorIterator
+ , RandomAccessIterator3
+ , _DifferenceTp
+ , Comparator>()(seqs_begin, seqs_end, target, sentinel, length, comp);
+ break;
+ }
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target + length, comp));
+#endif
+
+ return return_target;
+ }
+
+/**
+ * @brief Stable sorting functor.
+ *
+ * Used to reduce code instanciation in multiway_merge_sampling_splitting.
+ */
+template<bool stable, class RandomAccessIterator, class StrictWeakOrdering>
+struct sampling_sorter
+{
+ void operator()(RandomAccessIterator first, RandomAccessIterator last,
+ StrictWeakOrdering comp)
+ { __gnu_sequential::stable_sort(first, last, comp); }
+};
+
+/**
+ * @brief Non-stable sorting functor.
+ *
+ * Used to reduce code instantiation in multiway_merge_sampling_splitting.
+ */
+template<class RandomAccessIterator, class StrictWeakOrdering>
+struct sampling_sorter<false, RandomAccessIterator, StrictWeakOrdering>
+{
+ void operator()(RandomAccessIterator first, RandomAccessIterator last,
+ StrictWeakOrdering comp)
+ { __gnu_sequential::sort(first, last, comp); }
+};
+
+/**
+ * @brief Sampling based splitting for parallel multiway-merge routine.
+ */
+template<
+ bool stable
+ , typename RandomAccessIteratorIterator
+ , typename Comparator
+ , typename difference_type>
+void multiway_merge_sampling_splitting(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ difference_type length, difference_type total_length, Comparator comp,
+ std::vector<std::pair<difference_type, difference_type> > *pieces)
+{
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename std::iterator_traits<RandomAccessIterator1>::value_type
+ value_type;
+
+ // k sequences.
+ int k = static_cast<int>(seqs_end - seqs_begin);
+
+ int num_threads = omp_get_num_threads();
+
+ difference_type num_samples =
+ __gnu_parallel::_Settings::get().merge_oversampling * num_threads;
+
+ value_type* samples = static_cast<value_type*>(
+ ::operator new(sizeof(value_type) * k * num_samples));
+ // Sample.
+ for (int s = 0; s < k; ++s)
+ for (difference_type i = 0; i < num_samples; ++i)
+ {
+ difference_type sample_index =
+ static_cast<difference_type>(
+ _GLIBCXX_PARALLEL_LENGTH(seqs_begin[s])
+ * (double(i + 1) / (num_samples + 1))
+ * (double(length) / total_length));
+ new(&(samples[s * num_samples + i]))
+ value_type(seqs_begin[s].first[sample_index]);
+ }
+
+ // Sort stable or non-stable, depending on value of template parameter
+ // "stable".
+ sampling_sorter<stable, value_type*, Comparator>()(
+ samples, samples + (num_samples * k), comp);
+
+ for (int slab = 0; slab < num_threads; ++slab)
+ // For each slab / processor.
+ for (int seq = 0; seq < k; ++seq)
+ {
+ // For each sequence.
+ if (slab > 0)
+ pieces[slab][seq].first =
+ std::upper_bound(
+ seqs_begin[seq].first,
+ seqs_begin[seq].second,
+ samples[num_samples * k * slab / num_threads],
+ comp)
+ - seqs_begin[seq].first;
+ else
+ // Absolute beginning.
+ pieces[slab][seq].first = 0;
+ if ((slab + 1) < num_threads)
+ pieces[slab][seq].second =
+ std::upper_bound(
+ seqs_begin[seq].first,
+ seqs_begin[seq].second,
+ samples[num_samples * k * (slab + 1) /
+ num_threads], comp)
+ - seqs_begin[seq].first;
+ else
+ // Absolute end.
+ pieces[slab][seq].second = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]);
+ }
+ ::operator delete(samples);
+}
+
+/**
+ * @brief Exact splitting for parallel multiway-merge routine.
+ *
+ * None of the passed sequences may be empty.
+ */
+template<
+ bool stable
+ , typename RandomAccessIteratorIterator
+ , typename Comparator
+ , typename difference_type>
+void multiway_merge_exact_splitting(
+ RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ difference_type length, difference_type total_length, Comparator comp,
+ std::vector<std::pair<difference_type, difference_type> > *pieces)
+{
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+
+ const bool tight = (total_length == length);
+
+ // k sequences.
+ const int k = static_cast<int>(seqs_end - seqs_begin);
+
+ const int num_threads = omp_get_num_threads();
+
+ // (Settings::multiway_merge_splitting == __gnu_parallel::_Settings::EXACT).
+ std::vector<RandomAccessIterator1>* offsets =
+ new std::vector<RandomAccessIterator1>[num_threads];
+ std::vector<
+ std::pair<RandomAccessIterator1, RandomAccessIterator1>
+ > se(k);
+
+ copy(seqs_begin, seqs_end, se.begin());
+
+ difference_type* borders =
+ new difference_type[num_threads + 1];
+ equally_split(length, num_threads, borders);
+
+ for (int s = 0; s < (num_threads - 1); ++s)
+ {
+ offsets[s].resize(k);
+ multiseq_partition(
+ se.begin(), se.end(), borders[s + 1],
+ offsets[s].begin(), comp);
+
+ // Last one also needed and available.
+ if (!tight)
+ {
+ offsets[num_threads - 1].resize(k);
+ multiseq_partition(se.begin(), se.end(),
+ difference_type(length),
+ offsets[num_threads - 1].begin(), comp);
+ }
+ }
+
+
+ for (int slab = 0; slab < num_threads; ++slab)
+ {
+ // For each slab / processor.
+ for (int seq = 0; seq < k; ++seq)
+ {
+ // For each sequence.
+ if (slab == 0)
+ {
+ // Absolute beginning.
+ pieces[slab][seq].first = 0;
+ }
+ else
+ pieces[slab][seq].first =
+ pieces[slab - 1][seq].second;
+ if (!tight || slab < (num_threads - 1))
+ pieces[slab][seq].second =
+ offsets[slab][seq] - seqs_begin[seq].first;
+ else
+ {
+ // slab == num_threads - 1
+ pieces[slab][seq].second =
+ _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]);
+ }
+ }
+ }
+ delete[] offsets;
+}
+
+/** @brief Parallel multi-way merge routine.
+ *
+ * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor
+ * and runtime settings.
+ *
+ * Must not be called if the number of sequences is 1.
+ *
+ * @param Splitter functor to split input (either exact or sampling based)
+ *
+ * @param seqs_begin Begin iterator of iterator pair input sequence.
+ * @param seqs_end End iterator of iterator pair input sequence.
+ * @param target Begin iterator out output sequence.
+ * @param comp Comparator.
+ * @param length Maximum length to merge, possibly larger than the
+ * number of elements available.
+ * @param stable Stable merging incurs a performance penalty.
+ * @param sentinel Ignored.
+ * @return End iterator of output sequence.
+ */
+template<
+ bool stable,
+ bool sentinels,
+ typename RandomAccessIteratorIterator,
+ typename RandomAccessIterator3,
+ typename _DifferenceTp,
+ typename Splitter,
+ typename Comparator
+ >
+ RandomAccessIterator3
+ parallel_multiway_merge(RandomAccessIteratorIterator seqs_begin,
+ RandomAccessIteratorIterator seqs_end,
+ RandomAccessIterator3 target,
+ Splitter splitter,
+ _DifferenceTp length,
+ Comparator comp,
+ thread_index_t num_threads)
+ {
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(seqs_end - seqs_begin > 1);
+#endif
+
+ _GLIBCXX_CALL(length)
+
+ typedef _DifferenceTp difference_type;
+ typedef typename std::iterator_traits<RandomAccessIteratorIterator>
+ ::value_type::first_type
+ RandomAccessIterator1;
+ typedef typename
+ std::iterator_traits<RandomAccessIterator1>::value_type value_type;
+
+ // Leave only non-empty sequences.
+ std::pair<RandomAccessIterator1, RandomAccessIterator1>* ne_seqs =
+ static_cast<std::pair<RandomAccessIterator1, RandomAccessIterator1>*>(
+ ::operator new(
+ sizeof(std::pair<RandomAccessIterator1, RandomAccessIterator1>)
+ * (seqs_end - seqs_begin)));
+ int k = 0;
+ difference_type total_length = 0;
+ for (RandomAccessIteratorIterator raii = seqs_begin;
+ raii != seqs_end; ++raii)
+ {
+ _DifferenceTp seq_length = _GLIBCXX_PARALLEL_LENGTH(*raii);
+ if(seq_length > 0)
+ {
+ total_length += seq_length;
+ //ne_seqs[k] = *raii;
+ new(&(ne_seqs[k++]))
+ std::pair<RandomAccessIterator1, RandomAccessIterator1>(*raii);
+ }
+ }
+
+ _GLIBCXX_CALL(total_length)
+
+ length = std::min<_DifferenceTp>(length, total_length);
+
+ if (total_length == 0 || k == 0)
+ {
+ ::operator delete(ne_seqs);
+ return target;
+ }
+
+ std::vector<std::pair<difference_type, difference_type> >* pieces;
+
+ num_threads = static_cast<thread_index_t>
+ (std::min<difference_type>(num_threads, total_length));
+
+# pragma omp parallel num_threads (num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ // Thread t will have to merge pieces[iam][0..k - 1]
+ pieces = new std::vector<
+ std::pair<difference_type, difference_type> >[num_threads];
+ for (int s = 0; s < num_threads; ++s)
+ pieces[s].resize(k);
+
+ difference_type num_samples =
+ __gnu_parallel::_Settings::get().merge_oversampling *
+ num_threads;
+
+ splitter(ne_seqs, ne_seqs + k, length, total_length,
+ comp, pieces);
+ } //single
+
+ thread_index_t iam = omp_get_thread_num();
+
+ difference_type target_position = 0;
+
+ for (int c = 0; c < k; ++c)
+ target_position += pieces[iam][c].first;
+
+ std::pair<RandomAccessIterator1, RandomAccessIterator1>* chunks
+ = new std::pair<RandomAccessIterator1, RandomAccessIterator1>[k];
+
+ for (int s = 0; s < k; ++s)
+ {
+ chunks[s] = std::make_pair(
+ ne_seqs[s].first + pieces[iam][s].first,
+ ne_seqs[s].first + pieces[iam][s].second);
+ }
+
+ if(length > target_position)
+ sequential_multiway_merge<stable, sentinels>(
+ chunks, chunks + k, target + target_position,
+ *(seqs_begin->second), length - target_position, comp);
+
+ delete[] chunks;
+ } // parallel
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target + length, comp));
+#endif
+
+ k = 0;
+ // Update ends of sequences.
+ for (RandomAccessIteratorIterator raii = seqs_begin;
+ raii != seqs_end; ++raii)
+ {
+ _DifferenceTp length = _GLIBCXX_PARALLEL_LENGTH(*raii);
+ if(length > 0)
+ (*raii).first += pieces[num_threads - 1][k++].second;
+ }
+
+ delete[] pieces;
+
+ return target + length;
+ }
+
+/**
+ * @brief Multiway Merge Frontend.
+ *
+ * Merge the sequences specified by seqs_begin and seqs_end into
+ * target. seqs_begin and seqs_end must point to a sequence of
+ * pairs. These pairs must contain an iterator to the beginning
+ * of a sequence in their first entry and an iterator the end of
+ * the same sequence in their second entry.
+ *
+ * Ties are broken arbitrarily. See stable_multiway_merge for a variant
+ * that breaks ties by sequence number but is slower.
+ *
+ * The first entries of the pairs (i.e. the begin iterators) will be moved
+ * forward.
+ *
+ * The output sequence has to provide enough space for all elements
+ * that are written to it.
+ *
+ * This function will merge the input sequences:
+ *
+ * - not stable
+ * - parallel, depending on the input size and Settings
+ * - using sampling for splitting
+ * - not using sentinels
+ *
+ * Example:
+ *
+ * <pre>
+ * int sequences[10][10];
+ * for (int i = 0; i < 10; ++i)
+ * for (int j = 0; i < 10; ++j)
+ * sequences[i][j] = j;
+ *
+ * int out[33];
+ * std::vector<std::pair<int*> > seqs;
+ * for (int i = 0; i < 10; ++i)
+ * { seqs.push(std::make_pair<int*>(sequences[i], sequences[i] + 10)) }
+ *
+ * multiway_merge(seqs.begin(), seqs.end(), target, std::less<int>(), 33);
+ * </pre>
+ *
+ * @see stable_multiway_merge
+ *
+ * @pre All input sequences must be sorted.
+ * @pre Target must provide enough space to merge out length elements or
+ * the number of elements in all sequences, whichever is smaller.
+ *
+ * @post [target, return value) contains merged elements from the
+ * input sequences.
+ * @post return value - target = min(length, number of elements in all
+ * sequences).
+ *
+ * @param RandomAccessIteratorPairIterator iterator over sequence
+ * of pairs of iterators
+ * @param RandomAccessIteratorOut iterator over target sequence
+ * @param _DifferenceTp difference type for the sequence
+ * @param Comparator strict weak ordering type to compare elements
+ * in sequences
+ *
+ * @param seqs_begin begin of sequence sequence
+ * @param seqs_end end of sequence sequence
+ * @param target target sequence to merge to.
+ * @param comp strict weak ordering to use for element comparison.
+ * @param length Maximum length to merge, possibly larger than the
+ * number of elements available.
+ *
+ * @return end iterator of output sequence
+ */
+// multiway_merge
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::sequential_tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute multiway merge *sequentially*.
+ return sequential_multiway_merge
+ </* stable = */ false, /* sentinels = */ false>
+ (seqs_begin, seqs_end, target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::exact_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ false, /* sentinels = */ false>(
+ seqs_begin, seqs_end, target,
+ multiway_merge_exact_splitting</* stable = */ false,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */ false, /* sentinels = */ false>(
+ seqs_begin, seqs_end, target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::sampling_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ false, /* sentinels = */ false>(
+ seqs_begin, seqs_end,
+ target,
+ multiway_merge_exact_splitting</* stable = */ false,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */ false, /* sentinels = */ false>(
+ seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , parallel_tag tag = parallel_tag(0))
+{
+ return multiway_merge(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , default_parallel_tag tag)
+{
+ return multiway_merge(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+// stable_multiway_merge
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::sequential_tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute multiway merge *sequentially*.
+ return sequential_multiway_merge
+ </* stable = */ true, /* sentinels = */ false>
+ (seqs_begin, seqs_end, target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::exact_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ true, /* sentinels = */ false>(
+ seqs_begin, seqs_end,
+ target,
+ multiway_merge_exact_splitting</* stable = */ true,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge</* stable = */ true,
+ /* sentinels = */ false>(
+ seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , sampling_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ true, /* sentinels = */ false>(
+ seqs_begin, seqs_end,
+ target,
+ multiway_merge_sampling_splitting</* stable = */ true,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */ true, /* sentinels = */ false>(
+ seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , parallel_tag tag = parallel_tag(0))
+{
+ return stable_multiway_merge(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , default_parallel_tag tag)
+{
+ return stable_multiway_merge(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+/**
+ * @brief Multiway Merge Frontend.
+ *
+ * Merge the sequences specified by seqs_begin and seqs_end into
+ * target. seqs_begin and seqs_end must point to a sequence of
+ * pairs. These pairs must contain an iterator to the beginning
+ * of a sequence in their first entry and an iterator the end of
+ * the same sequence in their second entry.
+ *
+ * Ties are broken arbitrarily. See stable_multiway_merge for a variant
+ * that breaks ties by sequence number but is slower.
+ *
+ * The first entries of the pairs (i.e. the begin iterators) will be moved
+ * forward accordingly.
+ *
+ * The output sequence has to provide enough space for all elements
+ * that are written to it.
+ *
+ * This function will merge the input sequences:
+ *
+ * - not stable
+ * - parallel, depending on the input size and Settings
+ * - using sampling for splitting
+ * - using sentinels
+ *
+ * You have to take care that the element the end iterator points to is
+ * readable and contains a value that is greater than any other non-sentinel
+ * value in all sequences.
+ *
+ * Example:
+ *
+ * <pre>
+ * int sequences[10][11];
+ * for (int i = 0; i < 10; ++i)
+ * for (int j = 0; i < 11; ++j)
+ * sequences[i][j] = j; // last one is sentinel!
+ *
+ * int out[33];
+ * std::vector<std::pair<int*> > seqs;
+ * for (int i = 0; i < 10; ++i)
+ * { seqs.push(std::make_pair<int*>(sequences[i], sequences[i] + 10)) }
+ *
+ * multiway_merge(seqs.begin(), seqs.end(), target, std::less<int>(), 33);
+ * </pre>
+ *
+ * @pre All input sequences must be sorted.
+ * @pre Target must provide enough space to merge out length elements or
+ * the number of elements in all sequences, whichever is smaller.
+ * @pre For each @c i, @c seqs_begin[i].second must be the end
+ * marker of the sequence, but also reference the one more sentinel
+ * element.
+ *
+ * @post [target, return value) contains merged elements from the
+ * input sequences.
+ * @post return value - target = min(length, number of elements in all
+ * sequences).
+ *
+ * @see stable_multiway_merge_sentinels
+ *
+ * @param RandomAccessIteratorPairIterator iterator over sequence
+ * of pairs of iterators
+ * @param RandomAccessIteratorOut iterator over target sequence
+ * @param _DifferenceTp difference type for the sequence
+ * @param Comparator strict weak ordering type to compare elements
+ * in sequences
+ *
+ * @param seqs_begin begin of sequence sequence
+ * @param seqs_end end of sequence sequence
+ * @param target target sequence to merge to.
+ * @param comp strict weak ordering to use for element comparison.
+ * @param length Maximum length to merge, possibly larger than the
+ * number of elements available.
+ *
+ * @return end iterator of output sequence
+ */
+// multiway_merge_sentinels
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::sequential_tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute multiway merge *sequentially*.
+ return sequential_multiway_merge
+ </* stable = */ false, /* sentinels = */ true>
+ (seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::exact_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ false, /* sentinels = */ true>(
+ seqs_begin, seqs_end,
+ target,
+ multiway_merge_exact_splitting</* stable = */ false,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */ false, /* sentinels = */ true>(
+ seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , sampling_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ false, /* sentinels = */ true>
+ (seqs_begin, seqs_end, target,
+ multiway_merge_sampling_splitting</* stable = */ false,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */false, /* sentinels = */ true>(
+ seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , parallel_tag tag = parallel_tag(0))
+{
+ return multiway_merge_sentinels(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , default_parallel_tag tag)
+{
+ return multiway_merge_sentinels(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+// stable_multiway_merge_sentinels
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::sequential_tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute multiway merge *sequentially*.
+ return sequential_multiway_merge
+ </* stable = */ true, /* sentinels = */ true>
+ (seqs_begin, seqs_end, target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , __gnu_parallel::exact_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ true, /* sentinels = */ true>(
+ seqs_begin, seqs_end,
+ target,
+ multiway_merge_exact_splitting</* stable = */ true,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */ true, /* sentinels = */ true>(
+ seqs_begin, seqs_end, target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , sampling_tag tag)
+{
+ typedef _DifferenceTp difference_type;
+ _GLIBCXX_CALL(seqs_end - seqs_begin)
+
+ // catch special case: no sequences
+ if (seqs_begin == seqs_end)
+ return target;
+
+ // Execute merge; maybe parallel, depending on the number of merged
+ // elements and the number of sequences and global thresholds in
+ // Settings.
+ if ((seqs_end - seqs_begin > 1) &&
+ _GLIBCXX_PARALLEL_CONDITION(
+ ((seqs_end - seqs_begin) >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+ && ((sequence_index_t)length >=
+ __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+ return parallel_multiway_merge
+ </* stable = */ true, /* sentinels = */ true>(
+ seqs_begin, seqs_end,
+ target,
+ multiway_merge_sampling_splitting</* stable = */ true,
+ typename std::iterator_traits<RandomAccessIteratorPairIterator>
+ ::value_type*, Comparator, _DifferenceTp>,
+ static_cast<difference_type>(length), comp, tag.get_num_threads());
+ else
+ return sequential_multiway_merge
+ </* stable = */ true, /* sentinels = */ true>(
+ seqs_begin, seqs_end,
+ target, *(seqs_begin->second), length, comp);
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , parallel_tag tag = parallel_tag(0))
+{
+ return stable_multiway_merge_sentinels(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+// public interface
+template<
+ typename RandomAccessIteratorPairIterator
+ , typename RandomAccessIteratorOut
+ , typename _DifferenceTp
+ , typename Comparator>
+RandomAccessIteratorOut
+stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin
+ , RandomAccessIteratorPairIterator seqs_end
+ , RandomAccessIteratorOut target
+ , _DifferenceTp length, Comparator comp
+ , default_parallel_tag tag)
+{
+ return stable_multiway_merge_sentinels(seqs_begin, seqs_end, target, length, comp,
+ exact_tag(tag.get_num_threads()));
+}
+
+}; // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/multiway_mergesort.h b/gcc-4.4.0/libstdc++-v3/include/parallel/multiway_mergesort.h
new file mode 100644
index 000000000..11dd885c8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/multiway_mergesort.h
@@ -0,0 +1,475 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/multiway_mergesort.h
+ * @brief Parallel multiway merge sort.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H
+#define _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H 1
+
+#include <vector>
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_algo.h>
+#include <parallel/parallel.h>
+#include <parallel/multiway_merge.h>
+
+namespace __gnu_parallel
+{
+
+/** @brief Subsequence description. */
+template<typename _DifferenceTp>
+ struct Piece
+ {
+ typedef _DifferenceTp difference_type;
+
+ /** @brief Begin of subsequence. */
+ difference_type begin;
+
+ /** @brief End of subsequence. */
+ difference_type end;
+ };
+
+/** @brief Data accessed by all threads.
+ *
+ * PMWMS = parallel multiway mergesort */
+template<typename RandomAccessIterator>
+ struct PMWMSSortingData
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ /** @brief Number of threads involved. */
+ thread_index_t num_threads;
+
+ /** @brief Input begin. */
+ RandomAccessIterator source;
+
+ /** @brief Start indices, per thread. */
+ difference_type* starts;
+
+ /** @brief Storage in which to sort. */
+ value_type** temporary;
+
+ /** @brief Samples. */
+ value_type* samples;
+
+ /** @brief Offsets to add to the found positions. */
+ difference_type* offsets;
+
+ /** @brief Pieces of data to merge @c [thread][sequence] */
+ std::vector<Piece<difference_type> >* pieces;
+};
+
+/**
+ * @brief Select samples from a sequence.
+ * @param sd Pointer to algorithm data. Result will be placed in
+ * @c sd->samples.
+ * @param num_samples Number of samples to select.
+ */
+template<typename RandomAccessIterator, typename _DifferenceTp>
+ void
+ determine_samples(PMWMSSortingData<RandomAccessIterator>* sd,
+ _DifferenceTp num_samples)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef _DifferenceTp difference_type;
+
+ thread_index_t iam = omp_get_thread_num();
+
+ difference_type* es = new difference_type[num_samples + 2];
+
+ equally_split(sd->starts[iam + 1] - sd->starts[iam],
+ num_samples + 1, es);
+
+ for (difference_type i = 0; i < num_samples; ++i)
+ ::new(&(sd->samples[iam * num_samples + i]))
+ value_type(sd->source[sd->starts[iam] + es[i + 1]]);
+
+ delete[] es;
+ }
+
+/** @brief Split consistently. */
+template<bool exact, typename RandomAccessIterator,
+ typename Comparator, typename SortingPlacesIterator>
+ struct split_consistently
+ {
+ };
+
+/** @brief Split by exact splitting. */
+template<typename RandomAccessIterator, typename Comparator,
+ typename SortingPlacesIterator>
+ struct split_consistently
+ <true, RandomAccessIterator, Comparator, SortingPlacesIterator>
+ {
+ void operator()(
+ const thread_index_t iam,
+ PMWMSSortingData<RandomAccessIterator>* sd,
+ Comparator& comp,
+ const typename
+ std::iterator_traits<RandomAccessIterator>::difference_type
+ num_samples)
+ const
+ {
+# pragma omp barrier
+
+ std::vector<std::pair<SortingPlacesIterator, SortingPlacesIterator> >
+ seqs(sd->num_threads);
+ for (thread_index_t s = 0; s < sd->num_threads; s++)
+ seqs[s] = std::make_pair(sd->temporary[s],
+ sd->temporary[s]
+ + (sd->starts[s + 1] - sd->starts[s]));
+
+ std::vector<SortingPlacesIterator> offsets(sd->num_threads);
+
+ // if not last thread
+ if (iam < sd->num_threads - 1)
+ multiseq_partition(seqs.begin(), seqs.end(),
+ sd->starts[iam + 1], offsets.begin(), comp);
+
+ for (int seq = 0; seq < sd->num_threads; seq++)
+ {
+ // for each sequence
+ if (iam < (sd->num_threads - 1))
+ sd->pieces[iam][seq].end = offsets[seq] - seqs[seq].first;
+ else
+ // very end of this sequence
+ sd->pieces[iam][seq].end =
+ sd->starts[seq + 1] - sd->starts[seq];
+ }
+
+# pragma omp barrier
+
+ for (thread_index_t seq = 0; seq < sd->num_threads; seq++)
+ {
+ // For each sequence.
+ if (iam > 0)
+ sd->pieces[iam][seq].begin = sd->pieces[iam - 1][seq].end;
+ else
+ // Absolute beginning.
+ sd->pieces[iam][seq].begin = 0;
+ }
+ }
+ };
+
+/** @brief Split by sampling. */
+template<typename RandomAccessIterator, typename Comparator,
+ typename SortingPlacesIterator>
+ struct split_consistently<false, RandomAccessIterator, Comparator,
+ SortingPlacesIterator>
+ {
+ void operator()(
+ const thread_index_t iam,
+ PMWMSSortingData<RandomAccessIterator>* sd,
+ Comparator& comp,
+ const typename
+ std::iterator_traits<RandomAccessIterator>::difference_type
+ num_samples)
+ const
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ determine_samples(sd, num_samples);
+
+# pragma omp barrier
+
+# pragma omp single
+ __gnu_sequential::sort(sd->samples,
+ sd->samples + (num_samples * sd->num_threads),
+ comp);
+
+# pragma omp barrier
+
+ for (thread_index_t s = 0; s < sd->num_threads; ++s)
+ {
+ // For each sequence.
+ if (num_samples * iam > 0)
+ sd->pieces[iam][s].begin =
+ std::lower_bound(sd->temporary[s],
+ sd->temporary[s]
+ + (sd->starts[s + 1] - sd->starts[s]),
+ sd->samples[num_samples * iam],
+ comp)
+ - sd->temporary[s];
+ else
+ // Absolute beginning.
+ sd->pieces[iam][s].begin = 0;
+
+ if ((num_samples * (iam + 1)) < (num_samples * sd->num_threads))
+ sd->pieces[iam][s].end =
+ std::lower_bound(sd->temporary[s],
+ sd->temporary[s]
+ + (sd->starts[s + 1] - sd->starts[s]),
+ sd->samples[num_samples * (iam + 1)],
+ comp)
+ - sd->temporary[s];
+ else
+ // Absolute end.
+ sd->pieces[iam][s].end = sd->starts[s + 1] - sd->starts[s];
+ }
+ }
+ };
+
+template<bool stable, typename RandomAccessIterator, typename Comparator>
+ struct possibly_stable_sort
+ {
+ };
+
+template<typename RandomAccessIterator, typename Comparator>
+ struct possibly_stable_sort<true, RandomAccessIterator, Comparator>
+ {
+ void operator()(const RandomAccessIterator& begin,
+ const RandomAccessIterator& end, Comparator& comp) const
+ {
+ __gnu_sequential::stable_sort(begin, end, comp);
+ }
+ };
+
+template<typename RandomAccessIterator, typename Comparator>
+ struct possibly_stable_sort<false, RandomAccessIterator, Comparator>
+ {
+ void operator()(const RandomAccessIterator begin,
+ const RandomAccessIterator end, Comparator& comp) const
+ {
+ __gnu_sequential::sort(begin, end, comp);
+ }
+ };
+
+template<bool stable, typename SeqRandomAccessIterator,
+ typename RandomAccessIterator, typename Comparator,
+ typename DiffType>
+ struct possibly_stable_multiway_merge
+ {
+ };
+
+template<typename SeqRandomAccessIterator, typename RandomAccessIterator,
+ typename Comparator, typename DiffType>
+ struct possibly_stable_multiway_merge
+ <true, SeqRandomAccessIterator, RandomAccessIterator, Comparator,
+ DiffType>
+ {
+ void operator()(const SeqRandomAccessIterator& seqs_begin,
+ const SeqRandomAccessIterator& seqs_end,
+ const RandomAccessIterator& target,
+ Comparator& comp,
+ DiffType length_am) const
+ {
+ stable_multiway_merge(seqs_begin, seqs_end, target, length_am, comp,
+ sequential_tag());
+ }
+ };
+
+template<typename SeqRandomAccessIterator, typename RandomAccessIterator,
+ typename Comparator, typename DiffType>
+ struct possibly_stable_multiway_merge
+ <false, SeqRandomAccessIterator, RandomAccessIterator, Comparator,
+ DiffType>
+ {
+ void operator()(const SeqRandomAccessIterator& seqs_begin,
+ const SeqRandomAccessIterator& seqs_end,
+ const RandomAccessIterator& target,
+ Comparator& comp,
+ DiffType length_am) const
+ {
+ multiway_merge(seqs_begin, seqs_end, target, length_am, comp,
+ sequential_tag());
+ }
+ };
+
+/** @brief PMWMS code executed by each thread.
+ * @param sd Pointer to algorithm data.
+ * @param comp Comparator.
+ */
+template<bool stable, bool exact, typename RandomAccessIterator,
+ typename Comparator>
+ void
+ parallel_sort_mwms_pu(PMWMSSortingData<RandomAccessIterator>* sd,
+ Comparator& comp)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ thread_index_t iam = omp_get_thread_num();
+
+ // Length of this thread's chunk, before merging.
+ difference_type length_local = sd->starts[iam + 1] - sd->starts[iam];
+
+ // Sort in temporary storage, leave space for sentinel.
+
+ typedef value_type* SortingPlacesIterator;
+
+ sd->temporary[iam] =
+ static_cast<value_type*>(
+ ::operator new(sizeof(value_type) * (length_local + 1)));
+
+ // Copy there.
+ std::uninitialized_copy(sd->source + sd->starts[iam],
+ sd->source + sd->starts[iam] + length_local,
+ sd->temporary[iam]);
+
+ possibly_stable_sort<stable, SortingPlacesIterator, Comparator>()
+ (sd->temporary[iam], sd->temporary[iam] + length_local, comp);
+
+ // Invariant: locally sorted subsequence in sd->temporary[iam],
+ // sd->temporary[iam] + length_local.
+
+ // No barrier here: Synchronization is done by the splitting routine.
+
+ difference_type num_samples =
+ _Settings::get().sort_mwms_oversampling * sd->num_threads - 1;
+ split_consistently
+ <exact, RandomAccessIterator, Comparator, SortingPlacesIterator>()
+ (iam, sd, comp, num_samples);
+
+ // Offset from target begin, length after merging.
+ difference_type offset = 0, length_am = 0;
+ for (thread_index_t s = 0; s < sd->num_threads; s++)
+ {
+ length_am += sd->pieces[iam][s].end - sd->pieces[iam][s].begin;
+ offset += sd->pieces[iam][s].begin;
+ }
+
+ typedef std::vector<
+ std::pair<SortingPlacesIterator, SortingPlacesIterator> >
+ seq_vector_type;
+ seq_vector_type seqs(sd->num_threads);
+
+ for (int s = 0; s < sd->num_threads; ++s)
+ {
+ seqs[s] =
+ std::make_pair(sd->temporary[s] + sd->pieces[iam][s].begin,
+ sd->temporary[s] + sd->pieces[iam][s].end);
+ }
+
+ possibly_stable_multiway_merge<
+ stable,
+ typename seq_vector_type::iterator,
+ RandomAccessIterator,
+ Comparator, difference_type>()
+ (seqs.begin(), seqs.end(),
+ sd->source + offset, comp,
+ length_am);
+
+# pragma omp barrier
+
+ ::operator delete(sd->temporary[iam]);
+ }
+
+/** @brief PMWMS main call.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param comp Comparator.
+ * @param n Length of sequence.
+ * @param num_threads Number of threads to use.
+ */
+template<bool stable, bool exact, typename RandomAccessIterator,
+ typename Comparator>
+ void
+ parallel_sort_mwms(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp,
+ thread_index_t num_threads)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+
+ if (n <= 1)
+ return;
+
+ // at least one element per thread
+ if (num_threads > n)
+ num_threads = static_cast<thread_index_t>(n);
+
+ // shared variables
+ PMWMSSortingData<RandomAccessIterator> sd;
+ difference_type* starts;
+
+# pragma omp parallel num_threads(num_threads)
+ {
+ num_threads = omp_get_num_threads(); //no more threads than requested
+
+# pragma omp single
+ {
+ sd.num_threads = num_threads;
+ sd.source = begin;
+
+ sd.temporary = new value_type*[num_threads];
+
+ if (!exact)
+ {
+ difference_type size =
+ (_Settings::get().sort_mwms_oversampling * num_threads - 1)
+ * num_threads;
+ sd.samples = static_cast<value_type*>(
+ ::operator new(size * sizeof(value_type)));
+ }
+ else
+ sd.samples = NULL;
+
+ sd.offsets = new difference_type[num_threads - 1];
+ sd.pieces = new std::vector<Piece<difference_type> >[num_threads];
+ for (int s = 0; s < num_threads; ++s)
+ sd.pieces[s].resize(num_threads);
+ starts = sd.starts = new difference_type[num_threads + 1];
+
+ difference_type chunk_length = n / num_threads;
+ difference_type split = n % num_threads;
+ difference_type pos = 0;
+ for (int i = 0; i < num_threads; ++i)
+ {
+ starts[i] = pos;
+ pos += (i < split) ? (chunk_length + 1) : chunk_length;
+ }
+ starts[num_threads] = pos;
+ } //single
+
+ // Now sort in parallel.
+ parallel_sort_mwms_pu<stable, exact>(&sd, comp);
+ } //parallel
+
+ delete[] starts;
+ delete[] sd.temporary;
+
+ if (!exact)
+ ::operator delete(sd.samples);
+
+ delete[] sd.offsets;
+ delete[] sd.pieces;
+ }
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/numeric b/gcc-4.4.0/libstdc++-v3/include/parallel/numeric
new file mode 100644
index 000000000..33b1411f1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/numeric
@@ -0,0 +1,500 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file parallel/numeric
+*
+ * @brief Parallel STL function calls corresponding to stl_numeric.h.
+ * The functions defined here mainly do case switches and
+ * call the actual parallelized versions in other files.
+ * Inlining policy: Functions that basically only contain one function call,
+ * are declared inline.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_NUMERIC_H
+#define _GLIBCXX_PARALLEL_NUMERIC_H 1
+
+#include <numeric>
+#include <functional>
+#include <parallel/numericfwd.h>
+#include <parallel/iterator.h>
+#include <parallel/for_each.h>
+#include <parallel/for_each_selectors.h>
+#include <parallel/partial_sum.h>
+
+namespace std
+{
+namespace __parallel
+{
+ // Sequential fallback.
+ template<typename InputIterator, typename T>
+ inline T
+ accumulate(InputIterator begin, InputIterator end, T init,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::accumulate(begin, end, init); }
+
+ template<typename InputIterator, typename T, typename BinaryOperation>
+ inline T
+ accumulate(InputIterator begin, InputIterator end, T init,
+ BinaryOperation binary_op, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::accumulate(begin, end, init, binary_op); }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator, typename T, typename IteratorTag>
+ inline T
+ accumulate_switch(InputIterator begin, InputIterator end,
+ T init, IteratorTag)
+ { return accumulate(begin, end, init, __gnu_parallel::sequential_tag()); }
+
+ template<typename InputIterator, typename T, typename BinaryOperation,
+ typename IteratorTag>
+ inline T
+ accumulate_switch(InputIterator begin, InputIterator end, T init,
+ BinaryOperation binary_op, IteratorTag)
+ { return accumulate(begin, end, init, binary_op,
+ __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename _RandomAccessIterator, typename T,
+ typename BinaryOperation>
+ T
+ accumulate_switch(_RandomAccessIterator begin, _RandomAccessIterator end,
+ T init, BinaryOperation binary_op,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_unbalanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().accumulate_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ T res = init;
+ __gnu_parallel::accumulate_selector<_RandomAccessIterator>
+ my_selector;
+ __gnu_parallel::
+ for_each_template_random_access_ed(begin, end,
+ __gnu_parallel::nothing(),
+ my_selector,
+ __gnu_parallel::
+ accumulate_binop_reduct
+ <BinaryOperation>(binary_op),
+ res, res, -1);
+ return res;
+ }
+ else
+ return accumulate(begin, end, init, binary_op,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename InputIterator, typename T>
+ inline T
+ accumulate(InputIterator begin, InputIterator end, T init,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef std::iterator_traits<InputIterator> iterator_traits;
+ typedef typename iterator_traits::value_type value_type;
+ typedef typename iterator_traits::iterator_category iterator_category;
+
+ return accumulate_switch(begin, end, init,
+ __gnu_parallel::plus<T, value_type>(),
+ iterator_category(), parallelism_tag);
+ }
+
+ template<typename InputIterator, typename T>
+ inline T
+ accumulate(InputIterator begin, InputIterator end, T init)
+ {
+ typedef std::iterator_traits<InputIterator> iterator_traits;
+ typedef typename iterator_traits::value_type value_type;
+ typedef typename iterator_traits::iterator_category iterator_category;
+
+ return accumulate_switch(begin, end, init,
+ __gnu_parallel::plus<T, value_type>(),
+ iterator_category());
+ }
+
+ template<typename InputIterator, typename T, typename BinaryOperation>
+ inline T
+ accumulate(InputIterator begin, InputIterator end, T init,
+ BinaryOperation binary_op,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return accumulate_switch(begin, end, init, binary_op,
+ iterator_category(), parallelism_tag);
+ }
+
+ template<typename InputIterator, typename T, typename BinaryOperation>
+ inline T
+ accumulate(InputIterator begin, InputIterator end, T init,
+ BinaryOperation binary_op)
+ {
+ typedef iterator_traits<InputIterator> iterator_traits;
+ typedef typename iterator_traits::iterator_category iterator_category;
+ return accumulate_switch(begin, end, init, binary_op,
+ iterator_category());
+ }
+
+
+ // Sequential fallback.
+ template<typename InputIterator1, typename InputIterator2, typename T>
+ inline T
+ inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::inner_product(first1, last1, first2, init); }
+
+ template<typename InputIterator1, typename InputIterator2, typename T,
+ typename BinaryFunction1, typename BinaryFunction2>
+ inline T
+ inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init, BinaryFunction1 binary_op1,
+ BinaryFunction2 binary_op2, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::inner_product(first1, last1, first2, init,
+ binary_op1, binary_op2); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename RandomAccessIterator1, typename RandomAccessIterator2,
+ typename T, typename BinaryFunction1, typename BinaryFunction2>
+ T
+ inner_product_switch(RandomAccessIterator1 first1,
+ RandomAccessIterator1 last1,
+ RandomAccessIterator2 first2, T init,
+ BinaryFunction1 binary_op1,
+ BinaryFunction2 binary_op2,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_unbalanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION((last1 - first1)
+ >= __gnu_parallel::_Settings::get().
+ accumulate_minimal_n
+ && __gnu_parallel::
+ is_parallel(parallelism_tag)))
+ {
+ T res = init;
+ __gnu_parallel::
+ inner_product_selector<RandomAccessIterator1,
+ RandomAccessIterator2, T> my_selector(first1, first2);
+ __gnu_parallel::
+ for_each_template_random_access_ed(first1, last1, binary_op2,
+ my_selector, binary_op1,
+ res, res, -1);
+ return res;
+ }
+ else
+ return inner_product(first1, last1, first2, init,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // No parallelism for input iterators.
+ template<typename InputIterator1, typename InputIterator2, typename T,
+ typename BinaryFunction1, typename BinaryFunction2,
+ typename IteratorTag1, typename IteratorTag2>
+ inline T
+ inner_product_switch(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init,
+ BinaryFunction1 binary_op1,
+ BinaryFunction2 binary_op2,
+ IteratorTag1, IteratorTag2)
+ { return inner_product(first1, last1, first2, init,
+ binary_op1, binary_op2,
+ __gnu_parallel::sequential_tag()); }
+
+ template<typename InputIterator1, typename InputIterator2, typename T,
+ typename BinaryFunction1, typename BinaryFunction2>
+ inline T
+ inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init, BinaryFunction1 binary_op1,
+ BinaryFunction2 binary_op2,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator1> traits1_type;
+ typedef typename traits1_type::iterator_category iterator1_category;
+
+ typedef iterator_traits<InputIterator2> traits2_type;
+ typedef typename traits2_type::iterator_category iterator2_category;
+
+ return inner_product_switch(first1, last1, first2, init, binary_op1,
+ binary_op2, iterator1_category(),
+ iterator2_category(), parallelism_tag);
+ }
+
+ template<typename InputIterator1, typename InputIterator2, typename T,
+ typename BinaryFunction1, typename BinaryFunction2>
+ inline T
+ inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init, BinaryFunction1 binary_op1,
+ BinaryFunction2 binary_op2)
+ {
+ typedef iterator_traits<InputIterator1> traits1_type;
+ typedef typename traits1_type::iterator_category iterator1_category;
+
+ typedef iterator_traits<InputIterator2> traits2_type;
+ typedef typename traits2_type::iterator_category iterator2_category;
+
+ return inner_product_switch(first1, last1, first2, init, binary_op1,
+ binary_op2, iterator1_category(),
+ iterator2_category());
+ }
+
+ template<typename InputIterator1, typename InputIterator2, typename T>
+ inline T
+ inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator1> traits_type1;
+ typedef typename traits_type1::value_type value_type1;
+ typedef iterator_traits<InputIterator2> traits_type2;
+ typedef typename traits_type2::value_type value_type2;
+
+ typedef typename
+ __gnu_parallel::multiplies<value_type1, value_type2>::result
+ multiplies_result_type;
+ return inner_product(first1, last1, first2, init,
+ __gnu_parallel::plus<T, multiplies_result_type>(),
+ __gnu_parallel::
+ multiplies<value_type1, value_type2>(),
+ parallelism_tag);
+ }
+
+ template<typename InputIterator1, typename InputIterator2, typename T>
+ inline T
+ inner_product(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init)
+ {
+ typedef iterator_traits<InputIterator1> traits_type1;
+ typedef typename traits_type1::value_type value_type1;
+ typedef iterator_traits<InputIterator2> traits_type2;
+ typedef typename traits_type2::value_type value_type2;
+
+ typedef typename
+ __gnu_parallel::multiplies<value_type1, value_type2>::result
+ multiplies_result_type;
+ return inner_product(first1, last1, first2, init,
+ __gnu_parallel::plus<T, multiplies_result_type>(),
+ __gnu_parallel::
+ multiplies<value_type1, value_type2>());
+ }
+
+ // Sequential fallback.
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ partial_sum(InputIterator begin, InputIterator end, OutputIterator result,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::partial_sum(begin, end, result); }
+
+ // Sequential fallback.
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ inline OutputIterator
+ partial_sum(InputIterator begin, InputIterator end, OutputIterator result,
+ BinaryOperation bin_op, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::partial_sum(begin, end, result, bin_op); }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation, typename IteratorTag1,
+ typename IteratorTag2>
+ inline OutputIterator
+ partial_sum_switch(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ IteratorTag1, IteratorTag2)
+ { return _GLIBCXX_STD_P::partial_sum(begin, end, result, bin_op); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ OutputIterator
+ partial_sum_switch(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ random_access_iterator_tag, random_access_iterator_tag)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().partial_sum_minimal_n))
+ return __gnu_parallel::parallel_partial_sum(begin, end,
+ result, bin_op);
+ else
+ return partial_sum(begin, end, result, bin_op,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ partial_sum(InputIterator begin, InputIterator end, OutputIterator result)
+ {
+ typedef typename iterator_traits<InputIterator>::value_type value_type;
+ return partial_sum(begin, end, result, std::plus<value_type>());
+ }
+
+ // Public interface
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ inline OutputIterator
+ partial_sum(InputIterator begin, InputIterator end, OutputIterator result,
+ BinaryOperation binary_op)
+ {
+ typedef iterator_traits<InputIterator> traitsi_type;
+ typedef typename traitsi_type::iterator_category iteratori_category;
+
+ typedef iterator_traits<OutputIterator> traitso_type;
+ typedef typename traitso_type::iterator_category iteratoro_category;
+
+ return partial_sum_switch(begin, end, result, binary_op,
+ iteratori_category(), iteratoro_category());
+ }
+
+ // Sequential fallback.
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ adjacent_difference(InputIterator begin, InputIterator end,
+ OutputIterator result, __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::adjacent_difference(begin, end, result); }
+
+ // Sequential fallback.
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ inline OutputIterator
+ adjacent_difference(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ __gnu_parallel::sequential_tag)
+ { return _GLIBCXX_STD_P::adjacent_difference(begin, end, result, bin_op); }
+
+ // Sequential fallback for input iterator case.
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation, typename IteratorTag1,
+ typename IteratorTag2>
+ inline OutputIterator
+ adjacent_difference_switch(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ IteratorTag1, IteratorTag2)
+ { return adjacent_difference(begin, end, result, bin_op,
+ __gnu_parallel::sequential_tag()); }
+
+ // Parallel algorithm for random access iterators.
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ OutputIterator
+ adjacent_difference_switch(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism_tag
+ = __gnu_parallel::parallel_balanced)
+ {
+ if (_GLIBCXX_PARALLEL_CONDITION(
+ static_cast<__gnu_parallel::sequence_index_t>(end - begin)
+ >= __gnu_parallel::_Settings::get().adjacent_difference_minimal_n
+ && __gnu_parallel::is_parallel(parallelism_tag)))
+ {
+ bool dummy = true;
+ typedef __gnu_parallel::iterator_pair<InputIterator, OutputIterator,
+ random_access_iterator_tag> ip;
+ *result = *begin;
+ ip begin_pair(begin + 1, result + 1),
+ end_pair(end, result + (end - begin));
+ __gnu_parallel::adjacent_difference_selector<ip> functionality;
+ __gnu_parallel::
+ for_each_template_random_access_ed(begin_pair, end_pair, bin_op,
+ functionality,
+ __gnu_parallel::dummy_reduct(),
+ dummy, dummy, -1);
+ return functionality.finish_iterator;
+ }
+ else
+ return adjacent_difference(begin, end, result, bin_op,
+ __gnu_parallel::sequential_tag());
+ }
+
+ // Public interface.
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ adjacent_difference(InputIterator begin, InputIterator end,
+ OutputIterator result,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ return adjacent_difference(begin, end, result, std::minus<value_type>(),
+ parallelism_tag);
+ }
+
+ template<typename InputIterator, typename OutputIterator>
+ inline OutputIterator
+ adjacent_difference(InputIterator begin, InputIterator end,
+ OutputIterator result)
+ {
+ typedef iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ return adjacent_difference(begin, end, result, std::minus<value_type>());
+ }
+
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ inline OutputIterator
+ adjacent_difference(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation binary_op,
+ __gnu_parallel::_Parallelism parallelism_tag)
+ {
+ typedef iterator_traits<InputIterator> traitsi_type;
+ typedef typename traitsi_type::iterator_category iteratori_category;
+
+ typedef iterator_traits<OutputIterator> traitso_type;
+ typedef typename traitso_type::iterator_category iteratoro_category;
+
+ return adjacent_difference_switch(begin, end, result, binary_op,
+ iteratori_category(),
+ iteratoro_category(), parallelism_tag);
+ }
+
+ template<typename InputIterator, typename OutputIterator,
+ typename BinaryOperation>
+ inline OutputIterator
+ adjacent_difference(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation binary_op)
+ {
+ typedef iterator_traits<InputIterator> traitsi_type;
+ typedef typename traitsi_type::iterator_category iteratori_category;
+
+ typedef iterator_traits<OutputIterator> traitso_type;
+ typedef typename traitso_type::iterator_category iteratoro_category;
+
+ return adjacent_difference_switch(begin, end, result, binary_op,
+ iteratori_category(),
+ iteratoro_category());
+ }
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_NUMERIC_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/numericfwd.h b/gcc-4.4.0/libstdc++-v3/include/parallel/numericfwd.h
new file mode 100644
index 000000000..af2d0416f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/numericfwd.h
@@ -0,0 +1,203 @@
+// <numeric> parallel extensions -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/numericfwd.h
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PARALLEL_NUMERICFWD_H
+#define _GLIBCXX_PARALLEL_NUMERICFWD_H 1
+
+#pragma GCC system_header
+
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+
+namespace std
+{
+namespace __parallel
+{
+ template<typename _IIter, typename _Tp>
+ _Tp
+ accumulate(_IIter, _IIter, _Tp);
+
+ template<typename _IIter, typename _Tp>
+ _Tp
+ accumulate(_IIter, _IIter, _Tp, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _Tp>
+ _Tp
+ accumulate(_IIter, _IIter, _Tp, __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _Tp, typename _Tag>
+ _Tp
+ accumulate_switch(_IIter, _IIter, _Tp, _Tag);
+
+ template<typename _IIter, typename _Tp, typename _BinaryOper>
+ _Tp
+ accumulate(_IIter, _IIter, _Tp, _BinaryOper);
+
+ template<typename _IIter, typename _Tp, typename _BinaryOper>
+ _Tp
+ accumulate(_IIter, _IIter, _Tp, _BinaryOper,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _Tp, typename _BinaryOper>
+ _Tp
+ accumulate(_IIter, _IIter, _Tp, _BinaryOper,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _Tp, typename _BinaryOper,
+ typename _Tag>
+ _Tp
+ accumulate_switch(_IIter, _IIter, _Tp, _BinaryOper, _Tag);
+
+ template<typename _RAIter, typename _Tp, typename _BinaryOper>
+ _Tp
+ accumulate_switch(_RAIter, _RAIter, _Tp, _BinaryOper,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_unbalanced);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ adjacent_difference(_IIter, _IIter, _OIter);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ adjacent_difference(_IIter, _IIter, _OIter,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ adjacent_difference(_IIter, _IIter, _OIter,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper,
+ typename _Tag1, typename _Tag2>
+ _OIter
+ adjacent_difference_switch(_IIter, _IIter, _OIter, _BinaryOper,
+ _Tag1, _Tag2);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ adjacent_difference_switch(_IIter, _IIter, _OIter, _BinaryOper,
+ random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism parallelism
+ = __gnu_parallel::parallel_unbalanced);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp>
+ _Tp
+ inner_product(_IIter1, _IIter1, _IIter2, _Tp);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp>
+ _Tp
+ inner_product(_IIter1, _IIter1, _IIter2, _Tp,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp>
+ _Tp
+ inner_product(_IIter1, _IIter1, _IIter2, _Tp,
+ __gnu_parallel::_Parallelism);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp,
+ typename _BinaryFunction1, typename _BinaryFunction2>
+ _Tp
+ inner_product(_IIter1, _IIter1, _IIter2, _Tp,
+ _BinaryFunction1, _BinaryFunction2);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp,
+ typename _BinaryFunction1, typename _BinaryFunction2>
+ _Tp
+ inner_product(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1,
+ _BinaryFunction2, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp,
+ typename BinaryFunction1, typename BinaryFunction2>
+ _Tp
+ inner_product(_IIter1, _IIter1, _IIter2, _Tp, BinaryFunction1,
+ BinaryFunction2, __gnu_parallel::_Parallelism);
+
+ template<typename _RAIter1, typename _RAIter2, typename _Tp,
+ typename BinaryFunction1, typename BinaryFunction2>
+ _Tp
+ inner_product_switch(_RAIter1, _RAIter1, _RAIter2, _Tp, BinaryFunction1,
+ BinaryFunction2, random_access_iterator_tag,
+ random_access_iterator_tag,
+ __gnu_parallel::_Parallelism
+ = __gnu_parallel::parallel_unbalanced);
+
+ template<typename _IIter1, typename _IIter2, typename _Tp,
+ typename _BinaryFunction1, typename _BinaryFunction2,
+ typename _Tag1, typename _Tag2>
+ _Tp
+ inner_product_switch(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1,
+ _BinaryFunction2, _Tag1, _Tag2);
+
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ partial_sum(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ partial_sum(_IIter, _IIter, _OIter, _BinaryOper,
+ __gnu_parallel::sequential_tag);
+
+ template<typename _IIter, typename _OIter>
+ _OIter
+ partial_sum(_IIter, _IIter, _OIter result);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ partial_sum(_IIter, _IIter, _OIter, _BinaryOper);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper,
+ typename _Tag1, typename _Tag2>
+ _OIter
+ partial_sum_switch(_IIter, _IIter, _OIter, _BinaryOper, _Tag1, _Tag2);
+
+ template<typename _IIter, typename _OIter, typename _BinaryOper>
+ _OIter
+ partial_sum_switch(_IIter, _IIter, _OIter, _BinaryOper,
+ random_access_iterator_tag, random_access_iterator_tag);
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_NUMERICFWD_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop.h b/gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop.h
new file mode 100644
index 000000000..66f6d44bc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop.h
@@ -0,0 +1,118 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/omp_loop.h
+ * @brief Parallelization of embarrassingly parallel execution by
+ * means of an OpenMP for loop.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H
+#define _GLIBCXX_PARALLEL_OMP_LOOP_H 1
+
+#include <omp.h>
+
+#include <parallel/settings.h>
+#include <parallel/basic_iterator.h>
+#include <parallel/base.h>
+
+namespace __gnu_parallel
+{
+/** @brief Embarrassingly parallel algorithm for random access
+ * iterators, using an OpenMP for loop.
+ *
+ * @param begin Begin iterator of element sequence.
+ * @param end End iterator of element sequence.
+ * @param o User-supplied functor (comparator, predicate, adding
+ * functor, etc.).
+ * @param f Functor to "process" an element with op (depends on
+ * desired functionality, e. g. for std::for_each(), ...).
+ * @param r Functor to "add" a single result to the already
+ * processed elements (depends on functionality).
+ * @param base Base value for reduction.
+ * @param output Pointer to position where final result is written to
+ * @param bound Maximum number of elements processed (e. g. for
+ * std::count_n()).
+ * @return User-supplied functor (that may contain a part of the result).
+ */
+template<typename RandomAccessIterator,
+ typename Op,
+ typename Fu,
+ typename Red,
+ typename Result>
+ Op
+ for_each_template_random_access_omp_loop(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Op o, Fu& f, Red r, Result base,
+ Result& output,
+ typename std::iterator_traits
+ <RandomAccessIterator>::
+ difference_type bound)
+ {
+ typedef typename
+ std::iterator_traits<RandomAccessIterator>::difference_type
+ difference_type;
+
+ difference_type length = end - begin;
+ thread_index_t num_threads =
+ __gnu_parallel::min<difference_type>(get_max_threads(), length);
+
+ Result *thread_results;
+
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ thread_results = new Result[num_threads];
+
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ thread_results[i] = Result();
+ }
+
+ thread_index_t iam = omp_get_thread_num();
+
+# pragma omp for schedule(dynamic, _Settings::get().workstealing_chunk_size)
+ for (difference_type pos = 0; pos < length; ++pos)
+ thread_results[iam] =
+ r(thread_results[iam], f(o, begin+pos));
+ } //parallel
+
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ output = r(output, thread_results[i]);
+
+ delete [] thread_results;
+
+ // Points to last element processed (needed as return value for
+ // some algorithms like transform).
+ f.finish_iterator = begin + length;
+
+ return o;
+ }
+
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_OMP_LOOP_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop_static.h b/gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop_static.h
new file mode 100644
index 000000000..523618307
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/omp_loop_static.h
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/omp_loop_static.h
+ * @brief Parallelization of embarrassingly parallel execution by
+ * means of an OpenMP for loop with static scheduling.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H
+#define _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H 1
+
+#include <omp.h>
+
+#include <parallel/settings.h>
+#include <parallel/basic_iterator.h>
+
+namespace __gnu_parallel
+{
+
+ /** @brief Embarrassingly parallel algorithm for random access
+ * iterators, using an OpenMP for loop with static scheduling.
+ *
+ * @param begin Begin iterator of element sequence.
+ * @param end End iterator of element sequence.
+ * @param o User-supplied functor (comparator, predicate, adding
+ * functor, ...).
+ * @param f Functor to "process" an element with op (depends on
+ * desired functionality, e. g. for std::for_each(), ...).
+ * @param r Functor to "add" a single result to the already processed
+ * elements (depends on functionality).
+ * @param base Base value for reduction.
+ * @param output Pointer to position where final result is written to
+ * @param bound Maximum number of elements processed (e. g. for
+ * std::count_n()).
+ * @return User-supplied functor (that may contain a part of the result).
+ */
+template<typename RandomAccessIterator,
+ typename Op,
+ typename Fu,
+ typename Red,
+ typename Result>
+ Op
+ for_each_template_random_access_omp_loop_static(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Op o, Fu& f, Red r,
+ Result base, Result& output,
+ typename std::iterator_traits
+ <RandomAccessIterator>::
+ difference_type bound)
+ {
+ typedef typename
+ std::iterator_traits<RandomAccessIterator>::difference_type
+ difference_type;
+
+ difference_type length = end - begin;
+ thread_index_t num_threads =
+ std::min<difference_type>(get_max_threads(), length);
+
+ Result *thread_results;
+
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ thread_results = new Result[num_threads];
+
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ thread_results[i] = Result();
+ }
+
+ thread_index_t iam = omp_get_thread_num();
+
+# pragma omp for schedule(static, _Settings::get().workstealing_chunk_size)
+ for (difference_type pos = 0; pos < length; ++pos)
+ thread_results[iam] = r(thread_results[iam], f(o, begin+pos));
+ } //parallel
+
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ output = r(output, thread_results[i]);
+
+ delete [] thread_results;
+
+ // Points to last element processed (needed as return value for
+ // some algorithms like transform).
+ f.finish_iterator = begin + length;
+
+ return o;
+ }
+
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/par_loop.h b/gcc-4.4.0/libstdc++-v3/include/parallel/par_loop.h
new file mode 100644
index 000000000..be61d4ca2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/par_loop.h
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/par_loop.h
+ * @brief Parallelization of embarrassingly parallel execution by
+ * means of equal splitting.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_PAR_LOOP_H
+#define _GLIBCXX_PARALLEL_PAR_LOOP_H 1
+
+#include <omp.h>
+#include <parallel/settings.h>
+#include <parallel/base.h>
+#include <parallel/equally_split.h>
+
+namespace __gnu_parallel
+{
+
+/** @brief Embarrassingly parallel algorithm for random access
+ * iterators, using hand-crafted parallelization by equal splitting
+ * the work.
+ *
+ * @param begin Begin iterator of element sequence.
+ * @param end End iterator of element sequence.
+ * @param o User-supplied functor (comparator, predicate, adding
+ * functor, ...)
+ * @param f Functor to "process" an element with op (depends on
+ * desired functionality, e. g. for std::for_each(), ...).
+ * @param r Functor to "add" a single result to the already
+ * processed elements (depends on functionality).
+ * @param base Base value for reduction.
+ * @param output Pointer to position where final result is written to
+ * @param bound Maximum number of elements processed (e. g. for
+ * std::count_n()).
+ * @return User-supplied functor (that may contain a part of the result).
+ */
+template<typename RandomAccessIterator,
+ typename Op,
+ typename Fu,
+ typename Red,
+ typename Result>
+ Op
+ for_each_template_random_access_ed(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Op o, Fu& f, Red r, Result base,
+ Result& output,
+ typename std::iterator_traits
+ <RandomAccessIterator>::
+ difference_type bound)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ const difference_type length = end - begin;
+ Result *thread_results;
+ bool* constructed;
+
+ thread_index_t num_threads =
+ __gnu_parallel::min<difference_type>(get_max_threads(), length);
+
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ thread_results = static_cast<Result*>(
+ ::operator new(num_threads * sizeof(Result)));
+ constructed = new bool[num_threads];
+ }
+
+ thread_index_t iam = omp_get_thread_num();
+
+ // Neutral element.
+ Result* reduct = static_cast<Result*>(::operator new(sizeof(Result)));
+
+ difference_type
+ start = equally_split_point(length, num_threads, iam),
+ stop = equally_split_point(length, num_threads, iam + 1);
+
+ if (start < stop)
+ {
+ new(reduct) Result(f(o, begin + start));
+ ++start;
+ constructed[iam] = true;
+ }
+ else
+ constructed[iam] = false;
+
+ for (; start < stop; ++start)
+ *reduct = r(*reduct, f(o, begin + start));
+
+ thread_results[iam] = *reduct;
+ } //parallel
+
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ if (constructed[i])
+ output = r(output, thread_results[i]);
+
+ // Points to last element processed (needed as return value for
+ // some algorithms like transform).
+ f.finish_iterator = begin + length;
+
+ delete[] thread_results;
+ delete[] constructed;
+
+ return o;
+ }
+
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_PAR_LOOP_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/parallel.h b/gcc-4.4.0/libstdc++-v3/include/parallel/parallel.h
new file mode 100644
index 000000000..c4bfc057a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/parallel.h
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/parallel.h
+ * @brief End-user include file. Provides advanced settings and
+ * tuning options.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze and Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_PARALLEL_H
+#define _GLIBCXX_PARALLEL_PARALLEL_H 1
+
+#include <parallel/features.h>
+#include <parallel/compiletime_settings.h>
+#include <parallel/types.h>
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+
+#endif /* _GLIBCXX_PARALLEL_PARALLEL_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/partial_sum.h b/gcc-4.4.0/libstdc++-v3/include/parallel/partial_sum.h
new file mode 100644
index 000000000..92630936d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/partial_sum.h
@@ -0,0 +1,220 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/partial_sum.h
+ * @brief Parallel implementation of std::partial_sum(), i. e. prefix
+ * sums.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_PARTIAL_SUM_H
+#define _GLIBCXX_PARALLEL_PARTIAL_SUM_H 1
+
+#include <omp.h>
+#include <new>
+#include <bits/stl_algobase.h>
+#include <parallel/parallel.h>
+#include <parallel/numericfwd.h>
+
+namespace __gnu_parallel
+{
+ // Problem: there is no 0-element given.
+
+/** @brief Base case prefix sum routine.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param result Begin iterator of output sequence.
+ * @param bin_op Associative binary function.
+ * @param value Start value. Must be passed since the neutral
+ * element is unknown in general.
+ * @return End iterator of output sequence. */
+template<typename InputIterator,
+ typename OutputIterator,
+ typename BinaryOperation>
+ OutputIterator
+ parallel_partial_sum_basecase(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ typename std::iterator_traits
+ <InputIterator>::value_type value)
+ {
+ if (begin == end)
+ return result;
+
+ while (begin != end)
+ {
+ value = bin_op(value, *begin);
+ *result = value;
+ ++result;
+ ++begin;
+ }
+ return result;
+ }
+
+/** @brief Parallel partial sum implementation, two-phase approach,
+ no recursion.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param result Begin iterator of output sequence.
+ * @param bin_op Associative binary function.
+ * @param n Length of sequence.
+ * @param num_threads Number of threads to use.
+ * @return End iterator of output sequence.
+ */
+template<typename InputIterator,
+ typename OutputIterator,
+ typename BinaryOperation>
+ OutputIterator
+ parallel_partial_sum_linear(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op,
+ typename std::iterator_traits
+ <InputIterator>::difference_type n)
+ {
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ if (begin == end)
+ return result;
+
+ thread_index_t num_threads =
+ std::min<difference_type>(get_max_threads(), n - 1);
+
+ if (num_threads < 2)
+ {
+ *result = *begin;
+ return parallel_partial_sum_basecase(
+ begin + 1, end, result + 1, bin_op, *begin);
+ }
+
+ difference_type* borders;
+ value_type* sums;
+
+ const _Settings& __s = _Settings::get();
+
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+
+ borders = new difference_type[num_threads + 2];
+
+ if (__s.partial_sum_dilation == 1.0f)
+ equally_split(n, num_threads + 1, borders);
+ else
+ {
+ difference_type chunk_length =
+ ((double)n
+ / ((double)num_threads + __s.partial_sum_dilation)),
+ borderstart = n - num_threads * chunk_length;
+ borders[0] = 0;
+ for (int i = 1; i < (num_threads + 1); ++i)
+ {
+ borders[i] = borderstart;
+ borderstart += chunk_length;
+ }
+ borders[num_threads + 1] = n;
+ }
+
+ sums = static_cast<value_type*>(::operator new(sizeof(value_type)
+ * num_threads));
+ OutputIterator target_end;
+ } //single
+
+ thread_index_t iam = omp_get_thread_num();
+ if (iam == 0)
+ {
+ *result = *begin;
+ parallel_partial_sum_basecase(begin + 1, begin + borders[1],
+ result + 1, bin_op, *begin);
+ ::new(&(sums[iam])) value_type(*(result + borders[1] - 1));
+ }
+ else
+ {
+ ::new(&(sums[iam]))
+ value_type(std::accumulate(begin + borders[iam] + 1,
+ begin + borders[iam + 1],
+ *(begin + borders[iam]),
+ bin_op,
+ __gnu_parallel::sequential_tag()));
+ }
+
+# pragma omp barrier
+
+# pragma omp single
+ parallel_partial_sum_basecase(
+ sums + 1, sums + num_threads, sums + 1, bin_op, sums[0]);
+
+# pragma omp barrier
+
+ // Still same team.
+ parallel_partial_sum_basecase(begin + borders[iam + 1],
+ begin + borders[iam + 2],
+ result + borders[iam + 1], bin_op,
+ sums[iam]);
+ } //parallel
+
+ ::operator delete(sums);
+ delete[] borders;
+
+ return result + n;
+ }
+
+/** @brief Parallel partial sum front-end.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param result Begin iterator of output sequence.
+ * @param bin_op Associative binary function.
+ * @return End iterator of output sequence. */
+template<typename InputIterator,
+ typename OutputIterator,
+ typename BinaryOperation>
+ OutputIterator
+ parallel_partial_sum(InputIterator begin, InputIterator end,
+ OutputIterator result, BinaryOperation bin_op)
+ {
+ _GLIBCXX_CALL(begin - end)
+
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+
+ switch (_Settings::get().partial_sum_algorithm)
+ {
+ case LINEAR:
+ // Need an initial offset.
+ return parallel_partial_sum_linear(begin, end, result, bin_op, n);
+ default:
+ // Partial_sum algorithm not implemented.
+ _GLIBCXX_PARALLEL_ASSERT(0);
+ return result + n;
+ }
+ }
+}
+
+#endif /* _GLIBCXX_PARALLEL_PARTIAL_SUM_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/partition.h b/gcc-4.4.0/libstdc++-v3/include/parallel/partition.h
new file mode 100644
index 000000000..b88133c59
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/partition.h
@@ -0,0 +1,429 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/partition.h
+ * @brief Parallel implementation of std::partition(),
+ * std::nth_element(), and std::partial_sort().
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_PARTITION_H
+#define _GLIBCXX_PARALLEL_PARTITION_H 1
+
+#include <parallel/basic_iterator.h>
+#include <parallel/sort.h>
+#include <parallel/random_number.h>
+#include <bits/stl_algo.h>
+#include <parallel/parallel.h>
+
+/** @brief Decide whether to declare certain variables volatile. */
+#define _GLIBCXX_VOLATILE volatile
+
+namespace __gnu_parallel
+{
+/** @brief Parallel implementation of std::partition.
+ * @param begin Begin iterator of input sequence to split.
+ * @param end End iterator of input sequence to split.
+ * @param pred Partition predicate, possibly including some kind of pivot.
+ * @param num_threads Maximum number of threads to use for this task.
+ * @return Number of elements not fulfilling the predicate. */
+template<typename RandomAccessIterator, typename Predicate>
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ parallel_partition(RandomAccessIterator begin, RandomAccessIterator end,
+ Predicate pred, thread_index_t num_threads)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+
+ _GLIBCXX_CALL(n)
+
+ const _Settings& __s = _Settings::get();
+
+ // Shared.
+ _GLIBCXX_VOLATILE difference_type left = 0, right = n - 1;
+ _GLIBCXX_VOLATILE difference_type leftover_left, leftover_right;
+ _GLIBCXX_VOLATILE difference_type leftnew, rightnew;
+
+ bool* reserved_left = NULL, * reserved_right = NULL;
+
+ difference_type chunk_size;
+
+ omp_lock_t result_lock;
+ omp_init_lock(&result_lock);
+
+ //at least two chunks per thread
+ if(right - left + 1 >= 2 * num_threads * chunk_size)
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ reserved_left = new bool[num_threads];
+ reserved_right = new bool[num_threads];
+
+ if (__s.partition_chunk_share > 0.0)
+ chunk_size = std::max<difference_type>(__s.partition_chunk_size,
+ (double)n * __s.partition_chunk_share
+ / (double)num_threads);
+ else
+ chunk_size = __s.partition_chunk_size;
+ }
+
+ while (right - left + 1 >= 2 * num_threads * chunk_size)
+ {
+# pragma omp single
+ {
+ difference_type num_chunks = (right - left + 1) / chunk_size;
+
+ for (int r = 0; r < num_threads; ++r)
+ {
+ reserved_left[r] = false;
+ reserved_right[r] = false;
+ }
+ leftover_left = 0;
+ leftover_right = 0;
+ } //implicit barrier
+
+ // Private.
+ difference_type thread_left, thread_left_border,
+ thread_right, thread_right_border;
+ thread_left = left + 1;
+
+ // Just to satisfy the condition below.
+ thread_left_border = thread_left - 1;
+ thread_right = n - 1;
+ thread_right_border = thread_right + 1;
+
+ bool iam_finished = false;
+ while (!iam_finished)
+ {
+ if (thread_left > thread_left_border)
+ {
+ omp_set_lock(&result_lock);
+ if (left + (chunk_size - 1) > right)
+ iam_finished = true;
+ else
+ {
+ thread_left = left;
+ thread_left_border = left + (chunk_size - 1);
+ left += chunk_size;
+ }
+ omp_unset_lock(&result_lock);
+ }
+
+ if (thread_right < thread_right_border)
+ {
+ omp_set_lock(&result_lock);
+ if (left > right - (chunk_size - 1))
+ iam_finished = true;
+ else
+ {
+ thread_right = right;
+ thread_right_border = right - (chunk_size - 1);
+ right -= chunk_size;
+ }
+ omp_unset_lock(&result_lock);
+ }
+
+ if (iam_finished)
+ break;
+
+ // Swap as usual.
+ while (thread_left < thread_right)
+ {
+ while (pred(begin[thread_left])
+ && thread_left <= thread_left_border)
+ ++thread_left;
+ while (!pred(begin[thread_right])
+ && thread_right >= thread_right_border)
+ --thread_right;
+
+ if (thread_left > thread_left_border
+ || thread_right < thread_right_border)
+ // Fetch new chunk(s).
+ break;
+
+ std::swap(begin[thread_left], begin[thread_right]);
+ ++thread_left;
+ --thread_right;
+ }
+ }
+
+ // Now swap the leftover chunks to the right places.
+ if (thread_left <= thread_left_border)
+# pragma omp atomic
+ ++leftover_left;
+ if (thread_right >= thread_right_border)
+# pragma omp atomic
+ ++leftover_right;
+
+# pragma omp barrier
+
+# pragma omp single
+ {
+ leftnew = left - leftover_left * chunk_size;
+ rightnew = right + leftover_right * chunk_size;
+ }
+
+# pragma omp barrier
+
+ // <=> thread_left_border + (chunk_size - 1) >= leftnew
+ if (thread_left <= thread_left_border
+ && thread_left_border >= leftnew)
+ {
+ // Chunk already in place, reserve spot.
+ reserved_left[(left - (thread_left_border + 1)) / chunk_size]
+ = true;
+ }
+
+ // <=> thread_right_border - (chunk_size - 1) <= rightnew
+ if (thread_right >= thread_right_border
+ && thread_right_border <= rightnew)
+ {
+ // Chunk already in place, reserve spot.
+ reserved_right[((thread_right_border - 1) - right)
+ / chunk_size] = true;
+ }
+
+# pragma omp barrier
+
+ if (thread_left <= thread_left_border
+ && thread_left_border < leftnew)
+ {
+ // Find spot and swap.
+ difference_type swapstart = -1;
+ omp_set_lock(&result_lock);
+ for (int r = 0; r < leftover_left; ++r)
+ if (!reserved_left[r])
+ {
+ reserved_left[r] = true;
+ swapstart = left - (r + 1) * chunk_size;
+ break;
+ }
+ omp_unset_lock(&result_lock);
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(swapstart != -1);
+#endif
+
+ std::swap_ranges(begin + thread_left_border
+ - (chunk_size - 1),
+ begin + thread_left_border + 1,
+ begin + swapstart);
+ }
+
+ if (thread_right >= thread_right_border
+ && thread_right_border > rightnew)
+ {
+ // Find spot and swap
+ difference_type swapstart = -1;
+ omp_set_lock(&result_lock);
+ for (int r = 0; r < leftover_right; ++r)
+ if (!reserved_right[r])
+ {
+ reserved_right[r] = true;
+ swapstart = right + r * chunk_size + 1;
+ break;
+ }
+ omp_unset_lock(&result_lock);
+
+#if _GLIBCXX_ASSERTIONS
+ _GLIBCXX_PARALLEL_ASSERT(swapstart != -1);
+#endif
+
+ std::swap_ranges(begin + thread_right_border,
+ begin + thread_right_border + chunk_size,
+ begin + swapstart);
+ }
+#if _GLIBCXX_ASSERTIONS
+# pragma omp barrier
+
+# pragma omp single
+ {
+ for (int r = 0; r < leftover_left; ++r)
+ _GLIBCXX_PARALLEL_ASSERT(reserved_left[r]);
+ for (int r = 0; r < leftover_right; ++r)
+ _GLIBCXX_PARALLEL_ASSERT(reserved_right[r]);
+ }
+
+# pragma omp barrier
+#endif
+
+# pragma omp barrier
+
+ left = leftnew;
+ right = rightnew;
+ }
+# pragma omp flush(left, right)
+ } // end "recursion" //parallel
+
+ difference_type final_left = left, final_right = right;
+
+ while (final_left < final_right)
+ {
+ // Go right until key is geq than pivot.
+ while (pred(begin[final_left]) && final_left < final_right)
+ ++final_left;
+
+ // Go left until key is less than pivot.
+ while (!pred(begin[final_right]) && final_left < final_right)
+ --final_right;
+
+ if (final_left == final_right)
+ break;
+ std::swap(begin[final_left], begin[final_right]);
+ ++final_left;
+ --final_right;
+ }
+
+ // All elements on the left side are < piv, all elements on the
+ // right are >= piv
+ delete[] reserved_left;
+ delete[] reserved_right;
+
+ omp_destroy_lock(&result_lock);
+
+ // Element "between" final_left and final_right might not have
+ // been regarded yet
+ if (final_left < n && !pred(begin[final_left]))
+ // Really swapped.
+ return final_left;
+ else
+ return final_left + 1;
+ }
+
+/**
+ * @brief Parallel implementation of std::nth_element().
+ * @param begin Begin iterator of input sequence.
+ * @param nth Iterator of element that must be in position afterwards.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ */
+template<typename RandomAccessIterator, typename Comparator>
+ void
+ parallel_nth_element(RandomAccessIterator begin, RandomAccessIterator nth,
+ RandomAccessIterator end, Comparator comp)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ _GLIBCXX_CALL(end - begin)
+
+ RandomAccessIterator split;
+ random_number rng;
+
+ difference_type minimum_length =
+ std::max<difference_type>(2, _Settings::get().partition_minimal_n);
+
+ // Break if input range to small.
+ while (static_cast<sequence_index_t>(end - begin) >= minimum_length)
+ {
+ difference_type n = end - begin;
+
+ RandomAccessIterator pivot_pos = begin + rng(n);
+
+ // Swap pivot_pos value to end.
+ if (pivot_pos != (end - 1))
+ std::swap(*pivot_pos, *(end - 1));
+ pivot_pos = end - 1;
+
+ // XXX Comparator must have first_value_type, second_value_type,
+ // result_type
+ // Comparator == __gnu_parallel::lexicographic<S, int,
+ // __gnu_parallel::less<S, S> >
+ // pivot_pos == std::pair<S, int>*
+ // XXX binder2nd only for RandomAccessIterators??
+ __gnu_parallel::binder2nd<Comparator, value_type, value_type, bool>
+ pred(comp, *pivot_pos);
+
+ // Divide, leave pivot unchanged in last place.
+ RandomAccessIterator split_pos1, split_pos2;
+ split_pos1 = begin + parallel_partition(begin, end - 1, pred,
+ get_max_threads());
+
+ // Left side: < pivot_pos; right side: >= pivot_pos
+
+ // Swap pivot back to middle.
+ if (split_pos1 != pivot_pos)
+ std::swap(*split_pos1, *pivot_pos);
+ pivot_pos = split_pos1;
+
+ // In case all elements are equal, split_pos1 == 0
+ if ((split_pos1 + 1 - begin) < (n >> 7)
+ || (end - split_pos1) < (n >> 7))
+ {
+ // Very unequal split, one part smaller than one 128th
+ // elements not strictly larger than the pivot.
+ __gnu_parallel::unary_negate<__gnu_parallel::
+ binder1st<Comparator, value_type, value_type, bool>, value_type>
+ pred(__gnu_parallel::binder1st<Comparator, value_type,
+ value_type, bool>(comp, *pivot_pos));
+
+ // Find other end of pivot-equal range.
+ split_pos2 = __gnu_sequential::partition(split_pos1 + 1,
+ end, pred);
+ }
+ else
+ // Only skip the pivot.
+ split_pos2 = split_pos1 + 1;
+
+ // Compare iterators.
+ if (split_pos2 <= nth)
+ begin = split_pos2;
+ else if (nth < split_pos1)
+ end = split_pos1;
+ else
+ break;
+ }
+
+ // Only at most _Settings::partition_minimal_n elements left.
+ __gnu_sequential::sort(begin, end, comp);
+ }
+
+/** @brief Parallel implementation of std::partial_sort().
+* @param begin Begin iterator of input sequence.
+* @param middle Sort until this position.
+* @param end End iterator of input sequence.
+* @param comp Comparator. */
+template<typename RandomAccessIterator, typename Comparator>
+ void
+ parallel_partial_sort(RandomAccessIterator begin,
+ RandomAccessIterator middle,
+ RandomAccessIterator end, Comparator comp)
+ {
+ parallel_nth_element(begin, middle, end, comp);
+ std::sort(begin, middle, comp);
+ }
+
+} //namespace __gnu_parallel
+
+#undef _GLIBCXX_VOLATILE
+
+#endif /* _GLIBCXX_PARALLEL_PARTITION_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/queue.h b/gcc-4.4.0/libstdc++-v3/include/parallel/queue.h
new file mode 100644
index 000000000..9686a9ac2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/queue.h
@@ -0,0 +1,149 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/queue.h
+ * @brief Lock-free double-ended queue.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_QUEUE_H
+#define _GLIBCXX_PARALLEL_QUEUE_H 1
+
+#include <parallel/types.h>
+#include <parallel/base.h>
+#include <parallel/compatibility.h>
+
+/** @brief Decide whether to declare certain variable volatile in this file. */
+#define _GLIBCXX_VOLATILE volatile
+
+namespace __gnu_parallel
+{
+ /**@brief Double-ended queue of bounded size, allowing lock-free
+ * atomic access. push_front() and pop_front() must not be called
+ * concurrently to each other, while pop_back() can be called
+ * concurrently at all times.
+ * @c empty(), @c size(), and @c top() are intentionally not provided.
+ * Calling them would not make sense in a concurrent setting.
+ * @param T Contained element type. */
+ template<typename T>
+ class RestrictedBoundedConcurrentQueue
+ {
+ private:
+ /** @brief Array of elements, seen as cyclic buffer. */
+ T* base;
+
+ /** @brief Maximal number of elements contained at the same time. */
+ sequence_index_t max_size;
+
+ /** @brief Cyclic begin and end pointers contained in one
+ atomically changeable value. */
+ _GLIBCXX_VOLATILE lcas_t borders;
+
+ public:
+ /** @brief Constructor. Not to be called concurrent, of course.
+ * @param max_size Maximal number of elements to be contained. */
+ RestrictedBoundedConcurrentQueue(sequence_index_t max_size)
+ {
+ this->max_size = max_size;
+ base = new T[max_size];
+ borders = encode2(0, 0);
+#pragma omp flush
+ }
+
+ /** @brief Destructor. Not to be called concurrent, of course. */
+ ~RestrictedBoundedConcurrentQueue()
+ { delete[] base; }
+
+ /** @brief Pushes one element into the queue at the front end.
+ * Must not be called concurrently with pop_front(). */
+ void
+ push_front(const T& t)
+ {
+ lcas_t former_borders = borders;
+ int former_front, former_back;
+ decode2(former_borders, former_front, former_back);
+ *(base + former_front % max_size) = t;
+#if _GLIBCXX_ASSERTIONS
+ // Otherwise: front - back > max_size eventually.
+ _GLIBCXX_PARALLEL_ASSERT(((former_front + 1) - former_back)
+ <= max_size);
+#endif
+ fetch_and_add(&borders, encode2(1, 0));
+ }
+
+ /** @brief Pops one element from the queue at the front end.
+ * Must not be called concurrently with pop_front(). */
+ bool
+ pop_front(T& t)
+ {
+ int former_front, former_back;
+#pragma omp flush
+ decode2(borders, former_front, former_back);
+ while (former_front > former_back)
+ {
+ // Chance.
+ lcas_t former_borders = encode2(former_front, former_back);
+ lcas_t new_borders = encode2(former_front - 1, former_back);
+ if (compare_and_swap(&borders, former_borders, new_borders))
+ {
+ t = *(base + (former_front - 1) % max_size);
+ return true;
+ }
+#pragma omp flush
+ decode2(borders, former_front, former_back);
+ }
+ return false;
+ }
+
+ /** @brief Pops one element from the queue at the front end.
+ * Must not be called concurrently with pop_front(). */
+ bool
+ pop_back(T& t) //queue behavior
+ {
+ int former_front, former_back;
+#pragma omp flush
+ decode2(borders, former_front, former_back);
+ while (former_front > former_back)
+ {
+ // Chance.
+ lcas_t former_borders = encode2(former_front, former_back);
+ lcas_t new_borders = encode2(former_front, former_back + 1);
+ if (compare_and_swap(&borders, former_borders, new_borders))
+ {
+ t = *(base + former_back % max_size);
+ return true;
+ }
+#pragma omp flush
+ decode2(borders, former_front, former_back);
+ }
+ return false;
+ }
+ };
+} //namespace __gnu_parallel
+
+#undef _GLIBCXX_VOLATILE
+
+#endif /* _GLIBCXX_PARALLEL_QUEUE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/quicksort.h b/gcc-4.4.0/libstdc++-v3/include/parallel/quicksort.h
new file mode 100644
index 000000000..712b479e7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/quicksort.h
@@ -0,0 +1,179 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/quicksort.h
+ * @brief Implementation of a unbalanced parallel quicksort (in-place).
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_QUICKSORT_H
+#define _GLIBCXX_PARALLEL_QUICKSORT_H 1
+
+#include <parallel/parallel.h>
+#include <parallel/partition.h>
+
+namespace __gnu_parallel
+{
+ /** @brief Unbalanced quicksort divide step.
+ * @param begin Begin iterator of subsequence.
+ * @param end End iterator of subsequence.
+ * @param comp Comparator.
+ * @param pivot_rank Desired rank of the pivot.
+ * @param num_samples Choose pivot from that many samples.
+ * @param num_threads Number of threads that are allowed to work on
+ * this part.
+ */
+ template<typename RandomAccessIterator, typename Comparator>
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ parallel_sort_qs_divide(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Comparator comp, typename std::iterator_traits
+ <RandomAccessIterator>::difference_type pivot_rank,
+ typename std::iterator_traits
+ <RandomAccessIterator>::difference_type
+ num_samples, thread_index_t num_threads)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+ num_samples = std::min(num_samples, n);
+
+ // Allocate uninitialized, to avoid default constructor.
+ value_type* samples =
+ static_cast<value_type*>(::operator new(num_samples
+ * sizeof(value_type)));
+
+ for (difference_type s = 0; s < num_samples; ++s)
+ {
+ const unsigned long long index = static_cast<unsigned long long>(s)
+ * n / num_samples;
+ ::new(&(samples[s])) value_type(begin[index]);
+ }
+
+ __gnu_sequential::sort(samples, samples + num_samples, comp);
+
+ value_type& pivot = samples[pivot_rank * num_samples / n];
+
+ __gnu_parallel::binder2nd<Comparator, value_type, value_type, bool>
+ pred(comp, pivot);
+ difference_type split =
+ parallel_partition(begin, end, pred, num_threads);
+
+ ::operator delete(samples);
+
+ return split;
+ }
+
+ /** @brief Unbalanced quicksort conquer step.
+ * @param begin Begin iterator of subsequence.
+ * @param end End iterator of subsequence.
+ * @param comp Comparator.
+ * @param num_threads Number of threads that are allowed to work on
+ * this part.
+ */
+ template<typename RandomAccessIterator, typename Comparator>
+ void
+ parallel_sort_qs_conquer(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Comparator comp,
+ thread_index_t num_threads)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ if (num_threads <= 1)
+ {
+ __gnu_sequential::sort(begin, end, comp);
+ return;
+ }
+
+ difference_type n = end - begin, pivot_rank;
+
+ if (n <= 1)
+ return;
+
+ thread_index_t num_threads_left;
+
+ if ((num_threads % 2) == 1)
+ num_threads_left = num_threads / 2 + 1;
+ else
+ num_threads_left = num_threads / 2;
+
+ pivot_rank = n * num_threads_left / num_threads;
+
+ difference_type split =
+ parallel_sort_qs_divide(begin, end, comp, pivot_rank,
+ _Settings::get().sort_qs_num_samples_preset,
+ num_threads);
+
+#pragma omp parallel sections num_threads(2)
+ {
+#pragma omp section
+ parallel_sort_qs_conquer(begin, begin + split,
+ comp, num_threads_left);
+#pragma omp section
+ parallel_sort_qs_conquer(begin + split, end,
+ comp, num_threads - num_threads_left);
+ }
+ }
+
+
+
+ /** @brief Unbalanced quicksort main call.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator input sequence, ignored.
+ * @param comp Comparator.
+ * @param num_threads Number of threads that are allowed to work on
+ * this part.
+ */
+ template<typename RandomAccessIterator, typename Comparator>
+ void
+ parallel_sort_qs(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Comparator comp,
+ thread_index_t num_threads)
+ {
+ _GLIBCXX_CALL(n)
+
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+
+ // At least one element per processor.
+ if (num_threads > n)
+ num_threads = static_cast<thread_index_t>(n);
+
+ parallel_sort_qs_conquer(begin, begin + n, comp, num_threads);
+ }
+
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_QUICKSORT_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/random_number.h b/gcc-4.4.0/libstdc++-v3/include/parallel/random_number.h
new file mode 100644
index 000000000..7e821a473
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/random_number.h
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/random_number.h
+ * @brief Random number generator based on the Mersenne twister.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_RANDOM_NUMBER_H
+#define _GLIBCXX_PARALLEL_RANDOM_NUMBER_H 1
+
+#include <parallel/types.h>
+#include <tr1/random>
+
+namespace __gnu_parallel
+{
+ /** @brief Random number generator, based on the Mersenne twister. */
+ class random_number
+ {
+ private:
+ std::tr1::mt19937 mt;
+ uint64 supremum;
+ uint64 RAND_SUP;
+ double supremum_reciprocal;
+ double RAND_SUP_REC;
+
+ // Assumed to be twice as long as the usual random number.
+ uint64 cache;
+
+ // Bit results.
+ int bits_left;
+
+ static uint32
+ scale_down(uint64 x,
+#if _GLIBCXX_SCALE_DOWN_FPU
+ uint64 /*supremum*/, double supremum_reciprocal)
+#else
+ uint64 supremum, double /*supremum_reciprocal*/)
+#endif
+ {
+#if _GLIBCXX_SCALE_DOWN_FPU
+ return uint32(x * supremum_reciprocal);
+#else
+ return static_cast<uint32>(x % supremum);
+#endif
+ }
+
+ public:
+ /** @brief Default constructor. Seed with 0. */
+ random_number()
+ : mt(0), supremum(0x100000000ULL),
+ RAND_SUP(1ULL << (sizeof(uint32) * 8)),
+ supremum_reciprocal(double(supremum) / double(RAND_SUP)),
+ RAND_SUP_REC(1.0 / double(RAND_SUP)),
+ cache(0), bits_left(0) { }
+
+ /** @brief Constructor.
+ * @param seed Random seed.
+ * @param supremum Generate integer random numbers in the
+ * interval @c [0,supremum). */
+ random_number(uint32 seed, uint64 supremum = 0x100000000ULL)
+ : mt(seed), supremum(supremum),
+ RAND_SUP(1ULL << (sizeof(uint32) * 8)),
+ supremum_reciprocal(double(supremum) / double(RAND_SUP)),
+ RAND_SUP_REC(1.0 / double(RAND_SUP)),
+ cache(0), bits_left(0) { }
+
+ /** @brief Generate unsigned random 32-bit integer. */
+ uint32
+ operator()()
+ { return scale_down(mt(), supremum, supremum_reciprocal); }
+
+ /** @brief Generate unsigned random 32-bit integer in the
+ interval @c [0,local_supremum). */
+ uint32
+ operator()(uint64 local_supremum)
+ {
+ return scale_down(mt(), local_supremum,
+ double(local_supremum * RAND_SUP_REC));
+ }
+
+ /** @brief Generate a number of random bits, run-time parameter.
+ * @param bits Number of bits to generate. */
+ unsigned long
+ genrand_bits(int bits)
+ {
+ unsigned long res = cache & ((1 << bits) - 1);
+ cache = cache >> bits;
+ bits_left -= bits;
+ if (bits_left < 32)
+ {
+ cache |= ((uint64(mt())) << bits_left);
+ bits_left += 32;
+ }
+ return res;
+ }
+};
+
+} // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_RANDOM_NUMBER_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/random_shuffle.h b/gcc-4.4.0/libstdc++-v3/include/parallel/random_shuffle.h
new file mode 100644
index 000000000..6e0ebef15
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/random_shuffle.h
@@ -0,0 +1,519 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/random_shuffle.h
+ * @brief Parallel implementation of std::random_shuffle().
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H
+#define _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H 1
+
+#include <limits>
+#include <bits/stl_numeric.h>
+#include <parallel/parallel.h>
+#include <parallel/random_number.h>
+
+namespace __gnu_parallel
+{
+/** @brief Type to hold the index of a bin.
+ *
+ * Since many variables of this type are allocated, it should be
+ * chosen as small as possible.
+ */
+typedef unsigned short bin_index;
+
+/** @brief Data known to every thread participating in
+ __gnu_parallel::parallel_random_shuffle(). */
+template<typename RandomAccessIterator>
+ struct DRandomShufflingGlobalData
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ /** @brief Begin iterator of the source. */
+ RandomAccessIterator& source;
+
+ /** @brief Temporary arrays for each thread. */
+ value_type** temporaries;
+
+ /** @brief Two-dimensional array to hold the thread-bin distribution.
+ *
+ * Dimensions (num_threads + 1) x (num_bins + 1). */
+ difference_type** dist;
+
+ /** @brief Start indexes of the threads' chunks. */
+ difference_type* starts;
+
+ /** @brief Number of the thread that will further process the
+ corresponding bin. */
+ thread_index_t* bin_proc;
+
+ /** @brief Number of bins to distribute to. */
+ int num_bins;
+
+ /** @brief Number of bits needed to address the bins. */
+ int num_bits;
+
+ /** @brief Constructor. */
+ DRandomShufflingGlobalData(RandomAccessIterator& _source)
+ : source(_source) { }
+ };
+
+/** @brief Local data for a thread participating in
+ __gnu_parallel::parallel_random_shuffle().
+ */
+template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ struct DRSSorterPU
+ {
+ /** @brief Number of threads participating in total. */
+ int num_threads;
+
+ /** @brief Begin index for bins taken care of by this thread. */
+ bin_index bins_begin;
+
+ /** @brief End index for bins taken care of by this thread. */
+ bin_index bins_end;
+
+ /** @brief Random seed for this thread. */
+ uint32 seed;
+
+ /** @brief Pointer to global data. */
+ DRandomShufflingGlobalData<RandomAccessIterator>* sd;
+ };
+
+/** @brief Generate a random number in @c [0,2^logp).
+ * @param logp Logarithm (basis 2) of the upper range bound.
+ * @param rng Random number generator to use.
+ */
+template<typename RandomNumberGenerator>
+ inline int
+ random_number_pow2(int logp, RandomNumberGenerator& rng)
+ { return rng.genrand_bits(logp); }
+
+/** @brief Random shuffle code executed by each thread.
+ * @param pus Array of thread-local data records. */
+template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ void
+ parallel_random_shuffle_drs_pu(DRSSorterPU<RandomAccessIterator,
+ RandomNumberGenerator>* pus)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ thread_index_t iam = omp_get_thread_num();
+ DRSSorterPU<RandomAccessIterator, RandomNumberGenerator>* d = &pus[iam];
+ DRandomShufflingGlobalData<RandomAccessIterator>* sd = d->sd;
+
+ // Indexing: dist[bin][processor]
+ difference_type length = sd->starts[iam + 1] - sd->starts[iam];
+ bin_index* oracles = new bin_index[length];
+ difference_type* dist = new difference_type[sd->num_bins + 1];
+ bin_index* bin_proc = new bin_index[sd->num_bins];
+ value_type** temporaries = new value_type*[d->num_threads];
+
+ // Compute oracles and count appearances.
+ for (bin_index b = 0; b < sd->num_bins + 1; ++b)
+ dist[b] = 0;
+ int num_bits = sd->num_bits;
+
+ random_number rng(d->seed);
+
+ // First main loop.
+ for (difference_type i = 0; i < length; ++i)
+ {
+ bin_index oracle = random_number_pow2(num_bits, rng);
+ oracles[i] = oracle;
+
+ // To allow prefix (partial) sum.
+ ++(dist[oracle + 1]);
+ }
+
+ for (bin_index b = 0; b < sd->num_bins + 1; ++b)
+ sd->dist[b][iam + 1] = dist[b];
+
+# pragma omp barrier
+
+# pragma omp single
+ {
+ // Sum up bins, sd->dist[s + 1][d->num_threads] now contains the
+ // total number of items in bin s
+ for (bin_index s = 0; s < sd->num_bins; ++s)
+ __gnu_sequential::partial_sum(sd->dist[s + 1],
+ sd->dist[s + 1] + d->num_threads + 1,
+ sd->dist[s + 1]);
+ }
+
+# pragma omp barrier
+
+ sequence_index_t offset = 0, global_offset = 0;
+ for (bin_index s = 0; s < d->bins_begin; ++s)
+ global_offset += sd->dist[s + 1][d->num_threads];
+
+# pragma omp barrier
+
+ for (bin_index s = d->bins_begin; s < d->bins_end; ++s)
+ {
+ for (int t = 0; t < d->num_threads + 1; ++t)
+ sd->dist[s + 1][t] += offset;
+ offset = sd->dist[s + 1][d->num_threads];
+ }
+
+ sd->temporaries[iam] = static_cast<value_type*>(
+ ::operator new(sizeof(value_type) * offset));
+
+# pragma omp barrier
+
+ // Draw local copies to avoid false sharing.
+ for (bin_index b = 0; b < sd->num_bins + 1; ++b)
+ dist[b] = sd->dist[b][iam];
+ for (bin_index b = 0; b < sd->num_bins; ++b)
+ bin_proc[b] = sd->bin_proc[b];
+ for (thread_index_t t = 0; t < d->num_threads; ++t)
+ temporaries[t] = sd->temporaries[t];
+
+ RandomAccessIterator source = sd->source;
+ difference_type start = sd->starts[iam];
+
+ // Distribute according to oracles, second main loop.
+ for (difference_type i = 0; i < length; ++i)
+ {
+ bin_index target_bin = oracles[i];
+ thread_index_t target_p = bin_proc[target_bin];
+
+ // Last column [d->num_threads] stays unchanged.
+ ::new(&(temporaries[target_p][dist[target_bin + 1]++]))
+ value_type(*(source + i + start));
+ }
+
+ delete[] oracles;
+ delete[] dist;
+ delete[] bin_proc;
+ delete[] temporaries;
+
+# pragma omp barrier
+
+ // Shuffle bins internally.
+ for (bin_index b = d->bins_begin; b < d->bins_end; ++b)
+ {
+ value_type* begin =
+ sd->temporaries[iam] +
+ ((b == d->bins_begin) ? 0 : sd->dist[b][d->num_threads]),
+ * end =
+ sd->temporaries[iam] + sd->dist[b + 1][d->num_threads];
+ sequential_random_shuffle(begin, end, rng);
+ std::copy(begin, end, sd->source + global_offset +
+ ((b == d->bins_begin) ? 0 : sd->dist[b][d->num_threads]));
+ }
+
+ ::operator delete(sd->temporaries[iam]);
+ }
+
+/** @brief Round up to the next greater power of 2.
+ * @param x Integer to round up */
+template<typename T>
+ T
+ round_up_to_pow2(T x)
+ {
+ if (x <= 1)
+ return 1;
+ else
+ return (T)1 << (__log2(x - 1) + 1);
+ }
+
+/** @brief Main parallel random shuffle step.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param n Length of sequence.
+ * @param num_threads Number of threads to use.
+ * @param rng Random number generator to use.
+ */
+template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ void
+ parallel_random_shuffle_drs(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ typename std::iterator_traits
+ <RandomAccessIterator>::difference_type n,
+ thread_index_t num_threads,
+ RandomNumberGenerator& rng)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ _GLIBCXX_CALL(n)
+
+ const _Settings& __s = _Settings::get();
+
+ if (num_threads > n)
+ num_threads = static_cast<thread_index_t>(n);
+
+ bin_index num_bins, num_bins_cache;
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+ // Try the L1 cache first.
+
+ // Must fit into L1.
+ num_bins_cache = std::max<difference_type>(
+ 1, n / (__s.L1_cache_size_lb / sizeof(value_type)));
+ num_bins_cache = round_up_to_pow2(num_bins_cache);
+
+ // No more buckets than TLB entries, power of 2
+ // Power of 2 and at least one element per bin, at most the TLB size.
+ num_bins = std::min<difference_type>(n, num_bins_cache);
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+ // 2 TLB entries needed per bin.
+ num_bins = std::min<difference_type>(__s.TLB_size / 2, num_bins);
+#endif
+ num_bins = round_up_to_pow2(num_bins);
+
+ if (num_bins < num_bins_cache)
+ {
+#endif
+ // Now try the L2 cache
+ // Must fit into L2
+ num_bins_cache = static_cast<bin_index>(std::max<difference_type>(
+ 1, n / (__s.L2_cache_size / sizeof(value_type))));
+ num_bins_cache = round_up_to_pow2(num_bins_cache);
+
+ // No more buckets than TLB entries, power of 2.
+ num_bins = static_cast<bin_index>(
+ std::min(n, static_cast<difference_type>(num_bins_cache)));
+ // Power of 2 and at least one element per bin, at most the TLB size.
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+ // 2 TLB entries needed per bin.
+ num_bins = std::min(
+ static_cast<difference_type>(__s.TLB_size / 2), num_bins);
+#endif
+ num_bins = round_up_to_pow2(num_bins);
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+ }
+#endif
+
+ num_threads = std::min<bin_index>(num_threads, num_bins);
+
+ if (num_threads <= 1)
+ return sequential_random_shuffle(begin, end, rng);
+
+ DRandomShufflingGlobalData<RandomAccessIterator> sd(begin);
+ DRSSorterPU<RandomAccessIterator, random_number >* pus;
+ difference_type* starts;
+
+# pragma omp parallel num_threads(num_threads)
+ {
+ thread_index_t num_threads = omp_get_num_threads();
+# pragma omp single
+ {
+ pus = new DRSSorterPU<RandomAccessIterator, random_number>
+ [num_threads];
+
+ sd.temporaries = new value_type*[num_threads];
+ sd.dist = new difference_type*[num_bins + 1];
+ sd.bin_proc = new thread_index_t[num_bins];
+ for (bin_index b = 0; b < num_bins + 1; ++b)
+ sd.dist[b] = new difference_type[num_threads + 1];
+ for (bin_index b = 0; b < (num_bins + 1); ++b)
+ {
+ sd.dist[0][0] = 0;
+ sd.dist[b][0] = 0;
+ }
+ starts = sd.starts = new difference_type[num_threads + 1];
+ int bin_cursor = 0;
+ sd.num_bins = num_bins;
+ sd.num_bits = __log2(num_bins);
+
+ difference_type chunk_length = n / num_threads,
+ split = n % num_threads, start = 0;
+ difference_type bin_chunk_length = num_bins / num_threads,
+ bin_split = num_bins % num_threads;
+ for (thread_index_t i = 0; i < num_threads; ++i)
+ {
+ starts[i] = start;
+ start += (i < split) ? (chunk_length + 1) : chunk_length;
+ int j = pus[i].bins_begin = bin_cursor;
+
+ // Range of bins for this processor.
+ bin_cursor += (i < bin_split) ?
+ (bin_chunk_length + 1) : bin_chunk_length;
+ pus[i].bins_end = bin_cursor;
+ for (; j < bin_cursor; ++j)
+ sd.bin_proc[j] = i;
+ pus[i].num_threads = num_threads;
+ pus[i].seed = rng(std::numeric_limits<uint32>::max());
+ pus[i].sd = &sd;
+ }
+ starts[num_threads] = start;
+ } //single
+ // Now shuffle in parallel.
+ parallel_random_shuffle_drs_pu(pus);
+ } // parallel
+
+ delete[] starts;
+ delete[] sd.bin_proc;
+ for (int s = 0; s < (num_bins + 1); ++s)
+ delete[] sd.dist[s];
+ delete[] sd.dist;
+ delete[] sd.temporaries;
+
+ delete[] pus;
+ }
+
+/** @brief Sequential cache-efficient random shuffle.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param rng Random number generator to use.
+ */
+template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ void
+ sequential_random_shuffle(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ RandomNumberGenerator& rng)
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type n = end - begin;
+ const _Settings& __s = _Settings::get();
+
+ bin_index num_bins, num_bins_cache;
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+ // Try the L1 cache first, must fit into L1.
+ num_bins_cache =
+ std::max<difference_type>
+ (1, n / (__s.L1_cache_size_lb / sizeof(value_type)));
+ num_bins_cache = round_up_to_pow2(num_bins_cache);
+
+ // No more buckets than TLB entries, power of 2
+ // Power of 2 and at least one element per bin, at most the TLB size
+ num_bins = std::min(n, (difference_type)num_bins_cache);
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+ // 2 TLB entries needed per bin
+ num_bins = std::min((difference_type)__s.TLB_size / 2, num_bins);
+#endif
+ num_bins = round_up_to_pow2(num_bins);
+
+ if (num_bins < num_bins_cache)
+ {
+#endif
+ // Now try the L2 cache, must fit into L2.
+ num_bins_cache =
+ static_cast<bin_index>(std::max<difference_type>(
+ 1, n / (__s.L2_cache_size / sizeof(value_type))));
+ num_bins_cache = round_up_to_pow2(num_bins_cache);
+
+ // No more buckets than TLB entries, power of 2
+ // Power of 2 and at least one element per bin, at most the TLB size.
+ num_bins = static_cast<bin_index>
+ (std::min(n, static_cast<difference_type>(num_bins_cache)));
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+ // 2 TLB entries needed per bin
+ num_bins =
+ std::min<difference_type>(__s.TLB_size / 2, num_bins);
+#endif
+ num_bins = round_up_to_pow2(num_bins);
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+ }
+#endif
+
+ int num_bits = __log2(num_bins);
+
+ if (num_bins > 1)
+ {
+ value_type* target = static_cast<value_type*>(
+ ::operator new(sizeof(value_type) * n));
+ bin_index* oracles = new bin_index[n];
+ difference_type* dist0 = new difference_type[num_bins + 1],
+ * dist1 = new difference_type[num_bins + 1];
+
+ for (int b = 0; b < num_bins + 1; ++b)
+ dist0[b] = 0;
+
+ random_number bitrng(rng(0xFFFFFFFF));
+
+ for (difference_type i = 0; i < n; ++i)
+ {
+ bin_index oracle = random_number_pow2(num_bits, bitrng);
+ oracles[i] = oracle;
+
+ // To allow prefix (partial) sum.
+ ++(dist0[oracle + 1]);
+ }
+
+ // Sum up bins.
+ __gnu_sequential::partial_sum(dist0, dist0 + num_bins + 1, dist0);
+
+ for (int b = 0; b < num_bins + 1; ++b)
+ dist1[b] = dist0[b];
+
+ // Distribute according to oracles.
+ for (difference_type i = 0; i < n; ++i)
+ ::new(&(target[(dist0[oracles[i]])++])) value_type(*(begin + i));
+
+ for (int b = 0; b < num_bins; ++b)
+ {
+ sequential_random_shuffle(target + dist1[b],
+ target + dist1[b + 1],
+ rng);
+ }
+
+ // Copy elements back.
+ std::copy(target, target + n, begin);
+
+ delete[] dist0;
+ delete[] dist1;
+ delete[] oracles;
+ ::operator delete(target);
+ }
+ else
+ __gnu_sequential::random_shuffle(begin, end, rng);
+ }
+
+/** @brief Parallel random public call.
+ * @param begin Begin iterator of sequence.
+ * @param end End iterator of sequence.
+ * @param rng Random number generator to use.
+ */
+template<typename RandomAccessIterator, typename RandomNumberGenerator>
+ inline void
+ parallel_random_shuffle(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ RandomNumberGenerator rng = random_number())
+ {
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ difference_type n = end - begin;
+ parallel_random_shuffle_drs(begin, end, n, get_max_threads(), rng) ;
+ }
+
+}
+
+#endif /* _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/search.h b/gcc-4.4.0/libstdc++-v3/include/parallel/search.h
new file mode 100644
index 000000000..31a853402
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/search.h
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/search.h
+ * @brief Parallel implementation base for std::search() and
+ * std::search_n().
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_SEARCH_H
+#define _GLIBCXX_PARALLEL_SEARCH_H 1
+
+#include <bits/stl_algobase.h>
+
+#include <parallel/parallel.h>
+#include <parallel/equally_split.h>
+
+
+namespace __gnu_parallel
+{
+ /**
+ * @brief Precalculate advances for Knuth-Morris-Pratt algorithm.
+ * @param elements Begin iterator of sequence to search for.
+ * @param length Length of sequence to search for.
+ * @param advances Returned offsets.
+ */
+template<typename RandomAccessIterator, typename _DifferenceTp>
+ void
+ calc_borders(RandomAccessIterator elements, _DifferenceTp length,
+ _DifferenceTp* off)
+ {
+ typedef _DifferenceTp difference_type;
+
+ off[0] = -1;
+ if (length > 1)
+ off[1] = 0;
+ difference_type k = 0;
+ for (difference_type j = 2; j <= length; j++)
+ {
+ while ((k >= 0) && !(elements[k] == elements[j-1]))
+ k = off[k];
+ off[j] = ++k;
+ }
+ }
+
+ // Generic parallel find algorithm (requires random access iterator).
+
+ /** @brief Parallel std::search.
+ * @param begin1 Begin iterator of first sequence.
+ * @param end1 End iterator of first sequence.
+ * @param begin2 Begin iterator of second sequence.
+ * @param end2 End iterator of second sequence.
+ * @param pred Find predicate.
+ * @return Place of finding in first sequences. */
+template<typename _RandomAccessIterator1,
+ typename _RandomAccessIterator2,
+ typename Pred>
+ _RandomAccessIterator1
+ search_template(_RandomAccessIterator1 begin1, _RandomAccessIterator1 end1,
+ _RandomAccessIterator2 begin2, _RandomAccessIterator2 end2,
+ Pred pred)
+ {
+ typedef std::iterator_traits<_RandomAccessIterator1> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ _GLIBCXX_CALL((end1 - begin1) + (end2 - begin2));
+
+ difference_type pattern_length = end2 - begin2;
+
+ // Pattern too short.
+ if(pattern_length <= 0)
+ return end1;
+
+ // Last point to start search.
+ difference_type input_length = (end1 - begin1) - pattern_length;
+
+ // Where is first occurrence of pattern? defaults to end.
+ difference_type result = (end1 - begin1);
+ difference_type *splitters;
+
+ // Pattern too long.
+ if (input_length < 0)
+ return end1;
+
+ omp_lock_t result_lock;
+ omp_init_lock(&result_lock);
+
+ thread_index_t num_threads =
+ std::max<difference_type>(1,
+ std::min<difference_type>(input_length, get_max_threads()));
+
+ difference_type advances[pattern_length];
+ calc_borders(begin2, pattern_length, advances);
+
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ splitters = new difference_type[num_threads + 1];
+ equally_split(input_length, num_threads, splitters);
+ }
+
+ thread_index_t iam = omp_get_thread_num();
+
+ difference_type start = splitters[iam], stop = splitters[iam + 1];
+
+ difference_type pos_in_pattern = 0;
+ bool found_pattern = false;
+
+ while (start <= stop && !found_pattern)
+ {
+ // Get new value of result.
+ #pragma omp flush(result)
+ // No chance for this thread to find first occurrence.
+ if (result < start)
+ break;
+ while (pred(begin1[start + pos_in_pattern],
+ begin2[pos_in_pattern]))
+ {
+ ++pos_in_pattern;
+ if (pos_in_pattern == pattern_length)
+ {
+ // Found new candidate for result.
+ omp_set_lock(&result_lock);
+ result = std::min(result, start);
+ omp_unset_lock(&result_lock);
+
+ found_pattern = true;
+ break;
+ }
+ }
+ // Make safe jump.
+ start += (pos_in_pattern - advances[pos_in_pattern]);
+ pos_in_pattern =
+ (advances[pos_in_pattern] < 0) ? 0 : advances[pos_in_pattern];
+ }
+ } //parallel
+
+ omp_destroy_lock(&result_lock);
+
+ delete[] splitters;
+
+ // Return iterator on found element.
+ return (begin1 + result);
+ }
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_SEARCH_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/set_operations.h b/gcc-4.4.0/libstdc++-v3/include/parallel/set_operations.h
new file mode 100644
index 000000000..28008195b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/set_operations.h
@@ -0,0 +1,524 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file parallel/set_operations.h
+ * @brief Parallel implementations of set operations for random-access
+ * iterators.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Marius Elvert and Felix Bondarenko.
+
+#ifndef _GLIBCXX_PARALLEL_SET_OPERATIONS_H
+#define _GLIBCXX_PARALLEL_SET_OPERATIONS_H 1
+
+#include <omp.h>
+
+#include <parallel/settings.h>
+#include <parallel/multiseq_selection.h>
+
+namespace __gnu_parallel
+{
+template<typename InputIterator, typename OutputIterator>
+ OutputIterator
+ copy_tail(std::pair<InputIterator, InputIterator> b,
+ std::pair<InputIterator, InputIterator> e, OutputIterator r)
+ {
+ if (b.first != e.first)
+ {
+ do
+ {
+ *r++ = *b.first++;
+ }
+ while (b.first != e.first);
+ }
+ else
+ {
+ while (b.second != e.second)
+ *r++ = *b.second++;
+ }
+ return r;
+ }
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ struct symmetric_difference_func
+ {
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename std::pair<InputIterator, InputIterator> iterator_pair;
+
+ symmetric_difference_func(Comparator c) : comp(c) {}
+
+ Comparator comp;
+
+ OutputIterator
+ invoke(InputIterator a, InputIterator b,
+ InputIterator c, InputIterator d,
+ OutputIterator r) const
+ {
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ {
+ *r = *a;
+ ++a;
+ ++r;
+ }
+ else if (comp(*c, *a))
+ {
+ *r = *c;
+ ++c;
+ ++r;
+ }
+ else
+ {
+ ++a;
+ ++c;
+ }
+ }
+ return std::copy(c, d, std::copy(a, b, r));
+ }
+
+ difference_type
+ count(InputIterator a, InputIterator b,
+ InputIterator c, InputIterator d) const
+ {
+ difference_type counter = 0;
+
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ {
+ ++a;
+ ++counter;
+ }
+ else if (comp(*c, *a))
+ {
+ ++c;
+ ++counter;
+ }
+ else
+ {
+ ++a;
+ ++c;
+ }
+ }
+
+ return counter + (b - a) + (d - c);
+ }
+
+ OutputIterator
+ first_empty(InputIterator c, InputIterator d, OutputIterator out) const
+ { return std::copy(c, d, out); }
+
+ OutputIterator
+ second_empty(InputIterator a, InputIterator b, OutputIterator out) const
+ { return std::copy(a, b, out); }
+ };
+
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ struct difference_func
+ {
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename std::pair<InputIterator, InputIterator> iterator_pair;
+
+ difference_func(Comparator c) : comp(c) {}
+
+ Comparator comp;
+
+ OutputIterator
+ invoke(InputIterator a, InputIterator b, InputIterator c, InputIterator d,
+ OutputIterator r) const
+ {
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ {
+ *r = *a;
+ ++a;
+ ++r;
+ }
+ else if (comp(*c, *a))
+ { ++c; }
+ else
+ {
+ ++a;
+ ++c;
+ }
+ }
+ return std::copy(a, b, r);
+ }
+
+ difference_type
+ count(InputIterator a, InputIterator b,
+ InputIterator c, InputIterator d) const
+ {
+ difference_type counter = 0;
+
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ {
+ ++a;
+ ++counter;
+ }
+ else if (comp(*c, *a))
+ { ++c; }
+ else
+ { ++a; ++c; }
+ }
+
+ return counter + (b - a);
+ }
+
+ inline OutputIterator
+ first_empty(InputIterator c, InputIterator d, OutputIterator out) const
+ { return out; }
+
+ inline OutputIterator
+ second_empty(InputIterator a, InputIterator b, OutputIterator out) const
+ { return std::copy(a, b, out); }
+ };
+
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ struct intersection_func
+ {
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename std::pair<InputIterator, InputIterator> iterator_pair;
+
+ intersection_func(Comparator c) : comp(c) {}
+
+ Comparator comp;
+
+ OutputIterator
+ invoke(InputIterator a, InputIterator b, InputIterator c, InputIterator d,
+ OutputIterator r) const
+ {
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ { ++a; }
+ else if (comp(*c, *a))
+ { ++c; }
+ else
+ {
+ *r = *a;
+ ++a;
+ ++c;
+ ++r;
+ }
+ }
+
+ return r;
+ }
+
+ difference_type
+ count(InputIterator a, InputIterator b,
+ InputIterator c, InputIterator d) const
+ {
+ difference_type counter = 0;
+
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ { ++a; }
+ else if (comp(*c, *a))
+ { ++c; }
+ else
+ {
+ ++a;
+ ++c;
+ ++counter;
+ }
+ }
+
+ return counter;
+ }
+
+ inline OutputIterator
+ first_empty(InputIterator c, InputIterator d, OutputIterator out) const
+ { return out; }
+
+ inline OutputIterator
+ second_empty(InputIterator a, InputIterator b, OutputIterator out) const
+ { return out; }
+ };
+
+template<class InputIterator, class OutputIterator, class Comparator>
+ struct union_func
+ {
+ typedef typename std::iterator_traits<InputIterator>::difference_type
+ difference_type;
+
+ union_func(Comparator c) : comp(c) {}
+
+ Comparator comp;
+
+ OutputIterator
+ invoke(InputIterator a, const InputIterator b, InputIterator c,
+ const InputIterator d, OutputIterator r) const
+ {
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ {
+ *r = *a;
+ ++a;
+ }
+ else if (comp(*c, *a))
+ {
+ *r = *c;
+ ++c;
+ }
+ else
+ {
+ *r = *a;
+ ++a;
+ ++c;
+ }
+ ++r;
+ }
+ return std::copy(c, d, std::copy(a, b, r));
+ }
+
+ difference_type
+ count(InputIterator a, InputIterator b,
+ InputIterator c, InputIterator d) const
+ {
+ difference_type counter = 0;
+
+ while (a != b && c != d)
+ {
+ if (comp(*a, *c))
+ { ++a; }
+ else if (comp(*c, *a))
+ { ++c; }
+ else
+ {
+ ++a;
+ ++c;
+ }
+ ++counter;
+ }
+
+ counter += (b - a);
+ counter += (d - c);
+ return counter;
+ }
+
+ inline OutputIterator
+ first_empty(InputIterator c, InputIterator d, OutputIterator out) const
+ { return std::copy(c, d, out); }
+
+ inline OutputIterator
+ second_empty(InputIterator a, InputIterator b, OutputIterator out) const
+ { return std::copy(a, b, out); }
+ };
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Operation>
+ OutputIterator
+ parallel_set_operation(InputIterator begin1, InputIterator end1,
+ InputIterator begin2, InputIterator end2,
+ OutputIterator result, Operation op)
+ {
+ _GLIBCXX_CALL((end1 - begin1) + (end2 - begin2))
+
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+ typedef typename std::pair<InputIterator, InputIterator> iterator_pair;
+
+ if (begin1 == end1)
+ return op.first_empty(begin2, end2, result);
+
+ if (begin2 == end2)
+ return op.second_empty(begin1, end1, result);
+
+ const difference_type size = (end1 - begin1) + (end2 - begin2);
+
+ const iterator_pair sequence[ 2 ] =
+ { std::make_pair(begin1, end1), std::make_pair(begin2, end2) } ;
+ OutputIterator return_value = result;
+ difference_type *borders;
+ iterator_pair *block_begins;
+ difference_type* lengths;
+
+ thread_index_t num_threads =
+ std::min<difference_type>(get_max_threads(),
+ std::min(end1 - begin1, end2 - begin2));
+
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+
+ borders = new difference_type[num_threads + 2];
+ equally_split(size, num_threads + 1, borders);
+ block_begins = new iterator_pair[num_threads + 1];
+ // Very start.
+ block_begins[0] = std::make_pair(begin1, begin2);
+ lengths = new difference_type[num_threads];
+ } //single
+
+ thread_index_t iam = omp_get_thread_num();
+
+ // Result from multiseq_partition.
+ InputIterator offset[2];
+ const difference_type rank = borders[iam + 1];
+
+ multiseq_partition(sequence, sequence + 2, rank, offset, op.comp);
+
+ // allowed to read?
+ // together
+ // *(offset[ 0 ] - 1) == *offset[ 1 ]
+ if (offset[ 0 ] != begin1 && offset[ 1 ] != end2
+ && !op.comp(*(offset[ 0 ] - 1), *offset[ 1 ])
+ && !op.comp(*offset[ 1 ], *(offset[ 0 ] - 1)))
+ {
+ // Avoid split between globally equal elements: move one to
+ // front in first sequence.
+ --offset[ 0 ];
+ }
+
+ iterator_pair block_end = block_begins[ iam + 1 ] =
+ iterator_pair(offset[ 0 ], offset[ 1 ]);
+
+ // Make sure all threads have their block_begin result written out.
+# pragma omp barrier
+
+ iterator_pair block_begin = block_begins[ iam ];
+
+ // Begin working for the first block, while the others except
+ // the last start to count.
+ if (iam == 0)
+ {
+ // The first thread can copy already.
+ lengths[ iam ] = op.invoke(block_begin.first, block_end.first,
+ block_begin.second, block_end.second,
+ result)
+ - result;
+ }
+ else
+ {
+ lengths[ iam ] = op.count(block_begin.first, block_end.first,
+ block_begin.second, block_end.second);
+ }
+
+ // Make sure everyone wrote their lengths.
+# pragma omp barrier
+
+ OutputIterator r = result;
+
+ if (iam == 0)
+ {
+ // Do the last block.
+ for (int i = 0; i < num_threads; ++i)
+ r += lengths[i];
+
+ block_begin = block_begins[num_threads];
+
+ // Return the result iterator of the last block.
+ return_value = op.invoke(
+ block_begin.first, end1, block_begin.second, end2, r);
+
+ }
+ else
+ {
+ for (int i = 0; i < iam; ++i)
+ r += lengths[ i ];
+
+ // Reset begins for copy pass.
+ op.invoke(block_begin.first, block_end.first,
+ block_begin.second, block_end.second, r);
+ }
+ }
+ return return_value;
+ }
+
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ inline OutputIterator
+ parallel_set_union(InputIterator begin1, InputIterator end1,
+ InputIterator begin2, InputIterator end2,
+ OutputIterator result, Comparator comp)
+ {
+ return parallel_set_operation(begin1, end1, begin2, end2, result,
+ union_func< InputIterator, OutputIterator, Comparator>(comp));
+ }
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ inline OutputIterator
+ parallel_set_intersection(InputIterator begin1, InputIterator end1,
+ InputIterator begin2, InputIterator end2,
+ OutputIterator result, Comparator comp)
+ {
+ return parallel_set_operation(begin1, end1, begin2, end2, result,
+ intersection_func<InputIterator, OutputIterator, Comparator>(comp));
+ }
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ inline OutputIterator
+ parallel_set_difference(InputIterator begin1, InputIterator end1,
+ InputIterator begin2, InputIterator end2,
+ OutputIterator result, Comparator comp)
+ {
+ return parallel_set_operation(begin1, end1, begin2, end2, result,
+ difference_func<InputIterator, OutputIterator, Comparator>(comp));
+ }
+
+template<typename InputIterator,
+ typename OutputIterator,
+ typename Comparator>
+ inline OutputIterator
+ parallel_set_symmetric_difference(InputIterator begin1, InputIterator end1,
+ InputIterator begin2, InputIterator end2,
+ OutputIterator result, Comparator comp)
+ {
+ return parallel_set_operation(begin1, end1, begin2, end2, result,
+ symmetric_difference_func<InputIterator, OutputIterator, Comparator>
+ (comp));
+ }
+
+}
+
+#endif /* _GLIBCXX_PARALLEL_SET_OPERATIONS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/settings.h b/gcc-4.4.0/libstdc++-v3/include/parallel/settings.h
new file mode 100644
index 000000000..946e39cab
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/settings.h
@@ -0,0 +1,281 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/settings.h
+ * @brief Runtime settings and tuning parameters, heuristics to decide
+ * whether to use parallelized algorithms.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ *
+ * @section parallelization_decision
+ * The decision whether to run an algorithm in parallel.
+ *
+ * There are several ways the user can switch on and off the parallel
+ * execution of an algorithm, both at compile- and run-time.
+ *
+ * Only sequential execution can be forced at compile-time. This
+ * reduces code size and protects code parts that have
+ * non-thread-safe side effects.
+ *
+ * Ultimately, forcing parallel execution at compile-time makes
+ * sense. Often, the sequential algorithm implementation is used as
+ * a subroutine, so no reduction in code size can be achieved. Also,
+ * the machine the program is run on might have only one processor
+ * core, so to avoid overhead, the algorithm is executed
+ * sequentially.
+ *
+ * To force sequential execution of an algorithm ultimately at
+ * compile-time, the user must add the tag
+ * __gnu_parallel::sequential_tag() to the end of the parameter list,
+ * e. g.
+ *
+ * \code
+ * std::sort(v.begin(), v.end(), __gnu_parallel::sequential_tag());
+ * \endcode
+ *
+ * This is compatible with all overloaded algorithm variants. No
+ * additional code will be instantiated, at all. The same holds for
+ * most algorithm calls with iterators not providing random access.
+ *
+ * If the algorithm call is not forced to be executed sequentially
+ * at compile-time, the decision is made at run-time.
+ * The global variable __gnu_parallel::_Settings::algorithm_strategy
+ * is checked. It is a tristate variable corresponding to:
+ *
+ * a. force_sequential, meaning the sequential algorithm is executed.
+ * b. force_parallel, meaning the parallel algorithm is executed.
+ * c. heuristic
+ *
+ * For heuristic, the parallel algorithm implementation is called
+ * only if the input size is sufficiently large. For most
+ * algorithms, the input size is the (combined) length of the input
+ * sequence(s). The threshold can be set by the user, individually
+ * for each algorithm. The according variables are called
+ * __gnu_parallel::_Settings::[algorithm]_minimal_n .
+ *
+ * For some of the algorithms, there are even more tuning options,
+ * e. g. the ability to choose from multiple algorithm variants. See
+ * below for details.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_SETTINGS_H
+#define _GLIBCXX_PARALLEL_SETTINGS_H 1
+
+#include <parallel/types.h>
+
+/**
+ * @brief Determine at compile(?)-time if the parallel variant of an
+ * algorithm should be called.
+ * @param c A condition that is convertible to bool that is overruled by
+ * __gnu_parallel::_Settings::algorithm_strategy. Usually a decision
+ * based on the input size.
+ */
+#define _GLIBCXX_PARALLEL_CONDITION(c) (__gnu_parallel::_Settings::get().algorithm_strategy != __gnu_parallel::force_sequential && ((__gnu_parallel::get_max_threads() > 1 && (c)) || __gnu_parallel::_Settings::get().algorithm_strategy == __gnu_parallel::force_parallel))
+
+/*
+inline bool
+parallel_condition(bool c)
+{
+ bool ret = false;
+ const _Settings& s = _Settings::get();
+ if (s.algorithm_strategy != force_seqential)
+ {
+ if (s.algorithm_strategy == force_parallel)
+ ret = true;
+ else
+ ret = get_max_threads() > 1 && c;
+ }
+ return ret;
+}
+*/
+
+namespace __gnu_parallel
+{
+ /// class _Settings
+ /// Run-time settings for the parallel mode, including all tunable parameters.
+ struct _Settings
+ {
+ _AlgorithmStrategy algorithm_strategy;
+
+ _SortAlgorithm sort_algorithm;
+ _PartialSumAlgorithm partial_sum_algorithm;
+ _MultiwayMergeAlgorithm multiway_merge_algorithm;
+ _FindAlgorithm find_algorithm;
+
+ _SplittingAlgorithm sort_splitting;
+ _SplittingAlgorithm merge_splitting;
+ _SplittingAlgorithm multiway_merge_splitting;
+
+ // Per-algorithm settings.
+
+ /// Minimal input size for accumulate.
+ sequence_index_t accumulate_minimal_n;
+
+ /// Minimal input size for adjacent_difference.
+ unsigned int adjacent_difference_minimal_n;
+
+ /// Minimal input size for count and count_if.
+ sequence_index_t count_minimal_n;
+
+ /// Minimal input size for fill.
+ sequence_index_t fill_minimal_n;
+
+ /// Block size increase factor for find.
+ double find_increasing_factor;
+
+ /// Initial block size for find.
+ sequence_index_t find_initial_block_size;
+
+ /// Maximal block size for find.
+ sequence_index_t find_maximum_block_size;
+
+ /// Start with looking for this many elements sequentially, for find.
+ sequence_index_t find_sequential_search_size;
+
+ /// Minimal input size for for_each.
+ sequence_index_t for_each_minimal_n;
+
+ /// Minimal input size for generate.
+ sequence_index_t generate_minimal_n;
+
+ /// Minimal input size for max_element.
+ sequence_index_t max_element_minimal_n;
+
+ /// Minimal input size for merge.
+ sequence_index_t merge_minimal_n;
+
+ /// Oversampling factor for merge.
+ unsigned int merge_oversampling;
+
+ /// Minimal input size for min_element.
+ sequence_index_t min_element_minimal_n;
+
+ /// Minimal input size for multiway_merge.
+ sequence_index_t multiway_merge_minimal_n;
+
+ /// Oversampling factor for multiway_merge.
+ int multiway_merge_minimal_k;
+
+ /// Oversampling factor for multiway_merge.
+ unsigned int multiway_merge_oversampling;
+
+ /// Minimal input size for nth_element.
+ sequence_index_t nth_element_minimal_n;
+
+ /// Chunk size for partition.
+ sequence_index_t partition_chunk_size;
+
+ /// Chunk size for partition, relative to input size. If > 0.0,
+ /// this value overrides partition_chunk_size.
+ double partition_chunk_share;
+
+ /// Minimal input size for partition.
+ sequence_index_t partition_minimal_n;
+
+ /// Minimal input size for partial_sort.
+ sequence_index_t partial_sort_minimal_n;
+
+ /// Ratio for partial_sum. Assume "sum and write result" to be
+ /// this factor slower than just "sum".
+ float partial_sum_dilation;
+
+ /// Minimal input size for partial_sum.
+ unsigned int partial_sum_minimal_n;
+
+ /// Minimal input size for random_shuffle.
+ unsigned int random_shuffle_minimal_n;
+
+ /// Minimal input size for replace and replace_if.
+ sequence_index_t replace_minimal_n;
+
+ /// Minimal input size for set_difference.
+ sequence_index_t set_difference_minimal_n;
+
+ /// Minimal input size for set_intersection.
+ sequence_index_t set_intersection_minimal_n;
+
+ /// Minimal input size for set_symmetric_difference.
+ sequence_index_t set_symmetric_difference_minimal_n;
+
+ /// Minimal input size for set_union.
+ sequence_index_t set_union_minimal_n;
+
+ /// Minimal input size for parallel sorting.
+ sequence_index_t sort_minimal_n;
+
+ /// Oversampling factor for parallel std::sort (MWMS).
+ unsigned int sort_mwms_oversampling;
+
+ /// Such many samples to take to find a good pivot (quicksort).
+ unsigned int sort_qs_num_samples_preset;
+
+ /// Maximal subsequence length to switch to unbalanced base case.
+ /// Applies to std::sort with dynamically load-balanced quicksort.
+ sequence_index_t sort_qsb_base_case_maximal_n;
+
+ /// Minimal input size for parallel std::transform.
+ sequence_index_t transform_minimal_n;
+
+ /// Minimal input size for unique_copy.
+ sequence_index_t unique_copy_minimal_n;
+
+ sequence_index_t workstealing_chunk_size;
+
+ // Hardware dependent tuning parameters.
+
+ /// Size of the L1 cache in bytes (underestimation).
+ unsigned long long L1_cache_size;
+
+ /// Size of the L2 cache in bytes (underestimation).
+ unsigned long long L2_cache_size;
+
+ /// Size of the Translation Lookaside Buffer (underestimation).
+ unsigned int TLB_size;
+
+ /// Overestimation of cache line size. Used to avoid false
+ /// sharing, i. e. elements of different threads are at least this
+ /// amount apart.
+ unsigned int cache_line_size;
+
+ // Statistics.
+
+ /// The number of stolen ranges in load-balanced quicksort.
+ sequence_index_t qsb_steals;
+
+ /// Get the global settings.
+ static const _Settings&
+ get() throw();
+
+ /// Set the global settings.
+ static void
+ set(_Settings&) throw();
+
+ explicit
+ _Settings() : algorithm_strategy(heuristic), sort_algorithm(MWMS), partial_sum_algorithm(LINEAR), multiway_merge_algorithm(LOSER_TREE), find_algorithm(CONSTANT_SIZE_BLOCKS), sort_splitting(EXACT), merge_splitting(EXACT), multiway_merge_splitting(EXACT), accumulate_minimal_n(1000), adjacent_difference_minimal_n(1000), count_minimal_n(1000), fill_minimal_n(1000), find_increasing_factor(2.0), find_initial_block_size(256), find_maximum_block_size(8192), find_sequential_search_size(256), for_each_minimal_n(1000), generate_minimal_n(1000), max_element_minimal_n(1000), merge_minimal_n(1000), merge_oversampling(10), min_element_minimal_n(1000), multiway_merge_minimal_n(1000), multiway_merge_minimal_k(2), multiway_merge_oversampling(10), nth_element_minimal_n(1000), partition_chunk_size(1000), partition_chunk_share(0.0), partition_minimal_n(1000), partial_sort_minimal_n(1000), partial_sum_dilation(1.0f), partial_sum_minimal_n(1000), random_shuffle_minimal_n(1000), replace_minimal_n(1000), set_difference_minimal_n(1000), set_intersection_minimal_n(1000), set_symmetric_difference_minimal_n(1000), set_union_minimal_n(1000), sort_minimal_n(1000), sort_mwms_oversampling(10), sort_qs_num_samples_preset(100), sort_qsb_base_case_maximal_n(100), transform_minimal_n(1000), unique_copy_minimal_n(10000), workstealing_chunk_size(100), L1_cache_size(16 << 10), L2_cache_size(256 << 10), TLB_size(128), cache_line_size(64), qsb_steals(0)
+ { }
+ };
+}
+
+#endif /* _GLIBCXX_PARALLEL_SETTINGS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/sort.h b/gcc-4.4.0/libstdc++-v3/include/parallel/sort.h
new file mode 100644
index 000000000..de226e8b4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/sort.h
@@ -0,0 +1,229 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/sort.h
+ * @brief Parallel sorting algorithm switch.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_SORT_H
+#define _GLIBCXX_PARALLEL_SORT_H 1
+
+#include <parallel/basic_iterator.h>
+#include <parallel/features.h>
+#include <parallel/parallel.h>
+
+#if _GLIBCXX_ASSERTIONS
+#include <parallel/checkers.h>
+#endif
+
+#if _GLIBCXX_MERGESORT
+#include <parallel/multiway_mergesort.h>
+#endif
+
+#if _GLIBCXX_QUICKSORT
+#include <parallel/quicksort.h>
+#endif
+
+#if _GLIBCXX_BAL_QUICKSORT
+#include <parallel/balanced_quicksort.h>
+#endif
+
+namespace __gnu_parallel
+{
+ //prototype
+ template<bool stable, typename RandomAccessIterator,
+ typename Comparator, typename Parallelism>
+ void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, Parallelism parallelism);
+
+ /**
+ * @brief Choose multiway mergesort, splitting variant at run-time,
+ * for parallel sorting.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, multiway_mergesort_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ if(_Settings::get().sort_splitting == EXACT)
+ parallel_sort_mwms<stable, true>
+ (begin, end, comp, parallelism.get_num_threads());
+ else
+ parallel_sort_mwms<stable, false>
+ (begin, end, comp, parallelism.get_num_threads());
+ }
+
+ /**
+ * @brief Choose multiway mergesort with exact splitting,
+ * for parallel sorting.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, multiway_mergesort_exact_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ parallel_sort_mwms<stable, true>
+ (begin, end, comp, parallelism.get_num_threads());
+ }
+
+ /**
+ * @brief Choose multiway mergesort with splitting by sampling,
+ * for parallel sorting.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, multiway_mergesort_sampling_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ parallel_sort_mwms<stable, false>
+ (begin, end, comp, parallelism.get_num_threads());
+ }
+
+ /**
+ * @brief Choose quicksort for parallel sorting.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, quicksort_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ _GLIBCXX_PARALLEL_ASSERT(stable == false);
+
+ parallel_sort_qs(begin, end, comp, parallelism.get_num_threads());
+ }
+
+ /**
+ * @brief Choose balanced quicksort for parallel sorting.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @param stable Sort stable.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, balanced_quicksort_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ _GLIBCXX_PARALLEL_ASSERT(stable == false);
+
+ parallel_sort_qsb(begin, end, comp, parallelism.get_num_threads());
+ }
+
+
+ /**
+ * @brief Choose multiway mergesort with exact splitting,
+ * for parallel sorting.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, default_parallel_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ parallel_sort<stable>
+ (begin, end, comp,
+ multiway_mergesort_exact_tag(parallelism.get_num_threads()));
+ }
+
+
+ /**
+ * @brief Choose a parallel sorting algorithm.
+ * @param begin Begin iterator of input sequence.
+ * @param end End iterator of input sequence.
+ * @param comp Comparator.
+ * @param stable Sort stable.
+ * @callgraph
+ */
+ template<bool stable, typename RandomAccessIterator, typename Comparator>
+ inline void
+ parallel_sort(RandomAccessIterator begin, RandomAccessIterator end,
+ Comparator comp, parallel_tag parallelism)
+ {
+ _GLIBCXX_CALL(end - begin)
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ if (false) ;
+#if _GLIBCXX_MERGESORT
+ else if (stable || _Settings::get().sort_algorithm == MWMS)
+ {
+ if(_Settings::get().sort_splitting == EXACT)
+ parallel_sort_mwms<stable, true>
+ (begin, end, comp, parallelism.get_num_threads());
+ else
+ parallel_sort_mwms<false, false>
+ (begin, end, comp, parallelism.get_num_threads());
+ }
+#endif
+#if _GLIBCXX_QUICKSORT
+ else if (_Settings::get().sort_algorithm == QS)
+ parallel_sort_qs(begin, end, comp, parallelism.get_num_threads());
+#endif
+#if _GLIBCXX_BAL_QUICKSORT
+ else if (_Settings::get().sort_algorithm == QS_BALANCED)
+ parallel_sort_qsb(begin, end, comp, parallelism.get_num_threads());
+#endif
+ else
+ __gnu_sequential::sort(begin, end, comp);
+ }
+} // end namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_SORT_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/tags.h b/gcc-4.4.0/libstdc++-v3/include/parallel/tags.h
new file mode 100644
index 000000000..bc1a7e5c6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/tags.h
@@ -0,0 +1,191 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file parallel/tags.h
+ * @brief Tags for compile-time selection.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_TAGS_H
+#define _GLIBCXX_PARALLEL_TAGS_H 1
+
+#include <omp.h>
+#include <parallel/types.h>
+
+namespace __gnu_parallel
+{
+ /** @brief Forces sequential execution at compile time. */
+ struct sequential_tag { };
+
+ /** @brief Recommends parallel execution at compile time,
+ * optionally using a user-specified number of threads. */
+ struct parallel_tag
+ {
+ private:
+ thread_index_t num_threads;
+
+ public:
+ /** @brief Default constructor. Use default number of threads. */
+ parallel_tag()
+ {
+ this->num_threads = 0;
+ }
+
+ /** @brief Default constructor. Recommend number of threads to use.
+ * @param num_threads Desired number of threads. */
+ parallel_tag(thread_index_t num_threads)
+ {
+ this->num_threads = num_threads;
+ }
+
+ /** @brief Find out desired number of threads.
+ * @return Desired number of threads. */
+ inline thread_index_t get_num_threads()
+ {
+ if(num_threads == 0)
+ return omp_get_max_threads();
+ else
+ return num_threads;
+ }
+
+ /** @brief Set the desired number of threads.
+ * @param num_threads Desired number of threads. */
+ inline void set_num_threads(thread_index_t num_threads)
+ {
+ this->num_threads = num_threads;
+ }
+ };
+
+ /** @brief Recommends parallel execution using the
+ default parallel algorithm. */
+ struct default_parallel_tag : public parallel_tag
+ {
+ default_parallel_tag() { }
+ default_parallel_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+ /** @brief Recommends parallel execution using dynamic
+ load-balancing at compile time. */
+ struct balanced_tag : public parallel_tag { };
+
+ /** @brief Recommends parallel execution using static
+ load-balancing at compile time. */
+ struct unbalanced_tag : public parallel_tag { };
+
+ /** @brief Recommends parallel execution using OpenMP dynamic
+ load-balancing at compile time. */
+ struct omp_loop_tag : public parallel_tag { };
+
+ /** @brief Recommends parallel execution using OpenMP static
+ load-balancing at compile time. */
+ struct omp_loop_static_tag : public parallel_tag { };
+
+
+ /** @brief Base class for for std::find() variants. */
+ struct find_tag { };
+
+
+ /** @brief Forces parallel merging
+ * with exact splitting, at compile time. */
+ struct exact_tag : public parallel_tag
+ {
+ exact_tag() { }
+ exact_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+ /** @brief Forces parallel merging
+ * with exact splitting, at compile time. */
+ struct sampling_tag : public parallel_tag
+ {
+ sampling_tag() { }
+ sampling_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+
+ /** @brief Forces parallel sorting using multiway mergesort
+ * at compile time. */
+ struct multiway_mergesort_tag : public parallel_tag
+ {
+ multiway_mergesort_tag() { }
+ multiway_mergesort_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+ /** @brief Forces parallel sorting using multiway mergesort
+ * with exact splitting at compile time. */
+ struct multiway_mergesort_exact_tag : public parallel_tag
+ {
+ multiway_mergesort_exact_tag() { }
+ multiway_mergesort_exact_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+ /** @brief Forces parallel sorting using multiway mergesort
+ * with splitting by sampling at compile time. */
+ struct multiway_mergesort_sampling_tag : public parallel_tag
+ {
+ multiway_mergesort_sampling_tag() { }
+ multiway_mergesort_sampling_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+ /** @brief Forces parallel sorting using unbalanced quicksort
+ * at compile time. */
+ struct quicksort_tag : public parallel_tag
+ {
+ quicksort_tag() { }
+ quicksort_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+ /** @brief Forces parallel sorting using balanced quicksort
+ * at compile time. */
+ struct balanced_quicksort_tag : public parallel_tag
+ {
+ balanced_quicksort_tag() { }
+ balanced_quicksort_tag(thread_index_t num_threads)
+ : parallel_tag(num_threads) { }
+ };
+
+
+ /** @brief Selects the growing block size variant for std::find().
+ @see _GLIBCXX_FIND_GROWING_BLOCKS */
+ struct growing_blocks_tag : public find_tag { };
+
+ /** @brief Selects the constant block size variant for std::find().
+ @see _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS */
+ struct constant_size_blocks_tag : public find_tag { };
+
+ /** @brief Selects the equal splitting variant for std::find().
+ @see _GLIBCXX_FIND_EQUAL_SPLIT */
+ struct equal_split_tag : public find_tag { };
+}
+
+#endif /* _GLIBCXX_PARALLEL_TAGS_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/types.h b/gcc-4.4.0/libstdc++-v3/include/parallel/types.h
new file mode 100644
index 000000000..053dfff15
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/types.h
@@ -0,0 +1,155 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/types.h
+ * @brief Basic types and typedefs.
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_TYPES_H
+#define _GLIBCXX_PARALLEL_TYPES_H 1
+
+#include <cstdlib>
+
+namespace __gnu_parallel
+{
+ // Enumerated types.
+
+ /// Run-time equivalents for the compile-time tags.
+ enum _Parallelism
+ {
+ /// Not parallel.
+ sequential,
+
+ /// Parallel unbalanced (equal-sized chunks).
+ parallel_unbalanced,
+
+ /// Parallel balanced (work-stealing).
+ parallel_balanced,
+
+ /// Parallel with OpenMP dynamic load-balancing.
+ parallel_omp_loop,
+
+ /// Parallel with OpenMP static load-balancing.
+ parallel_omp_loop_static,
+
+ /// Parallel with OpenMP taskqueue construct.
+ parallel_taskqueue
+ };
+
+ /// Strategies for run-time algorithm selection:
+ // force_sequential, force_parallel, heuristic.
+ enum _AlgorithmStrategy
+ {
+ heuristic,
+ force_sequential,
+ force_parallel
+ };
+
+ /// Sorting algorithms:
+ // multi-way mergesort, quicksort, load-balanced quicksort.
+ enum _SortAlgorithm
+ {
+ MWMS,
+ QS,
+ QS_BALANCED
+ };
+
+ /// Merging algorithms:
+ // bubblesort-alike, loser-tree variants, enum sentinel.
+ enum _MultiwayMergeAlgorithm
+ {
+ LOSER_TREE
+ };
+
+ /// Partial sum algorithms: recursive, linear.
+ enum _PartialSumAlgorithm
+ {
+ RECURSIVE,
+ LINEAR
+ };
+
+ /// Sorting/merging algorithms: sampling, exact.
+ enum _SplittingAlgorithm
+ {
+ SAMPLING,
+ EXACT
+ };
+
+ /// Find algorithms:
+ // growing blocks, equal-sized blocks, equal splitting.
+ enum _FindAlgorithm
+ {
+ GROWING_BLOCKS,
+ CONSTANT_SIZE_BLOCKS,
+ EQUAL_SPLIT
+ };
+
+ /// Integer Types.
+ // XXX need to use <cstdint>
+ /** @brief 16-bit signed integer. */
+ typedef short int16;
+
+ /** @brief 16-bit unsigned integer. */
+ typedef unsigned short uint16;
+
+ /** @brief 32-bit signed integer. */
+ typedef int int32;
+
+ /** @brief 32-bit unsigned integer. */
+ typedef unsigned int uint32;
+
+ /** @brief 64-bit signed integer. */
+ typedef long long int64;
+
+ /** @brief 64-bit unsigned integer. */
+ typedef unsigned long long uint64;
+
+ /**
+ * @brief Unsigned integer to index elements.
+ * The total number of elements for each algorithm must fit into this type.
+ */
+ typedef uint64 sequence_index_t;
+
+ /**
+ * @brief Unsigned integer to index a thread number.
+ * The maximum thread number (for each processor) must fit into this type.
+ */
+ typedef uint16 thread_index_t;
+
+ // XXX atomics interface?
+ /// Longest compare-and-swappable integer type on this platform.
+ typedef int64 lcas_t;
+
+ // XXX numeric_limits::digits?
+ /// Number of bits of ::lcas_t.
+ static const int lcas_t_bits = sizeof(lcas_t) * 8;
+
+ /// ::lcas_t with the right half of bits set to 1.
+ static const lcas_t lcas_t_mask = ((lcas_t(1) << (lcas_t_bits / 2)) - 1);
+}
+
+#endif /* _GLIBCXX_PARALLEL_TYPES_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/unique_copy.h b/gcc-4.4.0/libstdc++-v3/include/parallel/unique_copy.h
new file mode 100644
index 000000000..a83c2c0c5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/unique_copy.h
@@ -0,0 +1,192 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/unique_copy.h
+ * @brief Parallel implementations of std::unique_copy().
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Robert Geisberger and Robin Dapp.
+
+#ifndef _GLIBCXX_PARALLEL_UNIQUE_COPY_H
+#define _GLIBCXX_PARALLEL_UNIQUE_COPY_H 1
+
+#include <parallel/parallel.h>
+#include <parallel/multiseq_selection.h>
+
+namespace __gnu_parallel
+{
+
+/** @brief Parallel std::unique_copy(), w/o explicit equality predicate.
+ * @param first Begin iterator of input sequence.
+ * @param last End iterator of input sequence.
+ * @param result Begin iterator of result sequence.
+ * @param binary_pred Equality predicate.
+ * @return End iterator of result sequence. */
+template<typename InputIterator,
+ class OutputIterator,
+ class BinaryPredicate>
+ OutputIterator
+ parallel_unique_copy(InputIterator first, InputIterator last,
+ OutputIterator result, BinaryPredicate binary_pred)
+ {
+ _GLIBCXX_CALL(last - first)
+
+ typedef std::iterator_traits<InputIterator> traits_type;
+ typedef typename traits_type::value_type value_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ difference_type size = last - first;
+
+ if (size == 0)
+ return result;
+
+ // Let the first thread process two parts.
+ difference_type *counter;
+ difference_type *borders;
+
+ thread_index_t num_threads = get_max_threads();
+ // First part contains at least one element.
+# pragma omp parallel num_threads(num_threads)
+ {
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+ borders = new difference_type[num_threads + 2];
+ equally_split(size, num_threads + 1, borders);
+ counter = new difference_type[num_threads + 1];
+ }
+
+ thread_index_t iam = omp_get_thread_num();
+
+ difference_type begin, end;
+
+ // Check for length without duplicates
+ // Needed for position in output
+ difference_type i = 0;
+ OutputIterator out = result;
+
+ if (iam == 0)
+ {
+ begin = borders[0] + 1; // == 1
+ end = borders[iam + 1];
+
+ ++i;
+ *out++ = *first;
+
+ for (InputIterator iter = first + begin; iter < first + end; ++iter)
+ {
+ if (!binary_pred(*iter, *(iter-1)))
+ {
+ ++i;
+ *out++ = *iter;
+ }
+ }
+ }
+ else
+ {
+ begin = borders[iam]; //one part
+ end = borders[iam + 1];
+
+ for (InputIterator iter = first + begin; iter < first + end; ++iter)
+ {
+ if (!binary_pred(*iter, *(iter - 1)))
+ ++i;
+ }
+ }
+ counter[iam] = i;
+
+ // Last part still untouched.
+ difference_type begin_output;
+
+# pragma omp barrier
+
+ // Store result in output on calculated positions.
+ begin_output = 0;
+
+ if (iam == 0)
+ {
+ for (int t = 0; t < num_threads; ++t)
+ begin_output += counter[t];
+
+ i = 0;
+
+ OutputIterator iter_out = result + begin_output;
+
+ begin = borders[num_threads];
+ end = size;
+
+ for (InputIterator iter = first + begin; iter < first + end; ++iter)
+ {
+ if (iter == first || !binary_pred(*iter, *(iter - 1)))
+ {
+ ++i;
+ *iter_out++ = *iter;
+ }
+ }
+
+ counter[num_threads] = i;
+ }
+ else
+ {
+ for (int t = 0; t < iam; t++)
+ begin_output += counter[t];
+
+ OutputIterator iter_out = result + begin_output;
+ for (InputIterator iter = first + begin; iter < first + end; ++iter)
+ {
+ if (!binary_pred(*iter, *(iter-1)))
+ *iter_out++ = *iter;
+ }
+ }
+ }
+
+ difference_type end_output = 0;
+ for (int t = 0; t < num_threads + 1; t++)
+ end_output += counter[t];
+
+ delete[] borders;
+
+ return result + end_output;
+ }
+
+/** @brief Parallel std::unique_copy(), without explicit equality predicate
+ * @param first Begin iterator of input sequence.
+ * @param last End iterator of input sequence.
+ * @param result Begin iterator of result sequence.
+ * @return End iterator of result sequence. */
+template<typename InputIterator, class OutputIterator>
+ inline OutputIterator
+ parallel_unique_copy(InputIterator first, InputIterator last,
+ OutputIterator result)
+ {
+ typedef typename std::iterator_traits<InputIterator>::value_type
+ value_type;
+ return parallel_unique_copy(first, last, result,
+ std::equal_to<value_type>());
+ }
+
+}//namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_UNIQUE_COPY_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/parallel/workstealing.h b/gcc-4.4.0/libstdc++-v3/include/parallel/workstealing.h
new file mode 100644
index 000000000..b82fe7cef
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/parallel/workstealing.h
@@ -0,0 +1,306 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 3, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/workstealing.h
+ * @brief Parallelization of embarrassingly parallel execution by
+ * means of work-stealing.
+ *
+ * Work stealing is described in
+ *
+ * R. D. Blumofe and C. E. Leiserson.
+ * Scheduling multithreaded computations by work stealing.
+ * Journal of the ACM, 46(5):720–748, 1999.
+ *
+ * This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_WORKSTEALING_H
+#define _GLIBCXX_PARALLEL_WORKSTEALING_H 1
+
+#include <parallel/parallel.h>
+#include <parallel/random_number.h>
+#include <parallel/compatibility.h>
+
+namespace __gnu_parallel
+{
+
+#define _GLIBCXX_JOB_VOLATILE volatile
+
+/** @brief One job for a certain thread. */
+template<typename _DifferenceTp>
+ struct Job
+ {
+ typedef _DifferenceTp difference_type;
+
+ /** @brief First element.
+ *
+ * Changed by owning and stealing thread. By stealing thread,
+ * always incremented. */
+ _GLIBCXX_JOB_VOLATILE difference_type first;
+
+ /** @brief Last element.
+ *
+ * Changed by owning thread only. */
+ _GLIBCXX_JOB_VOLATILE difference_type last;
+
+ /** @brief Number of elements, i. e. @c last-first+1.
+ *
+ * Changed by owning thread only. */
+ _GLIBCXX_JOB_VOLATILE difference_type load;
+ };
+
+/** @brief Work stealing algorithm for random access iterators.
+ *
+ * Uses O(1) additional memory. Synchronization at job lists is
+ * done with atomic operations.
+ * @param begin Begin iterator of element sequence.
+ * @param end End iterator of element sequence.
+ * @param op User-supplied functor (comparator, predicate, adding
+ * functor, ...).
+ * @param f Functor to "process" an element with op (depends on
+ * desired functionality, e. g. for std::for_each(), ...).
+ * @param r Functor to "add" a single result to the already
+ * processed elements (depends on functionality).
+ * @param base Base value for reduction.
+ * @param output Pointer to position where final result is written to
+ * @param bound Maximum number of elements processed (e. g. for
+ * std::count_n()).
+ * @return User-supplied functor (that may contain a part of the result).
+ */
+template<typename RandomAccessIterator,
+ typename Op,
+ typename Fu,
+ typename Red,
+ typename Result>
+ Op
+ for_each_template_random_access_workstealing(RandomAccessIterator begin,
+ RandomAccessIterator end,
+ Op op, Fu& f, Red r,
+ Result base, Result& output,
+ typename std::iterator_traits
+ <RandomAccessIterator>::
+ difference_type bound)
+ {
+ _GLIBCXX_CALL(end - begin)
+
+ typedef std::iterator_traits<RandomAccessIterator> traits_type;
+ typedef typename traits_type::difference_type difference_type;
+
+ const _Settings& __s = _Settings::get();
+
+ difference_type chunk_size = static_cast<difference_type>(__s.workstealing_chunk_size);
+
+ // How many jobs?
+ difference_type length = (bound < 0) ? (end - begin) : bound;
+
+ // To avoid false sharing in a cache line.
+ const int stride = __s.cache_line_size * 10 / sizeof(Job<difference_type>) + 1;
+
+ // Total number of threads currently working.
+ thread_index_t busy = 0;
+
+ Job<difference_type> *job;
+
+ omp_lock_t output_lock;
+ omp_init_lock(&output_lock);
+
+ // Write base value to output.
+ output = base;
+
+ // No more threads than jobs, at least one thread.
+ thread_index_t num_threads =
+ __gnu_parallel::max<thread_index_t>(1,
+ __gnu_parallel::min<difference_type>(length, get_max_threads()));
+
+# pragma omp parallel shared(busy) num_threads(num_threads)
+ {
+
+# pragma omp single
+ {
+ num_threads = omp_get_num_threads();
+
+ // Create job description array.
+ job = new Job<difference_type>[num_threads * stride];
+ }
+
+ // Initialization phase.
+
+ // Flags for every thread if it is doing productive work.
+ bool iam_working = false;
+
+ // Thread id.
+ thread_index_t iam = omp_get_thread_num();
+
+ // This job.
+ Job<difference_type>& my_job = job[iam * stride];
+
+ // Random number (for work stealing).
+ thread_index_t victim;
+
+ // Local value for reduction.
+ Result result = Result();
+
+ // Number of elements to steal in one attempt.
+ difference_type steal;
+
+ // Every thread has its own random number generator
+ // (modulo num_threads).
+ random_number rand_gen(iam, num_threads);
+
+ // This thread is currently working.
+# pragma omp atomic
+ ++busy;
+
+ iam_working = true;
+
+ // How many jobs per thread? last thread gets the rest.
+ my_job.first =
+ static_cast<difference_type>(iam * (length / num_threads));
+
+ my_job.last = (iam == (num_threads - 1)) ?
+ (length - 1) : ((iam + 1) * (length / num_threads) - 1);
+ my_job.load = my_job.last - my_job.first + 1;
+
+ // Init result with first value (to have a base value for reduction).
+ if (my_job.first <= my_job.last)
+ {
+ // Cannot use volatile variable directly.
+ difference_type my_first = my_job.first;
+ result = f(op, begin + my_first);
+ ++my_job.first;
+ --my_job.load;
+ }
+
+ RandomAccessIterator current;
+
+# pragma omp barrier
+
+ // Actual work phase
+ // Work on own or stolen start
+ while (busy > 0)
+ {
+ // Work until no productive thread left.
+# pragma omp flush(busy)
+
+ // Thread has own work to do
+ while (my_job.first <= my_job.last)
+ {
+ // fetch-and-add call
+ // Reserve current job block (size chunk_size) in my queue.
+ difference_type current_job =
+ fetch_and_add<difference_type>(&(my_job.first), chunk_size);
+
+ // Update load, to make the three values consistent,
+ // first might have been changed in the meantime
+ my_job.load = my_job.last - my_job.first + 1;
+ for (difference_type job_counter = 0;
+ job_counter < chunk_size && current_job <= my_job.last;
+ ++job_counter)
+ {
+ // Yes: process it!
+ current = begin + current_job;
+ ++current_job;
+
+ // Do actual work.
+ result = r(result, f(op, current));
+ }
+
+# pragma omp flush(busy)
+ }
+
+ // After reaching this point, a thread's job list is empty.
+ if (iam_working)
+ {
+ // This thread no longer has work.
+# pragma omp atomic
+ --busy;
+
+ iam_working = false;
+ }
+
+ difference_type supposed_first, supposed_last, supposed_load;
+ do
+ {
+ // Find random nonempty deque (not own), do consistency check.
+ yield();
+# pragma omp flush(busy)
+ victim = rand_gen();
+ supposed_first = job[victim * stride].first;
+ supposed_last = job[victim * stride].last;
+ supposed_load = job[victim * stride].load;
+ }
+ while (busy > 0
+ && ((supposed_load <= 0)
+ || ((supposed_first + supposed_load - 1) != supposed_last)));
+
+ if (busy == 0)
+ break;
+
+ if (supposed_load > 0)
+ {
+ // Has work and work to do.
+ // Number of elements to steal (at least one).
+ steal = (supposed_load < 2) ? 1 : supposed_load / 2;
+
+ // Push victim's start forward.
+ difference_type stolen_first =
+ fetch_and_add<difference_type>(
+ &(job[victim * stride].first), steal);
+ difference_type stolen_try =
+ stolen_first + steal - difference_type(1);
+
+ my_job.first = stolen_first;
+ my_job.last = __gnu_parallel::min(stolen_try, supposed_last);
+ my_job.load = my_job.last - my_job.first + 1;
+
+ // Has potential work again.
+# pragma omp atomic
+ ++busy;
+ iam_working = true;
+
+# pragma omp flush(busy)
+ }
+# pragma omp flush(busy)
+ } // end while busy > 0
+ // Add accumulated result to output.
+ omp_set_lock(&output_lock);
+ output = r(output, result);
+ omp_unset_lock(&output_lock);
+ }
+
+ delete[] job;
+
+ // Points to last element processed (needed as return value for
+ // some algorithms like transform)
+ f.finish_iterator = begin + length;
+
+ omp_destroy_lock(&output_lock);
+
+ return op;
+ }
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_WORKSTEALING_H */
diff --git a/gcc-4.4.0/libstdc++-v3/include/precompiled/extc++.h b/gcc-4.4.0/libstdc++-v3/include/precompiled/extc++.h
new file mode 100644
index 000000000..f0ccc42f0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/precompiled/extc++.h
@@ -0,0 +1,69 @@
+// C++ includes used for precompiling extensions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file extc++.h
+ * This is an implementation file for a precompiled header.
+ */
+
+#include <bits/stdtr1c++.h>
+
+#include <ext/algorithm>
+#include <ext/array_allocator.h>
+#include <ext/atomicity.h>
+#include <ext/bitmap_allocator.h>
+#include <ext/cast.h>
+#include <ext/concurrence.h>
+#include <ext/debug_allocator.h>
+#include <ext/extptr_allocator.h>
+#include <ext/functional>
+#include <ext/iterator>
+#include <ext/malloc_allocator.h>
+#include <ext/memory>
+#include <ext/mt_allocator.h>
+#include <ext/new_allocator.h>
+#include <ext/numeric>
+#include <ext/pod_char_traits.h>
+#include <ext/pointer.h>
+#include <ext/pool_allocator.h>
+#include <ext/rb_tree>
+#include <ext/rope>
+#include <ext/slist>
+#include <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_filebuf.h>
+#include <ext/throw_allocator.h>
+#include <ext/typelist.h>
+#include <ext/type_traits.h>
+#include <ext/vstring.h>
+#include <ext/pb_ds/assoc_container.hpp>
+#include <ext/pb_ds/priority_queue.hpp>
+#include <ext/pb_ds/exception.hpp>
+#include <ext/pb_ds/hash_policy.hpp>
+#include <ext/pb_ds/list_update_policy.hpp>
+#include <ext/pb_ds/tree_policy.hpp>
+#include <ext/pb_ds/trie_policy.hpp>
+
+#ifdef _GLIBCXX_HAVE_ICONV
+ #include <ext/codecvt_specializations.h>
+ #include <ext/enc_filebuf.h>
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/precompiled/stdc++.h b/gcc-4.4.0/libstdc++-v3/include/precompiled/stdc++.h
new file mode 100644
index 000000000..5782fa3b8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/precompiled/stdc++.h
@@ -0,0 +1,111 @@
+// C++ includes used for precompiling -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdc++.h
+ * This is an implementation file for a precompiled header.
+ */
+
+// 17.4.1.2 Headers
+
+// C
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <ccomplex>
+#include <cfenv>
+#include <cinttypes>
+#include <cstdatomic>
+#include <cstdbool>
+#include <cstdint>
+#include <ctgmath>
+#include <cwchar>
+#include <cwctype>
+#endif
+
+// C++
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <array>
+#include <chrono>
+#include <condition_variable>
+#include <forward_list>
+#include <mutex>
+#include <random>
+#include <ratio>
+#include <regex>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/precompiled/stdtr1c++.h b/gcc-4.4.0/libstdc++-v3/include/precompiled/stdtr1c++.h
new file mode 100644
index 000000000..8ed9cb667
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/precompiled/stdtr1c++.h
@@ -0,0 +1,53 @@
+// C++ includes used for precompiling TR1 -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdtr1c++.h
+ * This is an implementation file for a precompiled header.
+ */
+
+#include <bits/stdc++.h>
+
+#include <tr1/array>
+#include <tr1/cctype>
+#include <tr1/cfenv>
+#include <tr1/cfloat>
+#include <tr1/cinttypes>
+#include <tr1/climits>
+#include <tr1/cmath>
+#include <tr1/complex>
+#include <tr1/cstdarg>
+#include <tr1/cstdbool>
+#include <tr1/cstdint>
+#include <tr1/cstdio>
+#include <tr1/cstdlib>
+#include <tr1/ctgmath>
+#include <tr1/ctime>
+#include <tr1/cwchar>
+#include <tr1/cwctype>
+#include <tr1/functional>
+#include <tr1/random>
+#include <tr1/tuple>
+#include <tr1/unordered_map>
+#include <tr1/unordered_set>
+#include <tr1/utility>
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/algorithm b/gcc-4.4.0/libstdc++-v3/include/std/algorithm
new file mode 100644
index 000000000..cb8488c53
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/algorithm
@@ -0,0 +1,68 @@
+// <algorithm> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/algorithm
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_ALGORITHM
+#define _GLIBCXX_ALGORITHM 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h>
+
+#ifdef _GLIBCXX_PARALLEL
+# include <parallel/algorithm>
+#endif
+
+#endif /* _GLIBCXX_ALGORITHM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/array b/gcc-4.4.0/libstdc++-v3/include/std/array
new file mode 100644
index 000000000..70e775644
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/array
@@ -0,0 +1,60 @@
+// <array> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/array
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_ARRAY
+#define _GLIBCXX_ARRAY 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <bits/stl_algobase.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/array>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/array>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_ARRAY
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/bitset b/gcc-4.4.0/libstdc++-v3/include/std/bitset
new file mode 100644
index 000000000..5ca442989
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/bitset
@@ -0,0 +1,1396 @@
+// <bitset> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/bitset
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_BITSET
+#define _GLIBCXX_BITSET 1
+
+#pragma GCC system_header
+
+#include <cstddef> // For size_t
+#include <string>
+#include <bits/functexcept.h> // For invalid_argument, out_of_range,
+ // overflow_error
+#include <iosfwd>
+#include <cxxabi-forced.h>
+
+#define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * sizeof(unsigned long))
+#define _GLIBCXX_BITSET_WORDS(__n) \
+ ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1) \
+ / _GLIBCXX_BITSET_BITS_PER_WORD)
+
+_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
+
+ /**
+ * Base class, general case. It is a class invariant that _Nw will be
+ * nonnegative.
+ *
+ * See documentation for bitset.
+ */
+ template<size_t _Nw>
+ struct _Base_bitset
+ {
+ typedef unsigned long _WordT;
+
+ /// 0 is the least significant word.
+ _WordT _M_w[_Nw];
+
+ _Base_bitset()
+ { _M_do_reset(); }
+
+ _Base_bitset(unsigned long __val)
+ {
+ _M_do_reset();
+ _M_w[0] = __val;
+ }
+
+ static size_t
+ _S_whichword(size_t __pos )
+ { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+ static size_t
+ _S_whichbyte(size_t __pos )
+ { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
+
+ static size_t
+ _S_whichbit(size_t __pos )
+ { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+ static _WordT
+ _S_maskbit(size_t __pos )
+ { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
+
+ _WordT&
+ _M_getword(size_t __pos)
+ { return _M_w[_S_whichword(__pos)]; }
+
+ _WordT
+ _M_getword(size_t __pos) const
+ { return _M_w[_S_whichword(__pos)]; }
+
+ _WordT&
+ _M_hiword()
+ { return _M_w[_Nw - 1]; }
+
+ _WordT
+ _M_hiword() const
+ { return _M_w[_Nw - 1]; }
+
+ void
+ _M_do_and(const _Base_bitset<_Nw>& __x)
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ _M_w[__i] &= __x._M_w[__i];
+ }
+
+ void
+ _M_do_or(const _Base_bitset<_Nw>& __x)
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ _M_w[__i] |= __x._M_w[__i];
+ }
+
+ void
+ _M_do_xor(const _Base_bitset<_Nw>& __x)
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ _M_w[__i] ^= __x._M_w[__i];
+ }
+
+ void
+ _M_do_left_shift(size_t __shift);
+
+ void
+ _M_do_right_shift(size_t __shift);
+
+ void
+ _M_do_flip()
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ _M_w[__i] = ~_M_w[__i];
+ }
+
+ void
+ _M_do_set()
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ _M_w[__i] = ~static_cast<_WordT>(0);
+ }
+
+ void
+ _M_do_reset()
+ { __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); }
+
+ bool
+ _M_is_equal(const _Base_bitset<_Nw>& __x) const
+ {
+ for (size_t __i = 0; __i < _Nw; ++__i)
+ if (_M_w[__i] != __x._M_w[__i])
+ return false;
+ return true;
+ }
+
+ size_t
+ _M_are_all_aux() const
+ {
+ for (size_t __i = 0; __i < _Nw - 1; __i++)
+ if (_M_w[__i] != ~static_cast<_WordT>(0))
+ return 0;
+ return ((_Nw - 1) * _GLIBCXX_BITSET_BITS_PER_WORD
+ + __builtin_popcountl(_M_hiword()));
+ }
+
+ bool
+ _M_is_any() const
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ if (_M_w[__i] != static_cast<_WordT>(0))
+ return true;
+ return false;
+ }
+
+ size_t
+ _M_do_count() const
+ {
+ size_t __result = 0;
+ for (size_t __i = 0; __i < _Nw; __i++)
+ __result += __builtin_popcountl(_M_w[__i]);
+ return __result;
+ }
+
+ unsigned long
+ _M_do_to_ulong() const;
+
+ // find first "on" bit
+ size_t
+ _M_do_find_first(size_t __not_found) const;
+
+ // find the next "on" bit that follows "prev"
+ size_t
+ _M_do_find_next(size_t __prev, size_t __not_found) const;
+ };
+
+ // Definitions of non-inline functions from _Base_bitset.
+ template<size_t _Nw>
+ void
+ _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift)
+ {
+ if (__builtin_expect(__shift != 0, 1))
+ {
+ const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD;
+ const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD;
+
+ if (__offset == 0)
+ for (size_t __n = _Nw - 1; __n >= __wshift; --__n)
+ _M_w[__n] = _M_w[__n - __wshift];
+ else
+ {
+ const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD
+ - __offset);
+ for (size_t __n = _Nw - 1; __n > __wshift; --__n)
+ _M_w[__n] = ((_M_w[__n - __wshift] << __offset)
+ | (_M_w[__n - __wshift - 1] >> __sub_offset));
+ _M_w[__wshift] = _M_w[0] << __offset;
+ }
+
+ std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0));
+ }
+ }
+
+ template<size_t _Nw>
+ void
+ _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift)
+ {
+ if (__builtin_expect(__shift != 0, 1))
+ {
+ const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD;
+ const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD;
+ const size_t __limit = _Nw - __wshift - 1;
+
+ if (__offset == 0)
+ for (size_t __n = 0; __n <= __limit; ++__n)
+ _M_w[__n] = _M_w[__n + __wshift];
+ else
+ {
+ const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD
+ - __offset);
+ for (size_t __n = 0; __n < __limit; ++__n)
+ _M_w[__n] = ((_M_w[__n + __wshift] >> __offset)
+ | (_M_w[__n + __wshift + 1] << __sub_offset));
+ _M_w[__limit] = _M_w[_Nw-1] >> __offset;
+ }
+
+ std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0));
+ }
+ }
+
+ template<size_t _Nw>
+ unsigned long
+ _Base_bitset<_Nw>::_M_do_to_ulong() const
+ {
+ for (size_t __i = 1; __i < _Nw; ++__i)
+ if (_M_w[__i])
+ __throw_overflow_error(__N("_Base_bitset::_M_do_to_ulong"));
+ return _M_w[0];
+ }
+
+ template<size_t _Nw>
+ size_t
+ _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const
+ {
+ for (size_t __i = 0; __i < _Nw; __i++)
+ {
+ _WordT __thisword = _M_w[__i];
+ if (__thisword != static_cast<_WordT>(0))
+ return (__i * _GLIBCXX_BITSET_BITS_PER_WORD
+ + __builtin_ctzl(__thisword));
+ }
+ // not found, so return an indication of failure.
+ return __not_found;
+ }
+
+ template<size_t _Nw>
+ size_t
+ _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const
+ {
+ // make bound inclusive
+ ++__prev;
+
+ // check out of bounds
+ if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD)
+ return __not_found;
+
+ // search first word
+ size_t __i = _S_whichword(__prev);
+ _WordT __thisword = _M_w[__i];
+
+ // mask off bits below bound
+ __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
+
+ if (__thisword != static_cast<_WordT>(0))
+ return (__i * _GLIBCXX_BITSET_BITS_PER_WORD
+ + __builtin_ctzl(__thisword));
+
+ // check subsequent words
+ __i++;
+ for (; __i < _Nw; __i++)
+ {
+ __thisword = _M_w[__i];
+ if (__thisword != static_cast<_WordT>(0))
+ return (__i * _GLIBCXX_BITSET_BITS_PER_WORD
+ + __builtin_ctzl(__thisword));
+ }
+ // not found, so return an indication of failure.
+ return __not_found;
+ } // end _M_do_find_next
+
+ /**
+ * Base class, specialization for a single word.
+ *
+ * See documentation for bitset.
+ */
+ template<>
+ struct _Base_bitset<1>
+ {
+ typedef unsigned long _WordT;
+ _WordT _M_w;
+
+ _Base_bitset(void)
+ : _M_w(0)
+ { }
+
+ _Base_bitset(unsigned long __val)
+ : _M_w(__val)
+ { }
+
+ static size_t
+ _S_whichword(size_t __pos )
+ { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+ static size_t
+ _S_whichbyte(size_t __pos )
+ { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
+
+ static size_t
+ _S_whichbit(size_t __pos )
+ { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+ static _WordT
+ _S_maskbit(size_t __pos )
+ { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
+
+ _WordT&
+ _M_getword(size_t)
+ { return _M_w; }
+
+ _WordT
+ _M_getword(size_t) const
+ { return _M_w; }
+
+ _WordT&
+ _M_hiword()
+ { return _M_w; }
+
+ _WordT
+ _M_hiword() const
+ { return _M_w; }
+
+ void
+ _M_do_and(const _Base_bitset<1>& __x)
+ { _M_w &= __x._M_w; }
+
+ void
+ _M_do_or(const _Base_bitset<1>& __x)
+ { _M_w |= __x._M_w; }
+
+ void
+ _M_do_xor(const _Base_bitset<1>& __x)
+ { _M_w ^= __x._M_w; }
+
+ void
+ _M_do_left_shift(size_t __shift)
+ { _M_w <<= __shift; }
+
+ void
+ _M_do_right_shift(size_t __shift)
+ { _M_w >>= __shift; }
+
+ void
+ _M_do_flip()
+ { _M_w = ~_M_w; }
+
+ void
+ _M_do_set()
+ { _M_w = ~static_cast<_WordT>(0); }
+
+ void
+ _M_do_reset()
+ { _M_w = 0; }
+
+ bool
+ _M_is_equal(const _Base_bitset<1>& __x) const
+ { return _M_w == __x._M_w; }
+
+ size_t
+ _M_are_all_aux() const
+ { return __builtin_popcountl(_M_w); }
+
+ bool
+ _M_is_any() const
+ { return _M_w != 0; }
+
+ size_t
+ _M_do_count() const
+ { return __builtin_popcountl(_M_w); }
+
+ unsigned long
+ _M_do_to_ulong() const
+ { return _M_w; }
+
+ size_t
+ _M_do_find_first(size_t __not_found) const
+ {
+ if (_M_w != 0)
+ return __builtin_ctzl(_M_w);
+ else
+ return __not_found;
+ }
+
+ // find the next "on" bit that follows "prev"
+ size_t
+ _M_do_find_next(size_t __prev, size_t __not_found) const
+ {
+ ++__prev;
+ if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD))
+ return __not_found;
+
+ _WordT __x = _M_w >> __prev;
+ if (__x != 0)
+ return __builtin_ctzl(__x) + __prev;
+ else
+ return __not_found;
+ }
+ };
+
+ /**
+ * Base class, specialization for no storage (zero-length %bitset).
+ *
+ * See documentation for bitset.
+ */
+ template<>
+ struct _Base_bitset<0>
+ {
+ typedef unsigned long _WordT;
+
+ _Base_bitset()
+ { }
+
+ _Base_bitset(unsigned long)
+ { }
+
+ static size_t
+ _S_whichword(size_t __pos )
+ { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+ static size_t
+ _S_whichbyte(size_t __pos )
+ { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
+
+ static size_t
+ _S_whichbit(size_t __pos )
+ { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
+
+ static _WordT
+ _S_maskbit(size_t __pos )
+ { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
+
+ // This would normally give access to the data. The bounds-checking
+ // in the bitset class will prevent the user from getting this far,
+ // but (1) it must still return an lvalue to compile, and (2) the
+ // user might call _Unchecked_set directly, in which case this /needs/
+ // to fail. Let's not penalize zero-length users unless they actually
+ // make an unchecked call; all the memory ugliness is therefore
+ // localized to this single should-never-get-this-far function.
+ _WordT&
+ _M_getword(size_t) const
+ {
+ __throw_out_of_range(__N("_Base_bitset::_M_getword"));
+ return *new _WordT;
+ }
+
+ _WordT
+ _M_hiword() const
+ { return 0; }
+
+ void
+ _M_do_and(const _Base_bitset<0>&)
+ { }
+
+ void
+ _M_do_or(const _Base_bitset<0>&)
+ { }
+
+ void
+ _M_do_xor(const _Base_bitset<0>&)
+ { }
+
+ void
+ _M_do_left_shift(size_t)
+ { }
+
+ void
+ _M_do_right_shift(size_t)
+ { }
+
+ void
+ _M_do_flip()
+ { }
+
+ void
+ _M_do_set()
+ { }
+
+ void
+ _M_do_reset()
+ { }
+
+ // Are all empty bitsets equal to each other? Are they equal to
+ // themselves? How to compare a thing which has no state? What is
+ // the sound of one zero-length bitset clapping?
+ bool
+ _M_is_equal(const _Base_bitset<0>&) const
+ { return true; }
+
+ size_t
+ _M_are_all_aux() const
+ { return 0; }
+
+ bool
+ _M_is_any() const
+ { return false; }
+
+ size_t
+ _M_do_count() const
+ { return 0; }
+
+ unsigned long
+ _M_do_to_ulong() const
+ { return 0; }
+
+ // Normally "not found" is the size, but that could also be
+ // misinterpreted as an index in this corner case. Oh well.
+ size_t
+ _M_do_find_first(size_t) const
+ { return 0; }
+
+ size_t
+ _M_do_find_next(size_t, size_t) const
+ { return 0; }
+ };
+
+
+ // Helper class to zero out the unused high-order bits in the highest word.
+ template<size_t _Extrabits>
+ struct _Sanitize
+ {
+ static void _S_do_sanitize(unsigned long& __val)
+ { __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); }
+ };
+
+ template<>
+ struct _Sanitize<0>
+ { static void _S_do_sanitize(unsigned long) {} };
+
+ /**
+ * @brief The %bitset class represents a @e fixed-size sequence of bits.
+ *
+ * @ingroup containers
+ *
+ * (Note that %bitset does @e not meet the formal requirements of a
+ * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.)
+ *
+ * The template argument, @a Nb, may be any non-negative number,
+ * specifying the number of bits (e.g., "0", "12", "1024*1024").
+ *
+ * In the general unoptimized case, storage is allocated in word-sized
+ * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B
+ * words will be used for storage. B - Nb%B bits are unused. (They are
+ * the high-order bits in the highest word.) It is a class invariant
+ * that those unused bits are always zero.
+ *
+ * If you think of %bitset as "a simple array of bits," be aware that
+ * your mental picture is reversed: a %bitset behaves the same way as
+ * bits in integers do, with the bit at index 0 in the "least significant
+ * / right-hand" position, and the bit at index Nb-1 in the "most
+ * significant / left-hand" position. Thus, unlike other containers, a
+ * %bitset's index "counts from right to left," to put it very loosely.
+ *
+ * This behavior is preserved when translating to and from strings. For
+ * example, the first line of the following program probably prints
+ * "b('a') is 0001100001" on a modern ASCII system.
+ *
+ * @code
+ * #include <bitset>
+ * #include <iostream>
+ * #include <sstream>
+ *
+ * using namespace std;
+ *
+ * int main()
+ * {
+ * long a = 'a';
+ * bitset<10> b(a);
+ *
+ * cout << "b('a') is " << b << endl;
+ *
+ * ostringstream s;
+ * s << b;
+ * string str = s.str();
+ * cout << "index 3 in the string is " << str[3] << " but\n"
+ * << "index 3 in the bitset is " << b[3] << endl;
+ * }
+ * @endcode
+ *
+ * Also see:
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch33s02.html
+ * for a description of extensions.
+ *
+ * Most of the actual code isn't contained in %bitset<> itself, but in the
+ * base class _Base_bitset. The base class works with whole words, not with
+ * individual bits. This allows us to specialize _Base_bitset for the
+ * important special case where the %bitset is only a single word.
+ *
+ * Extra confusion can result due to the fact that the storage for
+ * _Base_bitset @e is a regular array, and is indexed as such. This is
+ * carefully encapsulated.
+ */
+ template<size_t _Nb>
+ class bitset
+ : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)>
+ {
+ private:
+ typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base;
+ typedef unsigned long _WordT;
+
+ void
+ _M_do_sanitize()
+ {
+ _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>::
+ _S_do_sanitize(this->_M_hiword());
+ }
+
+ public:
+ /**
+ * This encapsulates the concept of a single bit. An instance of this
+ * class is a proxy for an actual bit; this way the individual bit
+ * operations are done as faster word-size bitwise instructions.
+ *
+ * Most users will never need to use this class directly; conversions
+ * to and from bool are automatic and should be transparent. Overloaded
+ * operators help to preserve the illusion.
+ *
+ * (On a typical system, this "bit %reference" is 64 times the size of
+ * an actual bit. Ha.)
+ */
+ class reference
+ {
+ friend class bitset;
+
+ _WordT *_M_wp;
+ size_t _M_bpos;
+
+ // left undefined
+ reference();
+
+ public:
+ reference(bitset& __b, size_t __pos)
+ {
+ _M_wp = &__b._M_getword(__pos);
+ _M_bpos = _Base::_S_whichbit(__pos);
+ }
+
+ ~reference()
+ { }
+
+ // For b[i] = __x;
+ reference&
+ operator=(bool __x)
+ {
+ if (__x)
+ *_M_wp |= _Base::_S_maskbit(_M_bpos);
+ else
+ *_M_wp &= ~_Base::_S_maskbit(_M_bpos);
+ return *this;
+ }
+
+ // For b[i] = b[__j];
+ reference&
+ operator=(const reference& __j)
+ {
+ if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)))
+ *_M_wp |= _Base::_S_maskbit(_M_bpos);
+ else
+ *_M_wp &= ~_Base::_S_maskbit(_M_bpos);
+ return *this;
+ }
+
+ // Flips the bit
+ bool
+ operator~() const
+ { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; }
+
+ // For __x = b[i];
+ operator bool() const
+ { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; }
+
+ // For b[i].flip();
+ reference&
+ flip()
+ {
+ *_M_wp ^= _Base::_S_maskbit(_M_bpos);
+ return *this;
+ }
+ };
+ friend class reference;
+
+ // 23.3.5.1 constructors:
+ /// All bits set to zero.
+ bitset()
+ { }
+
+ /// Initial bits bitwise-copied from a single word (others set to zero).
+ bitset(unsigned long __val)
+ : _Base(__val)
+ { _M_do_sanitize(); }
+
+ /**
+ * @brief Use a subset of a string.
+ * @param s A string of '0' and '1' characters.
+ * @param position Index of the first character in @a s to use;
+ * defaults to zero.
+ * @throw std::out_of_range If @a pos is bigger the size of @a s.
+ * @throw std::invalid_argument If a character appears in the string
+ * which is neither '0' nor '1'.
+ */
+ template<class _CharT, class _Traits, class _Alloc>
+ explicit
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __position = 0)
+ : _Base()
+ {
+ if (__position > __s.size())
+ __throw_out_of_range(__N("bitset::bitset initial position "
+ "not valid"));
+ _M_copy_from_string(__s, __position,
+ std::basic_string<_CharT, _Traits, _Alloc>::npos,
+ _CharT('0'), _CharT('1'));
+ }
+
+ /**
+ * @brief Use a subset of a string.
+ * @param s A string of '0' and '1' characters.
+ * @param position Index of the first character in @a s to use.
+ * @param n The number of characters to copy.
+ * @throw std::out_of_range If @a pos is bigger the size of @a s.
+ * @throw std::invalid_argument If a character appears in the string
+ * which is neither '0' nor '1'.
+ */
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __position, size_t __n)
+ : _Base()
+ {
+ if (__position > __s.size())
+ __throw_out_of_range(__N("bitset::bitset initial position "
+ "not valid"));
+ _M_copy_from_string(__s, __position, __n, _CharT('0'), _CharT('1'));
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits, class _Alloc>
+ bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __position, size_t __n,
+ _CharT __zero, _CharT __one = _CharT('1'))
+ : _Base()
+ {
+ if (__position > __s.size())
+ __throw_out_of_range(__N("bitset::bitset initial position "
+ "not valid"));
+ _M_copy_from_string(__s, __position, __n, __zero, __one);
+ }
+
+ // 23.3.5.2 bitset operations:
+ //@{
+ /**
+ * @brief Operations on bitsets.
+ * @param rhs A same-sized bitset.
+ *
+ * These should be self-explanatory.
+ */
+ bitset<_Nb>&
+ operator&=(const bitset<_Nb>& __rhs)
+ {
+ this->_M_do_and(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator|=(const bitset<_Nb>& __rhs)
+ {
+ this->_M_do_or(__rhs);
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator^=(const bitset<_Nb>& __rhs)
+ {
+ this->_M_do_xor(__rhs);
+ return *this;
+ }
+ //@}
+
+ //@{
+ /**
+ * @brief Operations on bitsets.
+ * @param position The number of places to shift.
+ *
+ * These should be self-explanatory.
+ */
+ bitset<_Nb>&
+ operator<<=(size_t __position)
+ {
+ if (__builtin_expect(__position < _Nb, 1))
+ {
+ this->_M_do_left_shift(__position);
+ this->_M_do_sanitize();
+ }
+ else
+ this->_M_do_reset();
+ return *this;
+ }
+
+ bitset<_Nb>&
+ operator>>=(size_t __position)
+ {
+ if (__builtin_expect(__position < _Nb, 1))
+ {
+ this->_M_do_right_shift(__position);
+ this->_M_do_sanitize();
+ }
+ else
+ this->_M_do_reset();
+ return *this;
+ }
+ //@}
+
+ //@{
+ /**
+ * These versions of single-bit set, reset, flip, and test are
+ * extensions from the SGI version. They do no range checking.
+ * @ingroup SGIextensions
+ */
+ bitset<_Nb>&
+ _Unchecked_set(size_t __pos)
+ {
+ this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>&
+ _Unchecked_set(size_t __pos, int __val)
+ {
+ if (__val)
+ this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
+ else
+ this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>&
+ _Unchecked_reset(size_t __pos)
+ {
+ this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);
+ return *this;
+ }
+
+ bitset<_Nb>&
+ _Unchecked_flip(size_t __pos)
+ {
+ this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos);
+ return *this;
+ }
+
+ bool
+ _Unchecked_test(size_t __pos) const
+ { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos))
+ != static_cast<_WordT>(0)); }
+ //@}
+
+ // Set, reset, and flip.
+ /**
+ * @brief Sets every bit to true.
+ */
+ bitset<_Nb>&
+ set()
+ {
+ this->_M_do_set();
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ /**
+ * @brief Sets a given bit to a particular value.
+ * @param position The index of the bit.
+ * @param val Either true or false, defaults to true.
+ * @throw std::out_of_range If @a pos is bigger the size of the %set.
+ */
+ bitset<_Nb>&
+ set(size_t __position, bool __val = true)
+ {
+ if (__position >= _Nb)
+ __throw_out_of_range(__N("bitset::set"));
+ return _Unchecked_set(__position, __val);
+ }
+
+ /**
+ * @brief Sets every bit to false.
+ */
+ bitset<_Nb>&
+ reset()
+ {
+ this->_M_do_reset();
+ return *this;
+ }
+
+ /**
+ * @brief Sets a given bit to false.
+ * @param position The index of the bit.
+ * @throw std::out_of_range If @a pos is bigger the size of the %set.
+ *
+ * Same as writing @c set(pos,false).
+ */
+ bitset<_Nb>&
+ reset(size_t __position)
+ {
+ if (__position >= _Nb)
+ __throw_out_of_range(__N("bitset::reset"));
+ return _Unchecked_reset(__position);
+ }
+
+ /**
+ * @brief Toggles every bit to its opposite value.
+ */
+ bitset<_Nb>&
+ flip()
+ {
+ this->_M_do_flip();
+ this->_M_do_sanitize();
+ return *this;
+ }
+
+ /**
+ * @brief Toggles a given bit to its opposite value.
+ * @param position The index of the bit.
+ * @throw std::out_of_range If @a pos is bigger the size of the %set.
+ */
+ bitset<_Nb>&
+ flip(size_t __position)
+ {
+ if (__position >= _Nb)
+ __throw_out_of_range(__N("bitset::flip"));
+ return _Unchecked_flip(__position);
+ }
+
+ /// See the no-argument flip().
+ bitset<_Nb>
+ operator~() const
+ { return bitset<_Nb>(*this).flip(); }
+
+ //@{
+ /**
+ * @brief Array-indexing support.
+ * @param position Index into the %bitset.
+ * @return A bool for a 'const %bitset'. For non-const bitsets, an
+ * instance of the reference proxy class.
+ * @note These operators do no range checking and throw no exceptions,
+ * as required by DR 11 to the standard.
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS Note that this implementation already
+ * resolves DR 11 (items 1 and 2), but does not do the range-checking
+ * required by that DR's resolution. -pme
+ * The DR has since been changed: range-checking is a precondition
+ * (users' responsibility), and these functions must not throw. -pme
+ */
+ reference
+ operator[](size_t __position)
+ { return reference(*this,__position); }
+
+ bool
+ operator[](size_t __position) const
+ { return _Unchecked_test(__position); }
+ //@}
+
+ /**
+ * @brief Returns a numerical interpretation of the %bitset.
+ * @return The integral equivalent of the bits.
+ * @throw std::overflow_error If there are too many bits to be
+ * represented in an @c unsigned @c long.
+ */
+ unsigned long
+ to_ulong() const
+ { return this->_M_do_to_ulong(); }
+
+ /**
+ * @brief Returns a character interpretation of the %bitset.
+ * @return The string equivalent of the bits.
+ *
+ * Note the ordering of the bits: decreasing character positions
+ * correspond to increasing bit positions (see the main class notes for
+ * an example).
+ */
+ template<class _CharT, class _Traits, class _Alloc>
+ std::basic_string<_CharT, _Traits, _Alloc>
+ to_string() const
+ {
+ std::basic_string<_CharT, _Traits, _Alloc> __result;
+ _M_copy_to_string(__result, _CharT('0'), _CharT('1'));
+ return __result;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ template<class _CharT, class _Traits, class _Alloc>
+ std::basic_string<_CharT, _Traits, _Alloc>
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ {
+ std::basic_string<_CharT, _Traits, _Alloc> __result;
+ _M_copy_to_string(__result, __zero, __one);
+ return __result;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 434. bitset::to_string() hard to use.
+ template<class _CharT, class _Traits>
+ std::basic_string<_CharT, _Traits, std::allocator<_CharT> >
+ to_string() const
+ { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 853. to_string needs updating with zero and one.
+ template<class _CharT, class _Traits>
+ std::basic_string<_CharT, _Traits, std::allocator<_CharT> >
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ { return to_string<_CharT, _Traits,
+ std::allocator<_CharT> >(__zero, __one); }
+
+ template<class _CharT>
+ std::basic_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >
+ to_string() const
+ {
+ return to_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >();
+ }
+
+ template<class _CharT>
+ std::basic_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >
+ to_string(_CharT __zero, _CharT __one = _CharT('1')) const
+ {
+ return to_string<_CharT, std::char_traits<_CharT>,
+ std::allocator<_CharT> >(__zero, __one);
+ }
+
+ std::basic_string<char, std::char_traits<char>, std::allocator<char> >
+ to_string() const
+ {
+ return to_string<char, std::char_traits<char>,
+ std::allocator<char> >();
+ }
+
+ std::basic_string<char, std::char_traits<char>, std::allocator<char> >
+ to_string(char __zero, char __one = '1') const
+ {
+ return to_string<char, std::char_traits<char>,
+ std::allocator<char> >(__zero, __one);
+ }
+
+ // Helper functions for string operations.
+ template<class _CharT, class _Traits>
+ void
+ _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t,
+ _CharT, _CharT);
+
+ template<class _CharT, class _Traits, class _Alloc>
+ void
+ _M_copy_from_string(const std::basic_string<_CharT,
+ _Traits, _Alloc>& __s, size_t __pos, size_t __n,
+ _CharT __zero, _CharT __one)
+ { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n,
+ __zero, __one); }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ void
+ _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&,
+ _CharT, _CharT) const;
+
+ // NB: Backward compat.
+ template<class _CharT, class _Traits, class _Alloc>
+ void
+ _M_copy_from_string(const std::basic_string<_CharT,
+ _Traits, _Alloc>& __s, size_t __pos, size_t __n)
+ { _M_copy_from_string(__s, __pos, __n, _CharT('0'), _CharT('1')); }
+
+ template<class _CharT, class _Traits, class _Alloc>
+ void
+ _M_copy_to_string(std::basic_string<_CharT, _Traits,_Alloc>& __s) const
+ { _M_copy_to_string(__s, _CharT('0'), _CharT('1')); }
+
+ /// Returns the number of bits which are set.
+ size_t
+ count() const
+ { return this->_M_do_count(); }
+
+ /// Returns the total number of bits.
+ size_t
+ size() const
+ { return _Nb; }
+
+ //@{
+ /// These comparisons for equality/inequality are, well, @e bitwise.
+ bool
+ operator==(const bitset<_Nb>& __rhs) const
+ { return this->_M_is_equal(__rhs); }
+
+ bool
+ operator!=(const bitset<_Nb>& __rhs) const
+ { return !this->_M_is_equal(__rhs); }
+ //@}
+
+ /**
+ * @brief Tests the value of a bit.
+ * @param position The index of a bit.
+ * @return The value at @a pos.
+ * @throw std::out_of_range If @a pos is bigger the size of the %set.
+ */
+ bool
+ test(size_t __position) const
+ {
+ if (__position >= _Nb)
+ __throw_out_of_range(__N("bitset::test"));
+ return _Unchecked_test(__position);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 693. std::bitset::all() missing.
+ /**
+ * @brief Tests whether all the bits are on.
+ * @return True if all the bits are set.
+ */
+ bool
+ all() const
+ { return this->_M_are_all_aux() == _Nb; }
+
+ /**
+ * @brief Tests whether any of the bits are on.
+ * @return True if at least one bit is set.
+ */
+ bool
+ any() const
+ { return this->_M_is_any(); }
+
+ /**
+ * @brief Tests whether any of the bits are on.
+ * @return True if none of the bits are set.
+ */
+ bool
+ none() const
+ { return !this->_M_is_any(); }
+
+ //@{
+ /// Self-explanatory.
+ bitset<_Nb>
+ operator<<(size_t __position) const
+ { return bitset<_Nb>(*this) <<= __position; }
+
+ bitset<_Nb>
+ operator>>(size_t __position) const
+ { return bitset<_Nb>(*this) >>= __position; }
+ //@}
+
+ /**
+ * @brief Finds the index of the first "on" bit.
+ * @return The index of the first bit set, or size() if not found.
+ * @ingroup SGIextensions
+ * @sa _Find_next
+ */
+ size_t
+ _Find_first() const
+ { return this->_M_do_find_first(_Nb); }
+
+ /**
+ * @brief Finds the index of the next "on" bit after prev.
+ * @return The index of the next bit set, or size() if not found.
+ * @param prev Where to start searching.
+ * @ingroup SGIextensions
+ * @sa _Find_first
+ */
+ size_t
+ _Find_next(size_t __prev ) const
+ { return this->_M_do_find_next(__prev, _Nb); }
+ };
+
+ // Definitions of non-inline member functions.
+ template<size_t _Nb>
+ template<class _CharT, class _Traits>
+ void
+ bitset<_Nb>::
+ _M_copy_from_ptr(const _CharT* __s, size_t __len,
+ size_t __pos, size_t __n, _CharT __zero, _CharT __one)
+ {
+ reset();
+ const size_t __nbits = std::min(_Nb, std::min(__n, __len - __pos));
+ for (size_t __i = __nbits; __i > 0; --__i)
+ {
+ const _CharT __c = __s[__pos + __nbits - __i];
+ if (_Traits::eq(__c, __zero))
+ ;
+ else if (_Traits::eq(__c, __one))
+ _Unchecked_set(__i - 1);
+ else
+ __throw_invalid_argument(__N("bitset::_M_copy_from_ptr"));
+ }
+ }
+
+ template<size_t _Nb>
+ template<class _CharT, class _Traits, class _Alloc>
+ void
+ bitset<_Nb>::
+ _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s,
+ _CharT __zero, _CharT __one) const
+ {
+ __s.assign(_Nb, __zero);
+ for (size_t __i = _Nb; __i > 0; --__i)
+ if (_Unchecked_test(__i - 1))
+ _Traits::assign(__s[_Nb - __i], __one);
+ }
+
+ // 23.3.5.3 bitset operations:
+ //@{
+ /**
+ * @brief Global bitwise operations on bitsets.
+ * @param x A bitset.
+ * @param y A bitset of the same size as @a x.
+ * @return A new bitset.
+ *
+ * These should be self-explanatory.
+ */
+ template<size_t _Nb>
+ inline bitset<_Nb>
+ operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ {
+ bitset<_Nb> __result(__x);
+ __result &= __y;
+ return __result;
+ }
+
+ template<size_t _Nb>
+ inline bitset<_Nb>
+ operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ {
+ bitset<_Nb> __result(__x);
+ __result |= __y;
+ return __result;
+ }
+
+ template <size_t _Nb>
+ inline bitset<_Nb>
+ operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ {
+ bitset<_Nb> __result(__x);
+ __result ^= __y;
+ return __result;
+ }
+ //@}
+
+ //@{
+ /**
+ * @brief Global I/O operators for bitsets.
+ *
+ * Direct I/O between streams and bitsets is supported. Output is
+ * straightforward. Input will skip whitespace, only accept '0' and '1'
+ * characters, and will only extract as many digits as the %bitset will
+ * hold.
+ */
+ template<class _CharT, class _Traits, size_t _Nb>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
+ {
+ typedef typename _Traits::char_type char_type;
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ std::basic_string<_CharT, _Traits> __tmp;
+ __tmp.reserve(_Nb);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 303. Bitset input operator underspecified
+ const char_type __zero = __is.widen('0');
+ const char_type __one = __is.widen('1');
+
+ typename __ios_base::iostate __state = __ios_base::goodbit;
+ typename __istream_type::sentry __sentry(__is);
+ if (__sentry)
+ {
+ __try
+ {
+ for (size_t __i = _Nb; __i > 0; --__i)
+ {
+ static typename _Traits::int_type __eof = _Traits::eof();
+
+ typename _Traits::int_type __c1 = __is.rdbuf()->sbumpc();
+ if (_Traits::eq_int_type(__c1, __eof))
+ {
+ __state |= __ios_base::eofbit;
+ break;
+ }
+ else
+ {
+ const char_type __c2 = _Traits::to_char_type(__c1);
+ if (_Traits::eq(__c2, __zero))
+ __tmp.push_back(__zero);
+ else if (_Traits::eq(__c2, __one))
+ __tmp.push_back(__one);
+ else if (_Traits::
+ eq_int_type(__is.rdbuf()->sputbackc(__c2),
+ __eof))
+ {
+ __state |= __ios_base::failbit;
+ break;
+ }
+ }
+ }
+ }
+ __catch(__cxxabiv1::__forced_unwind&)
+ {
+ __is._M_setstate(__ios_base::badbit);
+ __throw_exception_again;
+ }
+ __catch(...)
+ { __is._M_setstate(__ios_base::badbit); }
+ }
+
+ if (__tmp.empty() && _Nb)
+ __state |= __ios_base::failbit;
+ else
+ __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb,
+ __zero, __one);
+ if (__state)
+ __is.setstate(__state);
+ return __is;
+ }
+
+ template <class _CharT, class _Traits, size_t _Nb>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bitset<_Nb>& __x)
+ {
+ std::basic_string<_CharT, _Traits> __tmp;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 396. what are characters zero and one.
+ const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__os.getloc());
+ __x._M_copy_to_string(__tmp, __ct.widen('0'), __ct.widen('1'));
+ return __os << __tmp;
+ }
+ //@}
+
+_GLIBCXX_END_NESTED_NAMESPACE
+
+#undef _GLIBCXX_BITSET_WORDS
+#undef _GLIBCXX_BITSET_BITS_PER_WORD
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/bitset>
+#endif
+
+#endif /* _GLIBCXX_BITSET */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/c++0x_warning.h b/gcc-4.4.0/libstdc++-v3/include/std/c++0x_warning.h
new file mode 100644
index 000000000..b74f3396c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/c++0x_warning.h
@@ -0,0 +1,36 @@
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/c++0x_warning.h
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _CXX0X_WARNING_H
+#define _CXX0X_WARNING_H 1
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#error This file requires compiler and library support for the upcoming \
+ISO C++ standard, C++0x. This support is currently experimental, and must be \
+enabled with the -std=c++0x or -std=gnu++0x compiler options.
+#endif
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/chrono b/gcc-4.4.0/libstdc++-v3/include/std/chrono
new file mode 100644
index 000000000..aaa9646f2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/chrono
@@ -0,0 +1,672 @@
+// <chrono> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/chrono
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CHRONO
+#define _GLIBCXX_CHRONO 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#ifdef _GLIBCXX_INCLUDE_AS_TR1
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <ratio>
+#include <type_traits>
+#include <limits>
+#include <ctime>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std
+{
+ /**
+ * @defgroup chrono Time
+ * @ingroup utilities
+ *
+ * Classes and functions for time.
+ * @{
+ */
+
+ /** @namespace std::chrono
+ * @brief ISO C++ 0x entities sub namespace for time and date.
+ */
+ namespace chrono
+ {
+ template<typename _Rep, typename _Period = ratio<1>>
+ struct duration;
+
+ template<typename _Clock, typename _Duration = typename _Clock::duration>
+ struct time_point;
+ }
+
+ // 20.8.2.3 specialization of common_type (for duration)
+ template<typename _Rep1, typename _Period1, typename _Rep2, typename _Period2>
+ struct common_type<chrono::duration<_Rep1, _Period1>,
+ chrono::duration<_Rep2, _Period2>>
+ {
+ typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
+ ratio<__static_gcd<_Period1::num, _Period2::num>::value,
+ (_Period1::den / __static_gcd<_Period1::den, _Period2::den>::value)
+ * _Period2::den>> type;
+ };
+
+ // 20.8.2.3 specialization of common_type (for time_point)
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ struct common_type<chrono::time_point<_Clock, _Duration1>,
+ chrono::time_point<_Clock, _Duration2>>
+ {
+ typedef chrono::time_point<_Clock,
+ typename common_type<_Duration1, _Duration2>::type> type;
+ };
+
+ namespace chrono
+ {
+ // Primary template for duration_cast impl.
+ template<typename _ToDuration, typename _CF, typename _CR,
+ bool _NumIsOne = false, bool _DenIsOne = false>
+ struct __duration_cast_impl
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(static_cast<
+ typename _ToDuration::rep>(static_cast<_CR>(__d.count())
+ * static_cast<_CR>(_CF::num)
+ / static_cast<_CR>(_CF::den)));
+ }
+ };
+
+ template<typename _ToDuration, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDuration, _CF, _CR, true, true>
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(
+ static_cast<typename _ToDuration::rep>(__d.count()));
+ }
+ };
+
+ template<typename _ToDuration, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDuration, _CF, _CR, true, false>
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den)));
+ }
+ };
+
+ template<typename _ToDuration, typename _CF, typename _CR>
+ struct __duration_cast_impl<_ToDuration, _CF, _CR, false, true>
+ {
+ template<typename _Rep, typename _Period>
+ static _ToDuration __cast(const duration<_Rep, _Period>& __d)
+ {
+ return _ToDuration(static_cast<typename _ToDuration::rep>(
+ static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num)));
+ }
+ };
+
+ /// duration_cast
+ template<typename _ToDuration, typename _Rep, typename _Period>
+ inline _ToDuration
+ duration_cast(const duration<_Rep, _Period>& __d)
+ {
+ typedef typename
+ ratio_divide<_Period, typename _ToDuration::period>::type __cf;
+ typedef typename
+ common_type<typename _ToDuration::rep, _Rep, intmax_t>::type __cr;
+
+ return __duration_cast_impl<_ToDuration, __cf, __cr,
+ __cf::num == 1, __cf::den == 1>::__cast(__d);
+ }
+
+ /// treat_as_floating_point
+ template<typename _Rep>
+ struct treat_as_floating_point
+ : is_floating_point<_Rep>
+ { };
+
+ /// duration_values
+ template<typename _Rep>
+ struct duration_values
+ {
+ static const _Rep
+ zero()
+ { return _Rep(0); }
+
+ static const _Rep
+ max()
+ { return numeric_limits<_Rep>::max(); }
+
+ static const _Rep
+ min()
+ { return numeric_limits<_Rep>::min(); }
+ };
+
+ template<typename _Tp>
+ struct __is_duration
+ : std::false_type
+ { };
+
+ template<typename _Rep, typename _Period>
+ struct __is_duration<duration<_Rep, _Period>>
+ : std::true_type
+ { };
+
+ template<typename T>
+ struct __is_ratio
+ : std::false_type
+ { };
+
+ template<intmax_t _Num, intmax_t _Den>
+ struct __is_ratio<ratio<_Num, _Den>>
+ : std::true_type
+ { };
+
+ /// duration
+ template<typename _Rep, typename _Period>
+ struct duration
+ {
+ static_assert(!__is_duration<_Rep>::value, "rep cannot be a duration");
+ static_assert(__is_ratio<_Period>::value,
+ "period must be a specialization of ratio");
+ static_assert(_Period::num > 0, "period must be positive");
+
+ typedef _Rep rep;
+ typedef _Period period;
+
+ // 20.8.3.1 construction / copy / destroy
+ duration() = default;
+
+ template<typename _Rep2>
+ explicit duration(_Rep2 const& __rep)
+ : __r(static_cast<rep>(__rep))
+ {
+ static_assert(is_convertible<_Rep2,rep>::value
+ && (treat_as_floating_point<rep>::value
+ || !treat_as_floating_point<_Rep2>::value),
+ "cannot construct integral duration with floating point type");
+ }
+
+ template<typename _Rep2, typename _Period2>
+ duration(const duration<_Rep2, _Period2>& __d)
+ : __r(duration_cast<duration>(__d).count())
+ {
+ static_assert(treat_as_floating_point<rep>::value == true
+ || ratio_divide<_Period2, period>::type::den == 1,
+ "the resulting duration is not exactly representable");
+ }
+
+ ~duration() = default;
+ duration(const duration&) = default;
+ duration& operator=(const duration&) = default;
+
+ // 20.8.3.2 observer
+ rep
+ count() const
+ { return __r; }
+
+ // 20.8.3.3 arithmetic
+ duration
+ operator+() const
+ { return *this; }
+
+ duration
+ operator-() const
+ { return duration(-__r); }
+
+ duration&
+ operator++()
+ {
+ ++__r;
+ return *this;
+ }
+
+ duration
+ operator++(int)
+ { return duration(__r++); }
+
+ duration&
+ operator--()
+ {
+ --__r;
+ return *this;
+ }
+
+ duration
+ operator--(int)
+ { return duration(__r--); }
+
+ duration&
+ operator+=(const duration& __d)
+ {
+ __r += __d.count();
+ return *this;
+ }
+
+ duration&
+ operator-=(const duration& __d)
+ {
+ __r -= __d.count();
+ return *this;
+ }
+
+ duration&
+ operator*=(const rep& __rhs)
+ {
+ __r *= __rhs;
+ return *this;
+ }
+
+ duration&
+ operator/=(const rep& __rhs)
+ {
+ __r /= __rhs;
+ return *this;
+ }
+
+ // 20.8.3.4 special values
+ // TODO: These should be constexprs.
+ static const duration
+ zero()
+ { return duration(duration_values<rep>::zero()); }
+
+ static const duration
+ min()
+ { return duration(duration_values<rep>::min()); }
+
+ static const duration
+ max()
+ { return duration(duration_values<rep>::max()); }
+
+ private:
+ rep __r;
+ };
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator+(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs) += __rhs;
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type
+ operator-(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs) -= __rhs;
+ }
+
+ template<typename _Rep1, typename _Period, typename _Rep2>
+ inline duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+ operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+ {
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ return duration<__cr, _Period>(__d) *= __s;
+ }
+
+ template<typename _Rep1, typename _Period, typename _Rep2>
+ inline duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+ operator*(const _Rep2& __s, const duration<_Rep1, _Period>& __d)
+ { return __d * __s; }
+
+ template<typename _Tp, typename _Up, typename _Ep = void>
+ struct __division_impl;
+
+ template<typename _Rep1, typename _Period, typename _Rep2>
+ struct __division_impl<duration<_Rep1, _Period>, _Rep2,
+ typename enable_if<!__is_duration<_Rep2>::value>::type>
+ {
+ typedef typename common_type<_Rep1, _Rep2>::type __cr;
+ typedef
+ duration<typename common_type<_Rep1, _Rep2>::type, _Period> __rt;
+
+ static __rt
+ __divide(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
+ { return duration<__cr, _Period>(__d) /= __s; }
+ };
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ struct __division_impl<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ typedef typename common_type<_Rep1, _Rep2>::type __rt;
+
+ static __rt
+ __divide(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return __ct(__lhs).count() / __ct(__rhs).count(); }
+ };
+
+ template<typename _Rep, typename _Period, typename _Up>
+ inline typename __division_impl<duration<_Rep, _Period>, _Up>::__rt
+ operator/(const duration<_Rep, _Period>& __d, const _Up& __u)
+ {
+ return
+ __division_impl<duration<_Rep, _Period>, _Up>::__divide(__d, __u);
+ }
+
+ // comparisons
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator==(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs).count() == __ct(__rhs).count();
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator<(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef typename common_type<duration<_Rep1, _Period1>,
+ duration<_Rep2, _Period2>>::type __ct;
+ return __ct(__lhs).count() < __ct(__rhs).count();
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator!=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator<=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return !(__rhs < __lhs); }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator>(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return __rhs < __lhs; }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Rep2, typename _Period2>
+ inline bool
+ operator>=(const duration<_Rep1, _Period1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return !(__lhs < __rhs); }
+
+ /// nanoseconds
+ typedef duration<int64_t, nano> nanoseconds;
+
+ /// microseconds
+ typedef duration<int64_t, micro> microseconds;
+
+ /// milliseconds
+ typedef duration<int64_t, milli> milliseconds;
+
+ /// seconds
+ typedef duration<int64_t > seconds;
+
+ /// minutes
+ typedef duration<int, ratio< 60>> minutes;
+
+ /// hours
+ typedef duration<int, ratio<3600>> hours;
+
+ /// time_point
+ template<typename _Clock, typename _Duration>
+ struct time_point
+ {
+ typedef _Clock clock;
+ typedef _Duration duration;
+ typedef typename duration::rep rep;
+ typedef typename duration::period period;
+
+ time_point() : __d(duration::zero())
+ { }
+
+ explicit time_point(const duration& __dur)
+ : __d(duration::zero() + __dur)
+ { }
+
+ // conversions
+ template<typename _Duration2>
+ time_point(const time_point<clock, _Duration2>& __t)
+ : __d(__t.time_since_epoch())
+ { }
+
+ // observer
+ duration
+ time_since_epoch() const
+ { return __d; }
+
+ // arithmetic
+ time_point&
+ operator+=(const duration& __dur)
+ {
+ __d += __dur;
+ return *this;
+ }
+
+ time_point&
+ operator-=(const duration& __dur)
+ {
+ __d -= __dur;
+ return *this;
+ }
+
+ // special values
+ // TODO: These should be constexprs.
+ static const time_point
+ min()
+ { return time_point(duration::min()); }
+
+ static const time_point
+ max()
+ { return time_point(duration::max()); }
+
+ private:
+ duration __d;
+ };
+
+ /// time_point_cast
+ template<typename _ToDuration, typename _Clock, typename _Duration>
+ inline time_point<_Clock, _ToDuration>
+ time_point_cast(const time_point<_Clock, _Duration>& __t)
+ {
+ return time_point<_Clock, _ToDuration>(
+ duration_cast<_ToDuration>(__t.time_since_epoch()));
+ }
+
+ template<typename _Clock, typename _Duration1,
+ typename _Rep2, typename _Period2>
+ inline time_point<_Clock,
+ typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
+ operator+(const time_point<_Clock, _Duration1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ {
+ typedef time_point<_Clock,
+ typename common_type<_Duration1,
+ duration<_Rep2, _Period2>>::type> __ct;
+ return __ct(__lhs) += __rhs;
+ }
+
+ template<typename _Rep1, typename _Period1,
+ typename _Clock, typename _Duration2>
+ inline time_point<_Clock,
+ typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+ operator+(const duration<_Rep1, _Period1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __rhs + __lhs; }
+
+ template<typename _Clock, typename _Duration1,
+ typename _Rep2, typename _Period2>
+ inline time_point<_Clock,
+ typename common_type<_Duration1, duration<_Rep2, _Period2>>::type>
+ operator-(const time_point<_Clock, _Duration1>& __lhs,
+ const duration<_Rep2, _Period2>& __rhs)
+ { return __lhs + (-__rhs); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline typename common_type<_Duration1, _Duration2>::type
+ operator-(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator==(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator!=(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return !(__lhs == __rhs); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator<(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator<=(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return !(__rhs < __lhs); }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator>(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return __rhs < __lhs; }
+
+ template<typename _Clock, typename _Duration1, typename _Duration2>
+ inline bool
+ operator>=(const time_point<_Clock, _Duration1>& __lhs,
+ const time_point<_Clock, _Duration2>& __rhs)
+ { return !(__lhs < __rhs); }
+
+ /// system_clock
+ struct system_clock
+ {
+#ifdef _GLIBCXX_USE_CLOCK_REALTIME
+ typedef chrono::nanoseconds duration;
+#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
+ typedef chrono::microseconds duration;
+#else
+ typedef chrono::seconds duration;
+#endif
+
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock, duration> time_point;
+
+ static const bool is_monotonic = false;
+
+ static time_point
+ now();
+
+ // Map to C API
+ static std::time_t
+ to_time_t(const time_point& __t)
+ {
+ return std::time_t(
+ duration_cast<chrono::seconds>(__t.time_since_epoch()).count());
+ }
+
+ static time_point
+ from_time_t(std::time_t __t)
+ {
+ return time_point_cast<system_clock::duration>(
+ chrono::time_point<system_clock, chrono::seconds>(
+ chrono::seconds(__t)));
+ }
+
+ // TODO: requires constexpr
+ /*
+ static_assert(
+ system_clock::duration::min() <
+ system_clock::duration::zero(),
+ "a clock's minimum duration cannot be less than its epoch");
+ */
+ };
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+ /// monotonic_clock
+ struct monotonic_clock
+ {
+ typedef chrono::nanoseconds duration;
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<monotonic_clock, duration> time_point;
+
+ static const bool is_monotonic = true;
+
+ static time_point
+ now();
+ };
+#else
+ typedef system_clock monotonic_clock;
+#endif
+
+ typedef system_clock high_resolution_clock;
+ } // namespace chrono
+
+ // @} group chrono
+} // namespace std
+
+#endif //_GLIBCXX_USE_C99_STDINT_TR1
+
+#endif //__GXX_EXPERIMENTAL_CXX0X__
+
+#endif //_GLIBCXX_CHRONO
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/complex b/gcc-4.4.0/libstdc++-v3/include/std/complex
new file mode 100644
index 000000000..4c0d3fbe7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/complex
@@ -0,0 +1,1587 @@
+// The template and inlines for the -*- C++ -*- complex number classes.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/complex
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 26.2 Complex Numbers
+// Note: this is not a conforming implementation.
+// Initially implemented by Ulrich Drepper <drepper@cygnus.com>
+// Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+//
+
+#ifndef _GLIBCXX_COMPLEX
+#define _GLIBCXX_COMPLEX 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+#include <cmath>
+#include <sstream>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @defgroup complex_numbers Complex Numbers
+ * @ingroup numerics
+ *
+ * Classes and functions for complex numbers.
+ * @{
+ */
+
+ // Forward declarations.
+ template<typename _Tp> class complex;
+ template<> class complex<float>;
+ template<> class complex<double>;
+ template<> class complex<long double>;
+
+ /// Return magnitude of @a z.
+ template<typename _Tp> _Tp abs(const complex<_Tp>&);
+ /// Return phase angle of @a z.
+ template<typename _Tp> _Tp arg(const complex<_Tp>&);
+ /// Return @a z magnitude squared.
+ template<typename _Tp> _Tp norm(const complex<_Tp>&);
+
+ /// Return complex conjugate of @a z.
+ template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
+ /// Return complex with magnitude @a rho and angle @a theta.
+ template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp& = 0);
+
+ // Transcendentals:
+ /// Return complex cosine of @a z.
+ template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);
+ /// Return complex hyperbolic cosine of @a z.
+ template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);
+ /// Return complex base e exponential of @a z.
+ template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);
+ /// Return complex natural logarithm of @a z.
+ template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
+ /// Return complex base 10 logarithm of @a z.
+ template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // DR 844.
+ /// Return @a x to the @a y'th power.
+ template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
+#endif
+ /// Return @a x to the @a y'th power.
+ template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
+ /// Return @a x to the @a y'th power.
+ template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&,
+ const complex<_Tp>&);
+ /// Return @a x to the @a y'th power.
+ template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);
+ /// Return complex sine of @a z.
+ template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);
+ /// Return complex hyperbolic sine of @a z.
+ template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);
+ /// Return complex square root of @a z.
+ template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);
+ /// Return complex tangent of @a z.
+ template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);
+ /// Return complex hyperbolic tangent of @a z.
+ template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);
+
+
+ // 26.2.2 Primary template class complex
+ /**
+ * Template to represent complex numbers.
+ *
+ * Specializations for float, double, and long double are part of the
+ * library. Results with any other type are not guaranteed.
+ *
+ * @param Tp Type of real and imaginary values.
+ */
+ template<typename _Tp>
+ struct complex
+ {
+ /// Value typedef.
+ typedef _Tp value_type;
+
+ /// Default constructor. First parameter is x, second parameter is y.
+ /// Unspecified parameters default to 0.
+ complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
+ : _M_real(__r), _M_imag(__i) { }
+
+ // Lets the compiler synthesize the copy constructor
+ // complex (const complex<_Tp>&);
+ /// Copy constructor.
+ template<typename _Up>
+ complex(const complex<_Up>& __z)
+ : _M_real(__z.real()), _M_imag(__z.imag()) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ _Tp real() const
+ { return _M_real; }
+
+ _Tp imag() const
+ { return _M_imag; }
+#else
+ /// Return real part of complex number.
+ _Tp& real()
+ { return _M_real; }
+
+ /// Return real part of complex number.
+ const _Tp& real() const
+ { return _M_real; }
+
+ /// Return imaginary part of complex number.
+ _Tp& imag()
+ { return _M_imag; }
+
+ /// Return imaginary part of complex number.
+ const _Tp& imag() const
+ { return _M_imag; }
+#endif
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ void real(_Tp __val)
+ { _M_real = __val; }
+
+ void imag(_Tp __val)
+ { _M_imag = __val; }
+
+ /// Assign this complex number to scalar @a t.
+ complex<_Tp>& operator=(const _Tp&);
+
+ /// Add @a t to this complex number.
+ // 26.2.5/1
+ complex<_Tp>&
+ operator+=(const _Tp& __t)
+ {
+ _M_real += __t;
+ return *this;
+ }
+
+ /// Subtract @a t from this complex number.
+ // 26.2.5/3
+ complex<_Tp>&
+ operator-=(const _Tp& __t)
+ {
+ _M_real -= __t;
+ return *this;
+ }
+
+ /// Multiply this complex number by @a t.
+ complex<_Tp>& operator*=(const _Tp&);
+ /// Divide this complex number by @a t.
+ complex<_Tp>& operator/=(const _Tp&);
+
+ // Lets the compiler synthesize the
+ // copy and assignment operator
+ // complex<_Tp>& operator= (const complex<_Tp>&);
+ /// Assign this complex number to complex @a z.
+ template<typename _Up>
+ complex<_Tp>& operator=(const complex<_Up>&);
+ /// Add @a z to this complex number.
+ template<typename _Up>
+ complex<_Tp>& operator+=(const complex<_Up>&);
+ /// Subtract @a z from this complex number.
+ template<typename _Up>
+ complex<_Tp>& operator-=(const complex<_Up>&);
+ /// Multiply this complex number by @a z.
+ template<typename _Up>
+ complex<_Tp>& operator*=(const complex<_Up>&);
+ /// Divide this complex number by @a z.
+ template<typename _Up>
+ complex<_Tp>& operator/=(const complex<_Up>&);
+
+ const complex& __rep() const
+ { return *this; }
+
+ private:
+ _Tp _M_real;
+ _Tp _M_imag;
+ };
+
+ template<typename _Tp>
+ complex<_Tp>&
+ complex<_Tp>::operator=(const _Tp& __t)
+ {
+ _M_real = __t;
+ _M_imag = _Tp();
+ return *this;
+ }
+
+ // 26.2.5/5
+ template<typename _Tp>
+ complex<_Tp>&
+ complex<_Tp>::operator*=(const _Tp& __t)
+ {
+ _M_real *= __t;
+ _M_imag *= __t;
+ return *this;
+ }
+
+ // 26.2.5/7
+ template<typename _Tp>
+ complex<_Tp>&
+ complex<_Tp>::operator/=(const _Tp& __t)
+ {
+ _M_real /= __t;
+ _M_imag /= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator=(const complex<_Up>& __z)
+ {
+ _M_real = __z.real();
+ _M_imag = __z.imag();
+ return *this;
+ }
+
+ // 26.2.5/9
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator+=(const complex<_Up>& __z)
+ {
+ _M_real += __z.real();
+ _M_imag += __z.imag();
+ return *this;
+ }
+
+ // 26.2.5/11
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator-=(const complex<_Up>& __z)
+ {
+ _M_real -= __z.real();
+ _M_imag -= __z.imag();
+ return *this;
+ }
+
+ // 26.2.5/13
+ // XXX: This is a grammar school implementation.
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator*=(const complex<_Up>& __z)
+ {
+ const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
+ _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
+ _M_real = __r;
+ return *this;
+ }
+
+ // 26.2.5/15
+ // XXX: This is a grammar school implementation.
+ template<typename _Tp>
+ template<typename _Up>
+ complex<_Tp>&
+ complex<_Tp>::operator/=(const complex<_Up>& __z)
+ {
+ const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
+ const _Tp __n = std::norm(__z);
+ _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;
+ _M_real = __r / __n;
+ return *this;
+ }
+
+ // Operators:
+ //@{
+ /// Return new complex value @a x plus @a y.
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r += __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const complex<_Tp>& __x, const _Tp& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r += __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const _Tp& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __y;
+ __r += __x;
+ return __r;
+ }
+ //@}
+
+ //@{
+ /// Return new complex value @a x minus @a y.
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r -= __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const complex<_Tp>& __x, const _Tp& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r -= __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const _Tp& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r(__x, -__y.imag());
+ __r -= __y.real();
+ return __r;
+ }
+ //@}
+
+ //@{
+ /// Return new complex value @a x times @a y.
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r *= __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator*(const complex<_Tp>& __x, const _Tp& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r *= __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator*(const _Tp& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __y;
+ __r *= __x;
+ return __r;
+ }
+ //@}
+
+ //@{
+ /// Return new complex value @a x divided by @a y.
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r /= __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator/(const complex<_Tp>& __x, const _Tp& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r /= __y;
+ return __r;
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator/(const _Tp& __x, const complex<_Tp>& __y)
+ {
+ complex<_Tp> __r = __x;
+ __r /= __y;
+ return __r;
+ }
+ //@}
+
+ /// Return @a x.
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator+(const complex<_Tp>& __x)
+ { return __x; }
+
+ /// Return complex negation of @a x.
+ template<typename _Tp>
+ inline complex<_Tp>
+ operator-(const complex<_Tp>& __x)
+ { return complex<_Tp>(-__x.real(), -__x.imag()); }
+
+ //@{
+ /// Return true if @a x is equal to @a y.
+ template<typename _Tp>
+ inline bool
+ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __x.real() == __y.real() && __x.imag() == __y.imag(); }
+
+ template<typename _Tp>
+ inline bool
+ operator==(const complex<_Tp>& __x, const _Tp& __y)
+ { return __x.real() == __y && __x.imag() == _Tp(); }
+
+ template<typename _Tp>
+ inline bool
+ operator==(const _Tp& __x, const complex<_Tp>& __y)
+ { return __x == __y.real() && _Tp() == __y.imag(); }
+ //@}
+
+ //@{
+ /// Return false if @a x is equal to @a y.
+ template<typename _Tp>
+ inline bool
+ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __x.real() != __y.real() || __x.imag() != __y.imag(); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const complex<_Tp>& __x, const _Tp& __y)
+ { return __x.real() != __y || __x.imag() != _Tp(); }
+
+ template<typename _Tp>
+ inline bool
+ operator!=(const _Tp& __x, const complex<_Tp>& __y)
+ { return __x != __y.real() || _Tp() != __y.imag(); }
+ //@}
+
+ /// Extraction operator for complex values.
+ template<typename _Tp, typename _CharT, class _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
+ {
+ _Tp __re_x, __im_x;
+ _CharT __ch;
+ __is >> __ch;
+ if (__ch == '(')
+ {
+ __is >> __re_x >> __ch;
+ if (__ch == ',')
+ {
+ __is >> __im_x >> __ch;
+ if (__ch == ')')
+ __x = complex<_Tp>(__re_x, __im_x);
+ else
+ __is.setstate(ios_base::failbit);
+ }
+ else if (__ch == ')')
+ __x = __re_x;
+ else
+ __is.setstate(ios_base::failbit);
+ }
+ else
+ {
+ __is.putback(__ch);
+ __is >> __re_x;
+ __x = __re_x;
+ }
+ return __is;
+ }
+
+ /// Insertion operator for complex values.
+ template<typename _Tp, typename _CharT, class _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
+ {
+ basic_ostringstream<_CharT, _Traits> __s;
+ __s.flags(__os.flags());
+ __s.imbue(__os.getloc());
+ __s.precision(__os.precision());
+ __s << '(' << __x.real() << ',' << __x.imag() << ')';
+ return __os << __s.str();
+ }
+
+ // Values
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ inline _Tp
+ real(const complex<_Tp>& __z)
+ { return __z.real(); }
+
+ template<typename _Tp>
+ inline _Tp
+ imag(const complex<_Tp>& __z)
+ { return __z.imag(); }
+#else
+ template<typename _Tp>
+ inline _Tp&
+ real(complex<_Tp>& __z)
+ { return __z.real(); }
+
+ template<typename _Tp>
+ inline const _Tp&
+ real(const complex<_Tp>& __z)
+ { return __z.real(); }
+
+ template<typename _Tp>
+ inline _Tp&
+ imag(complex<_Tp>& __z)
+ { return __z.imag(); }
+
+ template<typename _Tp>
+ inline const _Tp&
+ imag(const complex<_Tp>& __z)
+ { return __z.imag(); }
+#endif
+
+ // 26.2.7/3 abs(__z): Returns the magnitude of __z.
+ template<typename _Tp>
+ inline _Tp
+ __complex_abs(const complex<_Tp>& __z)
+ {
+ _Tp __x = __z.real();
+ _Tp __y = __z.imag();
+ const _Tp __s = std::max(abs(__x), abs(__y));
+ if (__s == _Tp()) // well ...
+ return __s;
+ __x /= __s;
+ __y /= __s;
+ return __s * sqrt(__x * __x + __y * __y);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline float
+ __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); }
+
+ inline double
+ __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); }
+
+ inline long double
+ __complex_abs(const __complex__ long double& __z)
+ { return __builtin_cabsl(__z); }
+
+ template<typename _Tp>
+ inline _Tp
+ abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline _Tp
+ abs(const complex<_Tp>& __z) { return __complex_abs(__z); }
+#endif
+
+
+ // 26.2.7/4: arg(__z): Returns the phase angle of __z.
+ template<typename _Tp>
+ inline _Tp
+ __complex_arg(const complex<_Tp>& __z)
+ { return atan2(__z.imag(), __z.real()); }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline float
+ __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); }
+
+ inline double
+ __complex_arg(__complex__ double __z) { return __builtin_carg(__z); }
+
+ inline long double
+ __complex_arg(const __complex__ long double& __z)
+ { return __builtin_cargl(__z); }
+
+ template<typename _Tp>
+ inline _Tp
+ arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline _Tp
+ arg(const complex<_Tp>& __z) { return __complex_arg(__z); }
+#endif
+
+ // 26.2.7/5: norm(__z) returns the squared magnitude of __z.
+ // As defined, norm() is -not- a norm is the common mathematical
+ // sens used in numerics. The helper class _Norm_helper<> tries to
+ // distinguish between builtin floating point and the rest, so as
+ // to deliver an answer as close as possible to the real value.
+ template<bool>
+ struct _Norm_helper
+ {
+ template<typename _Tp>
+ static inline _Tp _S_do_it(const complex<_Tp>& __z)
+ {
+ const _Tp __x = __z.real();
+ const _Tp __y = __z.imag();
+ return __x * __x + __y * __y;
+ }
+ };
+
+ template<>
+ struct _Norm_helper<true>
+ {
+ template<typename _Tp>
+ static inline _Tp _S_do_it(const complex<_Tp>& __z)
+ {
+ _Tp __res = std::abs(__z);
+ return __res * __res;
+ }
+ };
+
+ template<typename _Tp>
+ inline _Tp
+ norm(const complex<_Tp>& __z)
+ {
+ return _Norm_helper<__is_floating<_Tp>::__value
+ && !_GLIBCXX_FAST_MATH>::_S_do_it(__z);
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ polar(const _Tp& __rho, const _Tp& __theta)
+ { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ conj(const complex<_Tp>& __z)
+ { return complex<_Tp>(__z.real(), -__z.imag()); }
+
+ // Transcendentals
+
+ // 26.2.8/1 cos(__z): Returns the cosine of __z.
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_cos(const complex<_Tp>& __z)
+ {
+ const _Tp __x = __z.real();
+ const _Tp __y = __z.imag();
+ return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); }
+
+ inline __complex__ double
+ __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); }
+
+ inline __complex__ long double
+ __complex_cos(const __complex__ long double& __z)
+ { return __builtin_ccosl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ cos(const complex<_Tp>& __z) { return __complex_cos(__z); }
+#endif
+
+ // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z.
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_cosh(const complex<_Tp>& __z)
+ {
+ const _Tp __x = __z.real();
+ const _Tp __y = __z.imag();
+ return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); }
+
+ inline __complex__ double
+ __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); }
+
+ inline __complex__ long double
+ __complex_cosh(const __complex__ long double& __z)
+ { return __builtin_ccoshl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); }
+#endif
+
+ // 26.2.8/3 exp(__z): Returns the complex base e exponential of x
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_exp(const complex<_Tp>& __z)
+ { return std::polar(exp(__z.real()), __z.imag()); }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); }
+
+ inline __complex__ double
+ __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); }
+
+ inline __complex__ long double
+ __complex_exp(const __complex__ long double& __z)
+ { return __builtin_cexpl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ exp(const complex<_Tp>& __z) { return __complex_exp(__z); }
+#endif
+
+ // 26.2.8/5 log(__z): Returns the natural complex logarithm of __z.
+ // The branch cut is along the negative axis.
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_log(const complex<_Tp>& __z)
+ { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_log(__complex__ float __z) { return __builtin_clogf(__z); }
+
+ inline __complex__ double
+ __complex_log(__complex__ double __z) { return __builtin_clog(__z); }
+
+ inline __complex__ long double
+ __complex_log(const __complex__ long double& __z)
+ { return __builtin_clogl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ log(const complex<_Tp>& __z) { return __complex_log(__z); }
+#endif
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ log10(const complex<_Tp>& __z)
+ { return std::log(__z) / log(_Tp(10.0)); }
+
+ // 26.2.8/10 sin(__z): Returns the sine of __z.
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_sin(const complex<_Tp>& __z)
+ {
+ const _Tp __x = __z.real();
+ const _Tp __y = __z.imag();
+ return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); }
+
+ inline __complex__ double
+ __complex_sin(__complex__ double __z) { return __builtin_csin(__z); }
+
+ inline __complex__ long double
+ __complex_sin(const __complex__ long double& __z)
+ { return __builtin_csinl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ sin(const complex<_Tp>& __z) { return __complex_sin(__z); }
+#endif
+
+ // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z.
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_sinh(const complex<_Tp>& __z)
+ {
+ const _Tp __x = __z.real();
+ const _Tp __y = __z.imag();
+ return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); }
+
+ inline __complex__ double
+ __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); }
+
+ inline __complex__ long double
+ __complex_sinh(const __complex__ long double& __z)
+ { return __builtin_csinhl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); }
+#endif
+
+ // 26.2.8/13 sqrt(__z): Returns the complex square root of __z.
+ // The branch cut is on the negative axis.
+ template<typename _Tp>
+ complex<_Tp>
+ __complex_sqrt(const complex<_Tp>& __z)
+ {
+ _Tp __x = __z.real();
+ _Tp __y = __z.imag();
+
+ if (__x == _Tp())
+ {
+ _Tp __t = sqrt(abs(__y) / 2);
+ return complex<_Tp>(__t, __y < _Tp() ? -__t : __t);
+ }
+ else
+ {
+ _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x)));
+ _Tp __u = __t / 2;
+ return __x > _Tp()
+ ? complex<_Tp>(__u, __y / __t)
+ : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u);
+ }
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); }
+
+ inline __complex__ double
+ __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); }
+
+ inline __complex__ long double
+ __complex_sqrt(const __complex__ long double& __z)
+ { return __builtin_csqrtl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); }
+#endif
+
+ // 26.2.8/14 tan(__z): Return the complex tangent of __z.
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_tan(const complex<_Tp>& __z)
+ { return std::sin(__z) / std::cos(__z); }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); }
+
+ inline __complex__ double
+ __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); }
+
+ inline __complex__ long double
+ __complex_tan(const __complex__ long double& __z)
+ { return __builtin_ctanl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ tan(const complex<_Tp>& __z) { return __complex_tan(__z); }
+#endif
+
+
+ // 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z.
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_tanh(const complex<_Tp>& __z)
+ { return std::sinh(__z) / std::cosh(__z); }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); }
+
+ inline __complex__ double
+ __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); }
+
+ inline __complex__ long double
+ __complex_tanh(const __complex__ long double& __z)
+ { return __builtin_ctanhl(__z); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); }
+#endif
+
+
+ // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x
+ // raised to the __y-th power. The branch
+ // cut is on the negative axis.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 844. complex pow return type is ambiguous.
+ template<typename _Tp>
+ inline complex<_Tp>
+ pow(const complex<_Tp>& __z, int __n)
+ { return std::__pow_helper(__z, __n); }
+#endif
+
+ template<typename _Tp>
+ complex<_Tp>
+ pow(const complex<_Tp>& __x, const _Tp& __y)
+ {
+#ifndef _GLIBCXX_USE_C99_COMPLEX
+ if (__x == _Tp())
+ return _Tp();
+#endif
+ if (__x.imag() == _Tp() && __x.real() > _Tp())
+ return pow(__x.real(), __y);
+
+ complex<_Tp> __t = std::log(__x);
+ return std::polar(exp(__y * __t.real()), __y * __t.imag());
+ }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_pow(__complex__ float __x, __complex__ float __y)
+ { return __builtin_cpowf(__x, __y); }
+
+ inline __complex__ double
+ __complex_pow(__complex__ double __x, __complex__ double __y)
+ { return __builtin_cpow(__x, __y); }
+
+ inline __complex__ long double
+ __complex_pow(const __complex__ long double& __x,
+ const __complex__ long double& __y)
+ { return __builtin_cpowl(__x, __y); }
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __complex_pow(__x.__rep(), __y.__rep()); }
+#else
+ template<typename _Tp>
+ inline complex<_Tp>
+ pow(const complex<_Tp>& __x, const complex<_Tp>& __y)
+ { return __complex_pow(__x, __y); }
+#endif
+
+ template<typename _Tp>
+ inline complex<_Tp>
+ pow(const _Tp& __x, const complex<_Tp>& __y)
+ {
+ return __x > _Tp() ? std::polar(pow(__x, __y.real()),
+ __y.imag() * log(__x))
+ : std::pow(complex<_Tp>(__x), __y);
+ }
+
+ // 26.2.3 complex specializations
+ // complex<float> specialization
+ template<>
+ struct complex<float>
+ {
+ typedef float value_type;
+ typedef __complex__ float _ComplexT;
+
+ complex(_ComplexT __z) : _M_value(__z) { }
+
+ complex(float __r = 0.0f, float __i = 0.0f)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = __i;
+ }
+
+ explicit complex(const complex<double>&);
+ explicit complex(const complex<long double>&);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ float real() const
+ { return __real__ _M_value; }
+
+ float imag() const
+ { return __imag__ _M_value; }
+#else
+ float& real()
+ { return __real__ _M_value; }
+
+ const float& real() const
+ { return __real__ _M_value; }
+
+ float& imag()
+ { return __imag__ _M_value; }
+
+ const float& imag() const
+ { return __imag__ _M_value; }
+#endif
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ void real(float __val)
+ { __real__ _M_value = __val; }
+
+ void imag(float __val)
+ { __imag__ _M_value = __val; }
+
+ complex<float>&
+ operator=(float __f)
+ {
+ __real__ _M_value = __f;
+ __imag__ _M_value = 0.0f;
+ return *this;
+ }
+
+ complex<float>&
+ operator+=(float __f)
+ {
+ __real__ _M_value += __f;
+ return *this;
+ }
+
+ complex<float>&
+ operator-=(float __f)
+ {
+ __real__ _M_value -= __f;
+ return *this;
+ }
+
+ complex<float>&
+ operator*=(float __f)
+ {
+ _M_value *= __f;
+ return *this;
+ }
+
+ complex<float>&
+ operator/=(float __f)
+ {
+ _M_value /= __f;
+ return *this;
+ }
+
+ // Let the compiler synthesize the copy and assignment
+ // operator. It always does a pretty good job.
+ // complex& operator=(const complex&);
+
+ template<typename _Tp>
+ complex<float>&
+ operator=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<float>&
+ operator+=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value += __z.real();
+ __imag__ _M_value += __z.imag();
+ return *this;
+ }
+
+ template<class _Tp>
+ complex<float>&
+ operator-=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value -= __z.real();
+ __imag__ _M_value -= __z.imag();
+ return *this;
+ }
+
+ template<class _Tp>
+ complex<float>&
+ operator*=(const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<class _Tp>
+ complex<float>&
+ operator/=(const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value /= __t;
+ return *this;
+ }
+
+ const _ComplexT& __rep() const { return _M_value; }
+
+ private:
+ _ComplexT _M_value;
+ };
+
+ // 26.2.3 complex specializations
+ // complex<double> specialization
+ template<>
+ struct complex<double>
+ {
+ typedef double value_type;
+ typedef __complex__ double _ComplexT;
+
+ complex(_ComplexT __z) : _M_value(__z) { }
+
+ complex(double __r = 0.0, double __i = 0.0)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = __i;
+ }
+
+ complex(const complex<float>& __z)
+ : _M_value(__z.__rep()) { }
+
+ explicit complex(const complex<long double>&);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ double real() const
+ { return __real__ _M_value; }
+
+ double imag() const
+ { return __imag__ _M_value; }
+#else
+ double& real()
+ { return __real__ _M_value; }
+
+ const double& real() const
+ { return __real__ _M_value; }
+
+ double& imag()
+ { return __imag__ _M_value; }
+
+ const double& imag() const
+ { return __imag__ _M_value; }
+#endif
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ void real(double __val)
+ { __real__ _M_value = __val; }
+
+ void imag(double __val)
+ { __imag__ _M_value = __val; }
+
+ complex<double>&
+ operator=(double __d)
+ {
+ __real__ _M_value = __d;
+ __imag__ _M_value = 0.0;
+ return *this;
+ }
+
+ complex<double>&
+ operator+=(double __d)
+ {
+ __real__ _M_value += __d;
+ return *this;
+ }
+
+ complex<double>&
+ operator-=(double __d)
+ {
+ __real__ _M_value -= __d;
+ return *this;
+ }
+
+ complex<double>&
+ operator*=(double __d)
+ {
+ _M_value *= __d;
+ return *this;
+ }
+
+ complex<double>&
+ operator/=(double __d)
+ {
+ _M_value /= __d;
+ return *this;
+ }
+
+ // The compiler will synthesize this, efficiently.
+ // complex& operator=(const complex&);
+
+ template<typename _Tp>
+ complex<double>&
+ operator=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<double>&
+ operator+=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value += __z.real();
+ __imag__ _M_value += __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<double>&
+ operator-=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value -= __z.real();
+ __imag__ _M_value -= __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<double>&
+ operator*=(const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<double>&
+ operator/=(const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value /= __t;
+ return *this;
+ }
+
+ const _ComplexT& __rep() const { return _M_value; }
+
+ private:
+ _ComplexT _M_value;
+ };
+
+ // 26.2.3 complex specializations
+ // complex<long double> specialization
+ template<>
+ struct complex<long double>
+ {
+ typedef long double value_type;
+ typedef __complex__ long double _ComplexT;
+
+ complex(_ComplexT __z) : _M_value(__z) { }
+
+ complex(long double __r = 0.0L, long double __i = 0.0L)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = __i;
+ }
+
+ complex(const complex<float>& __z)
+ : _M_value(__z.__rep()) { }
+
+ complex(const complex<double>& __z)
+ : _M_value(__z.__rep()) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ long double real() const
+ { return __real__ _M_value; }
+
+ long double imag() const
+ { return __imag__ _M_value; }
+#else
+ long double& real()
+ { return __real__ _M_value; }
+
+ const long double& real() const
+ { return __real__ _M_value; }
+
+ long double& imag()
+ { return __imag__ _M_value; }
+
+ const long double& imag() const
+ { return __imag__ _M_value; }
+#endif
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 387. std::complex over-encapsulated.
+ void real(long double __val)
+ { __real__ _M_value = __val; }
+
+ void imag(long double __val)
+ { __imag__ _M_value = __val; }
+
+ complex<long double>&
+ operator=(long double __r)
+ {
+ __real__ _M_value = __r;
+ __imag__ _M_value = 0.0L;
+ return *this;
+ }
+
+ complex<long double>&
+ operator+=(long double __r)
+ {
+ __real__ _M_value += __r;
+ return *this;
+ }
+
+ complex<long double>&
+ operator-=(long double __r)
+ {
+ __real__ _M_value -= __r;
+ return *this;
+ }
+
+ complex<long double>&
+ operator*=(long double __r)
+ {
+ _M_value *= __r;
+ return *this;
+ }
+
+ complex<long double>&
+ operator/=(long double __r)
+ {
+ _M_value /= __r;
+ return *this;
+ }
+
+ // The compiler knows how to do this efficiently
+ // complex& operator=(const complex&);
+
+ template<typename _Tp>
+ complex<long double>&
+ operator=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value = __z.real();
+ __imag__ _M_value = __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<long double>&
+ operator+=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value += __z.real();
+ __imag__ _M_value += __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<long double>&
+ operator-=(const complex<_Tp>& __z)
+ {
+ __real__ _M_value -= __z.real();
+ __imag__ _M_value -= __z.imag();
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<long double>&
+ operator*=(const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value *= __t;
+ return *this;
+ }
+
+ template<typename _Tp>
+ complex<long double>&
+ operator/=(const complex<_Tp>& __z)
+ {
+ _ComplexT __t;
+ __real__ __t = __z.real();
+ __imag__ __t = __z.imag();
+ _M_value /= __t;
+ return *this;
+ }
+
+ const _ComplexT& __rep() const { return _M_value; }
+
+ private:
+ _ComplexT _M_value;
+ };
+
+ // These bits have to be at the end of this file, so that the
+ // specializations have all been defined.
+ inline
+ complex<float>::complex(const complex<double>& __z)
+ : _M_value(__z.__rep()) { }
+
+ inline
+ complex<float>::complex(const complex<long double>& __z)
+ : _M_value(__z.__rep()) { }
+
+ inline
+ complex<double>::complex(const complex<long double>& __z)
+ : _M_value(__z.__rep()) { }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template istream& operator>>(istream&, complex<float>&);
+ extern template ostream& operator<<(ostream&, const complex<float>&);
+ extern template istream& operator>>(istream&, complex<double>&);
+ extern template ostream& operator<<(ostream&, const complex<double>&);
+ extern template istream& operator>>(istream&, complex<long double>&);
+ extern template ostream& operator<<(ostream&, const complex<long double>&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template wistream& operator>>(wistream&, complex<float>&);
+ extern template wostream& operator<<(wostream&, const complex<float>&);
+ extern template wistream& operator>>(wistream&, complex<double>&);
+ extern template wostream& operator<<(wostream&, const complex<double>&);
+ extern template wistream& operator>>(wistream&, complex<long double>&);
+ extern template wostream& operator<<(wostream&, const complex<long double>&);
+#endif
+#endif
+
+ // @} group complex_numbers
+
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ // See ext/type_traits.h for the primary template.
+ template<typename _Tp, typename _Up>
+ struct __promote_2<std::complex<_Tp>, _Up>
+ {
+ public:
+ typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
+ };
+
+ template<typename _Tp, typename _Up>
+ struct __promote_2<_Tp, std::complex<_Up> >
+ {
+ public:
+ typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
+ };
+
+ template<typename _Tp, typename _Up>
+ struct __promote_2<std::complex<_Tp>, std::complex<_Up> >
+ {
+ public:
+ typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/complex>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/complex>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // Forward declarations.
+ // DR 781.
+ template<typename _Tp> std::complex<_Tp> proj(const std::complex<_Tp>&);
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_proj(const std::complex<_Tp>& __z)
+ {
+ const _Tp __den = (__z.real() * __z.real()
+ + __z.imag() * __z.imag() + _Tp(1.0));
+
+ return std::complex<_Tp>((_Tp(2.0) * __z.real()) / __den,
+ (_Tp(2.0) * __z.imag()) / __den);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX
+ inline __complex__ float
+ __complex_proj(__complex__ float __z)
+ { return __builtin_cprojf(__z); }
+
+ inline __complex__ double
+ __complex_proj(__complex__ double __z)
+ { return __builtin_cproj(__z); }
+
+ inline __complex__ long double
+ __complex_proj(const __complex__ long double& __z)
+ { return __builtin_cprojl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ proj(const std::complex<_Tp>& __z)
+ { return __complex_proj(__z.__rep()); }
+#else
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ proj(const std::complex<_Tp>& __z)
+ { return __complex_proj(__z); }
+#endif
+
+ template<typename _Tp>
+ inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
+ proj(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return std::proj(std::complex<__type>(__x));
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
+#endif /* _GLIBCXX_COMPLEX */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/condition_variable b/gcc-4.4.0/libstdc++-v3/include/std/condition_variable
new file mode 100644
index 000000000..64f2bb771
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/condition_variable
@@ -0,0 +1,225 @@
+// <condition_variable> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file condition_variable
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_CONDITION_VARIABLE
+#define _GLIBCXX_CONDITION_VARIABLE 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <chrono>
+#include <mutex> // unique_lock
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+namespace std
+{
+ /**
+ * @defgroup condition_variables Condition Variables
+ * @ingroup concurrency
+ *
+ * Classes for condition_variable support.
+ * @{
+ */
+
+ /// condition_variable
+ class condition_variable
+ {
+ typedef chrono::system_clock __clock_t;
+ typedef __gthread_cond_t __native_type;
+ __native_type _M_cond;
+
+ public:
+ typedef __native_type* native_handle_type;
+
+ condition_variable();
+ ~condition_variable();
+
+ condition_variable(const condition_variable&) = delete;
+ condition_variable& operator=(const condition_variable&) = delete;
+
+ void
+ notify_one();
+
+ void
+ notify_all();
+
+ void
+ wait(unique_lock<mutex>& __lock);
+
+ template<typename _Predicate>
+ void
+ wait(unique_lock<mutex>& __lock, _Predicate __p)
+ {
+ while (!__p())
+ wait(__lock);
+ }
+
+ template<typename _Duration>
+ bool
+ wait_until(unique_lock<mutex>& __lock,
+ const chrono::time_point<__clock_t, _Duration>& __atime)
+ { return __wait_until_impl(__lock, __atime); }
+
+ template<typename _Clock, typename _Duration>
+ bool
+ wait_until(unique_lock<mutex>& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime)
+ {
+ // DR 887 - Sync unknown clock to known clock.
+ typename _Clock::time_point __c_entry = _Clock::now();
+ __clock_t::time_point __s_entry = __clock_t::now();
+ chrono::nanoseconds __delta = __atime - __c_entry;
+ __clock_t::time_point __s_atime = __s_entry + __delta;
+
+ return __wait_until_impl(__lock, __s_atime);
+ }
+
+ template<typename _Clock, typename _Duration, typename _Predicate>
+ bool
+ wait_until(unique_lock<mutex>& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime,
+ _Predicate __p)
+ {
+ while (!__p())
+ if (!wait_until(__lock, __atime))
+ return __p();
+
+ return true;
+ }
+
+ template<typename _Rep, typename _Period>
+ bool
+ wait_for(unique_lock<mutex>& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime)
+ { return wait_until(__lock, __clock_t::now() + __rtime); }
+
+ template<typename _Rep, typename _Period, typename _Predicate>
+ bool
+ wait_for(unique_lock<mutex>& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime,
+ _Predicate __p)
+ { return wait_until(__lock, __clock_t::now() + __rtime, std::move(__p)); }
+
+ native_handle_type
+ native_handle()
+ { return &_M_cond; }
+
+ private:
+ template<typename _Clock, typename _Duration>
+ bool
+ __wait_until_impl(unique_lock<mutex>& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime)
+ {
+ chrono::time_point<__clock_t, chrono::seconds> __s =
+ chrono::time_point_cast<chrono::seconds>(__atime);
+
+ chrono::nanoseconds __ns =
+ chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+
+ __gthread_time_t __ts =
+ {
+ static_cast<std::time_t>(__s.time_since_epoch().count()),
+ static_cast<long>(__ns.count())
+ };
+
+ __gthread_cond_timedwait(&_M_cond, __lock.mutex()->native_handle(),
+ &__ts);
+
+ return _Clock::now() < __atime;
+ }
+ };
+
+ /// condition_variable_any
+ // Like above, only mutex may not have try_lock.
+ class condition_variable_any
+ {
+ typedef __gthread_cond_t __native_type;
+ __native_type _M_cond;
+
+ public:
+ typedef __native_type* native_handle_type;
+
+ condition_variable_any();
+ ~condition_variable_any();
+
+ condition_variable_any(const condition_variable_any&) = delete;
+ condition_variable_any& operator=(const condition_variable_any&) = delete;
+
+ void
+ notify_one();
+
+ void
+ notify_all();
+
+ template<typename _Lock>
+ void
+ wait(_Lock& __lock);
+
+ template<typename _Lock, typename _Predicate>
+ void
+ wait(_Lock& __lock, _Predicate __p);
+
+ template<typename _Lock, typename _Clock, typename _Duration>
+ bool
+ wait_until(_Lock& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime);
+
+ template<typename _Lock, typename _Clock,
+ typename _Duration, typename _Predicate>
+ bool
+ wait_until(_Lock& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime,
+ _Predicate __p);
+
+ template<typename _Lock, typename _Rep, typename _Period>
+ bool
+ wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime);
+
+ template<typename _Lock, typename _Rep,
+ typename _Period, typename _Predicate>
+ bool
+ wait_for(_Lock& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p);
+
+ native_handle_type
+ native_handle()
+ { return &_M_cond; }
+ };
+
+ // @} group condition_variables
+}
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_CONDITION_VARIABLE
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/deque b/gcc-4.4.0/libstdc++-v3/include/std/deque
new file mode 100644
index 000000000..8f64b005c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/deque
@@ -0,0 +1,75 @@
+// <deque> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/deque
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_DEQUE
+#define _GLIBCXX_DEQUE 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_deque.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/deque.tcc>
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/deque>
+#endif
+
+#endif /* _GLIBCXX_DEQUE */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/forward_list b/gcc-4.4.0/libstdc++-v3/include/std/forward_list
new file mode 100644
index 000000000..40a0812c0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/forward_list
@@ -0,0 +1,46 @@
+// <forward_list> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file forward_list
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_FORWARD_LIST
+#define _GLIBCXX_FORWARD_LIST 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <bits/forward_list.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/forward_list.tcc>
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_FORWARD_LIST
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/fstream b/gcc-4.4.0/libstdc++-v3/include/std/fstream
new file mode 100644
index 000000000..88c1d1488
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/fstream
@@ -0,0 +1,918 @@
+// File based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file fstream
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.8 File-based streams
+//
+
+#ifndef _GLIBCXX_FSTREAM
+#define _GLIBCXX_FSTREAM 1
+
+#pragma GCC system_header
+
+#include <istream>
+#include <ostream>
+#include <bits/codecvt.h>
+#include <cstdio> // For BUFSIZ
+#include <bits/basic_file.h> // For __basic_file, __c_lock
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#include <string> // For std::string overloads.
+#endif
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // [27.8.1.1] template class basic_filebuf
+ /**
+ * @brief The actual work of input and output (for files).
+ * @ingroup io
+ *
+ * This class associates both its input and output sequence with an
+ * external disk file, and maintains a joint file position for both
+ * sequences. Many of its semantics are described in terms of similar
+ * behavior in the Standard C Library's @c FILE streams.
+ */
+ // Requirements on traits_type, specific to this class:
+ // traits_type::pos_type must be fpos<traits_type::state_type>
+ // traits_type::off_type must be streamoff
+ // traits_type::state_type must be Assignable and DefaultConstructible,
+ // and traits_type::state_type() must be the initial state for codecvt.
+ template<typename _CharT, typename _Traits>
+ class basic_filebuf : public basic_streambuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ typedef basic_streambuf<char_type, traits_type> __streambuf_type;
+ typedef basic_filebuf<char_type, traits_type> __filebuf_type;
+ typedef __basic_file<char> __file_type;
+ typedef typename traits_type::state_type __state_type;
+ typedef codecvt<char_type, char, __state_type> __codecvt_type;
+
+ friend class ios_base; // For sync_with_stdio.
+
+ protected:
+ // Data Members:
+ // MT lock inherited from libio or other low-level io library.
+ __c_lock _M_lock;
+
+ // External buffer.
+ __file_type _M_file;
+
+ /// Place to stash in || out || in | out settings for current filebuf.
+ ios_base::openmode _M_mode;
+
+ // Beginning state type for codecvt.
+ __state_type _M_state_beg;
+
+ // During output, the state that corresponds to pptr(),
+ // during input, the state that corresponds to egptr() and
+ // _M_ext_next.
+ __state_type _M_state_cur;
+
+ // Not used for output. During input, the state that corresponds
+ // to eback() and _M_ext_buf.
+ __state_type _M_state_last;
+
+ /// Pointer to the beginning of internal buffer.
+ char_type* _M_buf;
+
+ /**
+ * Actual size of internal buffer. This number is equal to the size
+ * of the put area + 1 position, reserved for the overflow char of
+ * a full area.
+ */
+ size_t _M_buf_size;
+
+ // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer.
+ bool _M_buf_allocated;
+
+ /**
+ * _M_reading == false && _M_writing == false for 'uncommitted' mode;
+ * _M_reading == true for 'read' mode;
+ * _M_writing == true for 'write' mode;
+ *
+ * NB: _M_reading == true && _M_writing == true is unused.
+ */
+ bool _M_reading;
+ bool _M_writing;
+
+ //@{
+ /**
+ * Necessary bits for putback buffer management.
+ *
+ * @note pbacks of over one character are not currently supported.
+ */
+ char_type _M_pback;
+ char_type* _M_pback_cur_save;
+ char_type* _M_pback_end_save;
+ bool _M_pback_init;
+ //@}
+
+ // Cached codecvt facet.
+ const __codecvt_type* _M_codecvt;
+
+ /**
+ * Buffer for external characters. Used for input when
+ * codecvt::always_noconv() == false. When valid, this corresponds
+ * to eback().
+ */
+ char* _M_ext_buf;
+
+ /**
+ * Size of buffer held by _M_ext_buf.
+ */
+ streamsize _M_ext_buf_size;
+
+ /**
+ * Pointers into the buffer held by _M_ext_buf that delimit a
+ * subsequence of bytes that have been read but not yet converted.
+ * When valid, _M_ext_next corresponds to egptr().
+ */
+ const char* _M_ext_next;
+ char* _M_ext_end;
+
+ /**
+ * Initializes pback buffers, and moves normal buffers to safety.
+ * Assumptions:
+ * _M_in_cur has already been moved back
+ */
+ void
+ _M_create_pback()
+ {
+ if (!_M_pback_init)
+ {
+ _M_pback_cur_save = this->gptr();
+ _M_pback_end_save = this->egptr();
+ this->setg(&_M_pback, &_M_pback, &_M_pback + 1);
+ _M_pback_init = true;
+ }
+ }
+
+ /**
+ * Deactivates pback buffer contents, and restores normal buffer.
+ * Assumptions:
+ * The pback buffer has only moved forward.
+ */
+ void
+ _M_destroy_pback() throw()
+ {
+ if (_M_pback_init)
+ {
+ // Length _M_in_cur moved in the pback buffer.
+ _M_pback_cur_save += this->gptr() != this->eback();
+ this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save);
+ _M_pback_init = false;
+ }
+ }
+
+ public:
+ // Constructors/destructor:
+ /**
+ * @brief Does not open any files.
+ *
+ * The default constructor initializes the parent class using its
+ * own default ctor.
+ */
+ basic_filebuf();
+
+ /**
+ * @brief The destructor closes the file first.
+ */
+ virtual
+ ~basic_filebuf()
+ { this->close(); }
+
+ // Members:
+ /**
+ * @brief Returns true if the external file is open.
+ */
+ bool
+ is_open() const throw()
+ { return _M_file.is_open(); }
+
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ * @return @c this on success, NULL on failure
+ *
+ * If a file is already open, this function immediately fails.
+ * Otherwise it tries to open the file named @a s using the flags
+ * given in @a mode.
+ *
+ * Table 92, adapted here, gives the relation between openmode
+ * combinations and the equivalent fopen() flags.
+ * (NB: lines app, in|out|app, in|app, binary|app, binary|in|out|app,
+ * and binary|in|app per DR 596)
+ * +---------------------------------------------------------+
+ * | ios_base Flag combination stdio equivalent |
+ * |binary in out trunc app |
+ * +---------------------------------------------------------+
+ * | + "w" |
+ * | + + "a" |
+ * | + "a" |
+ * | + + "w" |
+ * | + "r" |
+ * | + + "r+" |
+ * | + + + "w+" |
+ * | + + + "a+" |
+ * | + + "a+" |
+ * +---------------------------------------------------------+
+ * | + + "wb" |
+ * | + + + "ab" |
+ * | + + "ab" |
+ * | + + + "wb" |
+ * | + + "rb" |
+ * | + + + "r+b" |
+ * | + + + + "w+b" |
+ * | + + + + "a+b" |
+ * | + + + "a+b" |
+ * +---------------------------------------------------------+
+ */
+ __filebuf_type*
+ open(const char* __s, ios_base::openmode __mode);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ * @return @c this on success, NULL on failure
+ */
+ __filebuf_type*
+ open(const std::string& __s, ios_base::openmode __mode)
+ { return open(__s.c_str(), __mode); }
+#endif
+
+ /**
+ * @brief Closes the currently associated file.
+ * @return @c this on success, NULL on failure
+ *
+ * If no file is currently open, this function immediately fails.
+ *
+ * If a "put buffer area" exists, @c overflow(eof) is called to flush
+ * all the characters. The file is then closed.
+ *
+ * If any operations fail, this function also fails.
+ */
+ __filebuf_type*
+ close();
+
+ protected:
+ void
+ _M_allocate_internal_buffer();
+
+ void
+ _M_destroy_internal_buffer() throw();
+
+ // [27.8.1.4] overridden virtual functions
+ virtual streamsize
+ showmanyc();
+
+ // Stroustrup, 1998, p. 628
+ // underflow() and uflow() functions are called to get the next
+ // character from the real input source when the buffer is empty.
+ // Buffered input uses underflow()
+
+ virtual int_type
+ underflow();
+
+ virtual int_type
+ pbackfail(int_type __c = _Traits::eof());
+
+ // Stroustrup, 1998, p 648
+ // The overflow() function is called to transfer characters to the
+ // real output destination when the buffer is full. A call to
+ // overflow(c) outputs the contents of the buffer plus the
+ // character c.
+ // 27.5.2.4.5
+ // Consume some sequence of the characters in the pending sequence.
+ virtual int_type
+ overflow(int_type __c = _Traits::eof());
+
+ // Convert internal byte sequence to external, char-based
+ // sequence via codecvt.
+ bool
+ _M_convert_to_external(char_type*, streamsize);
+
+ /**
+ * @brief Manipulates the buffer.
+ * @param s Pointer to a buffer area.
+ * @param n Size of @a s.
+ * @return @c this
+ *
+ * If no file has been opened, and both @a s and @a n are zero, then
+ * the stream becomes unbuffered. Otherwise, @c s is used as a
+ * buffer; see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html
+ * for more.
+ */
+ virtual __streambuf_type*
+ setbuf(char_type* __s, streamsize __n);
+
+ virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual pos_type
+ seekpos(pos_type __pos,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ // Common code for seekoff and seekpos
+ pos_type
+ _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state);
+
+ virtual int
+ sync();
+
+ virtual void
+ imbue(const locale& __loc);
+
+ virtual streamsize
+ xsgetn(char_type* __s, streamsize __n);
+
+ virtual streamsize
+ xsputn(const char_type* __s, streamsize __n);
+
+ // Flushes output buffer, then writes unshift sequence.
+ bool
+ _M_terminate_output();
+
+ /**
+ * This function sets the pointers of the internal buffer, both get
+ * and put areas. Typically:
+ *
+ * __off == egptr() - eback() upon underflow/uflow ('read' mode);
+ * __off == 0 upon overflow ('write' mode);
+ * __off == -1 upon open, setbuf, seekoff/pos ('uncommitted' mode).
+ *
+ * NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size
+ * reflects the actual allocated memory and the last cell is reserved
+ * for the overflow char of a full put area.
+ */
+ void
+ _M_set_buffer(streamsize __off)
+ {
+ const bool __testin = _M_mode & ios_base::in;
+ const bool __testout = _M_mode & ios_base::out;
+
+ if (__testin && __off > 0)
+ this->setg(_M_buf, _M_buf, _M_buf + __off);
+ else
+ this->setg(_M_buf, _M_buf, _M_buf);
+
+ if (__testout && __off == 0 && _M_buf_size > 1 )
+ this->setp(_M_buf, _M_buf + _M_buf_size - 1);
+ else
+ this->setp(NULL, NULL);
+ }
+ };
+
+ // [27.8.1.5] Template class basic_ifstream
+ /**
+ * @brief Controlling input for files.
+ * @ingroup io
+ *
+ * This class supports reading from named files, using the inherited
+ * functions from std::basic_istream. To control the associated
+ * sequence, an instance of std::basic_filebuf is used, which this page
+ * refers to as @c sb.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_ifstream : public basic_istream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // Non-standard types:
+ typedef basic_filebuf<char_type, traits_type> __filebuf_type;
+ typedef basic_istream<char_type, traits_type> __istream_type;
+
+ private:
+ __filebuf_type _M_filebuf;
+
+ public:
+ // Constructors/Destructors:
+ /**
+ * @brief Default constructor.
+ *
+ * Initializes @c sb using its default constructor, and passes
+ * @c &sb to the base class initializer. Does not open any files
+ * (you haven't given it a filename to open).
+ */
+ basic_ifstream() : __istream_type(), _M_filebuf()
+ { this->init(&_M_filebuf); }
+
+ /**
+ * @brief Create an input file stream.
+ * @param s Null terminated string specifying the filename.
+ * @param mode Open file in specified mode (see std::ios_base).
+ *
+ * @c ios_base::in is automatically included in @a mode.
+ *
+ * Tip: When using std::string to hold the filename, you must use
+ * .c_str() before passing it to this constructor.
+ */
+ explicit
+ basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
+ : __istream_type(), _M_filebuf()
+ {
+ this->init(&_M_filebuf);
+ this->open(__s, __mode);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Create an input file stream.
+ * @param s std::string specifying the filename.
+ * @param mode Open file in specified mode (see std::ios_base).
+ *
+ * @c ios_base::in is automatically included in @a mode.
+ */
+ explicit
+ basic_ifstream(const std::string& __s,
+ ios_base::openmode __mode = ios_base::in)
+ : __istream_type(), _M_filebuf()
+ {
+ this->init(&_M_filebuf);
+ this->open(__s, __mode);
+ }
+#endif
+
+ /**
+ * @brief The destructor does nothing.
+ *
+ * The file is closed by the filebuf object, not the formatting
+ * stream.
+ */
+ ~basic_ifstream()
+ { }
+
+ // Members:
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current basic_filebuf buffer.
+ *
+ * This hides both signatures of std::basic_ios::rdbuf().
+ */
+ __filebuf_type*
+ rdbuf() const
+ { return const_cast<__filebuf_type*>(&_M_filebuf); }
+
+ /**
+ * @brief Wrapper to test for an open file.
+ * @return @c rdbuf()->is_open()
+ */
+ bool
+ is_open()
+ { return _M_filebuf.is_open(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 365. Lack of const-qualification in clause 27
+ bool
+ is_open() const
+ { return _M_filebuf.is_open(); }
+
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ *
+ * Calls @c std::basic_filebuf::open(s,mode|in). If that function
+ * fails, @c failbit is set in the stream's error state.
+ *
+ * Tip: When using std::string to hold the filename, you must use
+ * .c_str() before passing it to this constructor.
+ */
+ void
+ open(const char* __s, ios_base::openmode __mode = ios_base::in)
+ {
+ if (!_M_filebuf.open(__s, __mode | ios_base::in))
+ this->setstate(ios_base::failbit);
+ else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 409. Closing an fstream should clear error state
+ this->clear();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ *
+ * Calls @c std::basic_filebuf::open(s,mode|in). If that function
+ * fails, @c failbit is set in the stream's error state.
+ */
+ void
+ open(const std::string& __s, ios_base::openmode __mode = ios_base::in)
+ {
+ if (!_M_filebuf.open(__s, __mode | ios_base::in))
+ this->setstate(ios_base::failbit);
+ else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 409. Closing an fstream should clear error state
+ this->clear();
+ }
+#endif
+
+ /**
+ * @brief Close the file.
+ *
+ * Calls @c std::basic_filebuf::close(). If that function
+ * fails, @c failbit is set in the stream's error state.
+ */
+ void
+ close()
+ {
+ if (!_M_filebuf.close())
+ this->setstate(ios_base::failbit);
+ }
+ };
+
+
+ // [27.8.1.8] Template class basic_ofstream
+ /**
+ * @brief Controlling output for files.
+ * @ingroup io
+ *
+ * This class supports reading from named files, using the inherited
+ * functions from std::basic_ostream. To control the associated
+ * sequence, an instance of std::basic_filebuf is used, which this page
+ * refers to as @c sb.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_ofstream : public basic_ostream<_CharT,_Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // Non-standard types:
+ typedef basic_filebuf<char_type, traits_type> __filebuf_type;
+ typedef basic_ostream<char_type, traits_type> __ostream_type;
+
+ private:
+ __filebuf_type _M_filebuf;
+
+ public:
+ // Constructors:
+ /**
+ * @brief Default constructor.
+ *
+ * Initializes @c sb using its default constructor, and passes
+ * @c &sb to the base class initializer. Does not open any files
+ * (you haven't given it a filename to open).
+ */
+ basic_ofstream(): __ostream_type(), _M_filebuf()
+ { this->init(&_M_filebuf); }
+
+ /**
+ * @brief Create an output file stream.
+ * @param s Null terminated string specifying the filename.
+ * @param mode Open file in specified mode (see std::ios_base).
+ *
+ * @c ios_base::out|ios_base::trunc is automatically included in
+ * @a mode.
+ *
+ * Tip: When using std::string to hold the filename, you must use
+ * .c_str() before passing it to this constructor.
+ */
+ explicit
+ basic_ofstream(const char* __s,
+ ios_base::openmode __mode = ios_base::out|ios_base::trunc)
+ : __ostream_type(), _M_filebuf()
+ {
+ this->init(&_M_filebuf);
+ this->open(__s, __mode);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Create an output file stream.
+ * @param s std::string specifying the filename.
+ * @param mode Open file in specified mode (see std::ios_base).
+ *
+ * @c ios_base::out|ios_base::trunc is automatically included in
+ * @a mode.
+ */
+ explicit
+ basic_ofstream(const std::string& __s,
+ ios_base::openmode __mode = ios_base::out|ios_base::trunc)
+ : __ostream_type(), _M_filebuf()
+ {
+ this->init(&_M_filebuf);
+ this->open(__s, __mode);
+ }
+#endif
+
+ /**
+ * @brief The destructor does nothing.
+ *
+ * The file is closed by the filebuf object, not the formatting
+ * stream.
+ */
+ ~basic_ofstream()
+ { }
+
+ // Members:
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current basic_filebuf buffer.
+ *
+ * This hides both signatures of std::basic_ios::rdbuf().
+ */
+ __filebuf_type*
+ rdbuf() const
+ { return const_cast<__filebuf_type*>(&_M_filebuf); }
+
+ /**
+ * @brief Wrapper to test for an open file.
+ * @return @c rdbuf()->is_open()
+ */
+ bool
+ is_open()
+ { return _M_filebuf.is_open(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 365. Lack of const-qualification in clause 27
+ bool
+ is_open() const
+ { return _M_filebuf.is_open(); }
+
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ *
+ * Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that
+ * function fails, @c failbit is set in the stream's error state.
+ *
+ * Tip: When using std::string to hold the filename, you must use
+ * .c_str() before passing it to this constructor.
+ */
+ void
+ open(const char* __s,
+ ios_base::openmode __mode = ios_base::out | ios_base::trunc)
+ {
+ if (!_M_filebuf.open(__s, __mode | ios_base::out))
+ this->setstate(ios_base::failbit);
+ else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 409. Closing an fstream should clear error state
+ this->clear();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ *
+ * Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that
+ * function fails, @c failbit is set in the stream's error state.
+ */
+ void
+ open(const std::string& __s,
+ ios_base::openmode __mode = ios_base::out | ios_base::trunc)
+ {
+ if (!_M_filebuf.open(__s, __mode | ios_base::out))
+ this->setstate(ios_base::failbit);
+ else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 409. Closing an fstream should clear error state
+ this->clear();
+ }
+#endif
+
+ /**
+ * @brief Close the file.
+ *
+ * Calls @c std::basic_filebuf::close(). If that function
+ * fails, @c failbit is set in the stream's error state.
+ */
+ void
+ close()
+ {
+ if (!_M_filebuf.close())
+ this->setstate(ios_base::failbit);
+ }
+ };
+
+
+ // [27.8.1.11] Template class basic_fstream
+ /**
+ * @brief Controlling input and output for files.
+ * @ingroup io
+ *
+ * This class supports reading from and writing to named files, using
+ * the inherited functions from std::basic_iostream. To control the
+ * associated sequence, an instance of std::basic_filebuf is used, which
+ * this page refers to as @c sb.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_fstream : public basic_iostream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // Non-standard types:
+ typedef basic_filebuf<char_type, traits_type> __filebuf_type;
+ typedef basic_ios<char_type, traits_type> __ios_type;
+ typedef basic_iostream<char_type, traits_type> __iostream_type;
+
+ private:
+ __filebuf_type _M_filebuf;
+
+ public:
+ // Constructors/destructor:
+ /**
+ * @brief Default constructor.
+ *
+ * Initializes @c sb using its default constructor, and passes
+ * @c &sb to the base class initializer. Does not open any files
+ * (you haven't given it a filename to open).
+ */
+ basic_fstream()
+ : __iostream_type(), _M_filebuf()
+ { this->init(&_M_filebuf); }
+
+ /**
+ * @brief Create an input/output file stream.
+ * @param s Null terminated string specifying the filename.
+ * @param mode Open file in specified mode (see std::ios_base).
+ *
+ * Tip: When using std::string to hold the filename, you must use
+ * .c_str() before passing it to this constructor.
+ */
+ explicit
+ basic_fstream(const char* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __iostream_type(NULL), _M_filebuf()
+ {
+ this->init(&_M_filebuf);
+ this->open(__s, __mode);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Create an input/output file stream.
+ * @param s Null terminated string specifying the filename.
+ * @param mode Open file in specified mode (see std::ios_base).
+ */
+ explicit
+ basic_fstream(const std::string& __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __iostream_type(NULL), _M_filebuf()
+ {
+ this->init(&_M_filebuf);
+ this->open(__s, __mode);
+ }
+#endif
+
+ /**
+ * @brief The destructor does nothing.
+ *
+ * The file is closed by the filebuf object, not the formatting
+ * stream.
+ */
+ ~basic_fstream()
+ { }
+
+ // Members:
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current basic_filebuf buffer.
+ *
+ * This hides both signatures of std::basic_ios::rdbuf().
+ */
+ __filebuf_type*
+ rdbuf() const
+ { return const_cast<__filebuf_type*>(&_M_filebuf); }
+
+ /**
+ * @brief Wrapper to test for an open file.
+ * @return @c rdbuf()->is_open()
+ */
+ bool
+ is_open()
+ { return _M_filebuf.is_open(); }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 365. Lack of const-qualification in clause 27
+ bool
+ is_open() const
+ { return _M_filebuf.is_open(); }
+
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ *
+ * Calls @c std::basic_filebuf::open(s,mode). If that
+ * function fails, @c failbit is set in the stream's error state.
+ *
+ * Tip: When using std::string to hold the filename, you must use
+ * .c_str() before passing it to this constructor.
+ */
+ void
+ open(const char* __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ {
+ if (!_M_filebuf.open(__s, __mode))
+ this->setstate(ios_base::failbit);
+ else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 409. Closing an fstream should clear error state
+ this->clear();
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Opens an external file.
+ * @param s The name of the file.
+ * @param mode The open mode flags.
+ *
+ * Calls @c std::basic_filebuf::open(s,mode). If that
+ * function fails, @c failbit is set in the stream's error state.
+ */
+ void
+ open(const std::string& __s,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ {
+ if (!_M_filebuf.open(__s, __mode))
+ this->setstate(ios_base::failbit);
+ else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 409. Closing an fstream should clear error state
+ this->clear();
+ }
+#endif
+
+ /**
+ * @brief Close the file.
+ *
+ * Calls @c std::basic_filebuf::close(). If that function
+ * fails, @c failbit is set in the stream's error state.
+ */
+ void
+ close()
+ {
+ if (!_M_filebuf.close())
+ this->setstate(ios_base::failbit);
+ }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/fstream.tcc>
+#endif
+
+#endif /* _GLIBCXX_FSTREAM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/functional b/gcc-4.4.0/libstdc++-v3/include/std/functional
new file mode 100644
index 000000000..8f4f42ceb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/functional
@@ -0,0 +1,78 @@
+// <functional> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file include/functional
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_FUNCTIONAL
+#define _GLIBCXX_FUNCTIONAL 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/stl_function.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# include <typeinfo>
+# include <new>
+# include <tuple>
+# include <type_traits>
+# include <bits/stringfwd.h>
+# include <bits/functional_hash.h>
+# include <ext/type_traits.h>
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/functional>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/functional>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#endif
+
+#endif // _GLIBCXX_FUNCTIONAL
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/iomanip b/gcc-4.4.0/libstdc++-v3/include/std/iomanip
new file mode 100644
index 000000000..873c76f17
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/iomanip
@@ -0,0 +1,296 @@
+// Standard stream manipulators -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file iomanip
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.6.3 Standard manipulators
+//
+
+#ifndef _GLIBCXX_IOMANIP
+#define _GLIBCXX_IOMANIP 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <iosfwd>
+#include <bits/ios_base.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // [27.6.3] standard manipulators
+ // Also see DR 183.
+
+ struct _Resetiosflags { ios_base::fmtflags _M_mask; };
+
+ /**
+ * @brief Manipulator for @c setf.
+ * @param mask A format flags mask.
+ *
+ * Sent to a stream object, this manipulator resets the specified flags,
+ * via @e stream.setf(0,mask).
+ */
+ inline _Resetiosflags
+ resetiosflags(ios_base::fmtflags __mask)
+ {
+ _Resetiosflags __x;
+ __x._M_mask = __mask;
+ return __x;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
+ {
+ __is.setf(ios_base::fmtflags(0), __f._M_mask);
+ return __is;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
+ {
+ __os.setf(ios_base::fmtflags(0), __f._M_mask);
+ return __os;
+ }
+
+
+ struct _Setiosflags { ios_base::fmtflags _M_mask; };
+
+ /**
+ * @brief Manipulator for @c setf.
+ * @param mask A format flags mask.
+ *
+ * Sent to a stream object, this manipulator sets the format flags
+ * to @a mask.
+ */
+ inline _Setiosflags
+ setiosflags(ios_base::fmtflags __mask)
+ {
+ _Setiosflags __x;
+ __x._M_mask = __mask;
+ return __x;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
+ {
+ __is.setf(__f._M_mask);
+ return __is;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
+ {
+ __os.setf(__f._M_mask);
+ return __os;
+ }
+
+
+ struct _Setbase { int _M_base; };
+
+ /**
+ * @brief Manipulator for @c setf.
+ * @param base A numeric base.
+ *
+ * Sent to a stream object, this manipulator changes the
+ * @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base
+ * is 8, 10, or 16, accordingly, and to 0 if @a base is any other value.
+ */
+ inline _Setbase
+ setbase(int __base)
+ {
+ _Setbase __x;
+ __x._M_base = __base;
+ return __x;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
+ {
+ __is.setf(__f._M_base == 8 ? ios_base::oct :
+ __f._M_base == 10 ? ios_base::dec :
+ __f._M_base == 16 ? ios_base::hex :
+ ios_base::fmtflags(0), ios_base::basefield);
+ return __is;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
+ {
+ __os.setf(__f._M_base == 8 ? ios_base::oct :
+ __f._M_base == 10 ? ios_base::dec :
+ __f._M_base == 16 ? ios_base::hex :
+ ios_base::fmtflags(0), ios_base::basefield);
+ return __os;
+ }
+
+
+ template<typename _CharT>
+ struct _Setfill { _CharT _M_c; };
+
+ /**
+ * @brief Manipulator for @c fill.
+ * @param c The new fill character.
+ *
+ * Sent to a stream object, this manipulator calls @c fill(c) for that
+ * object.
+ */
+ template<typename _CharT>
+ inline _Setfill<_CharT>
+ setfill(_CharT __c)
+ {
+ _Setfill<_CharT> __x;
+ __x._M_c = __c;
+ return __x;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
+ {
+ __is.fill(__f._M_c);
+ return __is;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
+ {
+ __os.fill(__f._M_c);
+ return __os;
+ }
+
+
+ struct _Setprecision { int _M_n; };
+
+ /**
+ * @brief Manipulator for @c precision.
+ * @param n The new precision.
+ *
+ * Sent to a stream object, this manipulator calls @c precision(n) for
+ * that object.
+ */
+ inline _Setprecision
+ setprecision(int __n)
+ {
+ _Setprecision __x;
+ __x._M_n = __n;
+ return __x;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
+ {
+ __is.precision(__f._M_n);
+ return __is;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
+ {
+ __os.precision(__f._M_n);
+ return __os;
+ }
+
+
+ struct _Setw { int _M_n; };
+
+ /**
+ * @brief Manipulator for @c width.
+ * @param n The new width.
+ *
+ * Sent to a stream object, this manipulator calls @c width(n) for
+ * that object.
+ */
+ inline _Setw
+ setw(int __n)
+ {
+ _Setw __x;
+ __x._M_n = __n;
+ return __x;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
+ {
+ __is.width(__f._M_n);
+ return __is;
+ }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
+ {
+ __os.width(__f._M_n);
+ return __os;
+ }
+
+ // Inhibit implicit instantiations for required instantiations,
+ // which are defined via explicit instantiations elsewhere.
+ // NB: This syntax is a GNU extension.
+#if _GLIBCXX_EXTERN_TEMPLATE
+ extern template ostream& operator<<(ostream&, _Setfill<char>);
+ extern template ostream& operator<<(ostream&, _Setiosflags);
+ extern template ostream& operator<<(ostream&, _Resetiosflags);
+ extern template ostream& operator<<(ostream&, _Setbase);
+ extern template ostream& operator<<(ostream&, _Setprecision);
+ extern template ostream& operator<<(ostream&, _Setw);
+ extern template istream& operator>>(istream&, _Setfill<char>);
+ extern template istream& operator>>(istream&, _Setiosflags);
+ extern template istream& operator>>(istream&, _Resetiosflags);
+ extern template istream& operator>>(istream&, _Setbase);
+ extern template istream& operator>>(istream&, _Setprecision);
+ extern template istream& operator>>(istream&, _Setw);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);
+ extern template wostream& operator<<(wostream&, _Setiosflags);
+ extern template wostream& operator<<(wostream&, _Resetiosflags);
+ extern template wostream& operator<<(wostream&, _Setbase);
+ extern template wostream& operator<<(wostream&, _Setprecision);
+ extern template wostream& operator<<(wostream&, _Setw);
+ extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);
+ extern template wistream& operator>>(wistream&, _Setiosflags);
+ extern template wistream& operator>>(wistream&, _Resetiosflags);
+ extern template wistream& operator>>(wistream&, _Setbase);
+ extern template wistream& operator>>(wistream&, _Setprecision);
+ extern template wistream& operator>>(wistream&, _Setw);
+#endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_IOMANIP */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/ios b/gcc-4.4.0/libstdc++-v3/include/std/ios
new file mode 100644
index 000000000..d561ac663
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/ios
@@ -0,0 +1,47 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ios
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#ifndef _GLIBCXX_IOS
+#define _GLIBCXX_IOS 1
+
+#pragma GCC system_header
+
+#include <iosfwd>
+#include <exception> // For ios_base::failure
+#include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos
+#include <bits/localefwd.h> // For class locale
+#include <bits/ios_base.h> // For ios_base declarations.
+#include <streambuf>
+#include <bits/basic_ios.h>
+
+#endif /* _GLIBCXX_IOS */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/iosfwd b/gcc-4.4.0/libstdc++-v3/include/std/iosfwd
new file mode 100644
index 000000000..9bba0ab6b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/iosfwd
@@ -0,0 +1,160 @@
+// Forwarding declarations -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file iosfwd
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.2 Forward declarations
+//
+
+#ifndef _GLIBCXX_IOSFWD
+#define _GLIBCXX_IOSFWD 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/stringfwd.h> // For string forward declarations.
+#include <bits/postypes.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ios;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_streambuf;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_istream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ostream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_iostream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_stringbuf;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_istringstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_ostringstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_stringstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_filebuf;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ifstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ofstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_fstream;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class istreambuf_iterator;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class ostreambuf_iterator;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // Not included. (??? Apparently no LWG number?)
+ class ios_base;
+
+ /**
+ * @defgroup io I/O
+ *
+ * Nearly all of the I/O classes are parameterized on the type of
+ * characters they read and write. (The major exception is ios_base at
+ * the top of the hierarchy.) This is a change from pre-Standard
+ * streams, which were not templates.
+ *
+ * For ease of use and compatibility, all of the basic_* I/O-related
+ * classes are given typedef names for both of the builtin character
+ * widths (wide and narrow). The typedefs are the same as the
+ * pre-Standard names, for example:
+ *
+ * @code
+ * typedef basic_ifstream<char> ifstream;
+ * @endcode
+ *
+ * Because properly forward-declaring these classes can be difficult, you
+ * should not do it yourself. Instead, include the &lt;iosfwd&gt;
+ * header, which contains only declarations of all the I/O classes as
+ * well as the typedefs. Trying to forward-declare the typedefs
+ * themselves (e.g., "class ostream;") is not valid ISO C++.
+ *
+ * For more specific declarations, see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
+ *
+ * @{
+ */
+ typedef basic_ios<char> ios; ///< @isiosfwd
+ typedef basic_streambuf<char> streambuf; ///< @isiosfwd
+ typedef basic_istream<char> istream; ///< @isiosfwd
+ typedef basic_ostream<char> ostream; ///< @isiosfwd
+ typedef basic_iostream<char> iostream; ///< @isiosfwd
+ typedef basic_stringbuf<char> stringbuf; ///< @isiosfwd
+ typedef basic_istringstream<char> istringstream; ///< @isiosfwd
+ typedef basic_ostringstream<char> ostringstream; ///< @isiosfwd
+ typedef basic_stringstream<char> stringstream; ///< @isiosfwd
+ typedef basic_filebuf<char> filebuf; ///< @isiosfwd
+ typedef basic_ifstream<char> ifstream; ///< @isiosfwd
+ typedef basic_ofstream<char> ofstream; ///< @isiosfwd
+ typedef basic_fstream<char> fstream; ///< @isiosfwd
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef basic_ios<wchar_t> wios; ///< @isiosfwd
+ typedef basic_streambuf<wchar_t> wstreambuf; ///< @isiosfwd
+ typedef basic_istream<wchar_t> wistream; ///< @isiosfwd
+ typedef basic_ostream<wchar_t> wostream; ///< @isiosfwd
+ typedef basic_iostream<wchar_t> wiostream; ///< @isiosfwd
+ typedef basic_stringbuf<wchar_t> wstringbuf; ///< @isiosfwd
+ typedef basic_istringstream<wchar_t> wistringstream; ///< @isiosfwd
+ typedef basic_ostringstream<wchar_t> wostringstream; ///< @isiosfwd
+ typedef basic_stringstream<wchar_t> wstringstream; ///< @isiosfwd
+ typedef basic_filebuf<wchar_t> wfilebuf; ///< @isiosfwd
+ typedef basic_ifstream<wchar_t> wifstream; ///< @isiosfwd
+ typedef basic_ofstream<wchar_t> wofstream; ///< @isiosfwd
+ typedef basic_fstream<wchar_t> wfstream; ///< @isiosfwd
+#endif
+ /** @} */
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_IOSFWD */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/iostream b/gcc-4.4.0/libstdc++-v3/include/std/iostream
new file mode 100644
index 000000000..e14c4f366
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/iostream
@@ -0,0 +1,76 @@
+// Standard iostream objects -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file iostream
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.3 Standard iostream objects
+//
+
+#ifndef _GLIBCXX_IOSTREAM
+#define _GLIBCXX_IOSTREAM 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <ostream>
+#include <istream>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @name Standard Stream Objects
+ *
+ * The &lt;iostream&gt; header declares the eight <em>standard stream
+ * objects</em>. For other declarations, see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
+ * and the @link iosfwd I/O forward declarations @endlink
+ *
+ * They are required by default to cooperate with the global C library's
+ * @c FILE streams, and to be available during program startup and
+ * termination. For more information, see the HOWTO linked to above.
+ */
+ //@{
+ extern istream cin; ///< Linked to standard input
+ extern ostream cout; ///< Linked to standard output
+ extern ostream cerr; ///< Linked to standard error (unbuffered)
+ extern ostream clog; ///< Linked to standard error (buffered)
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern wistream wcin; ///< Linked to standard input
+ extern wostream wcout; ///< Linked to standard output
+ extern wostream wcerr; ///< Linked to standard error (unbuffered)
+ extern wostream wclog; ///< Linked to standard error (buffered)
+#endif
+ //@}
+
+ // For construction of filebuffers for cout, cin, cerr, clog et. al.
+ static ios_base::Init __ioinit;
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_IOSTREAM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/istream b/gcc-4.4.0/libstdc++-v3/include/std/istream
new file mode 100644
index 000000000..521be7fd5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/istream
@@ -0,0 +1,833 @@
+// Input streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.6.1 Input streams
+//
+
+/** @file istream
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_ISTREAM
+#define _GLIBCXX_ISTREAM 1
+
+#pragma GCC system_header
+
+#include <ios>
+#include <ostream>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // [27.6.1.1] Template class basic_istream
+ /**
+ * @brief Controlling input.
+ * @ingroup io
+ *
+ * This is the base class for all input streams. It provides text
+ * formatting of all builtin types, and communicates with any class
+ * derived from basic_streambuf to do the actual input.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_istream : virtual public basic_ios<_CharT, _Traits>
+ {
+ public:
+ // Types (inherited from basic_ios (27.4.4)):
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_ios<_CharT, _Traits> __ios_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
+ __num_get_type;
+ typedef ctype<_CharT> __ctype_type;
+
+ protected:
+ // Data Members:
+ /**
+ * The number of characters extracted in the previous unformatted
+ * function; see gcount().
+ */
+ streamsize _M_gcount;
+
+ public:
+ // [27.6.1.1.1] constructor/destructor
+ /**
+ * @brief Base constructor.
+ *
+ * This ctor is almost never called by the user directly, rather from
+ * derived classes' initialization lists, which pass a pointer to
+ * their own stream buffer.
+ */
+ explicit
+ basic_istream(__streambuf_type* __sb)
+ : _M_gcount(streamsize(0))
+ { this->init(__sb); }
+
+ /**
+ * @brief Base destructor.
+ *
+ * This does very little apart from providing a virtual base dtor.
+ */
+ virtual
+ ~basic_istream()
+ { _M_gcount = streamsize(0); }
+
+ // [27.6.1.1.2] prefix/suffix
+ class sentry;
+ friend class sentry;
+
+ // [27.6.1.2] formatted input
+ // [27.6.1.2.3] basic_istream::operator>>
+ //@{
+ /**
+ * @brief Interface for manipulators.
+ *
+ * Manipulators such as @c std::ws and @c std::dec use these
+ * functions in constructs like "std::cin >> std::ws". For more
+ * information, see the iomanip header.
+ */
+ __istream_type&
+ operator>>(__istream_type& (*__pf)(__istream_type&))
+ { return __pf(*this); }
+
+ __istream_type&
+ operator>>(__ios_type& (*__pf)(__ios_type&))
+ {
+ __pf(*this);
+ return *this;
+ }
+
+ __istream_type&
+ operator>>(ios_base& (*__pf)(ios_base&))
+ {
+ __pf(*this);
+ return *this;
+ }
+ //@}
+
+ // [27.6.1.2.2] arithmetic extractors
+ /**
+ * @name Arithmetic Extractors
+ *
+ * All the @c operator>> functions (aka <em>formatted input
+ * functions</em>) have some common behavior. Each starts by
+ * constructing a temporary object of type std::basic_istream::sentry
+ * with the second argument (noskipws) set to false. This has several
+ * effects, concluding with the setting of a status flag; see the
+ * sentry documentation for more.
+ *
+ * If the sentry status is good, the function tries to extract
+ * whatever data is appropriate for the type of the argument.
+ *
+ * If an exception is thrown during extraction, ios_base::badbit
+ * will be turned on in the stream's error state without causing an
+ * ios_base::failure to be thrown. The original exception will then
+ * be rethrown.
+ */
+ //@{
+ /**
+ * @brief Basic arithmetic extractors
+ * @param A variable of builtin type.
+ * @return @c *this if successful
+ *
+ * These functions use the stream's current locale (specifically, the
+ * @c num_get facet) to parse the input data.
+ */
+ __istream_type&
+ operator>>(bool& __n)
+ { return _M_extract(__n); }
+
+ __istream_type&
+ operator>>(short& __n);
+
+ __istream_type&
+ operator>>(unsigned short& __n)
+ { return _M_extract(__n); }
+
+ __istream_type&
+ operator>>(int& __n);
+
+ __istream_type&
+ operator>>(unsigned int& __n)
+ { return _M_extract(__n); }
+
+ __istream_type&
+ operator>>(long& __n)
+ { return _M_extract(__n); }
+
+ __istream_type&
+ operator>>(unsigned long& __n)
+ { return _M_extract(__n); }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ __istream_type&
+ operator>>(long long& __n)
+ { return _M_extract(__n); }
+
+ __istream_type&
+ operator>>(unsigned long long& __n)
+ { return _M_extract(__n); }
+#endif
+
+ __istream_type&
+ operator>>(float& __f)
+ { return _M_extract(__f); }
+
+ __istream_type&
+ operator>>(double& __f)
+ { return _M_extract(__f); }
+
+ __istream_type&
+ operator>>(long double& __f)
+ { return _M_extract(__f); }
+
+ __istream_type&
+ operator>>(void*& __p)
+ { return _M_extract(__p); }
+
+ /**
+ * @brief Extracting into another streambuf.
+ * @param sb A pointer to a streambuf
+ *
+ * This function behaves like one of the basic arithmetic extractors,
+ * in that it also constructs a sentry object and has the same error
+ * handling behavior.
+ *
+ * If @a sb is NULL, the stream will set failbit in its error state.
+ *
+ * Characters are extracted from this stream and inserted into the
+ * @a sb streambuf until one of the following occurs:
+ *
+ * - the input stream reaches end-of-file,
+ * - insertion into the output buffer fails (in this case, the
+ * character that would have been inserted is not extracted), or
+ * - an exception occurs (and in this case is caught)
+ *
+ * If the function inserts no characters, failbit is set.
+ */
+ __istream_type&
+ operator>>(__streambuf_type* __sb);
+ //@}
+
+ // [27.6.1.3] unformatted input
+ /**
+ * @brief Character counting
+ * @return The number of characters extracted by the previous
+ * unformatted input function dispatched for this stream.
+ */
+ streamsize
+ gcount() const
+ { return _M_gcount; }
+
+ /**
+ * @name Unformatted Input Functions
+ *
+ * All the unformatted input functions have some common behavior.
+ * Each starts by constructing a temporary object of type
+ * std::basic_istream::sentry with the second argument (noskipws)
+ * set to true. This has several effects, concluding with the
+ * setting of a status flag; see the sentry documentation for more.
+ *
+ * If the sentry status is good, the function tries to extract
+ * whatever data is appropriate for the type of the argument.
+ *
+ * The number of characters extracted is stored for later retrieval
+ * by gcount().
+ *
+ * If an exception is thrown during extraction, ios_base::badbit
+ * will be turned on in the stream's error state without causing an
+ * ios_base::failure to be thrown. The original exception will then
+ * be rethrown.
+ */
+ //@{
+ /**
+ * @brief Simple extraction.
+ * @return A character, or eof().
+ *
+ * Tries to extract a character. If none are available, sets failbit
+ * and returns traits::eof().
+ */
+ int_type
+ get();
+
+ /**
+ * @brief Simple extraction.
+ * @param c The character in which to store data.
+ * @return *this
+ *
+ * Tries to extract a character and store it in @a c. If none are
+ * available, sets failbit and returns traits::eof().
+ *
+ * @note This function is not overloaded on signed char and
+ * unsigned char.
+ */
+ __istream_type&
+ get(char_type& __c);
+
+ /**
+ * @brief Simple multiple-character extraction.
+ * @param s Pointer to an array.
+ * @param n Maximum number of characters to store in @a s.
+ * @param delim A "stop" character.
+ * @return *this
+ *
+ * Characters are extracted and stored into @a s until one of the
+ * following happens:
+ *
+ * - @c n-1 characters are stored
+ * - the input sequence reaches EOF
+ * - the next character equals @a delim, in which case the character
+ * is not extracted
+ *
+ * If no characters are stored, failbit is set in the stream's error
+ * state.
+ *
+ * In any case, a null character is stored into the next location in
+ * the array.
+ *
+ * @note This function is not overloaded on signed char and
+ * unsigned char.
+ */
+ __istream_type&
+ get(char_type* __s, streamsize __n, char_type __delim);
+
+ /**
+ * @brief Simple multiple-character extraction.
+ * @param s Pointer to an array.
+ * @param n Maximum number of characters to store in @a s.
+ * @return *this
+ *
+ * Returns @c get(s,n,widen('\n')).
+ */
+ __istream_type&
+ get(char_type* __s, streamsize __n)
+ { return this->get(__s, __n, this->widen('\n')); }
+
+ /**
+ * @brief Extraction into another streambuf.
+ * @param sb A streambuf in which to store data.
+ * @param delim A "stop" character.
+ * @return *this
+ *
+ * Characters are extracted and inserted into @a sb until one of the
+ * following happens:
+ *
+ * - the input sequence reaches EOF
+ * - insertion into the output buffer fails (in this case, the
+ * character that would have been inserted is not extracted)
+ * - the next character equals @a delim (in this case, the character
+ * is not extracted)
+ * - an exception occurs (and in this case is caught)
+ *
+ * If no characters are stored, failbit is set in the stream's error
+ * state.
+ */
+ __istream_type&
+ get(__streambuf_type& __sb, char_type __delim);
+
+ /**
+ * @brief Extraction into another streambuf.
+ * @param sb A streambuf in which to store data.
+ * @return *this
+ *
+ * Returns @c get(sb,widen('\n')).
+ */
+ __istream_type&
+ get(__streambuf_type& __sb)
+ { return this->get(__sb, this->widen('\n')); }
+
+ /**
+ * @brief String extraction.
+ * @param s A character array in which to store the data.
+ * @param n Maximum number of characters to extract.
+ * @param delim A "stop" character.
+ * @return *this
+ *
+ * Extracts and stores characters into @a s until one of the
+ * following happens. Note that these criteria are required to be
+ * tested in the order listed here, to allow an input line to exactly
+ * fill the @a s array without setting failbit.
+ *
+ * -# the input sequence reaches end-of-file, in which case eofbit
+ * is set in the stream error state
+ * -# the next character equals @c delim, in which case the character
+ * is extracted (and therefore counted in @c gcount()) but not stored
+ * -# @c n-1 characters are stored, in which case failbit is set
+ * in the stream error state
+ *
+ * If no characters are extracted, failbit is set. (An empty line of
+ * input should therefore not cause failbit to be set.)
+ *
+ * In any case, a null character is stored in the next location in
+ * the array.
+ */
+ __istream_type&
+ getline(char_type* __s, streamsize __n, char_type __delim);
+
+ /**
+ * @brief String extraction.
+ * @param s A character array in which to store the data.
+ * @param n Maximum number of characters to extract.
+ * @return *this
+ *
+ * Returns @c getline(s,n,widen('\n')).
+ */
+ __istream_type&
+ getline(char_type* __s, streamsize __n)
+ { return this->getline(__s, __n, this->widen('\n')); }
+
+ /**
+ * @brief Discarding characters
+ * @param n Number of characters to discard.
+ * @param delim A "stop" character.
+ * @return *this
+ *
+ * Extracts characters and throws them away until one of the
+ * following happens:
+ * - if @a n @c != @c std::numeric_limits<int>::max(), @a n
+ * characters are extracted
+ * - the input sequence reaches end-of-file
+ * - the next character equals @a delim (in this case, the character
+ * is extracted); note that this condition will never occur if
+ * @a delim equals @c traits::eof().
+ *
+ * NB: Provide three overloads, instead of the single function
+ * (with defaults) mandated by the Standard: this leads to a
+ * better performing implementation, while still conforming to
+ * the Standard.
+ */
+ __istream_type&
+ ignore();
+
+ __istream_type&
+ ignore(streamsize __n);
+
+ __istream_type&
+ ignore(streamsize __n, int_type __delim);
+
+ /**
+ * @brief Looking ahead in the stream
+ * @return The next character, or eof().
+ *
+ * If, after constructing the sentry object, @c good() is false,
+ * returns @c traits::eof(). Otherwise reads but does not extract
+ * the next input character.
+ */
+ int_type
+ peek();
+
+ /**
+ * @brief Extraction without delimiters.
+ * @param s A character array.
+ * @param n Maximum number of characters to store.
+ * @return *this
+ *
+ * If the stream state is @c good(), extracts characters and stores
+ * them into @a s until one of the following happens:
+ * - @a n characters are stored
+ * - the input sequence reaches end-of-file, in which case the error
+ * state is set to @c failbit|eofbit.
+ *
+ * @note This function is not overloaded on signed char and
+ * unsigned char.
+ */
+ __istream_type&
+ read(char_type* __s, streamsize __n);
+
+ /**
+ * @brief Extraction until the buffer is exhausted, but no more.
+ * @param s A character array.
+ * @param n Maximum number of characters to store.
+ * @return The number of characters extracted.
+ *
+ * Extracts characters and stores them into @a s depending on the
+ * number of characters remaining in the streambuf's buffer,
+ * @c rdbuf()->in_avail(), called @c A here:
+ * - if @c A @c == @c -1, sets eofbit and extracts no characters
+ * - if @c A @c == @c 0, extracts no characters
+ * - if @c A @c > @c 0, extracts @c min(A,n)
+ *
+ * The goal is to empty the current buffer, and to not request any
+ * more from the external input sequence controlled by the streambuf.
+ */
+ streamsize
+ readsome(char_type* __s, streamsize __n);
+
+ /**
+ * @brief Unextracting a single character.
+ * @param c The character to push back into the input stream.
+ * @return *this
+ *
+ * If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c).
+ *
+ * If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in
+ * the error state.
+ *
+ * @note Since no characters are extracted, the next call to
+ * @c gcount() will return 0, as required by DR 60.
+ */
+ __istream_type&
+ putback(char_type __c);
+
+ /**
+ * @brief Unextracting the previous character.
+ * @return *this
+ *
+ * If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c).
+ *
+ * If @c rdbuf() is null or if @c sungetc() fails, sets badbit in
+ * the error state.
+ *
+ * @note Since no characters are extracted, the next call to
+ * @c gcount() will return 0, as required by DR 60.
+ */
+ __istream_type&
+ unget();
+
+ /**
+ * @brief Synchronizing the stream buffer.
+ * @return 0 on success, -1 on failure
+ *
+ * If @c rdbuf() is a null pointer, returns -1.
+ *
+ * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1,
+ * sets badbit and returns -1.
+ *
+ * Otherwise, returns 0.
+ *
+ * @note This function does not count the number of characters
+ * extracted, if any, and therefore does not affect the next
+ * call to @c gcount().
+ */
+ int
+ sync();
+
+ /**
+ * @brief Getting the current read position.
+ * @return A file position object.
+ *
+ * If @c fail() is not false, returns @c pos_type(-1) to indicate
+ * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,in).
+ *
+ * @note This function does not count the number of characters
+ * extracted, if any, and therefore does not affect the next
+ * call to @c gcount().
+ */
+ pos_type
+ tellg();
+
+ /**
+ * @brief Changing the current read position.
+ * @param pos A file position object.
+ * @return *this
+ *
+ * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If
+ * that function fails, sets failbit.
+ *
+ * @note This function does not count the number of characters
+ * extracted, if any, and therefore does not affect the next
+ * call to @c gcount().
+ */
+ __istream_type&
+ seekg(pos_type);
+
+ /**
+ * @brief Changing the current read position.
+ * @param off A file offset object.
+ * @param dir The direction in which to seek.
+ * @return *this
+ *
+ * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir).
+ * If that function fails, sets failbit.
+ *
+ * @note This function does not count the number of characters
+ * extracted, if any, and therefore does not affect the next
+ * call to @c gcount().
+ */
+ __istream_type&
+ seekg(off_type, ios_base::seekdir);
+ //@}
+
+ protected:
+ basic_istream()
+ : _M_gcount(streamsize(0))
+ { this->init(0); }
+
+ template<typename _ValueT>
+ __istream_type&
+ _M_extract(_ValueT& __v);
+ };
+
+ // Explicit specialization declarations, defined in src/istream.cc.
+ template<>
+ basic_istream<char>&
+ basic_istream<char>::
+ getline(char_type* __s, streamsize __n, char_type __delim);
+
+ template<>
+ basic_istream<char>&
+ basic_istream<char>::
+ ignore(streamsize __n);
+
+ template<>
+ basic_istream<char>&
+ basic_istream<char>::
+ ignore(streamsize __n, int_type __delim);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ basic_istream<wchar_t>&
+ basic_istream<wchar_t>::
+ getline(char_type* __s, streamsize __n, char_type __delim);
+
+ template<>
+ basic_istream<wchar_t>&
+ basic_istream<wchar_t>::
+ ignore(streamsize __n);
+
+ template<>
+ basic_istream<wchar_t>&
+ basic_istream<wchar_t>::
+ ignore(streamsize __n, int_type __delim);
+#endif
+
+ /**
+ * @brief Performs setup work for input streams.
+ *
+ * Objects of this class are created before all of the standard
+ * extractors are run. It is responsible for "exception-safe prefix and
+ * suffix operations," although only prefix actions are currently required
+ * by the standard.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_istream<_CharT, _Traits>::sentry
+ {
+ public:
+ /// Easy access to dependant types.
+ typedef _Traits traits_type;
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::__ctype_type __ctype_type;
+ typedef typename _Traits::int_type __int_type;
+
+ /**
+ * @brief The constructor performs all the work.
+ * @param is The input stream to guard.
+ * @param noskipws Whether to consume whitespace or not.
+ *
+ * If the stream state is good (@a is.good() is true), then the
+ * following actions are performed, otherwise the sentry state is
+ * false ("not okay") and failbit is set in the stream state.
+ *
+ * The sentry's preparatory actions are:
+ *
+ * -# if the stream is tied to an output stream, @c is.tie()->flush()
+ * is called to synchronize the output sequence
+ * -# if @a noskipws is false, and @c ios_base::skipws is set in
+ * @c is.flags(), the sentry extracts and discards whitespace
+ * characters from the stream. The currently imbued locale is
+ * used to determine whether each character is whitespace.
+ *
+ * If the stream state is still good, then the sentry state becomes
+ * true ("okay").
+ */
+ explicit
+ sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
+
+ /**
+ * @brief Quick status checking.
+ * @return The sentry state.
+ *
+ * For ease of use, sentries may be converted to booleans. The
+ * return value is that of the sentry state (true == okay).
+ */
+ operator bool() const
+ { return _M_ok; }
+
+ private:
+ bool _M_ok;
+ };
+
+ // [27.6.1.2.3] character extraction templates
+ //@{
+ /**
+ * @brief Character extractors
+ * @param in An input stream.
+ * @param c A character reference.
+ * @return in
+ *
+ * Behaves like one of the formatted arithmetic extractors described in
+ * std::basic_istream. After constructing a sentry object with good
+ * status, this function extracts a character (if one is available) and
+ * stores it in @a c. Otherwise, sets failbit in the input stream.
+ */
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
+
+ template<class _Traits>
+ inline basic_istream<char, _Traits>&
+ operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
+ { return (__in >> reinterpret_cast<char&>(__c)); }
+
+ template<class _Traits>
+ inline basic_istream<char, _Traits>&
+ operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
+ { return (__in >> reinterpret_cast<char&>(__c)); }
+ //@}
+
+ //@{
+ /**
+ * @brief Character string extractors
+ * @param in An input stream.
+ * @param s A pointer to a character array.
+ * @return in
+ *
+ * Behaves like one of the formatted arithmetic extractors described in
+ * std::basic_istream. After constructing a sentry object with good
+ * status, this function extracts up to @c n characters and stores them
+ * into the array starting at @a s. @c n is defined as:
+ *
+ * - if @c width() is greater than zero, @c n is width()
+ * - otherwise @c n is "the number of elements of the largest array of
+ * @c char_type that can store a terminating @c eos." [27.6.1.2.3]/6
+ *
+ * Characters are extracted and stored until one of the following happens:
+ * - @c n-1 characters are stored
+ * - EOF is reached
+ * - the next character is whitespace according to the current locale
+ * - the next character is a null byte (i.e., @c charT() )
+ *
+ * @c width(0) is then called for the input stream.
+ *
+ * If no characters are extracted, sets failbit.
+ */
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
+
+ // Explicit specialization declaration, defined in src/istream.cc.
+ template<>
+ basic_istream<char>&
+ operator>>(basic_istream<char>& __in, char* __s);
+
+ template<class _Traits>
+ inline basic_istream<char, _Traits>&
+ operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
+ { return (__in >> reinterpret_cast<char*>(__s)); }
+
+ template<class _Traits>
+ inline basic_istream<char, _Traits>&
+ operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
+ { return (__in >> reinterpret_cast<char*>(__s)); }
+ //@}
+
+ // 27.6.1.5 Template class basic_iostream
+ /**
+ * @brief Merging istream and ostream capabilities.
+ * @ingroup io
+ *
+ * This class multiply inherits from the input and output stream classes
+ * simply to provide a single interface.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_iostream
+ : public basic_istream<_CharT, _Traits>,
+ public basic_ostream<_CharT, _Traits>
+ {
+ public:
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 271. basic_iostream missing typedefs
+ // Types (inherited):
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+
+ /**
+ * @brief Constructor does nothing.
+ *
+ * Both of the parent classes are initialized with the same
+ * streambuf pointer passed to this constructor.
+ */
+ explicit
+ basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
+ : __istream_type(__sb), __ostream_type(__sb) { }
+
+ /**
+ * @brief Destructor does nothing.
+ */
+ virtual
+ ~basic_iostream() { }
+
+ protected:
+ basic_iostream()
+ : __istream_type(), __ostream_type() { }
+ };
+
+ // [27.6.1.4] standard basic_istream manipulators
+ /**
+ * @brief Quick and easy way to eat whitespace
+ *
+ * This manipulator extracts whitespace characters, stopping when the
+ * next character is non-whitespace, or when the input sequence is empty.
+ * If the sequence is empty, @c eofbit is set in the stream, but not
+ * @c failbit.
+ *
+ * The current locale is used to distinguish whitespace characters.
+ *
+ * Example:
+ * @code
+ * MyClass mc;
+ *
+ * std::cin >> std::ws >> mc;
+ * @endcode
+ * will skip leading whitespace before calling operator>> on cin and your
+ * object. Note that the same effect can be achieved by creating a
+ * std::basic_istream::sentry inside your definition of operator>>.
+ */
+ template<typename _CharT, typename _Traits>
+ basic_istream<_CharT, _Traits>&
+ ws(basic_istream<_CharT, _Traits>& __is);
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/istream.tcc>
+#endif
+
+#endif /* _GLIBCXX_ISTREAM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/iterator b/gcc-4.4.0/libstdc++-v3/include/std/iterator
new file mode 100644
index 000000000..a15bdf974
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/iterator
@@ -0,0 +1,70 @@
+// <iterator> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/iterator
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_ITERATOR
+#define _GLIBCXX_ITERATOR 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/stl_iterator.h>
+#include <ostream>
+#include <istream>
+#include <bits/stream_iterator.h>
+#include <bits/streambuf_iterator.h>
+
+#endif /* _GLIBCXX_ITERATOR */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/limits b/gcc-4.4.0/libstdc++-v3/include/std/limits
new file mode 100644
index 000000000..41bf806d5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/limits
@@ -0,0 +1,1256 @@
+// The template and inlines for the numeric_limits classes. -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file limits
+ * This is a Standard C++ Library header.
+ */
+
+// Note: this is not a conforming implementation.
+// Written by Gabriel Dos Reis <gdr@codesourcery.com>
+
+//
+// ISO 14882:1998
+// 18.2.1
+//
+
+#ifndef _GLIBCXX_NUMERIC_LIMITS
+#define _GLIBCXX_NUMERIC_LIMITS 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+//
+// The numeric_limits<> traits document implementation-defined aspects
+// of fundamental arithmetic data types (integers and floating points).
+// From Standard C++ point of view, there are 13 such types:
+// * integers
+// bool (1)
+// char, signed char, unsigned char (3)
+// short, unsigned short (2)
+// int, unsigned (2)
+// long, unsigned long (2)
+//
+// * floating points
+// float (1)
+// double (1)
+// long double (1)
+//
+// GNU C++ understands (where supported by the host C-library)
+// * integer
+// long long, unsigned long long (2)
+//
+// which brings us to 15 fundamental arithmetic data types in GNU C++.
+//
+//
+// Since a numeric_limits<> is a bit tricky to get right, we rely on
+// an interface composed of macros which should be defined in config/os
+// or config/cpu when they differ from the generic (read arbitrary)
+// definitions given here.
+//
+
+// These values can be overridden in the target configuration file.
+// The default values are appropriate for many 32-bit targets.
+
+// GCC only intrinsically supports modulo integral types. The only remaining
+// integral exceptional values is division by zero. Only targets that do not
+// signal division by zero in some "hard to ignore" way should use false.
+#ifndef __glibcxx_integral_traps
+# define __glibcxx_integral_traps true
+#endif
+
+// float
+//
+
+// Default values. Should be overridden in configuration files if necessary.
+
+#ifndef __glibcxx_float_has_denorm_loss
+# define __glibcxx_float_has_denorm_loss false
+#endif
+#ifndef __glibcxx_float_traps
+# define __glibcxx_float_traps false
+#endif
+#ifndef __glibcxx_float_tinyness_before
+# define __glibcxx_float_tinyness_before false
+#endif
+
+// double
+
+// Default values. Should be overridden in configuration files if necessary.
+
+#ifndef __glibcxx_double_has_denorm_loss
+# define __glibcxx_double_has_denorm_loss false
+#endif
+#ifndef __glibcxx_double_traps
+# define __glibcxx_double_traps false
+#endif
+#ifndef __glibcxx_double_tinyness_before
+# define __glibcxx_double_tinyness_before false
+#endif
+
+// long double
+
+// Default values. Should be overridden in configuration files if necessary.
+
+#ifndef __glibcxx_long_double_has_denorm_loss
+# define __glibcxx_long_double_has_denorm_loss false
+#endif
+#ifndef __glibcxx_long_double_traps
+# define __glibcxx_long_double_traps false
+#endif
+#ifndef __glibcxx_long_double_tinyness_before
+# define __glibcxx_long_double_tinyness_before false
+#endif
+
+// You should not need to define any macros below this point.
+
+#define __glibcxx_signed(T) ((T)(-1) < 0)
+
+#define __glibcxx_min(T) \
+ (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
+
+#define __glibcxx_max(T) \
+ (__glibcxx_signed (T) ? \
+ (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0)
+
+#define __glibcxx_digits(T) \
+ (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
+
+// The fraction 643/2136 approximates log10(2) to 7 significant digits.
+#define __glibcxx_digits10(T) \
+ (__glibcxx_digits (T) * 643 / 2136)
+
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @brief Describes the rounding style for floating-point types.
+ *
+ * This is used in the std::numeric_limits class.
+ */
+ enum float_round_style
+ {
+ round_indeterminate = -1, ///< Self-explanatory.
+ round_toward_zero = 0, ///< Self-explanatory.
+ round_to_nearest = 1, ///< To the nearest representable value.
+ round_toward_infinity = 2, ///< Self-explanatory.
+ round_toward_neg_infinity = 3 ///< Self-explanatory.
+ };
+
+ /**
+ * @brief Describes the denormalization for floating-point types.
+ *
+ * These values represent the presence or absence of a variable number
+ * of exponent bits. This type is used in the std::numeric_limits class.
+ */
+ enum float_denorm_style
+ {
+ /// Indeterminate at compile time whether denormalized values are allowed.
+ denorm_indeterminate = -1,
+ /// The type does not allow denormalized values.
+ denorm_absent = 0,
+ /// The type allows denormalized values.
+ denorm_present = 1
+ };
+
+ /**
+ * @brief Part of std::numeric_limits.
+ *
+ * The @c static @c const members are usable as integral constant
+ * expressions.
+ *
+ * @note This is a separate class for purposes of efficiency; you
+ * should only access these members as part of an instantiation
+ * of the std::numeric_limits class.
+ */
+ struct __numeric_limits_base
+ {
+ /** This will be true for all fundamental types (which have
+ specializations), and false for everything else. */
+ static const bool is_specialized = false;
+
+ /** The number of @c radix digits that be represented without change: for
+ integer types, the number of non-sign bits in the mantissa; for
+ floating types, the number of @c radix digits in the mantissa. */
+ static const int digits = 0;
+ /** The number of base 10 digits that can be represented without change. */
+ static const int digits10 = 0;
+ /** True if the type is signed. */
+ static const bool is_signed = false;
+ /** True if the type is integer.
+ * Is this supposed to be "if the type is integral"?
+ */
+ static const bool is_integer = false;
+ /** True if the type uses an exact representation. "All integer types are
+ exact, but not all exact types are integer. For example, rational and
+ fixed-exponent representations are exact but not integer."
+ [18.2.1.2]/15 */
+ static const bool is_exact = false;
+ /** For integer types, specifies the base of the representation. For
+ floating types, specifies the base of the exponent representation. */
+ static const int radix = 0;
+
+ /** The minimum negative integer such that @c radix raised to the power of
+ (one less than that integer) is a normalized floating point number. */
+ static const int min_exponent = 0;
+ /** The minimum negative integer such that 10 raised to that power is in
+ the range of normalized floating point numbers. */
+ static const int min_exponent10 = 0;
+ /** The maximum positive integer such that @c radix raised to the power of
+ (one less than that integer) is a representable finite floating point
+ number. */
+ static const int max_exponent = 0;
+ /** The maximum positive integer such that 10 raised to that power is in
+ the range of representable finite floating point numbers. */
+ static const int max_exponent10 = 0;
+
+ /** True if the type has a representation for positive infinity. */
+ static const bool has_infinity = false;
+ /** True if the type has a representation for a quiet (non-signaling)
+ "Not a Number." */
+ static const bool has_quiet_NaN = false;
+ /** True if the type has a representation for a signaling
+ "Not a Number." */
+ static const bool has_signaling_NaN = false;
+ /** See std::float_denorm_style for more information. */
+ static const float_denorm_style has_denorm = denorm_absent;
+ /** "True if loss of accuracy is detected as a denormalization loss,
+ rather than as an inexact result." [18.2.1.2]/42 */
+ static const bool has_denorm_loss = false;
+
+ /** True if-and-only-if the type adheres to the IEC 559 standard, also
+ known as IEEE 754. (Only makes sense for floating point types.) */
+ static const bool is_iec559 = false;
+ /** "True if the set of values representable by the type is finite. All
+ built-in types are bounded, this member would be false for arbitrary
+ precision types." [18.2.1.2]/54 */
+ static const bool is_bounded = false;
+ /** True if the type is @e modulo, that is, if it is possible to add two
+ positive numbers and have a result that wraps around to a third number
+ that is less. Typically false for floating types, true for unsigned
+ integers, and true for signed integers. */
+ static const bool is_modulo = false;
+
+ /** True if trapping is implemented for this type. */
+ static const bool traps = false;
+ /** True if tininess is detected before rounding. (see IEC 559) */
+ static const bool tinyness_before = false;
+ /** See std::float_round_style for more information. This is only
+ meaningful for floating types; integer types will all be
+ round_toward_zero. */
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /**
+ * @brief Properties of fundamental types.
+ *
+ * This class allows a program to obtain information about the
+ * representation of a fundamental type on a given platform. For
+ * non-fundamental types, the functions will return 0 and the data
+ * members will all be @c false.
+ *
+ * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are
+ * noted, but not incorporated in this documented (yet).
+ */
+ template<typename _Tp>
+ struct numeric_limits : public __numeric_limits_base
+ {
+ /** The minimum finite value, or for floating types with
+ denormalization, the minimum positive normalized value. */
+ static _Tp min() throw() { return static_cast<_Tp>(0); }
+ /** The maximum finite value. */
+ static _Tp max() throw() { return static_cast<_Tp>(0); }
+ /** The @e machine @e epsilon: the difference between 1 and the least
+ value greater than 1 that is representable. */
+ static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
+ /** The maximum rounding error measurement (see LIA-1). */
+ static _Tp round_error() throw() { return static_cast<_Tp>(0); }
+ /** The representation of positive infinity, if @c has_infinity. */
+ static _Tp infinity() throw() { return static_cast<_Tp>(0); }
+ /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */
+ static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
+ /** The representation of a signaling "Not a Number," if
+ @c has_signaling_NaN. */
+ static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
+ /** The minimum positive denormalized value. For types where
+ @c has_denorm is false, this is the minimum positive normalized
+ value. */
+ static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
+ };
+
+ // Now there follow 15 explicit specializations. Yes, 15. Make sure
+ // you get the count right.
+
+ /// numeric_limits<bool> specialization.
+ template<>
+ struct numeric_limits<bool>
+ {
+ static const bool is_specialized = true;
+
+ static bool min() throw()
+ { return false; }
+ static bool max() throw()
+ { return true; }
+
+ static const int digits = 1;
+ static const int digits10 = 0;
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static bool epsilon() throw()
+ { return false; }
+ static bool round_error() throw()
+ { return false; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static bool infinity() throw()
+ { return false; }
+ static bool quiet_NaN() throw()
+ { return false; }
+ static bool signaling_NaN() throw()
+ { return false; }
+ static bool denorm_min() throw()
+ { return false; }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ // It is not clear what it means for a boolean type to trap.
+ // This is a DR on the LWG issue list. Here, I use integer
+ // promotion semantics.
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<char> specialization.
+ template<>
+ struct numeric_limits<char>
+ {
+ static const bool is_specialized = true;
+
+ static char min() throw()
+ { return __glibcxx_min(char); }
+ static char max() throw()
+ { return __glibcxx_max(char); }
+
+ static const int digits = __glibcxx_digits (char);
+ static const int digits10 = __glibcxx_digits10 (char);
+ static const bool is_signed = __glibcxx_signed (char);
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static char epsilon() throw()
+ { return 0; }
+ static char round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static char infinity() throw()
+ { return char(); }
+ static char quiet_NaN() throw()
+ { return char(); }
+ static char signaling_NaN() throw()
+ { return char(); }
+ static char denorm_min() throw()
+ { return static_cast<char>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<signed char> specialization.
+ template<>
+ struct numeric_limits<signed char>
+ {
+ static const bool is_specialized = true;
+
+ static signed char min() throw()
+ { return -__SCHAR_MAX__ - 1; }
+ static signed char max() throw()
+ { return __SCHAR_MAX__; }
+
+ static const int digits = __glibcxx_digits (signed char);
+ static const int digits10 = __glibcxx_digits10 (signed char);
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static signed char epsilon() throw()
+ { return 0; }
+ static signed char round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static signed char infinity() throw()
+ { return static_cast<signed char>(0); }
+ static signed char quiet_NaN() throw()
+ { return static_cast<signed char>(0); }
+ static signed char signaling_NaN() throw()
+ { return static_cast<signed char>(0); }
+ static signed char denorm_min() throw()
+ { return static_cast<signed char>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<unsigned char> specialization.
+ template<>
+ struct numeric_limits<unsigned char>
+ {
+ static const bool is_specialized = true;
+
+ static unsigned char min() throw()
+ { return 0; }
+ static unsigned char max() throw()
+ { return __SCHAR_MAX__ * 2U + 1; }
+
+ static const int digits = __glibcxx_digits (unsigned char);
+ static const int digits10 = __glibcxx_digits10 (unsigned char);
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned char epsilon() throw()
+ { return 0; }
+ static unsigned char round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned char infinity() throw()
+ { return static_cast<unsigned char>(0); }
+ static unsigned char quiet_NaN() throw()
+ { return static_cast<unsigned char>(0); }
+ static unsigned char signaling_NaN() throw()
+ { return static_cast<unsigned char>(0); }
+ static unsigned char denorm_min() throw()
+ { return static_cast<unsigned char>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<wchar_t> specialization.
+ template<>
+ struct numeric_limits<wchar_t>
+ {
+ static const bool is_specialized = true;
+
+ static wchar_t min() throw()
+ { return __glibcxx_min (wchar_t); }
+ static wchar_t max() throw()
+ { return __glibcxx_max (wchar_t); }
+
+ static const int digits = __glibcxx_digits (wchar_t);
+ static const int digits10 = __glibcxx_digits10 (wchar_t);
+ static const bool is_signed = __glibcxx_signed (wchar_t);
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static wchar_t epsilon() throw()
+ { return 0; }
+ static wchar_t round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static wchar_t infinity() throw()
+ { return wchar_t(); }
+ static wchar_t quiet_NaN() throw()
+ { return wchar_t(); }
+ static wchar_t signaling_NaN() throw()
+ { return wchar_t(); }
+ static wchar_t denorm_min() throw()
+ { return wchar_t(); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// numeric_limits<char16_t> specialization.
+ template<>
+ struct numeric_limits<char16_t>
+ {
+ static const bool is_specialized = true;
+
+ static char16_t min() throw()
+ { return __glibcxx_min (char16_t); }
+ static char16_t max() throw()
+ { return __glibcxx_max (char16_t); }
+
+ static const int digits = __glibcxx_digits (char16_t);
+ static const int digits10 = __glibcxx_digits10 (char16_t);
+ static const bool is_signed = __glibcxx_signed (char16_t);
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static char16_t epsilon() throw()
+ { return 0; }
+ static char16_t round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static char16_t infinity() throw()
+ { return char16_t(); }
+ static char16_t quiet_NaN() throw()
+ { return char16_t(); }
+ static char16_t signaling_NaN() throw()
+ { return char16_t(); }
+ static char16_t denorm_min() throw()
+ { return char16_t(); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<char32_t> specialization.
+ template<>
+ struct numeric_limits<char32_t>
+ {
+ static const bool is_specialized = true;
+
+ static char32_t min() throw()
+ { return __glibcxx_min (char32_t); }
+ static char32_t max() throw()
+ { return __glibcxx_max (char32_t); }
+
+ static const int digits = __glibcxx_digits (char32_t);
+ static const int digits10 = __glibcxx_digits10 (char32_t);
+ static const bool is_signed = __glibcxx_signed (char32_t);
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static char32_t epsilon() throw()
+ { return 0; }
+ static char32_t round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static char32_t infinity() throw()
+ { return char32_t(); }
+ static char32_t quiet_NaN() throw()
+ { return char32_t(); }
+ static char32_t signaling_NaN() throw()
+ { return char32_t(); }
+ static char32_t denorm_min() throw()
+ { return char32_t(); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+#endif
+
+ /// numeric_limits<short> specialization.
+ template<>
+ struct numeric_limits<short>
+ {
+ static const bool is_specialized = true;
+
+ static short min() throw()
+ { return -__SHRT_MAX__ - 1; }
+ static short max() throw()
+ { return __SHRT_MAX__; }
+
+ static const int digits = __glibcxx_digits (short);
+ static const int digits10 = __glibcxx_digits10 (short);
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static short epsilon() throw()
+ { return 0; }
+ static short round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static short infinity() throw()
+ { return short(); }
+ static short quiet_NaN() throw()
+ { return short(); }
+ static short signaling_NaN() throw()
+ { return short(); }
+ static short denorm_min() throw()
+ { return short(); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<unsigned short> specialization.
+ template<>
+ struct numeric_limits<unsigned short>
+ {
+ static const bool is_specialized = true;
+
+ static unsigned short min() throw()
+ { return 0; }
+ static unsigned short max() throw()
+ { return __SHRT_MAX__ * 2U + 1; }
+
+ static const int digits = __glibcxx_digits (unsigned short);
+ static const int digits10 = __glibcxx_digits10 (unsigned short);
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned short epsilon() throw()
+ { return 0; }
+ static unsigned short round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned short infinity() throw()
+ { return static_cast<unsigned short>(0); }
+ static unsigned short quiet_NaN() throw()
+ { return static_cast<unsigned short>(0); }
+ static unsigned short signaling_NaN() throw()
+ { return static_cast<unsigned short>(0); }
+ static unsigned short denorm_min() throw()
+ { return static_cast<unsigned short>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<int> specialization.
+ template<>
+ struct numeric_limits<int>
+ {
+ static const bool is_specialized = true;
+
+ static int min() throw()
+ { return -__INT_MAX__ - 1; }
+ static int max() throw()
+ { return __INT_MAX__; }
+
+ static const int digits = __glibcxx_digits (int);
+ static const int digits10 = __glibcxx_digits10 (int);
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static int epsilon() throw()
+ { return 0; }
+ static int round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static int infinity() throw()
+ { return static_cast<int>(0); }
+ static int quiet_NaN() throw()
+ { return static_cast<int>(0); }
+ static int signaling_NaN() throw()
+ { return static_cast<int>(0); }
+ static int denorm_min() throw()
+ { return static_cast<int>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<unsigned int> specialization.
+ template<>
+ struct numeric_limits<unsigned int>
+ {
+ static const bool is_specialized = true;
+
+ static unsigned int min() throw()
+ { return 0; }
+ static unsigned int max() throw()
+ { return __INT_MAX__ * 2U + 1; }
+
+ static const int digits = __glibcxx_digits (unsigned int);
+ static const int digits10 = __glibcxx_digits10 (unsigned int);
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned int epsilon() throw()
+ { return 0; }
+ static unsigned int round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned int infinity() throw()
+ { return static_cast<unsigned int>(0); }
+ static unsigned int quiet_NaN() throw()
+ { return static_cast<unsigned int>(0); }
+ static unsigned int signaling_NaN() throw()
+ { return static_cast<unsigned int>(0); }
+ static unsigned int denorm_min() throw()
+ { return static_cast<unsigned int>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<long> specialization.
+ template<>
+ struct numeric_limits<long>
+ {
+ static const bool is_specialized = true;
+
+ static long min() throw()
+ { return -__LONG_MAX__ - 1; }
+ static long max() throw()
+ { return __LONG_MAX__; }
+
+ static const int digits = __glibcxx_digits (long);
+ static const int digits10 = __glibcxx_digits10 (long);
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static long epsilon() throw()
+ { return 0; }
+ static long round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static long infinity() throw()
+ { return static_cast<long>(0); }
+ static long quiet_NaN() throw()
+ { return static_cast<long>(0); }
+ static long signaling_NaN() throw()
+ { return static_cast<long>(0); }
+ static long denorm_min() throw()
+ { return static_cast<long>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<unsigned long> specialization.
+ template<>
+ struct numeric_limits<unsigned long>
+ {
+ static const bool is_specialized = true;
+
+ static unsigned long min() throw()
+ { return 0; }
+ static unsigned long max() throw()
+ { return __LONG_MAX__ * 2UL + 1; }
+
+ static const int digits = __glibcxx_digits (unsigned long);
+ static const int digits10 = __glibcxx_digits10 (unsigned long);
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned long epsilon() throw()
+ { return 0; }
+ static unsigned long round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned long infinity() throw()
+ { return static_cast<unsigned long>(0); }
+ static unsigned long quiet_NaN() throw()
+ { return static_cast<unsigned long>(0); }
+ static unsigned long signaling_NaN() throw()
+ { return static_cast<unsigned long>(0); }
+ static unsigned long denorm_min() throw()
+ { return static_cast<unsigned long>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<long long> specialization.
+ template<>
+ struct numeric_limits<long long>
+ {
+ static const bool is_specialized = true;
+
+ static long long min() throw()
+ { return -__LONG_LONG_MAX__ - 1; }
+ static long long max() throw()
+ { return __LONG_LONG_MAX__; }
+
+ static const int digits = __glibcxx_digits (long long);
+ static const int digits10 = __glibcxx_digits10 (long long);
+ static const bool is_signed = true;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static long long epsilon() throw()
+ { return 0; }
+ static long long round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static long long infinity() throw()
+ { return static_cast<long long>(0); }
+ static long long quiet_NaN() throw()
+ { return static_cast<long long>(0); }
+ static long long signaling_NaN() throw()
+ { return static_cast<long long>(0); }
+ static long long denorm_min() throw()
+ { return static_cast<long long>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<unsigned long long> specialization.
+ template<>
+ struct numeric_limits<unsigned long long>
+ {
+ static const bool is_specialized = true;
+
+ static unsigned long long min() throw()
+ { return 0; }
+ static unsigned long long max() throw()
+ { return __LONG_LONG_MAX__ * 2ULL + 1; }
+
+ static const int digits = __glibcxx_digits (unsigned long long);
+ static const int digits10 = __glibcxx_digits10 (unsigned long long);
+ static const bool is_signed = false;
+ static const bool is_integer = true;
+ static const bool is_exact = true;
+ static const int radix = 2;
+ static unsigned long long epsilon() throw()
+ { return 0; }
+ static unsigned long long round_error() throw()
+ { return 0; }
+
+ static const int min_exponent = 0;
+ static const int min_exponent10 = 0;
+ static const int max_exponent = 0;
+ static const int max_exponent10 = 0;
+
+ static const bool has_infinity = false;
+ static const bool has_quiet_NaN = false;
+ static const bool has_signaling_NaN = false;
+ static const float_denorm_style has_denorm = denorm_absent;
+ static const bool has_denorm_loss = false;
+
+ static unsigned long long infinity() throw()
+ { return static_cast<unsigned long long>(0); }
+ static unsigned long long quiet_NaN() throw()
+ { return static_cast<unsigned long long>(0); }
+ static unsigned long long signaling_NaN() throw()
+ { return static_cast<unsigned long long>(0); }
+ static unsigned long long denorm_min() throw()
+ { return static_cast<unsigned long long>(0); }
+
+ static const bool is_iec559 = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = true;
+
+ static const bool traps = __glibcxx_integral_traps;
+ static const bool tinyness_before = false;
+ static const float_round_style round_style = round_toward_zero;
+ };
+
+ /// numeric_limits<float> specialization.
+ template<>
+ struct numeric_limits<float>
+ {
+ static const bool is_specialized = true;
+
+ static float min() throw()
+ { return __FLT_MIN__; }
+ static float max() throw()
+ { return __FLT_MAX__; }
+
+ static const int digits = __FLT_MANT_DIG__;
+ static const int digits10 = __FLT_DIG__;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = __FLT_RADIX__;
+ static float epsilon() throw()
+ { return __FLT_EPSILON__; }
+ static float round_error() throw()
+ { return 0.5F; }
+
+ static const int min_exponent = __FLT_MIN_EXP__;
+ static const int min_exponent10 = __FLT_MIN_10_EXP__;
+ static const int max_exponent = __FLT_MAX_EXP__;
+ static const int max_exponent10 = __FLT_MAX_10_EXP__;
+
+ static const bool has_infinity = __FLT_HAS_INFINITY__;
+ static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
+ static const bool has_signaling_NaN = has_quiet_NaN;
+ static const float_denorm_style has_denorm
+ = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
+ static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
+
+ static float infinity() throw()
+ { return __builtin_huge_valf (); }
+ static float quiet_NaN() throw()
+ { return __builtin_nanf (""); }
+ static float signaling_NaN() throw()
+ { return __builtin_nansf (""); }
+ static float denorm_min() throw()
+ { return __FLT_DENORM_MIN__; }
+
+ static const bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = __glibcxx_float_traps;
+ static const bool tinyness_before = __glibcxx_float_tinyness_before;
+ static const float_round_style round_style = round_to_nearest;
+ };
+
+#undef __glibcxx_float_has_denorm_loss
+#undef __glibcxx_float_traps
+#undef __glibcxx_float_tinyness_before
+
+ /// numeric_limits<double> specialization.
+ template<>
+ struct numeric_limits<double>
+ {
+ static const bool is_specialized = true;
+
+ static double min() throw()
+ { return __DBL_MIN__; }
+ static double max() throw()
+ { return __DBL_MAX__; }
+
+ static const int digits = __DBL_MANT_DIG__;
+ static const int digits10 = __DBL_DIG__;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = __FLT_RADIX__;
+ static double epsilon() throw()
+ { return __DBL_EPSILON__; }
+ static double round_error() throw()
+ { return 0.5; }
+
+ static const int min_exponent = __DBL_MIN_EXP__;
+ static const int min_exponent10 = __DBL_MIN_10_EXP__;
+ static const int max_exponent = __DBL_MAX_EXP__;
+ static const int max_exponent10 = __DBL_MAX_10_EXP__;
+
+ static const bool has_infinity = __DBL_HAS_INFINITY__;
+ static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
+ static const bool has_signaling_NaN = has_quiet_NaN;
+ static const float_denorm_style has_denorm
+ = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
+ static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
+
+ static double infinity() throw()
+ { return __builtin_huge_val(); }
+ static double quiet_NaN() throw()
+ { return __builtin_nan (""); }
+ static double signaling_NaN() throw()
+ { return __builtin_nans (""); }
+ static double denorm_min() throw()
+ { return __DBL_DENORM_MIN__; }
+
+ static const bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = __glibcxx_double_traps;
+ static const bool tinyness_before = __glibcxx_double_tinyness_before;
+ static const float_round_style round_style = round_to_nearest;
+ };
+
+#undef __glibcxx_double_has_denorm_loss
+#undef __glibcxx_double_traps
+#undef __glibcxx_double_tinyness_before
+
+ /// numeric_limits<long double> specialization.
+ template<>
+ struct numeric_limits<long double>
+ {
+ static const bool is_specialized = true;
+
+ static long double min() throw()
+ { return __LDBL_MIN__; }
+ static long double max() throw()
+ { return __LDBL_MAX__; }
+
+ static const int digits = __LDBL_MANT_DIG__;
+ static const int digits10 = __LDBL_DIG__;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const int radix = __FLT_RADIX__;
+ static long double epsilon() throw()
+ { return __LDBL_EPSILON__; }
+ static long double round_error() throw()
+ { return 0.5L; }
+
+ static const int min_exponent = __LDBL_MIN_EXP__;
+ static const int min_exponent10 = __LDBL_MIN_10_EXP__;
+ static const int max_exponent = __LDBL_MAX_EXP__;
+ static const int max_exponent10 = __LDBL_MAX_10_EXP__;
+
+ static const bool has_infinity = __LDBL_HAS_INFINITY__;
+ static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
+ static const bool has_signaling_NaN = has_quiet_NaN;
+ static const float_denorm_style has_denorm
+ = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
+ static const bool has_denorm_loss
+ = __glibcxx_long_double_has_denorm_loss;
+
+ static long double infinity() throw()
+ { return __builtin_huge_vall (); }
+ static long double quiet_NaN() throw()
+ { return __builtin_nanl (""); }
+ static long double signaling_NaN() throw()
+ { return __builtin_nansl (""); }
+ static long double denorm_min() throw()
+ { return __LDBL_DENORM_MIN__; }
+
+ static const bool is_iec559
+ = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+
+ static const bool traps = __glibcxx_long_double_traps;
+ static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
+ static const float_round_style round_style = round_to_nearest;
+ };
+
+#undef __glibcxx_long_double_has_denorm_loss
+#undef __glibcxx_long_double_traps
+#undef __glibcxx_long_double_tinyness_before
+
+_GLIBCXX_END_NAMESPACE
+
+#undef __glibcxx_signed
+#undef __glibcxx_min
+#undef __glibcxx_max
+#undef __glibcxx_digits
+#undef __glibcxx_digits10
+
+#endif // _GLIBCXX_NUMERIC_LIMITS
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/list b/gcc-4.4.0/libstdc++-v3/include/std/list
new file mode 100644
index 000000000..d199802d7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/list
@@ -0,0 +1,74 @@
+// <list> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/list
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_LIST
+#define _GLIBCXX_LIST 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_list.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/list.tcc>
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/list>
+#endif
+
+#endif /* _GLIBCXX_LIST */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/locale b/gcc-4.4.0/libstdc++-v3/include/std/locale
new file mode 100644
index 000000000..3504b778c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/locale
@@ -0,0 +1,45 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+/** @file locale
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_LOCALE
+#define _GLIBCXX_LOCALE 1
+
+#pragma GCC system_header
+
+#include <bits/localefwd.h>
+#include <bits/locale_classes.h>
+#include <bits/locale_facets.h>
+#include <bits/locale_facets_nonio.h>
+
+#endif /* _GLIBCXX_LOCALE */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/map b/gcc-4.4.0/libstdc++-v3/include/std/map
new file mode 100644
index 000000000..159bfb3d0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/map
@@ -0,0 +1,68 @@
+// <map> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/map
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_MAP
+#define _GLIBCXX_MAP 1
+
+#pragma GCC system_header
+
+#include <bits/stl_tree.h>
+#include <bits/stl_map.h>
+#include <bits/stl_multimap.h>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/map>
+#endif
+
+#endif /* _GLIBCXX_MAP */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/memory b/gcc-4.4.0/libstdc++-v3/include/std/memory
new file mode 100644
index 000000000..9defd487c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/memory
@@ -0,0 +1,100 @@
+// <memory> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ * Copyright (c) 1997-1999
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file include/memory
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_MEMORY
+#define _GLIBCXX_MEMORY 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_tempbuf.h>
+#include <bits/stl_raw_storage_iter.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# include <exception> // std::exception
+# include <typeinfo> // std::type_info in get_deleter
+# include <iosfwd> // std::basic_ostream
+# include <ext/atomicity.h>
+# include <ext/concurrence.h>
+# include <bits/functexcept.h>
+# include <bits/stl_function.h> // std::less
+# include <bits/unique_ptr.h>
+# include <debug/debug.h>
+# include <type_traits>
+# include <functional>
+# if _GLIBCXX_DEPRECATED
+# include <backward/auto_ptr.h>
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/boost_sp_counted_base.h>
+# include <bits/shared_ptr.h>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/boost_sp_counted_base.h>
+# include <bits/shared_ptr.h>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+#else
+# include <backward/auto_ptr.h>
+#endif
+
+/**
+ * @defgroup memory Memory
+ * @ingroup utilities
+ *
+ * Components for memory allocation, deallocation, and management.
+ */
+
+#endif /* _GLIBCXX_MEMORY */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/mutex b/gcc-4.4.0/libstdc++-v3/include/std/mutex
new file mode 100644
index 000000000..eb71c764f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/mutex
@@ -0,0 +1,771 @@
+// <mutex> -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file mutex
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_MUTEX
+#define _GLIBCXX_MUTEX 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <tuple>
+#include <cstddef>
+#include <chrono>
+#include <exception>
+#include <type_traits>
+#include <functional>
+#include <system_error>
+#include <bits/functexcept.h>
+#include <bits/gthr.h>
+#include <bits/move.h> // for std::swap
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+namespace std
+{
+ /**
+ * @defgroup mutexes Mutexes
+ * @ingroup concurrency
+ *
+ * Classes for mutex support.
+ * @{
+ */
+
+ /// mutex
+ class mutex
+ {
+ typedef __gthread_mutex_t __native_type;
+ __native_type _M_mutex;
+
+ public:
+ typedef __native_type* native_handle_type;
+
+ mutex()
+ {
+ // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+#ifdef __GTHREAD_MUTEX_INIT
+ __native_type __tmp = __GTHREAD_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+ }
+
+ mutex(const mutex&) = delete;
+ mutex& operator=(const mutex&) = delete;
+
+ void
+ lock()
+ {
+ int __e = __gthread_mutex_lock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+ if (__e)
+ __throw_system_error(__e);
+ }
+
+ bool
+ try_lock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ return !__gthread_mutex_trylock(&_M_mutex);
+ }
+
+ void
+ unlock()
+ {
+ // XXX EINVAL, EAGAIN, EPERM
+ __gthread_mutex_unlock(&_M_mutex);
+ }
+
+ native_handle_type
+ native_handle()
+ { return &_M_mutex; }
+ };
+
+ /// recursive_mutex
+ class recursive_mutex
+ {
+ typedef __gthread_recursive_mutex_t __native_type;
+ __native_type _M_mutex;
+
+ public:
+ typedef __native_type* native_handle_type;
+
+ recursive_mutex()
+ {
+ // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
+ __native_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+ }
+
+ recursive_mutex(const recursive_mutex&) = delete;
+ recursive_mutex& operator=(const recursive_mutex&) = delete;
+
+ void
+ lock()
+ {
+ int __e = __gthread_recursive_mutex_lock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+ if (__e)
+ __throw_system_error(__e);
+ }
+
+ bool
+ try_lock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ return !__gthread_recursive_mutex_trylock(&_M_mutex);
+ }
+
+ void
+ unlock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ __gthread_recursive_mutex_unlock(&_M_mutex);
+ }
+
+ native_handle_type
+ native_handle()
+ { return &_M_mutex; }
+ };
+
+ /// timed_mutex
+ class timed_mutex
+ {
+ typedef __gthread_mutex_t __native_type;
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+ typedef chrono::monotonic_clock __clock_t;
+#else
+ typedef chrono::high_resolution_clock __clock_t;
+#endif
+
+ __native_type _M_mutex;
+
+ public:
+ typedef __native_type* native_handle_type;
+
+ timed_mutex()
+ {
+#ifdef __GTHREAD_MUTEX_INIT
+ __native_type __tmp = __GTHREAD_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+ }
+
+ timed_mutex(const timed_mutex&) = delete;
+ timed_mutex& operator=(const timed_mutex&) = delete;
+
+ void
+ lock()
+ {
+ int __e = __gthread_mutex_lock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+ if (__e)
+ __throw_system_error(__e);
+ }
+
+ bool
+ try_lock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ return !__gthread_mutex_trylock(&_M_mutex);
+ }
+
+ template <class _Rep, class _Period>
+ bool
+ try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
+ { return __try_lock_for_impl(__rtime); }
+
+ template <class _Clock, class _Duration>
+ bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+ {
+ chrono::time_point<_Clock, chrono::seconds> __s =
+ chrono::time_point_cast<chrono::seconds>(__atime);
+
+ chrono::nanoseconds __ns =
+ chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+
+ __gthread_time_t __ts = {
+ static_cast<std::time_t>(__s.time_since_epoch().count()),
+ static_cast<long>(__ns.count())
+ };
+
+ return !__gthread_mutex_timedlock(&_M_mutex, &__ts);
+ }
+
+ void
+ unlock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ __gthread_mutex_unlock(&_M_mutex);
+ }
+
+ native_handle_type
+ native_handle()
+ { return &_M_mutex; }
+
+ private:
+ template<typename _Rep, typename _Period>
+ typename enable_if<
+ ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+ __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+ {
+ __clock_t::time_point __atime = __clock_t::now()
+ + chrono::duration_cast<__clock_t::duration>(__rtime);
+
+ return try_lock_until(__atime);
+ }
+
+ template <typename _Rep, typename _Period>
+ typename enable_if<
+ !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+ __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+ {
+ __clock_t::time_point __atime = __clock_t::now()
+ + ++chrono::duration_cast<__clock_t::duration>(__rtime);
+
+ return try_lock_until(__atime);
+ }
+ };
+
+ /// recursive_timed_mutex
+ class recursive_timed_mutex
+ {
+ typedef __gthread_recursive_mutex_t __native_type;
+
+#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
+ typedef chrono::monotonic_clock __clock_t;
+#else
+ typedef chrono::high_resolution_clock __clock_t;
+#endif
+
+ __native_type _M_mutex;
+
+ public:
+ typedef __native_type* native_handle_type;
+
+ recursive_timed_mutex()
+ {
+ // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
+#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
+ __native_type __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
+ _M_mutex = __tmp;
+#else
+ __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
+#endif
+ }
+
+ recursive_timed_mutex(const recursive_timed_mutex&) = delete;
+ recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+
+ void
+ lock()
+ {
+ int __e = __gthread_recursive_mutex_lock(&_M_mutex);
+
+ // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
+ if (__e)
+ __throw_system_error(__e);
+ }
+
+ bool
+ try_lock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ return !__gthread_recursive_mutex_trylock(&_M_mutex);
+ }
+
+ template <class _Rep, class _Period>
+ bool
+ try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
+ { return __try_lock_for_impl(__rtime); }
+
+ template <class _Clock, class _Duration>
+ bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+ {
+ chrono::time_point<_Clock, chrono::seconds> __s =
+ chrono::time_point_cast<chrono::seconds>(__atime);
+
+ chrono::nanoseconds __ns =
+ chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
+
+ __gthread_time_t __ts = {
+ static_cast<std::time_t>(__s.time_since_epoch().count()),
+ static_cast<long>(__ns.count())
+ };
+
+ return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts);
+ }
+
+ void
+ unlock()
+ {
+ // XXX EINVAL, EAGAIN, EBUSY
+ __gthread_recursive_mutex_unlock(&_M_mutex);
+ }
+
+ native_handle_type
+ native_handle()
+ { return &_M_mutex; }
+
+ private:
+ template<typename _Rep, typename _Period>
+ typename enable_if<
+ ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+ __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+ {
+ __clock_t::time_point __atime = __clock_t::now()
+ + chrono::duration_cast<__clock_t::duration>(__rtime);
+
+ return try_lock_until(__atime);
+ }
+
+ template <typename _Rep, typename _Period>
+ typename enable_if<
+ !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type
+ __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime)
+ {
+ __clock_t::time_point __atime = __clock_t::now()
+ + ++chrono::duration_cast<__clock_t::duration>(__rtime);
+
+ return try_lock_until(__atime);
+ }
+ };
+
+ /// Do not acquire ownership of the mutex.
+ struct defer_lock_t { };
+
+ /// Try to acquire ownership of the mutex without blocking.
+ struct try_to_lock_t { };
+
+ /// Assume the calling thread has already obtained mutex ownership
+ /// and manage it.
+ struct adopt_lock_t { };
+
+ extern const defer_lock_t defer_lock;
+ extern const try_to_lock_t try_to_lock;
+ extern const adopt_lock_t adopt_lock;
+
+ /**
+ * @brief Thrown to indicate errors with lock operations.
+ *
+ * @ingroup exceptions
+ */
+ class lock_error : public exception
+ {
+ public:
+ virtual const char*
+ what() const throw();
+ };
+
+ /// @brief Scoped lock idiom.
+ // Acquire the mutex here with a constructor call, then release with
+ // the destructor call in accordance with RAII style.
+ template<typename _Mutex>
+ class lock_guard
+ {
+ public:
+ typedef _Mutex mutex_type;
+
+ explicit lock_guard(mutex_type& __m) : _M_device(__m)
+ { _M_device.lock(); }
+
+ lock_guard(mutex_type& __m, adopt_lock_t __a) : _M_device(__m)
+ { _M_device.lock(); }
+
+ ~lock_guard()
+ { _M_device.unlock(); }
+
+ lock_guard(const lock_guard&) = delete;
+ lock_guard& operator=(const lock_guard&) = delete;
+
+ private:
+ mutex_type& _M_device;
+ };
+
+ /// unique_lock
+ template<typename _Mutex>
+ class unique_lock
+ {
+ public:
+ typedef _Mutex mutex_type;
+
+ unique_lock()
+ : _M_device(0), _M_owns(false)
+ { }
+
+ explicit unique_lock(mutex_type& __m)
+ : _M_device(&__m), _M_owns(false)
+ {
+ lock();
+ _M_owns = true;
+ }
+
+ unique_lock(mutex_type& __m, defer_lock_t)
+ : _M_device(&__m), _M_owns(false)
+ { }
+
+ unique_lock(mutex_type& __m, try_to_lock_t)
+ : _M_device(&__m), _M_owns(_M_device->try_lock())
+ { }
+
+ unique_lock(mutex_type& __m, adopt_lock_t)
+ : _M_device(&__m), _M_owns(true)
+ {
+ // XXX calling thread owns mutex
+ }
+
+ template<typename _Clock, typename _Duration>
+ unique_lock(mutex_type& __m,
+ const chrono::time_point<_Clock, _Duration>& __atime)
+ : _M_device(&__m), _M_owns(_M_device->try_lock_until(__atime))
+ { }
+
+ template<typename _Rep, typename _Period>
+ unique_lock(mutex_type& __m,
+ const chrono::duration<_Rep, _Period>& __rtime)
+ : _M_device(&__m), _M_owns(_M_device->try_lock_for(__rtime))
+ { }
+
+ ~unique_lock()
+ {
+ if (_M_owns)
+ unlock();
+ }
+
+ unique_lock(const unique_lock&) = delete;
+ unique_lock& operator=(const unique_lock&) = delete;
+
+ unique_lock(unique_lock&& __u)
+ : _M_device(__u._M_device), _M_owns(__u._M_owns)
+ {
+ __u._M_device = 0;
+ __u._M_owns = false;
+ }
+
+ unique_lock& operator=(unique_lock&& __u)
+ {
+ if(_M_owns)
+ unlock();
+
+ unique_lock(std::move(__u)).swap(*this);
+
+ __u._M_device = 0;
+ __u._M_owns = false;
+
+ return *this;
+ }
+
+ void
+ lock()
+ {
+ if (!_M_device)
+ __throw_system_error(int(errc::operation_not_permitted));
+ else if (_M_owns)
+ __throw_system_error(int(errc::resource_deadlock_would_occur));
+ else
+ {
+ _M_device->lock();
+ _M_owns = true;
+ }
+ }
+
+ bool
+ try_lock()
+ {
+ if (!_M_device)
+ __throw_system_error(int(errc::operation_not_permitted));
+ else if (_M_owns)
+ __throw_system_error(int(errc::resource_deadlock_would_occur));
+ else
+ {
+ _M_owns = _M_device->try_lock();
+ return _M_owns;
+ }
+ }
+
+ template<typename _Clock, typename _Duration>
+ bool
+ try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
+ {
+ if (!_M_device)
+ __throw_system_error(int(errc::operation_not_permitted));
+ else if (_M_owns)
+ __throw_system_error(int(errc::resource_deadlock_would_occur));
+ else
+ {
+ _M_owns = _M_device->try_lock_until(__atime);
+ return _M_owns;
+ }
+ }
+
+ template<typename _Rep, typename _Period>
+ bool
+ try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
+ {
+ if (!_M_device)
+ __throw_system_error(int(errc::operation_not_permitted));
+ else if (_M_owns)
+ __throw_system_error(int(errc::resource_deadlock_would_occur));
+ else
+ {
+ _M_owns = _M_device->try_lock_for(__rtime);
+ return _M_owns;
+ }
+ }
+
+ void
+ unlock()
+ {
+ if (!_M_owns)
+ __throw_system_error(int(errc::operation_not_permitted));
+ else if (_M_device)
+ {
+ _M_device->unlock();
+ _M_owns = false;
+ }
+ }
+
+ void
+ swap(unique_lock&& __u)
+ {
+ std::swap(_M_device, __u._M_device);
+ std::swap(_M_owns, __u._M_owns);
+ }
+
+ mutex_type*
+ release()
+ {
+ mutex_type* __ret = _M_device;
+ _M_device = 0;
+ _M_owns = false;
+ return __ret;
+ }
+
+ bool
+ owns_lock() const
+ { return _M_owns; }
+
+ /* explicit */ operator bool () const
+ { return owns_lock(); }
+
+ mutex_type*
+ mutex() const
+ { return _M_device; }
+
+ private:
+ mutex_type* _M_device;
+ bool _M_owns; // XXX use atomic_bool
+ };
+
+ template<typename _Mutex>
+ inline void
+ swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Mutex>
+ inline void
+ swap(unique_lock<_Mutex>&& __x, unique_lock<_Mutex>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Mutex>
+ inline void
+ swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>&& __y)
+ { __x.swap(__y); }
+
+ template<int _Idx>
+ struct __unlock_impl
+ {
+ template<typename... _Lock>
+ static void
+ __do_unlock(tuple<_Lock&...>& __locks)
+ {
+ std::get<_Idx>(__locks).unlock();
+ __unlock_impl<_Idx - 1>::__do_unlock(__locks);
+ }
+ };
+
+ template<>
+ struct __unlock_impl<-1>
+ {
+ template<typename... _Lock>
+ static void
+ __do_unlock(tuple<_Lock&...>&)
+ { }
+ };
+
+ template<int _Idx, bool _Continue = true>
+ struct __try_lock_impl
+ {
+ template<typename... _Lock>
+ static int
+ __do_try_lock(tuple<_Lock&...>& __locks)
+ {
+ if(std::get<_Idx>(__locks).try_lock())
+ {
+ return __try_lock_impl<_Idx + 1,
+ _Idx + 2 < sizeof...(_Lock)>::__do_try_lock(__locks);
+ }
+ else
+ {
+ __unlock_impl<_Idx>::__do_unlock(__locks);
+ return _Idx;
+ }
+ }
+ };
+
+ template<int _Idx>
+ struct __try_lock_impl<_Idx, false>
+ {
+ template<typename... _Lock>
+ static int
+ __do_try_lock(tuple<_Lock&...>& __locks)
+ {
+ if(std::get<_Idx>(__locks).try_lock())
+ return -1;
+ else
+ {
+ __unlock_impl<_Idx>::__do_unlock(__locks);
+ return _Idx;
+ }
+ }
+ };
+
+ /** @brief Generic try_lock.
+ * @param __l1 Meets Mutex requirements (try_lock() may throw).
+ * @param __l2 Meets Mutex requirements (try_lock() may throw).
+ * @param __l3 Meets Mutex requirements (try_lock() may throw).
+ * @return Returns -1 if all try_lock() calls return true. Otherwise returns
+ * a 0-based index corresponding to the argument that returned false.
+ * @post Either all arguments are locked, or none will be.
+ *
+ * Sequentially calls try_lock() on each argument.
+ */
+ template<typename _Lock1, typename _Lock2, typename... _Lock3>
+ int
+ try_lock(_Lock1& __l1, _Lock2& __l2, _Lock3&... __l3)
+ {
+ tuple<_Lock1&, _Lock2&, _Lock3&...> __locks(__l1, __l2, __l3...);
+ return __try_lock_impl<0>::__do_try_lock(__locks);
+ }
+
+ /// lock
+ template<typename _L1, typename _L2, typename ..._L3>
+ void
+ lock(_L1&, _L2&, _L3&...);
+
+ /// once_flag
+ struct once_flag
+ {
+ private:
+ typedef __gthread_once_t __native_type;
+ __native_type _M_once;
+
+ public:
+ once_flag()
+ {
+ __native_type __tmp = __GTHREAD_ONCE_INIT;
+ _M_once = __tmp;
+ }
+
+ once_flag(const once_flag&) = delete;
+ once_flag& operator=(const once_flag&) = delete;
+
+ template<typename _Callable, typename... _Args>
+ friend void
+ call_once(once_flag& __once, _Callable __f, _Args&&... __args);
+ };
+
+#ifdef _GLIBCXX_HAVE_TLS
+ extern __thread void* __once_callable;
+ extern __thread void (*__once_call)();
+
+ template<typename _Callable>
+ inline void
+ __once_call_impl()
+ {
+ (*(_Callable*)__once_callable)();
+ }
+#else
+ extern function<void()> __once_functor;
+
+ extern unique_lock<mutex>&
+ __get_once_functor_lock();
+#endif
+
+ extern "C" void __once_proxy();
+
+ /// call_once
+ template<typename _Callable, typename... _Args>
+ void
+ call_once(once_flag& __once, _Callable __f, _Args&&... __args)
+ {
+#ifdef _GLIBCXX_HAVE_TLS
+ auto __bound_functor = bind(__f, __args...);
+ __once_callable = &__bound_functor;
+ __once_call = &__once_call_impl<decltype(__bound_functor)>;
+#else
+ unique_lock<mutex>& __functor_lock = __get_once_functor_lock();
+ __functor_lock.lock();
+ __once_functor = bind(__f, __args...);
+#endif
+
+ int __e = __gthread_once(&(__once._M_once), &__once_proxy);
+
+#ifndef _GLIBCXX_HAVE_TLS
+ if (__functor_lock)
+ __functor_lock.unlock();
+#endif
+
+ if (__e)
+ __throw_system_error(__e);
+ }
+
+ // @} group mutexes
+}
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_MUTEX
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/numeric b/gcc-4.4.0/libstdc++-v3/include/std/numeric
new file mode 100644
index 000000000..43d76d980
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/numeric
@@ -0,0 +1,78 @@
+// <numeric> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/numeric
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_NUMERIC
+#define _GLIBCXX_NUMERIC 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_numeric.h>
+
+#ifdef _GLIBCXX_PARALLEL
+# include <parallel/numeric>
+#endif
+
+/**
+ * @defgroup numerics Numerics
+ *
+ * Components for performing numeric operations. Includes support for
+ * for complex number types, random number generation, numeric
+ * (n-at-a-time) arrays, generalized numeric algorithms, and special
+ * math functions.
+ */
+
+#endif /* _GLIBCXX_NUMERIC */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/ostream b/gcc-4.4.0/libstdc++-v3/include/std/ostream
new file mode 100644
index 000000000..c49b36fc7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/ostream
@@ -0,0 +1,568 @@
+// Output streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ostream
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.6.2 Output streams
+//
+
+#ifndef _GLIBCXX_OSTREAM
+#define _GLIBCXX_OSTREAM 1
+
+#pragma GCC system_header
+
+#include <ios>
+#include <bits/ostream_insert.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // [27.6.2.1] Template class basic_ostream
+ /**
+ * @brief Controlling output.
+ * @ingroup io
+ *
+ * This is the base class for all output streams. It provides text
+ * formatting of all builtin types, and communicates with any class
+ * derived from basic_streambuf to do the actual output.
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_ostream : virtual public basic_ios<_CharT, _Traits>
+ {
+ public:
+ // Types (inherited from basic_ios (27.4.4)):
+ typedef _CharT char_type;
+ typedef typename _Traits::int_type int_type;
+ typedef typename _Traits::pos_type pos_type;
+ typedef typename _Traits::off_type off_type;
+ typedef _Traits traits_type;
+
+ // Non-standard Types:
+ typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
+ typedef basic_ios<_CharT, _Traits> __ios_type;
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
+ __num_put_type;
+ typedef ctype<_CharT> __ctype_type;
+
+ // [27.6.2.2] constructor/destructor
+ /**
+ * @brief Base constructor.
+ *
+ * This ctor is almost never called by the user directly, rather from
+ * derived classes' initialization lists, which pass a pointer to
+ * their own stream buffer.
+ */
+ explicit
+ basic_ostream(__streambuf_type* __sb)
+ { this->init(__sb); }
+
+ /**
+ * @brief Base destructor.
+ *
+ * This does very little apart from providing a virtual base dtor.
+ */
+ virtual
+ ~basic_ostream() { }
+
+ // [27.6.2.3] prefix/suffix
+ class sentry;
+ friend class sentry;
+
+ // [27.6.2.5] formatted output
+ // [27.6.2.5.3] basic_ostream::operator<<
+ //@{
+ /**
+ * @brief Interface for manipulators.
+ *
+ * Manipulators such as @c std::endl and @c std::hex use these
+ * functions in constructs like "std::cout << std::endl". For more
+ * information, see the iomanip header.
+ */
+ __ostream_type&
+ operator<<(__ostream_type& (*__pf)(__ostream_type&))
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 60. What is a formatted input function?
+ // The inserters for manipulators are *not* formatted output functions.
+ return __pf(*this);
+ }
+
+ __ostream_type&
+ operator<<(__ios_type& (*__pf)(__ios_type&))
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 60. What is a formatted input function?
+ // The inserters for manipulators are *not* formatted output functions.
+ __pf(*this);
+ return *this;
+ }
+
+ __ostream_type&
+ operator<<(ios_base& (*__pf) (ios_base&))
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 60. What is a formatted input function?
+ // The inserters for manipulators are *not* formatted output functions.
+ __pf(*this);
+ return *this;
+ }
+ //@}
+
+ // [27.6.2.5.2] arithmetic inserters
+ /**
+ * @name Arithmetic Inserters
+ *
+ * All the @c operator<< functions (aka <em>formatted output
+ * functions</em>) have some common behavior. Each starts by
+ * constructing a temporary object of type std::basic_ostream::sentry.
+ * This can have several effects, concluding with the setting of a
+ * status flag; see the sentry documentation for more.
+ *
+ * If the sentry status is good, the function tries to generate
+ * whatever data is appropriate for the type of the argument.
+ *
+ * If an exception is thrown during insertion, ios_base::badbit
+ * will be turned on in the stream's error state without causing an
+ * ios_base::failure to be thrown. The original exception will then
+ * be rethrown.
+ */
+ //@{
+ /**
+ * @brief Basic arithmetic inserters
+ * @param A variable of builtin type.
+ * @return @c *this if successful
+ *
+ * These functions use the stream's current locale (specifically, the
+ * @c num_get facet) to perform numeric formatting.
+ */
+ __ostream_type&
+ operator<<(long __n)
+ { return _M_insert(__n); }
+
+ __ostream_type&
+ operator<<(unsigned long __n)
+ { return _M_insert(__n); }
+
+ __ostream_type&
+ operator<<(bool __n)
+ { return _M_insert(__n); }
+
+ __ostream_type&
+ operator<<(short __n);
+
+ __ostream_type&
+ operator<<(unsigned short __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 117. basic_ostream uses nonexistent num_put member functions.
+ return _M_insert(static_cast<unsigned long>(__n));
+ }
+
+ __ostream_type&
+ operator<<(int __n);
+
+ __ostream_type&
+ operator<<(unsigned int __n)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 117. basic_ostream uses nonexistent num_put member functions.
+ return _M_insert(static_cast<unsigned long>(__n));
+ }
+
+#ifdef _GLIBCXX_USE_LONG_LONG
+ __ostream_type&
+ operator<<(long long __n)
+ { return _M_insert(__n); }
+
+ __ostream_type&
+ operator<<(unsigned long long __n)
+ { return _M_insert(__n); }
+#endif
+
+ __ostream_type&
+ operator<<(double __f)
+ { return _M_insert(__f); }
+
+ __ostream_type&
+ operator<<(float __f)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 117. basic_ostream uses nonexistent num_put member functions.
+ return _M_insert(static_cast<double>(__f));
+ }
+
+ __ostream_type&
+ operator<<(long double __f)
+ { return _M_insert(__f); }
+
+ __ostream_type&
+ operator<<(const void* __p)
+ { return _M_insert(__p); }
+
+ /**
+ * @brief Extracting from another streambuf.
+ * @param sb A pointer to a streambuf
+ *
+ * This function behaves like one of the basic arithmetic extractors,
+ * in that it also constructs a sentry object and has the same error
+ * handling behavior.
+ *
+ * If @a sb is NULL, the stream will set failbit in its error state.
+ *
+ * Characters are extracted from @a sb and inserted into @c *this
+ * until one of the following occurs:
+ *
+ * - the input stream reaches end-of-file,
+ * - insertion into the output sequence fails (in this case, the
+ * character that would have been inserted is not extracted), or
+ * - an exception occurs while getting a character from @a sb, which
+ * sets failbit in the error state
+ *
+ * If the function inserts no characters, failbit is set.
+ */
+ __ostream_type&
+ operator<<(__streambuf_type* __sb);
+ //@}
+
+ // [27.6.2.6] unformatted output functions
+ /**
+ * @name Unformatted Output Functions
+ *
+ * All the unformatted output functions have some common behavior.
+ * Each starts by constructing a temporary object of type
+ * std::basic_ostream::sentry. This has several effects, concluding
+ * with the setting of a status flag; see the sentry documentation
+ * for more.
+ *
+ * If the sentry status is good, the function tries to generate
+ * whatever data is appropriate for the type of the argument.
+ *
+ * If an exception is thrown during insertion, ios_base::badbit
+ * will be turned on in the stream's error state. If badbit is on in
+ * the stream's exceptions mask, the exception will be rethrown
+ * without completing its actions.
+ */
+ //@{
+ /**
+ * @brief Simple insertion.
+ * @param c The character to insert.
+ * @return *this
+ *
+ * Tries to insert @a c.
+ *
+ * @note This function is not overloaded on signed char and
+ * unsigned char.
+ */
+ __ostream_type&
+ put(char_type __c);
+
+ // Core write functionality, without sentry.
+ void
+ _M_write(const char_type* __s, streamsize __n)
+ {
+ const streamsize __put = this->rdbuf()->sputn(__s, __n);
+ if (__put != __n)
+ this->setstate(ios_base::badbit);
+ }
+
+ /**
+ * @brief Character string insertion.
+ * @param s The array to insert.
+ * @param n Maximum number of characters to insert.
+ * @return *this
+ *
+ * Characters are copied from @a s and inserted into the stream until
+ * one of the following happens:
+ *
+ * - @a n characters are inserted
+ * - inserting into the output sequence fails (in this case, badbit
+ * will be set in the stream's error state)
+ *
+ * @note This function is not overloaded on signed char and
+ * unsigned char.
+ */
+ __ostream_type&
+ write(const char_type* __s, streamsize __n);
+ //@}
+
+ /**
+ * @brief Synchronizing the stream buffer.
+ * @return *this
+ *
+ * If @c rdbuf() is a null pointer, changes nothing.
+ *
+ * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1,
+ * sets badbit.
+ */
+ __ostream_type&
+ flush();
+
+ // [27.6.2.4] seek members
+ /**
+ * @brief Getting the current write position.
+ * @return A file position object.
+ *
+ * If @c fail() is not false, returns @c pos_type(-1) to indicate
+ * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,out).
+ */
+ pos_type
+ tellp();
+
+ /**
+ * @brief Changing the current write position.
+ * @param pos A file position object.
+ * @return *this
+ *
+ * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If
+ * that function fails, sets failbit.
+ */
+ __ostream_type&
+ seekp(pos_type);
+
+ /**
+ * @brief Changing the current write position.
+ * @param off A file offset object.
+ * @param dir The direction in which to seek.
+ * @return *this
+ *
+ * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir).
+ * If that function fails, sets failbit.
+ */
+ __ostream_type&
+ seekp(off_type, ios_base::seekdir);
+
+ protected:
+ basic_ostream()
+ { this->init(0); }
+
+ template<typename _ValueT>
+ __ostream_type&
+ _M_insert(_ValueT __v);
+ };
+
+ /**
+ * @brief Performs setup work for output streams.
+ *
+ * Objects of this class are created before all of the standard
+ * inserters are run. It is responsible for "exception-safe prefix and
+ * suffix operations."
+ */
+ template <typename _CharT, typename _Traits>
+ class basic_ostream<_CharT, _Traits>::sentry
+ {
+ // Data Members:
+ bool _M_ok;
+ basic_ostream<_CharT, _Traits>& _M_os;
+
+ public:
+ /**
+ * @brief The constructor performs preparatory work.
+ * @param os The output stream to guard.
+ *
+ * If the stream state is good (@a os.good() is true), then if the
+ * stream is tied to another output stream, @c is.tie()->flush()
+ * is called to synchronize the output sequences.
+ *
+ * If the stream state is still good, then the sentry state becomes
+ * true ("okay").
+ */
+ explicit
+ sentry(basic_ostream<_CharT, _Traits>& __os);
+
+ /**
+ * @brief Possibly flushes the stream.
+ *
+ * If @c ios_base::unitbuf is set in @c os.flags(), and
+ * @c std::uncaught_exception() is true, the sentry destructor calls
+ * @c flush() on the output stream.
+ */
+ ~sentry()
+ {
+ // XXX MT
+ if (bool(_M_os.flags() & ios_base::unitbuf) && !uncaught_exception())
+ {
+ // Can't call flush directly or else will get into recursive lock.
+ if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
+ _M_os.setstate(ios_base::badbit);
+ }
+ }
+
+ /**
+ * @brief Quick status checking.
+ * @return The sentry state.
+ *
+ * For ease of use, sentries may be converted to booleans. The
+ * return value is that of the sentry state (true == okay).
+ */
+ operator bool() const
+ { return _M_ok; }
+ };
+
+ // [27.6.2.5.4] character insertion templates
+ //@{
+ /**
+ * @brief Character inserters
+ * @param out An output stream.
+ * @param c A character.
+ * @return out
+ *
+ * Behaves like one of the formatted arithmetic inserters described in
+ * std::basic_ostream. After constructing a sentry object with good
+ * status, this function inserts a single character and any required
+ * padding (as determined by [22.2.2.2.2]). @c out.width(0) is then
+ * called.
+ *
+ * If @a c is of type @c char and the character type of the stream is not
+ * @c char, the character is widened before insertion.
+ */
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
+ { return __ostream_insert(__out, &__c, 1); }
+
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
+ { return (__out << __out.widen(__c)); }
+
+ // Specialization
+ template <class _Traits>
+ inline basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, char __c)
+ { return __ostream_insert(__out, &__c, 1); }
+
+ // Signed and unsigned
+ template<class _Traits>
+ inline basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
+ { return (__out << static_cast<char>(__c)); }
+
+ template<class _Traits>
+ inline basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
+ { return (__out << static_cast<char>(__c)); }
+ //@}
+
+ //@{
+ /**
+ * @brief String inserters
+ * @param out An output stream.
+ * @param s A character string.
+ * @return out
+ * @pre @a s must be a non-NULL pointer
+ *
+ * Behaves like one of the formatted arithmetic inserters described in
+ * std::basic_ostream. After constructing a sentry object with good
+ * status, this function inserts @c traits::length(s) characters starting
+ * at @a s, widened if necessary, followed by any required padding (as
+ * determined by [22.2.2.2.2]). @c out.width(0) is then called.
+ */
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
+ {
+ if (!__s)
+ __out.setstate(ios_base::badbit);
+ else
+ __ostream_insert(__out, __s,
+ static_cast<streamsize>(_Traits::length(__s)));
+ return __out;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits> &
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);
+
+ // Partial specializations
+ template<class _Traits>
+ inline basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
+ {
+ if (!__s)
+ __out.setstate(ios_base::badbit);
+ else
+ __ostream_insert(__out, __s,
+ static_cast<streamsize>(_Traits::length(__s)));
+ return __out;
+ }
+
+ // Signed and unsigned
+ template<class _Traits>
+ inline basic_ostream<char, _Traits>&
+ operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
+ { return (__out << reinterpret_cast<const char*>(__s)); }
+
+ template<class _Traits>
+ inline basic_ostream<char, _Traits> &
+ operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
+ { return (__out << reinterpret_cast<const char*>(__s)); }
+ //@}
+
+ // [27.6.2.7] standard basic_ostream manipulators
+ /**
+ * @brief Write a newline and flush the stream.
+ *
+ * This manipulator is often mistakenly used when a simple newline is
+ * desired, leading to poor buffering performance. See
+ * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for more
+ * on this subject.
+ */
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ endl(basic_ostream<_CharT, _Traits>& __os)
+ { return flush(__os.put(__os.widen('\n'))); }
+
+ /**
+ * @brief Write a null character into the output sequence.
+ *
+ * "Null character" is @c CharT() by definition. For CharT of @c char,
+ * this correctly writes the ASCII @c NUL character string terminator.
+ */
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ ends(basic_ostream<_CharT, _Traits>& __os)
+ { return __os.put(_CharT()); }
+
+ /**
+ * @brief Flushes the output stream.
+ *
+ * This manipulator simply calls the stream's @c flush() member function.
+ */
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ flush(basic_ostream<_CharT, _Traits>& __os)
+ { return __os.flush(); }
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/ostream.tcc>
+#endif
+
+#endif /* _GLIBCXX_OSTREAM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/queue b/gcc-4.4.0/libstdc++-v3/include/std/queue
new file mode 100644
index 000000000..abf984212
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/queue
@@ -0,0 +1,67 @@
+// <queue> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/queue
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_QUEUE
+#define _GLIBCXX_QUEUE 1
+
+#pragma GCC system_header
+
+#include <deque>
+#include <vector>
+#include <bits/stl_heap.h>
+#include <bits/stl_function.h>
+#include <bits/stl_queue.h>
+
+#endif /* _GLIBCXX_QUEUE */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/random b/gcc-4.4.0/libstdc++-v3/include/std/random
new file mode 100644
index 000000000..1cb968cb5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/random
@@ -0,0 +1,70 @@
+// <random> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/random
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_RANDOM
+#define _GLIBCXX_RANDOM 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <iosfwd>
+#include <limits>
+#include <ext/type_traits.h>
+#include <ext/numeric_traits.h>
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+#include <type_traits>
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/random>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/random>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_RANDOM
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/ratio b/gcc-4.4.0/libstdc++-v3/include/std/ratio
new file mode 100644
index 000000000..f0e8831c5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/ratio
@@ -0,0 +1,303 @@
+// ratio -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file ratio
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_RATIO
+#define _GLIBCXX_RATIO 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <type_traits>
+#include <cstdint>
+
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std
+{
+ /**
+ * @defgroup ratio Rational Arithmetic
+ * @ingroup utilities
+ *
+ * Compile time representation of fininte rational numbers.
+ * @{
+ */
+
+ template<intmax_t _Pn>
+ struct __static_sign
+ : integral_constant<intmax_t, (_Pn < 0) ? -1 : 1>
+ { };
+
+ template<intmax_t _Pn>
+ struct __static_abs
+ : integral_constant<intmax_t, _Pn * __static_sign<_Pn>::value>
+ { };
+
+ template<intmax_t _Pn, intmax_t _Qn>
+ struct __static_gcd;
+
+ template<intmax_t _Pn, intmax_t _Qn>
+ struct __static_gcd
+ : __static_gcd<_Qn, (_Pn % _Qn)>
+ { };
+
+ template<intmax_t _Pn>
+ struct __static_gcd<_Pn, 0>
+ : integral_constant<intmax_t, __static_abs<_Pn>::value>
+ { };
+
+ template<intmax_t _Qn>
+ struct __static_gcd<0, _Qn>
+ : integral_constant<intmax_t, __static_abs<_Qn>::value>
+ { };
+
+ // Let c = 2^(half # of bits in an intmax_t)
+ // then we find a1, a0, b1, b0 s.t. N = a1*c + a0, M = b1*c + b0
+ // The multiplication of N and M becomes,
+ // N * M = (a1 * b1)c^2 + (a0 * b1 + b0 * a1)c + a0 * b0
+ // Multiplication is safe if each term and the sum of the terms
+ // is representable by intmax_t.
+ template<intmax_t _Pn, intmax_t _Qn>
+ struct __safe_multiply
+ {
+ private:
+ static const uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4);
+
+ static const uintmax_t __a0 = __static_abs<_Pn>::value % __c;
+ static const uintmax_t __a1 = __static_abs<_Pn>::value / __c;
+ static const uintmax_t __b0 = __static_abs<_Qn>::value % __c;
+ static const uintmax_t __b1 = __static_abs<_Qn>::value / __c;
+
+ static_assert(__a1 == 0 || __b1 == 0,
+ "overflow in multiplication");
+ static_assert(__a0 * __b1 + __b0 * __a1 < (__c >> 1),
+ "overflow in multiplication");
+ static_assert(__b0 * __a0 <= __INTMAX_MAX__,
+ "overflow in multiplication");
+ static_assert((__a0 * __b1 + __b0 * __a1) * __c <=
+ __INTMAX_MAX__ - __b0 * __a0, "overflow in multiplication");
+
+ public:
+ static const intmax_t value = _Pn * _Qn;
+ };
+
+ // Helpers for __safe_add
+ template<intmax_t _Pn, intmax_t _Qn, bool>
+ struct __add_overflow_check_impl
+ : integral_constant<bool, (_Pn <= __INTMAX_MAX__ - _Qn)>
+ { };
+
+ template<intmax_t _Pn, intmax_t _Qn>
+ struct __add_overflow_check_impl<_Pn, _Qn, false>
+ : integral_constant<bool, (_Pn >= -__INTMAX_MAX__ - _Qn)>
+ { };
+
+ template<intmax_t _Pn, intmax_t _Qn>
+ struct __add_overflow_check
+ : __add_overflow_check_impl<_Pn, _Qn, (_Qn >= 0)>
+ { };
+
+ template<intmax_t _Pn, intmax_t _Qn>
+ struct __safe_add
+ {
+ static_assert(__add_overflow_check<_Pn, _Qn>::value != 0,
+ "overflow in addition");
+
+ static const intmax_t value = _Pn + _Qn;
+ };
+
+ /**
+ * @brief Provides compile-time rational arithmetic.
+ *
+ * This class template represents any finite rational number with a
+ * numerator and denominator representable by compile-time constants of
+ * type intmax_t. The ratio is simplified when instantiated.
+ *
+ * For example:
+ * @code
+ * std::ratio<7,-21>::num == -1;
+ * std::ratio<7,-21>::den == 3;
+ * @endcode
+ *
+ */
+ template<intmax_t _Num, intmax_t _Den = 1>
+ struct ratio
+ {
+ static_assert(_Den != 0, "denominator cannot be zero");
+ static_assert(_Num >= -__INTMAX_MAX__ && _Den >= -__INTMAX_MAX__,
+ "out of range");
+
+ // Note: sign(N) * abs(N) == N
+ static const intmax_t num =
+ _Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value;
+
+ static const intmax_t den =
+ __static_abs<_Den>::value / __static_gcd<_Num, _Den>::value;
+ };
+
+ template<intmax_t _Num, intmax_t _Den>
+ const intmax_t ratio<_Num, _Den>::num;
+
+ template<intmax_t _Num, intmax_t _Den>
+ const intmax_t ratio<_Num, _Den>::den;
+
+ /// ratio_add
+ template<typename _R1, typename _R2>
+ struct ratio_add
+ {
+ private:
+ static const intmax_t __gcd =
+ __static_gcd<_R1::den, _R2::den>::value;
+
+ public:
+ typedef ratio<
+ __safe_add<
+ __safe_multiply<_R1::num, (_R2::den / __gcd)>::value,
+ __safe_multiply<_R2::num, (_R1::den / __gcd)>::value>::value,
+ __safe_multiply<_R1::den, (_R2::den / __gcd)>::value> type;
+ };
+
+ /// ratio_subtract
+ template<typename _R1, typename _R2>
+ struct ratio_subtract
+ {
+ typedef typename ratio_add<
+ _R1,
+ ratio<-_R2::num, _R2::den>>::type type;
+ };
+
+ /// ratio_multiply
+ template<typename _R1, typename _R2>
+ struct ratio_multiply
+ {
+ private:
+ static const intmax_t __gcd1 =
+ __static_gcd<_R1::num, _R2::den>::value;
+ static const intmax_t __gcd2 =
+ __static_gcd<_R2::num, _R1::den>::value;
+
+ public:
+ typedef ratio<
+ __safe_multiply<(_R1::num / __gcd1),
+ (_R2::num / __gcd2)>::value,
+ __safe_multiply<(_R1::den / __gcd2),
+ (_R2::den / __gcd1)>::value> type;
+ };
+
+ /// ratio_divide
+ template<typename _R1, typename _R2>
+ struct ratio_divide
+ {
+ static_assert(_R2::num != 0, "division by 0");
+
+ typedef typename ratio_multiply<
+ _R1,
+ ratio<_R2::den, _R2::num>>::type type;
+ };
+
+ /// ratio_equal
+ template<typename _R1, typename _R2>
+ struct ratio_equal
+ : integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den>
+ { };
+
+ /// ratio_not_equal
+ template<typename _R1, typename _R2>
+ struct ratio_not_equal
+ : integral_constant<bool, !ratio_equal<_R1, _R2>::value>
+ { };
+
+ template<typename _R1, typename _R2>
+ struct __ratio_less_simple_impl
+ : integral_constant<bool,
+ (__safe_multiply<_R1::num, _R2::den>::value
+ < __safe_multiply<_R2::num, _R1::den>::value)>
+ { };
+
+ // If the denominators are equal or the signs differ, we can just compare
+ // numerators, otherwise fallback to the simple cross-multiply method.
+ template<typename _R1, typename _R2>
+ struct __ratio_less_impl
+ : conditional<(_R1::den == _R2::den
+ || (__static_sign<_R1::num>::value
+ != __static_sign<_R2::num>::value)),
+ integral_constant<bool, (_R1::num < _R2::num)>,
+ __ratio_less_simple_impl<_R1, _R2>>::type
+ { };
+
+ /// ratio_less
+ template<typename _R1, typename _R2>
+ struct ratio_less
+ : __ratio_less_impl<_R1, _R2>::type
+ { };
+
+ /// ratio_less_equal
+ template<typename _R1, typename _R2>
+ struct ratio_less_equal
+ : integral_constant<bool, !ratio_less<_R2, _R1>::value>
+ { };
+
+ /// ratio_greater
+ template<typename _R1, typename _R2>
+ struct ratio_greater
+ : integral_constant<bool, ratio_less<_R2, _R1>::value>
+ { };
+
+ /// ratio_greater_equal
+ template<typename _R1, typename _R2>
+ struct ratio_greater_equal
+ : integral_constant<bool, !ratio_less<_R1, _R2>::value>
+ { };
+
+ typedef ratio<1, 1000000000000000000> atto;
+ typedef ratio<1, 1000000000000000> femto;
+ typedef ratio<1, 1000000000000> pico;
+ typedef ratio<1, 1000000000> nano;
+ typedef ratio<1, 1000000> micro;
+ typedef ratio<1, 1000> milli;
+ typedef ratio<1, 100> centi;
+ typedef ratio<1, 10> deci;
+ typedef ratio< 10, 1> deca;
+ typedef ratio< 100, 1> hecto;
+ typedef ratio< 1000, 1> kilo;
+ typedef ratio< 1000000, 1> mega;
+ typedef ratio< 1000000000, 1> giga;
+ typedef ratio< 1000000000000, 1> tera;
+ typedef ratio< 1000000000000000, 1> peta;
+ typedef ratio< 1000000000000000000, 1> exa;
+
+ // @} group ratio
+}
+
+#endif //_GLIBCXX_USE_C99_STDINT_TR1
+
+#endif //__GXX_EXPERIMENTAL_CXX0X__
+
+#endif //_GLIBCXX_RATIO
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/regex b/gcc-4.4.0/libstdc++-v3/include/std/regex
new file mode 100644
index 000000000..3b25044e5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/regex
@@ -0,0 +1,68 @@
+// <regex> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/regex
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_REGEX
+#define _GLIBCXX_REGEX 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <algorithm>
+#include <bitset>
+#include <iterator>
+#include <locale>
+#include <stdexcept>
+#include <string>
+#include <vector>
+#include <utility>
+#include <sstream>
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/regex>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/regex>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_REGEX
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/set b/gcc-4.4.0/libstdc++-v3/include/std/set
new file mode 100644
index 000000000..21e3f5a8a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/set
@@ -0,0 +1,68 @@
+// <set> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/set
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_SET
+#define _GLIBCXX_SET 1
+
+#pragma GCC system_header
+
+#include <bits/stl_tree.h>
+#include <bits/stl_set.h>
+#include <bits/stl_multiset.h>
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/set>
+#endif
+
+#endif /* _GLIBCXX_SET */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/sstream b/gcc-4.4.0/libstdc++-v3/include/std/sstream
new file mode 100644
index 000000000..f5e3191c4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/sstream
@@ -0,0 +1,576 @@
+// String based streams -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file sstream
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.7 String-based streams
+//
+
+#ifndef _GLIBCXX_SSTREAM
+#define _GLIBCXX_SSTREAM 1
+
+#pragma GCC system_header
+
+#include <istream>
+#include <ostream>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ // [27.7.1] template class basic_stringbuf
+ /**
+ * @brief The actual work of input and output (for std::string).
+ * @ingroup io
+ *
+ * This class associates either or both of its input and output sequences
+ * with a sequence of characters, which can be initialized from, or made
+ * available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.)
+ *
+ * For this class, open modes (of type @c ios_base::openmode) have
+ * @c in set if the input sequence can be read, and @c out set if the
+ * output sequence can be written.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 251. basic_stringbuf missing allocator_type
+ typedef _Alloc allocator_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ typedef basic_streambuf<char_type, traits_type> __streambuf_type;
+ typedef basic_string<char_type, _Traits, _Alloc> __string_type;
+ typedef typename __string_type::size_type __size_type;
+
+ protected:
+ /// Place to stash in || out || in | out settings for current stringbuf.
+ ios_base::openmode _M_mode;
+
+ // Data Members:
+ __string_type _M_string;
+
+ public:
+ // Constructors:
+ /**
+ * @brief Starts with an empty string buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * The default constructor initializes the parent class using its
+ * own default ctor.
+ */
+ explicit
+ basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __streambuf_type(), _M_mode(__mode), _M_string()
+ { }
+
+ /**
+ * @brief Starts with an existing string buffer.
+ * @param str A string to copy as a starting buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * This constructor initializes the parent class using its
+ * own default ctor.
+ */
+ explicit
+ basic_stringbuf(const __string_type& __str,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size())
+ { _M_stringbuf_init(__mode); }
+
+ // Get and set:
+ /**
+ * @brief Copying out the string buffer.
+ * @return A copy of one of the underlying sequences.
+ *
+ * "If the buffer is only created in input mode, the underlying
+ * character sequence is equal to the input sequence; otherwise, it
+ * is equal to the output sequence." [27.7.1.2]/1
+ */
+ __string_type
+ str() const
+ {
+ __string_type __ret;
+ if (this->pptr())
+ {
+ // The current egptr() may not be the actual string end.
+ if (this->pptr() > this->egptr())
+ __ret = __string_type(this->pbase(), this->pptr());
+ else
+ __ret = __string_type(this->pbase(), this->egptr());
+ }
+ else
+ __ret = _M_string;
+ return __ret;
+ }
+
+ /**
+ * @brief Setting a new buffer.
+ * @param s The string to use as a new sequence.
+ *
+ * Deallocates any previous stored sequence, then copies @a s to
+ * use as a new one.
+ */
+ void
+ str(const __string_type& __s)
+ {
+ // Cannot use _M_string = __s, since v3 strings are COW.
+ _M_string.assign(__s.data(), __s.size());
+ _M_stringbuf_init(_M_mode);
+ }
+
+ protected:
+ // Common initialization code goes here.
+ void
+ _M_stringbuf_init(ios_base::openmode __mode)
+ {
+ _M_mode = __mode;
+ __size_type __len = 0;
+ if (_M_mode & (ios_base::ate | ios_base::app))
+ __len = _M_string.size();
+ _M_sync(const_cast<char_type*>(_M_string.data()), 0, __len);
+ }
+
+ virtual streamsize
+ showmanyc()
+ {
+ streamsize __ret = -1;
+ if (_M_mode & ios_base::in)
+ {
+ _M_update_egptr();
+ __ret = this->egptr() - this->gptr();
+ }
+ return __ret;
+ }
+
+ virtual int_type
+ underflow();
+
+ virtual int_type
+ pbackfail(int_type __c = traits_type::eof());
+
+ virtual int_type
+ overflow(int_type __c = traits_type::eof());
+
+ /**
+ * @brief Manipulates the buffer.
+ * @param s Pointer to a buffer area.
+ * @param n Size of @a s.
+ * @return @c this
+ *
+ * If no buffer has already been created, and both @a s and @a n are
+ * non-zero, then @c s is used as a buffer; see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html
+ * for more.
+ */
+ virtual __streambuf_type*
+ setbuf(char_type* __s, streamsize __n)
+ {
+ if (__s && __n >= 0)
+ {
+ // This is implementation-defined behavior, and assumes
+ // that an external char_type array of length __n exists
+ // and has been pre-allocated. If this is not the case,
+ // things will quickly blow up.
+
+ // Step 1: Destroy the current internal array.
+ _M_string.clear();
+
+ // Step 2: Use the external array.
+ _M_sync(__s, __n, 0);
+ }
+ return this;
+ }
+
+ virtual pos_type
+ seekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ virtual pos_type
+ seekpos(pos_type __sp,
+ ios_base::openmode __mode = ios_base::in | ios_base::out);
+
+ // Internal function for correctly updating the internal buffer
+ // for a particular _M_string, due to initialization or re-sizing
+ // of an existing _M_string.
+ void
+ _M_sync(char_type* __base, __size_type __i, __size_type __o);
+
+ // Internal function for correctly updating egptr() to the actual
+ // string end.
+ void
+ _M_update_egptr()
+ {
+ const bool __testin = _M_mode & ios_base::in;
+ if (this->pptr() && this->pptr() > this->egptr())
+ {
+ if (__testin)
+ this->setg(this->eback(), this->gptr(), this->pptr());
+ else
+ this->setg(this->pptr(), this->pptr(), this->pptr());
+ }
+ }
+ };
+
+
+ // [27.7.2] Template class basic_istringstream
+ /**
+ * @brief Controlling input for std::string.
+ * @ingroup io
+ *
+ * This class supports reading from objects of type std::basic_string,
+ * using the inherited functions from std::basic_istream. To control
+ * the associated sequence, an instance of std::basic_stringbuf is used,
+ * which this page refers to as @c sb.
+ */
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_istringstream : public basic_istream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 251. basic_stringbuf missing allocator_type
+ typedef _Alloc allocator_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // Non-standard types:
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_istream<char_type, traits_type> __istream_type;
+
+ private:
+ __stringbuf_type _M_stringbuf;
+
+ public:
+ // Constructors:
+ /**
+ * @brief Default constructor starts with an empty string buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * @c ios_base::in is automatically included in @a mode.
+ *
+ * Initializes @c sb using @c mode|in, and passes @c &sb to the base
+ * class initializer. Does not allocate any buffer.
+ *
+ * That's a lie. We initialize the base class with NULL, because the
+ * string class does its own memory management.
+ */
+ explicit
+ basic_istringstream(ios_base::openmode __mode = ios_base::in)
+ : __istream_type(), _M_stringbuf(__mode | ios_base::in)
+ { this->init(&_M_stringbuf); }
+
+ /**
+ * @brief Starts with an existing string buffer.
+ * @param str A string to copy as a starting buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * @c ios_base::in is automatically included in @a mode.
+ *
+ * Initializes @c sb using @a str and @c mode|in, and passes @c &sb
+ * to the base class initializer.
+ *
+ * That's a lie. We initialize the base class with NULL, because the
+ * string class does its own memory management.
+ */
+ explicit
+ basic_istringstream(const __string_type& __str,
+ ios_base::openmode __mode = ios_base::in)
+ : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in)
+ { this->init(&_M_stringbuf); }
+
+ /**
+ * @brief The destructor does nothing.
+ *
+ * The buffer is deallocated by the stringbuf object, not the
+ * formatting stream.
+ */
+ ~basic_istringstream()
+ { }
+
+ // Members:
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current basic_stringbuf buffer.
+ *
+ * This hides both signatures of std::basic_ios::rdbuf().
+ */
+ __stringbuf_type*
+ rdbuf() const
+ { return const_cast<__stringbuf_type*>(&_M_stringbuf); }
+
+ /**
+ * @brief Copying out the string buffer.
+ * @return @c rdbuf()->str()
+ */
+ __string_type
+ str() const
+ { return _M_stringbuf.str(); }
+
+ /**
+ * @brief Setting a new buffer.
+ * @param s The string to use as a new sequence.
+ *
+ * Calls @c rdbuf()->str(s).
+ */
+ void
+ str(const __string_type& __s)
+ { _M_stringbuf.str(__s); }
+ };
+
+
+ // [27.7.3] Template class basic_ostringstream
+ /**
+ * @brief Controlling output for std::string.
+ * @ingroup io
+ *
+ * This class supports writing to objects of type std::basic_string,
+ * using the inherited functions from std::basic_ostream. To control
+ * the associated sequence, an instance of std::basic_stringbuf is used,
+ * which this page refers to as @c sb.
+ */
+ template <typename _CharT, typename _Traits, typename _Alloc>
+ class basic_ostringstream : public basic_ostream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 251. basic_stringbuf missing allocator_type
+ typedef _Alloc allocator_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // Non-standard types:
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_ostream<char_type, traits_type> __ostream_type;
+
+ private:
+ __stringbuf_type _M_stringbuf;
+
+ public:
+ // Constructors/destructor:
+ /**
+ * @brief Default constructor starts with an empty string buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * @c ios_base::out is automatically included in @a mode.
+ *
+ * Initializes @c sb using @c mode|out, and passes @c &sb to the base
+ * class initializer. Does not allocate any buffer.
+ *
+ * That's a lie. We initialize the base class with NULL, because the
+ * string class does its own memory management.
+ */
+ explicit
+ basic_ostringstream(ios_base::openmode __mode = ios_base::out)
+ : __ostream_type(), _M_stringbuf(__mode | ios_base::out)
+ { this->init(&_M_stringbuf); }
+
+ /**
+ * @brief Starts with an existing string buffer.
+ * @param str A string to copy as a starting buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * @c ios_base::out is automatically included in @a mode.
+ *
+ * Initializes @c sb using @a str and @c mode|out, and passes @c &sb
+ * to the base class initializer.
+ *
+ * That's a lie. We initialize the base class with NULL, because the
+ * string class does its own memory management.
+ */
+ explicit
+ basic_ostringstream(const __string_type& __str,
+ ios_base::openmode __mode = ios_base::out)
+ : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out)
+ { this->init(&_M_stringbuf); }
+
+ /**
+ * @brief The destructor does nothing.
+ *
+ * The buffer is deallocated by the stringbuf object, not the
+ * formatting stream.
+ */
+ ~basic_ostringstream()
+ { }
+
+ // Members:
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current basic_stringbuf buffer.
+ *
+ * This hides both signatures of std::basic_ios::rdbuf().
+ */
+ __stringbuf_type*
+ rdbuf() const
+ { return const_cast<__stringbuf_type*>(&_M_stringbuf); }
+
+ /**
+ * @brief Copying out the string buffer.
+ * @return @c rdbuf()->str()
+ */
+ __string_type
+ str() const
+ { return _M_stringbuf.str(); }
+
+ /**
+ * @brief Setting a new buffer.
+ * @param s The string to use as a new sequence.
+ *
+ * Calls @c rdbuf()->str(s).
+ */
+ void
+ str(const __string_type& __s)
+ { _M_stringbuf.str(__s); }
+ };
+
+
+ // [27.7.4] Template class basic_stringstream
+ /**
+ * @brief Controlling input and output for std::string.
+ * @ingroup io
+ *
+ * This class supports reading from and writing to objects of type
+ * std::basic_string, using the inherited functions from
+ * std::basic_iostream. To control the associated sequence, an instance
+ * of std::basic_stringbuf is used, which this page refers to as @c sb.
+ */
+ template <typename _CharT, typename _Traits, typename _Alloc>
+ class basic_stringstream : public basic_iostream<_CharT, _Traits>
+ {
+ public:
+ // Types:
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 251. basic_stringbuf missing allocator_type
+ typedef _Alloc allocator_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // Non-standard Types:
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_iostream<char_type, traits_type> __iostream_type;
+
+ private:
+ __stringbuf_type _M_stringbuf;
+
+ public:
+ // Constructors/destructors
+ /**
+ * @brief Default constructor starts with an empty string buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * Initializes @c sb using @c mode, and passes @c &sb to the base
+ * class initializer. Does not allocate any buffer.
+ *
+ * That's a lie. We initialize the base class with NULL, because the
+ * string class does its own memory management.
+ */
+ explicit
+ basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in)
+ : __iostream_type(), _M_stringbuf(__m)
+ { this->init(&_M_stringbuf); }
+
+ /**
+ * @brief Starts with an existing string buffer.
+ * @param str A string to copy as a starting buffer.
+ * @param mode Whether the buffer can read, or write, or both.
+ *
+ * Initializes @c sb using @a str and @c mode, and passes @c &sb
+ * to the base class initializer.
+ *
+ * That's a lie. We initialize the base class with NULL, because the
+ * string class does its own memory management.
+ */
+ explicit
+ basic_stringstream(const __string_type& __str,
+ ios_base::openmode __m = ios_base::out | ios_base::in)
+ : __iostream_type(), _M_stringbuf(__str, __m)
+ { this->init(&_M_stringbuf); }
+
+ /**
+ * @brief The destructor does nothing.
+ *
+ * The buffer is deallocated by the stringbuf object, not the
+ * formatting stream.
+ */
+ ~basic_stringstream()
+ { }
+
+ // Members:
+ /**
+ * @brief Accessing the underlying buffer.
+ * @return The current basic_stringbuf buffer.
+ *
+ * This hides both signatures of std::basic_ios::rdbuf().
+ */
+ __stringbuf_type*
+ rdbuf() const
+ { return const_cast<__stringbuf_type*>(&_M_stringbuf); }
+
+ /**
+ * @brief Copying out the string buffer.
+ * @return @c rdbuf()->str()
+ */
+ __string_type
+ str() const
+ { return _M_stringbuf.str(); }
+
+ /**
+ * @brief Setting a new buffer.
+ * @param s The string to use as a new sequence.
+ *
+ * Calls @c rdbuf()->str(s).
+ */
+ void
+ str(const __string_type& __s)
+ { _M_stringbuf.str(__s); }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/sstream.tcc>
+#endif
+
+#endif /* _GLIBCXX_SSTREAM */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/stack b/gcc-4.4.0/libstdc++-v3/include/std/stack
new file mode 100644
index 000000000..4ee2c72a7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/stack
@@ -0,0 +1,64 @@
+// <stack> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/stack
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_STACK
+#define _GLIBCXX_STACK 1
+
+#pragma GCC system_header
+
+#include <deque>
+#include <bits/stl_stack.h>
+
+#endif /* _GLIBCXX_STACK */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/stdexcept b/gcc-4.4.0/libstdc++-v3/include/std/stdexcept
new file mode 100644
index 000000000..9f5c9761c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/stdexcept
@@ -0,0 +1,150 @@
+// Standard exception classes -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2005, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file stdexcept
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 19.1 Exception classes
+//
+
+#ifndef _GLIBCXX_STDEXCEPT
+#define _GLIBCXX_STDEXCEPT 1
+
+#pragma GCC system_header
+
+#include <exception>
+#include <string>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup exceptions
+ * @{
+ */
+
+ /** Logic errors represent problems in the internal logic of a program;
+ * in theory, these are preventable, and even detectable before the
+ * program runs (e.g., violations of class invariants).
+ * @brief One of two subclasses of exception.
+ */
+ class logic_error : public exception
+ {
+ string _M_msg;
+
+ public:
+ /** Takes a character string describing the error. */
+ explicit
+ logic_error(const string& __arg);
+
+ virtual
+ ~logic_error() throw();
+
+ /** Returns a C-style character string describing the general cause of
+ * the current error (the same string passed to the ctor). */
+ virtual const char*
+ what() const throw();
+ };
+
+ /** Thrown by the library, or by you, to report domain errors (domain in
+ * the mathematical sense). */
+ class domain_error : public logic_error
+ {
+ public:
+ explicit domain_error(const string& __arg);
+ };
+
+ /** Thrown to report invalid arguments to functions. */
+ class invalid_argument : public logic_error
+ {
+ public:
+ explicit invalid_argument(const string& __arg);
+ };
+
+ /** Thrown when an object is constructed that would exceed its maximum
+ * permitted size (e.g., a basic_string instance). */
+ class length_error : public logic_error
+ {
+ public:
+ explicit length_error(const string& __arg);
+ };
+
+ /** This represents an argument whose value is not within the expected
+ * range (e.g., boundary checks in basic_string). */
+ class out_of_range : public logic_error
+ {
+ public:
+ explicit out_of_range(const string& __arg);
+ };
+
+ /** Runtime errors represent problems outside the scope of a program;
+ * they cannot be easily predicted and can generally only be caught as
+ * the program executes.
+ * @brief One of two subclasses of exception.
+ */
+ class runtime_error : public exception
+ {
+ string _M_msg;
+
+ public:
+ /** Takes a character string describing the error. */
+ explicit
+ runtime_error(const string& __arg);
+
+ virtual
+ ~runtime_error() throw();
+
+ /** Returns a C-style character string describing the general cause of
+ * the current error (the same string passed to the ctor). */
+ virtual const char*
+ what() const throw();
+ };
+
+ /** Thrown to indicate range errors in internal computations. */
+ class range_error : public runtime_error
+ {
+ public:
+ explicit range_error(const string& __arg);
+ };
+
+ /** Thrown to indicate arithmetic overflow. */
+ class overflow_error : public runtime_error
+ {
+ public:
+ explicit overflow_error(const string& __arg);
+ };
+
+ /** Thrown to indicate arithmetic underflow. */
+ class underflow_error : public runtime_error
+ {
+ public:
+ explicit underflow_error(const string& __arg);
+ };
+
+ // @} group exceptions
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_STDEXCEPT */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/streambuf b/gcc-4.4.0/libstdc++-v3/include/std/streambuf
new file mode 100644
index 000000000..790be0ec4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/streambuf
@@ -0,0 +1,799 @@
+// Stream buffer classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file streambuf
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 27.5 Stream buffers
+//
+
+#ifndef _GLIBXX_STREAMBUF
+#define _GLIBXX_STREAMBUF 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <iosfwd>
+#include <bits/localefwd.h>
+#include <bits/ios_base.h>
+#include <bits/cpp_type_traits.h>
+#include <ext/type_traits.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<typename _CharT, typename _Traits>
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,
+ basic_streambuf<_CharT, _Traits>*, bool&);
+
+ /**
+ * @brief The actual work of input and output (interface).
+ *
+ * This is a base class. Derived stream buffers each control a
+ * pair of character sequences: one for input, and one for output.
+ *
+ * Section [27.5.1] of the standard describes the requirements and
+ * behavior of stream buffer classes. That section (three paragraphs)
+ * is reproduced here, for simplicity and accuracy.
+ *
+ * -# Stream buffers can impose various constraints on the sequences
+ * they control. Some constraints are:
+ * - The controlled input sequence can be not readable.
+ * - The controlled output sequence can be not writable.
+ * - The controlled sequences can be associated with the contents of
+ * other representations for character sequences, such as external
+ * files.
+ * - The controlled sequences can support operations @e directly to or
+ * from associated sequences.
+ * - The controlled sequences can impose limitations on how the
+ * program can read characters from a sequence, write characters to
+ * a sequence, put characters back into an input sequence, or alter
+ * the stream position.
+ * .
+ * -# Each sequence is characterized by three pointers which, if non-null,
+ * all point into the same @c charT array object. The array object
+ * represents, at any moment, a (sub)sequence of characters from the
+ * sequence. Operations performed on a sequence alter the values
+ * stored in these pointers, perform reads and writes directly to or
+ * from associated sequences, and alter "the stream position" and
+ * conversion state as needed to maintain this subsequence relationship.
+ * The three pointers are:
+ * - the <em>beginning pointer</em>, or lowest element address in the
+ * array (called @e xbeg here);
+ * - the <em>next pointer</em>, or next element address that is a
+ * current candidate for reading or writing (called @e xnext here);
+ * - the <em>end pointer</em>, or first element address beyond the
+ * end of the array (called @e xend here).
+ * .
+ * -# The following semantic constraints shall always apply for any set
+ * of three pointers for a sequence, using the pointer names given
+ * immediately above:
+ * - If @e xnext is not a null pointer, then @e xbeg and @e xend shall
+ * also be non-null pointers into the same @c charT array, as
+ * described above; otherwise, @e xbeg and @e xend shall also be null.
+ * - If @e xnext is not a null pointer and @e xnext < @e xend for an
+ * output sequence, then a <em>write position</em> is available.
+ * In this case, @e *xnext shall be assignable as the next element
+ * to write (to put, or to store a character value, into the sequence).
+ * - If @e xnext is not a null pointer and @e xbeg < @e xnext for an
+ * input sequence, then a <em>putback position</em> is available.
+ * In this case, @e xnext[-1] shall have a defined value and is the
+ * next (preceding) element to store a character that is put back
+ * into the input sequence.
+ * - If @e xnext is not a null pointer and @e xnext< @e xend for an
+ * input sequence, then a <em>read position</em> is available.
+ * In this case, @e *xnext shall have a defined value and is the
+ * next element to read (to get, or to obtain a character value,
+ * from the sequence).
+ */
+ template<typename _CharT, typename _Traits>
+ class basic_streambuf
+ {
+ public:
+ //@{
+ /**
+ * These are standard types. They permit a standardized way of
+ * referring to names of (or names dependant on) the template
+ * parameters, which are specific to the implementation.
+ */
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+ //@}
+
+ //@{
+ /// This is a non-standard type.
+ typedef basic_streambuf<char_type, traits_type> __streambuf_type;
+ //@}
+
+ friend class basic_ios<char_type, traits_type>;
+ friend class basic_istream<char_type, traits_type>;
+ friend class basic_ostream<char_type, traits_type>;
+ friend class istreambuf_iterator<char_type, traits_type>;
+ friend class ostreambuf_iterator<char_type, traits_type>;
+
+ friend streamsize
+ __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&);
+
+ template<bool _IsMove, typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ _CharT2*>::__type
+ __copy_move_a2(istreambuf_iterator<_CharT2>,
+ istreambuf_iterator<_CharT2>, _CharT2*);
+
+ template<typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ istreambuf_iterator<_CharT2> >::__type
+ find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
+ const _CharT2&);
+
+ template<typename _CharT2, typename _Traits2>
+ friend basic_istream<_CharT2, _Traits2>&
+ operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*);
+
+ template<typename _CharT2, typename _Traits2, typename _Alloc>
+ friend basic_istream<_CharT2, _Traits2>&
+ operator>>(basic_istream<_CharT2, _Traits2>&,
+ basic_string<_CharT2, _Traits2, _Alloc>&);
+
+ template<typename _CharT2, typename _Traits2, typename _Alloc>
+ friend basic_istream<_CharT2, _Traits2>&
+ getline(basic_istream<_CharT2, _Traits2>&,
+ basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2);
+
+ protected:
+ //@{
+ /**
+ * This is based on _IO_FILE, just reordered to be more consistent,
+ * and is intended to be the most minimal abstraction for an
+ * internal buffer.
+ * - get == input == read
+ * - put == output == write
+ */
+ char_type* _M_in_beg; // Start of get area.
+ char_type* _M_in_cur; // Current read area.
+ char_type* _M_in_end; // End of get area.
+ char_type* _M_out_beg; // Start of put area.
+ char_type* _M_out_cur; // Current put area.
+ char_type* _M_out_end; // End of put area.
+
+ /// Current locale setting.
+ locale _M_buf_locale;
+
+ public:
+ /// Destructor deallocates no buffer space.
+ virtual
+ ~basic_streambuf()
+ { }
+
+ // [27.5.2.2.1] locales
+ /**
+ * @brief Entry point for imbue().
+ * @param loc The new locale.
+ * @return The previous locale.
+ *
+ * Calls the derived imbue(loc).
+ */
+ locale
+ pubimbue(const locale &__loc)
+ {
+ locale __tmp(this->getloc());
+ this->imbue(__loc);
+ _M_buf_locale = __loc;
+ return __tmp;
+ }
+
+ /**
+ * @brief Locale access.
+ * @return The current locale in effect.
+ *
+ * If pubimbue(loc) has been called, then the most recent @c loc
+ * is returned. Otherwise the global locale in effect at the time
+ * of construction is returned.
+ */
+ locale
+ getloc() const
+ { return _M_buf_locale; }
+
+ // [27.5.2.2.2] buffer management and positioning
+ //@{
+ /**
+ * @brief Entry points for derived buffer functions.
+ *
+ * The public versions of @c pubfoo dispatch to the protected
+ * derived @c foo member functions, passing the arguments (if any)
+ * and returning the result unchanged.
+ */
+ __streambuf_type*
+ pubsetbuf(char_type* __s, streamsize __n)
+ { return this->setbuf(__s, __n); }
+
+ pos_type
+ pubseekoff(off_type __off, ios_base::seekdir __way,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ { return this->seekoff(__off, __way, __mode); }
+
+ pos_type
+ pubseekpos(pos_type __sp,
+ ios_base::openmode __mode = ios_base::in | ios_base::out)
+ { return this->seekpos(__sp, __mode); }
+
+ int
+ pubsync() { return this->sync(); }
+ //@}
+
+ // [27.5.2.2.3] get area
+ /**
+ * @brief Looking ahead into the stream.
+ * @return The number of characters available.
+ *
+ * If a read position is available, returns the number of characters
+ * available for reading before the buffer must be refilled.
+ * Otherwise returns the derived @c showmanyc().
+ */
+ streamsize
+ in_avail()
+ {
+ const streamsize __ret = this->egptr() - this->gptr();
+ return __ret ? __ret : this->showmanyc();
+ }
+
+ /**
+ * @brief Getting the next character.
+ * @return The next character, or eof.
+ *
+ * Calls @c sbumpc(), and if that function returns
+ * @c traits::eof(), so does this function. Otherwise, @c sgetc().
+ */
+ int_type
+ snextc()
+ {
+ int_type __ret = traits_type::eof();
+ if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(),
+ __ret), true))
+ __ret = this->sgetc();
+ return __ret;
+ }
+
+ /**
+ * @brief Getting the next character.
+ * @return The next character, or eof.
+ *
+ * If the input read position is available, returns that character
+ * and increments the read pointer, otherwise calls and returns
+ * @c uflow().
+ */
+ int_type
+ sbumpc()
+ {
+ int_type __ret;
+ if (__builtin_expect(this->gptr() < this->egptr(), true))
+ {
+ __ret = traits_type::to_int_type(*this->gptr());
+ this->gbump(1);
+ }
+ else
+ __ret = this->uflow();
+ return __ret;
+ }
+
+ /**
+ * @brief Getting the next character.
+ * @return The next character, or eof.
+ *
+ * If the input read position is available, returns that character,
+ * otherwise calls and returns @c underflow(). Does not move the
+ * read position after fetching the character.
+ */
+ int_type
+ sgetc()
+ {
+ int_type __ret;
+ if (__builtin_expect(this->gptr() < this->egptr(), true))
+ __ret = traits_type::to_int_type(*this->gptr());
+ else
+ __ret = this->underflow();
+ return __ret;
+ }
+
+ /**
+ * @brief Entry point for xsgetn.
+ * @param s A buffer area.
+ * @param n A count.
+ *
+ * Returns xsgetn(s,n). The effect is to fill @a s[0] through
+ * @a s[n-1] with characters from the input sequence, if possible.
+ */
+ streamsize
+ sgetn(char_type* __s, streamsize __n)
+ { return this->xsgetn(__s, __n); }
+
+ // [27.5.2.2.4] putback
+ /**
+ * @brief Pushing characters back into the input stream.
+ * @param c The character to push back.
+ * @return The previous character, if possible.
+ *
+ * Similar to sungetc(), but @a c is pushed onto the stream instead
+ * of "the previous character". If successful, the next character
+ * fetched from the input stream will be @a c.
+ */
+ int_type
+ sputbackc(char_type __c)
+ {
+ int_type __ret;
+ const bool __testpos = this->eback() < this->gptr();
+ if (__builtin_expect(!__testpos ||
+ !traits_type::eq(__c, this->gptr()[-1]), false))
+ __ret = this->pbackfail(traits_type::to_int_type(__c));
+ else
+ {
+ this->gbump(-1);
+ __ret = traits_type::to_int_type(*this->gptr());
+ }
+ return __ret;
+ }
+
+ /**
+ * @brief Moving backwards in the input stream.
+ * @return The previous character, if possible.
+ *
+ * If a putback position is available, this function decrements the
+ * input pointer and returns that character. Otherwise, calls and
+ * returns pbackfail(). The effect is to "unget" the last character
+ * "gotten".
+ */
+ int_type
+ sungetc()
+ {
+ int_type __ret;
+ if (__builtin_expect(this->eback() < this->gptr(), true))
+ {
+ this->gbump(-1);
+ __ret = traits_type::to_int_type(*this->gptr());
+ }
+ else
+ __ret = this->pbackfail();
+ return __ret;
+ }
+
+ // [27.5.2.2.5] put area
+ /**
+ * @brief Entry point for all single-character output functions.
+ * @param c A character to output.
+ * @return @a c, if possible.
+ *
+ * One of two public output functions.
+ *
+ * If a write position is available for the output sequence (i.e.,
+ * the buffer is not full), stores @a c in that position, increments
+ * the position, and returns @c traits::to_int_type(c). If a write
+ * position is not available, returns @c overflow(c).
+ */
+ int_type
+ sputc(char_type __c)
+ {
+ int_type __ret;
+ if (__builtin_expect(this->pptr() < this->epptr(), true))
+ {
+ *this->pptr() = __c;
+ this->pbump(1);
+ __ret = traits_type::to_int_type(__c);
+ }
+ else
+ __ret = this->overflow(traits_type::to_int_type(__c));
+ return __ret;
+ }
+
+ /**
+ * @brief Entry point for all single-character output functions.
+ * @param s A buffer read area.
+ * @param n A count.
+ *
+ * One of two public output functions.
+ *
+ *
+ * Returns xsputn(s,n). The effect is to write @a s[0] through
+ * @a s[n-1] to the output sequence, if possible.
+ */
+ streamsize
+ sputn(const char_type* __s, streamsize __n)
+ { return this->xsputn(__s, __n); }
+
+ protected:
+ /**
+ * @brief Base constructor.
+ *
+ * Only called from derived constructors, and sets up all the
+ * buffer data to zero, including the pointers described in the
+ * basic_streambuf class description. Note that, as a result,
+ * - the class starts with no read nor write positions available,
+ * - this is not an error
+ */
+ basic_streambuf()
+ : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
+ _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
+ _M_buf_locale(locale())
+ { }
+
+ // [27.5.2.3.1] get area access
+ //@{
+ /**
+ * @brief Access to the get area.
+ *
+ * These functions are only available to other protected functions,
+ * including derived classes.
+ *
+ * - eback() returns the beginning pointer for the input sequence
+ * - gptr() returns the next pointer for the input sequence
+ * - egptr() returns the end pointer for the input sequence
+ */
+ char_type*
+ eback() const { return _M_in_beg; }
+
+ char_type*
+ gptr() const { return _M_in_cur; }
+
+ char_type*
+ egptr() const { return _M_in_end; }
+ //@}
+
+ /**
+ * @brief Moving the read position.
+ * @param n The delta by which to move.
+ *
+ * This just advances the read position without returning any data.
+ */
+ void
+ gbump(int __n) { _M_in_cur += __n; }
+
+ /**
+ * @brief Setting the three read area pointers.
+ * @param gbeg A pointer.
+ * @param gnext A pointer.
+ * @param gend A pointer.
+ * @post @a gbeg == @c eback(), @a gnext == @c gptr(), and
+ * @a gend == @c egptr()
+ */
+ void
+ setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)
+ {
+ _M_in_beg = __gbeg;
+ _M_in_cur = __gnext;
+ _M_in_end = __gend;
+ }
+
+ // [27.5.2.3.2] put area access
+ //@{
+ /**
+ * @brief Access to the put area.
+ *
+ * These functions are only available to other protected functions,
+ * including derived classes.
+ *
+ * - pbase() returns the beginning pointer for the output sequence
+ * - pptr() returns the next pointer for the output sequence
+ * - epptr() returns the end pointer for the output sequence
+ */
+ char_type*
+ pbase() const { return _M_out_beg; }
+
+ char_type*
+ pptr() const { return _M_out_cur; }
+
+ char_type*
+ epptr() const { return _M_out_end; }
+ //@}
+
+ /**
+ * @brief Moving the write position.
+ * @param n The delta by which to move.
+ *
+ * This just advances the write position without returning any data.
+ */
+ void
+ pbump(int __n) { _M_out_cur += __n; }
+
+ /**
+ * @brief Setting the three write area pointers.
+ * @param pbeg A pointer.
+ * @param pend A pointer.
+ * @post @a pbeg == @c pbase(), @a pbeg == @c pptr(), and
+ * @a pend == @c epptr()
+ */
+ void
+ setp(char_type* __pbeg, char_type* __pend)
+ {
+ _M_out_beg = _M_out_cur = __pbeg;
+ _M_out_end = __pend;
+ }
+
+ // [27.5.2.4] virtual functions
+ // [27.5.2.4.1] locales
+ /**
+ * @brief Changes translations.
+ * @param loc A new locale.
+ *
+ * Translations done during I/O which depend on the current locale
+ * are changed by this call. The standard adds, "Between invocations
+ * of this function a class derived from streambuf can safely cache
+ * results of calls to locale functions and to members of facets
+ * so obtained."
+ *
+ * @note Base class version does nothing.
+ */
+ virtual void
+ imbue(const locale&)
+ { }
+
+ // [27.5.2.4.2] buffer management and positioning
+ /**
+ * @brief Manipulates the buffer.
+ *
+ * Each derived class provides its own appropriate behavior. See
+ * the next-to-last paragraph of
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html
+ * for more on this function.
+ *
+ * @note Base class version does nothing, returns @c this.
+ */
+ virtual basic_streambuf<char_type,_Traits>*
+ setbuf(char_type*, streamsize)
+ { return this; }
+
+ /**
+ * @brief Alters the stream positions.
+ *
+ * Each derived class provides its own appropriate behavior.
+ * @note Base class version does nothing, returns a @c pos_type
+ * that represents an invalid stream position.
+ */
+ virtual pos_type
+ seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)
+ { return pos_type(off_type(-1)); }
+
+ /**
+ * @brief Alters the stream positions.
+ *
+ * Each derived class provides its own appropriate behavior.
+ * @note Base class version does nothing, returns a @c pos_type
+ * that represents an invalid stream position.
+ */
+ virtual pos_type
+ seekpos(pos_type,
+ ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)
+ { return pos_type(off_type(-1)); }
+
+ /**
+ * @brief Synchronizes the buffer arrays with the controlled sequences.
+ * @return -1 on failure.
+ *
+ * Each derived class provides its own appropriate behavior,
+ * including the definition of "failure".
+ * @note Base class version does nothing, returns zero.
+ */
+ virtual int
+ sync() { return 0; }
+
+ // [27.5.2.4.3] get area
+ /**
+ * @brief Investigating the data available.
+ * @return An estimate of the number of characters available in the
+ * input sequence, or -1.
+ *
+ * "If it returns a positive value, then successive calls to
+ * @c underflow() will not return @c traits::eof() until at least that
+ * number of characters have been supplied. If @c showmanyc()
+ * returns -1, then calls to @c underflow() or @c uflow() will fail."
+ * [27.5.2.4.3]/1
+ *
+ * @note Base class version does nothing, returns zero.
+ * @note The standard adds that "the intention is not only that the
+ * calls [to underflow or uflow] will not return @c eof() but
+ * that they will return "immediately".
+ * @note The standard adds that "the morphemes of @c showmanyc are
+ * "es-how-many-see", not "show-manic".
+ */
+ virtual streamsize
+ showmanyc() { return 0; }
+
+ /**
+ * @brief Multiple character extraction.
+ * @param s A buffer area.
+ * @param n Maximum number of characters to assign.
+ * @return The number of characters assigned.
+ *
+ * Fills @a s[0] through @a s[n-1] with characters from the input
+ * sequence, as if by @c sbumpc(). Stops when either @a n characters
+ * have been copied, or when @c traits::eof() would be copied.
+ *
+ * It is expected that derived classes provide a more efficient
+ * implementation by overriding this definition.
+ */
+ virtual streamsize
+ xsgetn(char_type* __s, streamsize __n);
+
+ /**
+ * @brief Fetches more data from the controlled sequence.
+ * @return The first character from the <em>pending sequence</em>.
+ *
+ * Informally, this function is called when the input buffer is
+ * exhausted (or does not exist, as buffering need not actually be
+ * done). If a buffer exists, it is "refilled". In either case, the
+ * next available character is returned, or @c traits::eof() to
+ * indicate a null pending sequence.
+ *
+ * For a formal definition of the pending sequence, see a good text
+ * such as Langer & Kreft, or [27.5.2.4.3]/7-14.
+ *
+ * A functioning input streambuf can be created by overriding only
+ * this function (no buffer area will be used). For an example, see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25.html
+ *
+ * @note Base class version does nothing, returns eof().
+ */
+ virtual int_type
+ underflow()
+ { return traits_type::eof(); }
+
+ /**
+ * @brief Fetches more data from the controlled sequence.
+ * @return The first character from the <em>pending sequence</em>.
+ *
+ * Informally, this function does the same thing as @c underflow(),
+ * and in fact is required to call that function. It also returns
+ * the new character, like @c underflow() does. However, this
+ * function also moves the read position forward by one.
+ */
+ virtual int_type
+ uflow()
+ {
+ int_type __ret = traits_type::eof();
+ const bool __testeof = traits_type::eq_int_type(this->underflow(),
+ __ret);
+ if (!__testeof)
+ {
+ __ret = traits_type::to_int_type(*this->gptr());
+ this->gbump(1);
+ }
+ return __ret;
+ }
+
+ // [27.5.2.4.4] putback
+ /**
+ * @brief Tries to back up the input sequence.
+ * @param c The character to be inserted back into the sequence.
+ * @return eof() on failure, "some other value" on success
+ * @post The constraints of @c gptr(), @c eback(), and @c pptr()
+ * are the same as for @c underflow().
+ *
+ * @note Base class version does nothing, returns eof().
+ */
+ virtual int_type
+ pbackfail(int_type /* __c */ = traits_type::eof())
+ { return traits_type::eof(); }
+
+ // Put area:
+ /**
+ * @brief Multiple character insertion.
+ * @param s A buffer area.
+ * @param n Maximum number of characters to write.
+ * @return The number of characters written.
+ *
+ * Writes @a s[0] through @a s[n-1] to the output sequence, as if
+ * by @c sputc(). Stops when either @a n characters have been
+ * copied, or when @c sputc() would return @c traits::eof().
+ *
+ * It is expected that derived classes provide a more efficient
+ * implementation by overriding this definition.
+ */
+ virtual streamsize
+ xsputn(const char_type* __s, streamsize __n);
+
+ /**
+ * @brief Consumes data from the buffer; writes to the
+ * controlled sequence.
+ * @param c An additional character to consume.
+ * @return eof() to indicate failure, something else (usually
+ * @a c, or not_eof())
+ *
+ * Informally, this function is called when the output buffer is full
+ * (or does not exist, as buffering need not actually be done). If a
+ * buffer exists, it is "consumed", with "some effect" on the
+ * controlled sequence. (Typically, the buffer is written out to the
+ * sequence verbatim.) In either case, the character @a c is also
+ * written out, if @a c is not @c eof().
+ *
+ * For a formal definition of this function, see a good text
+ * such as Langer & Kreft, or [27.5.2.4.5]/3-7.
+ *
+ * A functioning output streambuf can be created by overriding only
+ * this function (no buffer area will be used).
+ *
+ * @note Base class version does nothing, returns eof().
+ */
+ virtual int_type
+ overflow(int_type /* __c */ = traits_type::eof())
+ { return traits_type::eof(); }
+
+#if _GLIBCXX_DEPRECATED
+ // Annex D.6
+ public:
+ /**
+ * @brief Tosses a character.
+ *
+ * Advances the read pointer, ignoring the character that would have
+ * been read.
+ *
+ * See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html
+ */
+ void
+ stossc()
+ {
+ if (this->gptr() < this->egptr())
+ this->gbump(1);
+ else
+ this->uflow();
+ }
+#endif
+
+ private:
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // Side effect of DR 50.
+ basic_streambuf(const __streambuf_type& __sb)
+ : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
+ _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
+ _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),
+ _M_buf_locale(__sb._M_buf_locale)
+ { }
+
+ __streambuf_type&
+ operator=(const __streambuf_type&) { return *this; };
+ };
+
+ // Explicit specialization declarations, defined in src/streambuf.cc.
+ template<>
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<char>* __sbin,
+ basic_streambuf<char>* __sbout, bool& __ineof);
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin,
+ basic_streambuf<wchar_t>* __sbout, bool& __ineof);
+#endif
+
+_GLIBCXX_END_NAMESPACE
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/streambuf.tcc>
+#endif
+
+#endif /* _GLIBCXX_STREAMBUF */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/string b/gcc-4.4.0/libstdc++-v3/include/std/string
new file mode 100644
index 000000000..8c5949fd0
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/string
@@ -0,0 +1,59 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+// 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/string
+ * This is a Standard C++ Library header.
+ */
+
+//
+// ISO C++ 14882: 21 Strings library
+//
+
+#ifndef _GLIBCXX_STRING
+#define _GLIBCXX_STRING 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/stringfwd.h>
+#include <bits/char_traits.h> // NB: In turn includes stl_algobase.h
+#include <bits/allocator.h>
+#include <bits/cpp_type_traits.h>
+#include <bits/localefwd.h> // For operators >>, <<, and getline.
+#include <bits/ostream_insert.h>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/stl_iterator.h>
+#include <bits/stl_function.h> // For less
+#include <ext/numeric_traits.h>
+#include <bits/stl_algobase.h>
+#include <bits/basic_string.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/basic_string.tcc>
+#endif
+
+#endif /* _GLIBCXX_STRING */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/system_error b/gcc-4.4.0/libstdc++-v3/include/std/system_error
new file mode 100644
index 000000000..3a6883ddc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/system_error
@@ -0,0 +1,360 @@
+// <system_error> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file system_error
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_SYSTEM_ERROR
+#define _GLIBCXX_SYSTEM_ERROR 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <bits/error_constants.h>
+#include <iosfwd>
+#include <stdexcept>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ class error_code;
+ class error_condition;
+ class error_category;
+ class system_error;
+
+ /// is_error_code_enum
+ template<typename _Tp>
+ struct is_error_code_enum : public false_type { };
+
+ template<>
+ struct is_error_code_enum<errc>
+ : public true_type { };
+
+ /// is_error_condition_enum
+ template<typename _Tp>
+ struct is_error_condition_enum : public false_type { };
+
+ template<>
+ struct is_error_condition_enum<errc>
+ : public true_type { };
+
+
+ /// error_category
+ class error_category
+ {
+ protected:
+ error_category() = default;
+
+ public:
+ virtual ~error_category() { }
+
+ error_category(const error_category&) = delete;
+ error_category& operator=(const error_category&) = delete;
+
+ virtual const char*
+ name() const = 0;
+
+ virtual string
+ message(int) const = 0;
+
+ virtual error_condition
+ default_error_condition(int __i) const;
+
+ virtual bool
+ equivalent(int __i, const error_condition& __cond) const;
+
+ virtual bool
+ equivalent(const error_code& __code, int __i) const;
+
+ bool
+ operator<(const error_category& __other) const
+ { return less<const error_category*>()(this, &__other); }
+
+ bool
+ operator==(const error_category& __other) const
+ { return this == &__other; }
+
+ bool
+ operator!=(const error_category& __other) const
+ { return this != &__other; }
+ };
+
+ // DR 890.
+ const error_category& system_category();
+ const error_category& generic_category();
+
+ /// error_code
+ // Implementation-specific error identification
+ struct error_code
+ {
+ error_code()
+ : _M_value(0), _M_cat(&system_category()) { }
+
+ error_code(int __v, const error_category& __cat)
+ : _M_value(__v), _M_cat(&__cat) { }
+
+ template<typename _ErrorCodeEnum>
+ error_code(_ErrorCodeEnum __e,
+ typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type* = 0)
+ : _M_value(static_cast<int>(__e)), _M_cat(&generic_category())
+ { }
+
+ void
+ assign(int __v, const error_category& __cat)
+ {
+ _M_value = __v;
+ _M_cat = &__cat;
+ }
+
+ void
+ clear()
+ { assign(0, system_category()); }
+
+ // DR 804.
+ template<typename _ErrorCodeEnum>
+ typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value,
+ error_code&>::type
+ operator=(_ErrorCodeEnum __e)
+ {
+ assign(static_cast<int>(__e), generic_category());
+ return *this;
+ }
+
+ int
+ value() const { return _M_value; }
+
+ const error_category&
+ category() const { return *_M_cat; }
+
+ error_condition
+ default_error_condition() const;
+
+ string
+ message() const
+ { return category().message(value()); }
+
+ // Safe bool idiom.
+ // explicit operator bool() const throw()
+ // { return _M_value != 0; }
+ typedef void (*__bool_type)();
+
+ static void __not_bool_type() { }
+
+ operator __bool_type() const
+ { return _M_value != 0 ? &__not_bool_type : false; }
+
+ // DR 804.
+ private:
+ int _M_value;
+ const error_category* _M_cat;
+ };
+
+ // 19.4.2.6 non-member functions
+ inline error_code
+ make_error_code(errc __e)
+ { return error_code(static_cast<int>(__e), generic_category()); }
+
+ inline bool
+ operator<(const error_code& __lhs, const error_code& __rhs)
+ {
+ return (__lhs.category() < __rhs.category()
+ || (__lhs.category() == __rhs.category()
+ && __lhs.value() < __rhs.value()));
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
+ { return (__os << __e.category().name() << ':' << __e.value()); }
+
+
+ /// error_condition
+ // Portable error identification
+ struct error_condition
+ {
+ error_condition() : _M_value(0), _M_cat(&generic_category()) { }
+
+ error_condition(int __v, const error_category& __cat)
+ : _M_value(__v), _M_cat(&__cat) { }
+
+ template<typename _ErrorConditionEnum>
+ error_condition(_ErrorConditionEnum __e,
+ typename enable_if<is_error_condition_enum
+ <_ErrorConditionEnum>::value>::type* = 0)
+ : _M_value(static_cast<int>(__e)), _M_cat(&generic_category()) { }
+
+ void
+ assign(int __v, const error_category& __cat)
+ {
+ _M_value = __v;
+ _M_cat = &__cat;
+ }
+
+ // DR 804.
+ template<typename _ErrorConditionEnum>
+ typename enable_if<is_error_condition_enum
+ <_ErrorConditionEnum>::value, error_condition&>::type
+ operator=(_ErrorConditionEnum __e)
+ {
+ assign(static_cast<int>(__e), generic_category());
+ return *this;
+ }
+
+ void
+ clear()
+ { assign(0, generic_category()); }
+
+ // 19.4.3.4 observers
+ int
+ value() const { return _M_value; }
+
+ const error_category&
+ category() const { return *_M_cat; }
+
+ string
+ message() const
+ { return category().message(value()); }
+
+ // Safe bool idiom.
+ // explicit operator bool() const throw()
+ // { return _M_value != 0; }
+ typedef void (*__bool_type)();
+
+ static void __not_bool_type() { }
+
+ operator __bool_type() const
+ { return _M_value != 0 ? &__not_bool_type : false; }
+
+ // DR 804.
+ private:
+ int _M_value;
+ const error_category* _M_cat;
+ };
+
+ // 19.4.3.6 non-member functions
+ inline error_condition
+ make_error_condition(errc __e)
+ { return error_condition(static_cast<int>(__e), generic_category()); }
+
+ inline bool
+ operator<(const error_condition& __lhs, const error_condition& __rhs)
+ {
+ return (__lhs.category() < __rhs.category()
+ || (__lhs.category() == __rhs.category()
+ && __lhs.value() < __rhs.value()));
+ }
+
+ // 19.4.4 Comparison operators
+ inline bool
+ operator==(const error_code& __lhs, const error_code& __rhs)
+ { return (__lhs.category() == __rhs.category()
+ && __lhs.value() == __rhs.value()); }
+
+ inline bool
+ operator==(const error_code& __lhs, const error_condition& __rhs)
+ {
+ return (__lhs.category().equivalent(__lhs.value(), __rhs)
+ || __rhs.category().equivalent(__lhs, __rhs.value()));
+ }
+
+ inline bool
+ operator==(const error_condition& __lhs, const error_code& __rhs)
+ {
+ return (__rhs.category().equivalent(__rhs.value(), __lhs)
+ || __lhs.category().equivalent(__rhs, __lhs.value()));
+ }
+
+ inline bool
+ operator==(const error_condition& __lhs, const error_condition& __rhs)
+ {
+ return (__lhs.category() == __rhs.category()
+ && __lhs.value() == __rhs.value());
+ }
+
+ inline bool
+ operator!=(const error_code& __lhs, const error_code& __rhs)
+ { return !(__lhs == __rhs); }
+
+ inline bool
+ operator!=(const error_code& __lhs, const error_condition& __rhs)
+ { return !(__lhs == __rhs); }
+
+ inline bool
+ operator!=(const error_condition& __lhs, const error_code& __rhs)
+ { return !(__lhs == __rhs); }
+
+ inline bool
+ operator!=(const error_condition& __lhs, const error_condition& __rhs)
+ { return !(__lhs == __rhs); }
+
+
+ /**
+ * @brief Thrown to indicate error code of underlying system.
+ *
+ * @ingroup exceptions
+ */
+ class system_error : public std::runtime_error
+ {
+ private:
+ error_code _M_code;
+
+ public:
+ system_error(error_code __ec = error_code())
+ : runtime_error(""), _M_code(__ec) { }
+
+ system_error(error_code __ec, const string& __what)
+ : runtime_error(__what), _M_code(__ec) { }
+
+ /*
+ * TODO: Add const char* ctors to all exceptions.
+ *
+ * system_error(error_code __ec, const char* __what)
+ * : runtime_error(__what), _M_code(__ec) { }
+ *
+ * system_error(int __v, const error_category& __ecat, const char* __what)
+ * : runtime_error(__what), _M_code(error_code(__v, __ecat)) { }
+ */
+
+ system_error(int __v, const error_category& __ecat)
+ : runtime_error(""), _M_code(error_code(__v, __ecat)) { }
+
+ system_error(int __v, const error_category& __ecat, const string& __what)
+ : runtime_error(__what), _M_code(error_code(__v, __ecat)) { }
+
+ virtual ~system_error() throw();
+
+ const error_code&
+ code() const throw() { return _M_code; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_SYSTEM_ERROR
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/thread b/gcc-4.4.0/libstdc++-v3/include/std/thread
new file mode 100644
index 000000000..8ce9e5cf6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/thread
@@ -0,0 +1,284 @@
+// <thread> -*- C++ -*-
+
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file thread
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_THREAD
+#define _GLIBCXX_THREAD 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <chrono>
+#include <functional>
+#include <memory>
+#include <mutex>
+#include <condition_variable>
+#include <cstddef>
+#include <bits/functexcept.h>
+#include <bits/gthr.h>
+
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+
+namespace std
+{
+ /**
+ * @defgroup threads Threads
+ * @ingroup concurrency
+ *
+ * Classes for thread support.
+ * @{
+ */
+
+ /// thread
+ class thread
+ {
+ public:
+ typedef __gthread_t native_handle_type;
+ struct _Impl_base;
+ typedef shared_ptr<_Impl_base> __shared_base_type;
+
+ /// thread::id
+ class id
+ {
+ native_handle_type _M_thread;
+
+ public:
+ id() : _M_thread() { }
+
+ explicit
+ id(native_handle_type __id) : _M_thread(__id) { }
+
+ private:
+ friend class thread;
+
+ friend bool
+ operator==(thread::id __x, thread::id __y)
+ { return __gthread_equal(__x._M_thread, __y._M_thread); }
+
+ friend bool
+ operator<(thread::id __x, thread::id __y)
+ { return __x._M_thread < __y._M_thread; }
+
+ template<class _CharT, class _Traits>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>&& __out, thread::id __id);
+ };
+
+ // Simple base type that the templatized, derived class containing
+ // an arbitrary functor can be converted to and called.
+ struct _Impl_base
+ {
+ __shared_base_type _M_this_ptr;
+
+ virtual ~_Impl_base() = default;
+
+ virtual void _M_run() = 0;
+ };
+
+ template<typename _Callable>
+ struct _Impl : public _Impl_base
+ {
+ _Callable _M_func;
+
+ _Impl(_Callable&& __f) : _M_func(std::forward<_Callable>(__f))
+ { }
+
+ void
+ _M_run() { _M_func(); }
+ };
+
+ private:
+ id _M_id;
+
+ public:
+ thread() = default;
+ thread(const thread&) = delete;
+
+ thread(thread&& __t)
+ { swap(__t); }
+
+ template<typename _Callable>
+ explicit thread(_Callable __f)
+ { _M_start_thread(_M_make_routine<_Callable>(__f)); }
+
+ template<typename _Callable, typename... _Args>
+ thread(_Callable&& __f, _Args&&... __args)
+ { _M_start_thread(_M_make_routine(std::bind(__f, __args...))); }
+
+ ~thread()
+ {
+ if (joinable())
+ detach();
+ }
+
+ thread& operator=(const thread&) = delete;
+
+ thread& operator=(thread&& __t)
+ {
+ if (joinable())
+ detach();
+ swap(__t);
+ return *this;
+ }
+
+ void
+ swap(thread&& __t)
+ { std::swap(_M_id, __t._M_id); }
+
+ bool
+ joinable() const
+ { return !(_M_id == id()); }
+
+ void
+ join();
+
+ void
+ detach();
+
+ thread::id
+ get_id() const
+ { return _M_id; }
+
+ /** @pre thread is joinable
+ */
+ native_handle_type
+ native_handle()
+ { return _M_id._M_thread; }
+
+ // Returns a value that hints at the number of hardware thread contexts.
+ static unsigned int
+ hardware_concurrency()
+ { return 0; }
+
+ private:
+ void
+ _M_start_thread(__shared_base_type);
+
+ template<typename _Callable>
+ shared_ptr<_Impl<_Callable>>
+ _M_make_routine(_Callable&& __f)
+ {
+ // Create and allocate full data structure, not base.
+ return make_shared<_Impl<_Callable>>(std::forward<_Callable>(__f));
+ }
+ };
+
+ inline void
+ swap(thread& __x, thread& __y)
+ { __x.swap(__y); }
+
+ inline void
+ swap(thread&& __x, thread& __y)
+ { __x.swap(__y); }
+
+ inline void
+ swap(thread& __x, thread&& __y)
+ { __x.swap(__y); }
+
+ inline bool
+ operator!=(thread::id __x, thread::id __y)
+ { return !(__x == __y); }
+
+ inline bool
+ operator<=(thread::id __x, thread::id __y)
+ { return !(__y < __x); }
+
+ inline bool
+ operator>(thread::id __x, thread::id __y)
+ { return __y < __x; }
+
+ inline bool
+ operator>=(thread::id __x, thread::id __y)
+ { return !(__x < __y); }
+
+ template<class _CharT, class _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>&& __out, thread::id __id)
+ {
+ if (__id == thread::id())
+ return __out << "thread::id of a non-executing thread";
+ else
+ return __out << __id._M_thread;
+ }
+
+ /** @namespace std::this_thread
+ * @brief ISO C++ 0x entities sub namespace for thread.
+ * 30.2.2 Namespace this_thread.
+ */
+ namespace this_thread
+ {
+ /// get_id
+ inline thread::id
+ get_id() { return thread::id(__gthread_self()); }
+
+#ifdef _GLIBCXX_USE_SCHED_YIELD
+ /// yield
+ inline void
+ yield()
+ { __gthread_yield(); }
+#endif
+
+#ifdef _GLIBCXX_USE_NANOSLEEP
+ /// sleep_until
+ template<typename _Clock, typename _Duration>
+ inline void
+ sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
+ { sleep_for(__atime - _Clock::now()); }
+
+ /// sleep_for
+ template<typename _Rep, typename _Period>
+ inline void
+ sleep_for(const chrono::duration<_Rep, _Period>& __rtime)
+ {
+ chrono::seconds __s =
+ chrono::duration_cast<chrono::seconds>(__rtime);
+
+ chrono::nanoseconds __ns =
+ chrono::duration_cast<chrono::nanoseconds>(__rtime - __s);
+
+ __gthread_time_t __ts =
+ {
+ static_cast<std::time_t>(__s.count()),
+ static_cast<long>(__ns.count())
+ };
+
+ ::nanosleep(&__ts, 0);
+ }
+#endif
+ }
+
+ // @} group threads
+}
+
+#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_THREAD
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/tuple b/gcc-4.4.0/libstdc++-v3/include/std/tuple
new file mode 100644
index 000000000..c5dbe6bcc
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/tuple
@@ -0,0 +1,697 @@
+// <tuple> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/tuple
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TUPLE
+#define _GLIBCXX_TUPLE 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#include <utility>
+
+namespace std
+{
+ // Adds a const reference to a non-reference type.
+ template<typename _Tp>
+ struct __add_c_ref
+ { typedef const _Tp& type; };
+
+ template<typename _Tp>
+ struct __add_c_ref<_Tp&>
+ { typedef _Tp& type; };
+
+ // Adds a reference to a non-reference type.
+ template<typename _Tp>
+ struct __add_ref
+ { typedef _Tp& type; };
+
+ template<typename _Tp>
+ struct __add_ref<_Tp&>
+ { typedef _Tp& type; };
+
+ template<std::size_t _Idx, typename _Head, bool _IsEmpty>
+ struct _Head_base;
+
+ template<std::size_t _Idx, typename _Head>
+ struct _Head_base<_Idx, _Head, true>
+ : public _Head
+ {
+ _Head_base()
+ : _Head() { }
+
+ _Head_base(const _Head& __h)
+ : _Head(__h) { }
+
+ template<typename _UHead>
+ _Head_base(_UHead&& __h)
+ : _Head(std::forward<_UHead>(__h)) { }
+
+ _Head& _M_head() { return *this; }
+ const _Head& _M_head() const { return *this; }
+
+ void _M_swap_impl(_Head&&) { /* no-op */ }
+ };
+
+ template<std::size_t _Idx, typename _Head>
+ struct _Head_base<_Idx, _Head, false>
+ {
+ _Head_base()
+ : _M_head_impl() { }
+
+ _Head_base(const _Head& __h)
+ : _M_head_impl(__h) { }
+
+ template<typename _UHead>
+ _Head_base(_UHead&& __h)
+ : _M_head_impl(std::forward<_UHead>(__h)) { }
+
+ _Head& _M_head() { return _M_head_impl; }
+ const _Head& _M_head() const { return _M_head_impl; }
+
+ void
+ _M_swap_impl(_Head&& __h)
+ {
+ using std::swap;
+ swap(__h, _M_head_impl);
+ }
+
+ _Head _M_head_impl;
+ };
+
+ /**
+ * Contains the actual implementation of the @c tuple template, stored
+ * as a recursive inheritance hierarchy from the first element (most
+ * derived class) to the last (least derived class). The @c Idx
+ * parameter gives the 0-based index of the element stored at this
+ * point in the hierarchy; we use it to implement a constant-time
+ * get() operation.
+ */
+ template<std::size_t _Idx, typename... _Elements>
+ struct _Tuple_impl;
+
+ /**
+ * Zero-element tuple implementation. This is the basis case for the
+ * inheritance recursion.
+ */
+ template<std::size_t _Idx>
+ struct _Tuple_impl<_Idx>
+ {
+ protected:
+ void _M_swap_impl(_Tuple_impl&&) { /* no-op */ }
+ };
+
+ /**
+ * Recursive tuple implementation. Here we store the @c Head element
+ * and derive from a @c Tuple_impl containing the remaining elements
+ * (which contains the @c Tail).
+ */
+ template<std::size_t _Idx, typename _Head, typename... _Tail>
+ struct _Tuple_impl<_Idx, _Head, _Tail...>
+ : public _Tuple_impl<_Idx + 1, _Tail...>,
+ private _Head_base<_Idx, _Head, std::is_empty<_Head>::value>
+ {
+ typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
+ typedef _Head_base<_Idx, _Head, std::is_empty<_Head>::value> _Base;
+
+ _Head& _M_head() { return _Base::_M_head(); }
+ const _Head& _M_head() const { return _Base::_M_head(); }
+
+ _Inherited& _M_tail() { return *this; }
+ const _Inherited& _M_tail() const { return *this; }
+
+ _Tuple_impl()
+ : _Inherited(), _Base() { }
+
+ explicit
+ _Tuple_impl(const _Head& __head, const _Tail&... __tail)
+ : _Inherited(__tail...), _Base(__head) { }
+
+ template<typename _UHead, typename... _UTail>
+ explicit
+ _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
+ : _Inherited(std::forward<_UTail>(__tail)...),
+ _Base(std::forward<_UHead>(__head)) { }
+
+ _Tuple_impl(const _Tuple_impl& __in)
+ : _Inherited(__in._M_tail()), _Base(__in._M_head()) { }
+
+ _Tuple_impl(_Tuple_impl&& __in)
+ : _Inherited(std::move<_Inherited&&>(__in._M_tail())),
+ _Base(std::forward<_Head>(__in._M_head())) { }
+
+ template<typename... _UElements>
+ _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
+ : _Inherited(__in._M_tail()), _Base(__in._M_head()) { }
+
+ template<typename... _UElements>
+ _Tuple_impl(_Tuple_impl<_Idx, _UElements...>&& __in)
+ : _Inherited(std::move<typename _Tuple_impl<_Idx, _UElements...>::
+ _Inherited&&>(__in._M_tail())),
+ _Base(std::forward<typename _Tuple_impl<_Idx, _UElements...>::
+ _Base>(__in._M_head())) { }
+
+ _Tuple_impl&
+ operator=(const _Tuple_impl& __in)
+ {
+ _M_head() = __in._M_head();
+ _M_tail() = __in._M_tail();
+ return *this;
+ }
+
+ _Tuple_impl&
+ operator=(_Tuple_impl&& __in)
+ {
+ _M_head() = std::move(__in._M_head());
+ _M_tail() = std::move(__in._M_tail());
+ return *this;
+ }
+
+ template<typename... _UElements>
+ _Tuple_impl&
+ operator=(const _Tuple_impl<_Idx, _UElements...>& __in)
+ {
+ _M_head() = __in._M_head();
+ _M_tail() = __in._M_tail();
+ return *this;
+ }
+
+ template<typename... _UElements>
+ _Tuple_impl&
+ operator=(_Tuple_impl<_Idx, _UElements...>&& __in)
+ {
+ _M_head() = std::move(__in._M_head());
+ _M_tail() = std::move(__in._M_tail());
+ return *this;
+ }
+
+ protected:
+ void
+ _M_swap_impl(_Tuple_impl&& __in)
+ {
+ _Base::_M_swap_impl(__in._M_head());
+ _Inherited::_M_swap_impl(__in._M_tail());
+ }
+ };
+
+ /// tuple
+ template<typename... _Elements>
+ class tuple : public _Tuple_impl<0, _Elements...>
+ {
+ typedef _Tuple_impl<0, _Elements...> _Inherited;
+
+ public:
+ tuple()
+ : _Inherited() { }
+
+ explicit
+ tuple(const _Elements&... __elements)
+ : _Inherited(__elements...) { }
+
+ template<typename... _UElements>
+ explicit
+ tuple(_UElements&&... __elements)
+ : _Inherited(std::forward<_UElements>(__elements)...) { }
+
+ tuple(const tuple& __in)
+ : _Inherited(static_cast<const _Inherited&>(__in)) { }
+
+ tuple(tuple&& __in)
+ : _Inherited(std::move<_Inherited>(__in)) { }
+
+ template<typename... _UElements>
+ tuple(const tuple<_UElements...>& __in)
+ : _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
+ { }
+
+ template<typename... _UElements>
+ tuple(tuple<_UElements...>&& __in)
+ : _Inherited(std::move<_Tuple_impl<0, _UElements...> >(__in)) { }
+
+ // XXX http://gcc.gnu.org/ml/libstdc++/2008-02/msg00047.html
+ template<typename... _UElements>
+ tuple(tuple<_UElements...>& __in)
+ : _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
+ { }
+
+ tuple&
+ operator=(const tuple& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ tuple&
+ operator=(tuple&& __in)
+ {
+ static_cast<_Inherited&>(*this) = std::move(__in);
+ return *this;
+ }
+
+ template<typename... _UElements>
+ tuple&
+ operator=(const tuple<_UElements...>& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ template<typename... _UElements>
+ tuple&
+ operator=(tuple<_UElements...>&& __in)
+ {
+ static_cast<_Inherited&>(*this) = std::move(__in);
+ return *this;
+ }
+
+ void
+ swap(tuple&& __in)
+ { _Inherited::_M_swap_impl(__in); }
+ };
+
+
+ template<>
+ class tuple<>
+ {
+ public:
+ void swap(tuple&&) { /* no-op */ }
+ };
+
+ /// tuple (2-element), with construction and assignment from a pair.
+ template<typename _T1, typename _T2>
+ class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
+ {
+ typedef _Tuple_impl<0, _T1, _T2> _Inherited;
+
+ public:
+ tuple()
+ : _Inherited() { }
+
+ explicit
+ tuple(const _T1& __a1, const _T2& __a2)
+ : _Inherited(__a1, __a2) { }
+
+ template<typename _U1, typename _U2>
+ explicit
+ tuple(_U1&& __a1, _U2&& __a2)
+ : _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
+
+ tuple(const tuple& __in)
+ : _Inherited(static_cast<const _Inherited&>(__in)) { }
+
+ tuple(tuple&& __in)
+ : _Inherited(std::move<_Inherited>(__in)) { }
+
+ template<typename _U1, typename _U2>
+ tuple(const tuple<_U1, _U2>& __in)
+ : _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { }
+
+ template<typename _U1, typename _U2>
+ tuple(tuple<_U1, _U2>&& __in)
+ : _Inherited(std::move<_Tuple_impl<0, _U1, _U2> >(__in)) { }
+
+ template<typename _U1, typename _U2>
+ tuple(const pair<_U1, _U2>& __in)
+ : _Inherited(__in.first, __in.second) { }
+
+ template<typename _U1, typename _U2>
+ tuple(pair<_U1, _U2>&& __in)
+ : _Inherited(std::move(__in.first), std::move(__in.second)) { }
+
+ tuple&
+ operator=(const tuple& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ tuple&
+ operator=(tuple&& __in)
+ {
+ static_cast<_Inherited&>(*this) = std::move(__in);
+ return *this;
+ }
+
+ template<typename _U1, typename _U2>
+ tuple&
+ operator=(const tuple<_U1, _U2>& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ template<typename _U1, typename _U2>
+ tuple&
+ operator=(tuple<_U1, _U2>&& __in)
+ {
+ static_cast<_Inherited&>(*this) = std::move(__in);
+ return *this;
+ }
+
+ template<typename _U1, typename _U2>
+ tuple&
+ operator=(const pair<_U1, _U2>& __in)
+ {
+ this->_M_head() = __in.first;
+ this->_M_tail()._M_head() = __in.second;
+ return *this;
+ }
+
+ template<typename _U1, typename _U2>
+ tuple&
+ operator=(pair<_U1, _U2>&& __in)
+ {
+ this->_M_head() = std::move(__in.first);
+ this->_M_tail()._M_head() = std::move(__in.second);
+ return *this;
+ }
+
+ void
+ swap(tuple&& __in)
+ {
+ using std::swap;
+ swap(this->_M_head(), __in._M_head());
+ swap(this->_M_tail()._M_head(), __in._M_tail()._M_head());
+ }
+ };
+
+
+ /// Gives the type of the ith element of a given tuple type.
+ template<std::size_t __i, typename _Tp>
+ struct tuple_element;
+
+ /**
+ * Recursive case for tuple_element: strip off the first element in
+ * the tuple and retrieve the (i-1)th element of the remaining tuple.
+ */
+ template<std::size_t __i, typename _Head, typename... _Tail>
+ struct tuple_element<__i, tuple<_Head, _Tail...> >
+ : tuple_element<__i - 1, tuple<_Tail...> > { };
+
+ /**
+ * Basis case for tuple_element: The first element is the one we're seeking.
+ */
+ template<typename _Head, typename... _Tail>
+ struct tuple_element<0, tuple<_Head, _Tail...> >
+ {
+ typedef _Head type;
+ };
+
+ /// Finds the size of a given tuple type.
+ template<typename _Tp>
+ struct tuple_size;
+
+ /// class tuple_size
+ template<typename... _Elements>
+ struct tuple_size<tuple<_Elements...> >
+ {
+ static const std::size_t value = sizeof...(_Elements);
+ };
+
+ template<typename... _Elements>
+ const std::size_t tuple_size<tuple<_Elements...> >::value;
+
+ template<std::size_t __i, typename _Head, typename... _Tail>
+ inline typename __add_ref<_Head>::type
+ __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
+ { return __t._M_head(); }
+
+ template<std::size_t __i, typename _Head, typename... _Tail>
+ inline typename __add_c_ref<_Head>::type
+ __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
+ { return __t._M_head(); }
+
+ // Return a reference (const reference) to the ith element of a tuple.
+ // Any const or non-const ref elements are returned with their original type.
+ template<std::size_t __i, typename... _Elements>
+ inline typename __add_ref<
+ typename tuple_element<__i, tuple<_Elements...> >::type
+ >::type
+ get(tuple<_Elements...>& __t)
+ { return __get_helper<__i>(__t); }
+
+ template<std::size_t __i, typename... _Elements>
+ inline typename __add_c_ref<
+ typename tuple_element<__i, tuple<_Elements...> >::type
+ >::type
+ get(const tuple<_Elements...>& __t)
+ { return __get_helper<__i>(__t); }
+
+ // This class helps construct the various comparison operations on tuples
+ template<std::size_t __check_equal_size, std::size_t __i, std::size_t __j,
+ typename _Tp, typename _Up>
+ struct __tuple_compare;
+
+ template<std::size_t __i, std::size_t __j, typename _Tp, typename _Up>
+ struct __tuple_compare<0, __i, __j, _Tp, _Up>
+ {
+ static bool __eq(const _Tp& __t, const _Up& __u)
+ {
+ return (get<__i>(__t) == get<__i>(__u) &&
+ __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__eq(__t, __u));
+ }
+
+ static bool __less(const _Tp& __t, const _Up& __u)
+ {
+ return ((get<__i>(__t) < get<__i>(__u))
+ || !(get<__i>(__u) < get<__i>(__t)) &&
+ __tuple_compare<0, __i + 1, __j, _Tp, _Up>::__less(__t, __u));
+ }
+ };
+
+ template<std::size_t __i, typename _Tp, typename _Up>
+ struct __tuple_compare<0, __i, __i, _Tp, _Up>
+ {
+ static bool __eq(const _Tp&, const _Up&)
+ { return true; }
+
+ static bool __less(const _Tp&, const _Up&)
+ { return false; }
+ };
+
+ template<typename... _TElements, typename... _UElements>
+ bool
+ operator==(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ {
+ typedef tuple<_TElements...> _Tp;
+ typedef tuple<_UElements...> _Up;
+ return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
+ 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u));
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ bool
+ operator<(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ {
+ typedef tuple<_TElements...> _Tp;
+ typedef tuple<_UElements...> _Up;
+ return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
+ 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u));
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator!=(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return !(__t == __u); }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator>(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return __u < __t; }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator<=(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return !(__u < __t); }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator>=(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return !(__t < __u); }
+
+ // NB: DR 705.
+ template<typename... _Elements>
+ inline tuple<typename __decay_and_strip<_Elements>::__type...>
+ make_tuple(_Elements&&... __args)
+ {
+ typedef tuple<typename __decay_and_strip<_Elements>::__type...>
+ __result_type;
+ return __result_type(std::forward<_Elements>(__args)...);
+ }
+
+ template<std::size_t...> struct __index_holder { };
+
+ template<std::size_t __i, typename _IdxHolder, typename... _Elements>
+ struct __index_holder_impl;
+
+ template<std::size_t __i, std::size_t... _Indexes, typename _IdxHolder,
+ typename... _Elements>
+ struct __index_holder_impl<__i, __index_holder<_Indexes...>,
+ _IdxHolder, _Elements...>
+ {
+ typedef typename __index_holder_impl<__i + 1,
+ __index_holder<_Indexes..., __i>,
+ _Elements...>::type type;
+ };
+
+ template<std::size_t __i, std::size_t... _Indexes>
+ struct __index_holder_impl<__i, __index_holder<_Indexes...> >
+ { typedef __index_holder<_Indexes...> type; };
+
+ template<typename... _Elements>
+ struct __make_index_holder
+ : __index_holder_impl<0, __index_holder<>, _Elements...> { };
+
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
+ inline tuple<_TElements..., _UElements...>
+ __tuple_cat_helper(const tuple<_TElements...>& __t,
+ const __index_holder<_TIdx...>&,
+ const tuple<_UElements...>& __u,
+ const __index_holder<_UIdx...>&)
+ { return tuple<_TElements..., _UElements...>(get<_TIdx>(__t)...,
+ get<_UIdx>(__u)...); }
+
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
+ inline tuple<_TElements..., _UElements...>
+ __tuple_cat_helper(tuple<_TElements...>&& __t,
+ const __index_holder<_TIdx...>&,
+ const tuple<_UElements...>& __u,
+ const __index_holder<_UIdx...>&)
+ { return tuple<_TElements..., _UElements...>
+ (std::move(get<_TIdx>(__t))..., get<_UIdx>(__u)...); }
+
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
+ inline tuple<_TElements..., _UElements...>
+ __tuple_cat_helper(const tuple<_TElements...>& __t,
+ const __index_holder<_TIdx...>&,
+ tuple<_UElements...>&& __u,
+ const __index_holder<_UIdx...>&)
+ { return tuple<_TElements..., _UElements...>
+ (get<_TIdx>(__t)..., std::move(get<_UIdx>(__u))...); }
+
+ template<typename... _TElements, std::size_t... _TIdx,
+ typename... _UElements, std::size_t... _UIdx>
+ inline tuple<_TElements..., _UElements...>
+ __tuple_cat_helper(tuple<_TElements...>&& __t,
+ const __index_holder<_TIdx...>&,
+ tuple<_UElements...>&& __u,
+ const __index_holder<_UIdx...>&)
+ { return tuple<_TElements..., _UElements...>
+ (std::move(get<_TIdx>(__t))..., std::move(get<_UIdx>(__u))...); }
+
+ template<typename... _TElements, typename... _UElements>
+ inline tuple<_TElements..., _UElements...>
+ tuple_cat(const tuple<_TElements...>& __t, const tuple<_UElements...>& __u)
+ {
+ return __tuple_cat_helper(__t, typename
+ __make_index_holder<_TElements...>::type(),
+ __u, typename
+ __make_index_holder<_UElements...>::type());
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ inline tuple<_TElements..., _UElements...>
+ tuple_cat(tuple<_TElements...>&& __t, const tuple<_UElements...>& __u)
+ {
+ return __tuple_cat_helper(std::move(__t), typename
+ __make_index_holder<_TElements...>::type(),
+ __u, typename
+ __make_index_holder<_UElements...>::type());
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ inline tuple<_TElements..., _UElements...>
+ tuple_cat(const tuple<_TElements...>& __t, tuple<_UElements...>&& __u)
+ {
+ return __tuple_cat_helper(__t, typename
+ __make_index_holder<_TElements...>::type(),
+ std::move(__u), typename
+ __make_index_holder<_UElements...>::type());
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ inline tuple<_TElements..., _UElements...>
+ tuple_cat(tuple<_TElements...>&& __t, tuple<_UElements...>&& __u)
+ {
+ return __tuple_cat_helper(std::move(__t), typename
+ __make_index_holder<_TElements...>::type(),
+ std::move(__u), typename
+ __make_index_holder<_UElements...>::type());
+ }
+
+ template<typename... _Elements>
+ inline tuple<_Elements&...>
+ tie(_Elements&... __args)
+ { return tuple<_Elements&...>(__args...); }
+
+ template<typename... _Elements>
+ inline void
+ swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
+ { __x.swap(__y); }
+
+ template<typename... _Elements>
+ inline void
+ swap(tuple<_Elements...>&& __x, tuple<_Elements...>& __y)
+ { __x.swap(__y); }
+
+ template<typename... _Elements>
+ inline void
+ swap(tuple<_Elements...>& __x, tuple<_Elements...>&& __y)
+ { __x.swap(__y); }
+
+ // A class (and instance) which can be used in 'tie' when an element
+ // of a tuple is not required
+ struct _Swallow_assign
+ {
+ template<class _Tp>
+ _Swallow_assign&
+ operator=(const _Tp&)
+ { return *this; }
+ };
+
+ // TODO: Put this in some kind of shared file.
+ namespace
+ {
+ _Swallow_assign ignore;
+ }; // anonymous namespace
+}
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_TUPLE
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/type_traits b/gcc-4.4.0/libstdc++-v3/include/std/type_traits
new file mode 100644
index 000000000..ce9ee1b06
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/type_traits
@@ -0,0 +1,605 @@
+// C++0x type_traits -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/type_traits
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TYPE_TRAITS
+#define _GLIBCXX_TYPE_TRAITS 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <cstddef>
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/type_traits>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/type_traits>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+namespace std
+{
+ /** @addtogroup metaprogramming
+ * @{
+ */
+
+ // Primary classification traits.
+
+ /// is_lvalue_reference
+ template<typename>
+ struct is_lvalue_reference
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_lvalue_reference<_Tp&>
+ : public true_type { };
+
+ /// is_rvalue_reference
+ template<typename>
+ struct is_rvalue_reference
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_rvalue_reference<_Tp&&>
+ : public true_type { };
+
+ // Secondary classification traits.
+
+ /// is_reference
+ template<typename _Tp>
+ struct is_reference
+ : public integral_constant<bool, (is_lvalue_reference<_Tp>::value
+ || is_rvalue_reference<_Tp>::value)>
+ { };
+
+ // Reference transformations.
+
+ /// remove_reference
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp,
+ bool = !is_reference<_Tp>::value && !is_void<_Tp>::value,
+ bool = is_rvalue_reference<_Tp>::value>
+ struct __add_lvalue_reference_helper
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct __add_lvalue_reference_helper<_Tp, true, false>
+ { typedef _Tp& type; };
+
+ template<typename _Tp>
+ struct __add_lvalue_reference_helper<_Tp, false, true>
+ { typedef typename remove_reference<_Tp>::type& type; };
+
+ /// add_lvalue_reference
+ template<typename _Tp>
+ struct add_lvalue_reference
+ : public __add_lvalue_reference_helper<_Tp>
+ { };
+
+ template<typename _Tp,
+ bool = !is_reference<_Tp>::value && !is_void<_Tp>::value>
+ struct __add_rvalue_reference_helper
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct __add_rvalue_reference_helper<_Tp, true>
+ { typedef _Tp&& type; };
+
+ /// add_rvalue_reference
+ template<typename _Tp>
+ struct add_rvalue_reference
+ : public __add_rvalue_reference_helper<_Tp>
+ { };
+
+ // Scalar properties and transformations.
+
+ template<typename _Tp,
+ bool = is_integral<_Tp>::value,
+ bool = is_floating_point<_Tp>::value>
+ struct __is_signed_helper
+ : public false_type { };
+
+ template<typename _Tp>
+ struct __is_signed_helper<_Tp, false, true>
+ : public true_type { };
+
+ template<typename _Tp>
+ struct __is_signed_helper<_Tp, true, false>
+ : public integral_constant<bool, _Tp(-1) < _Tp(0)>
+ { };
+
+ /// is_signed
+ template<typename _Tp>
+ struct is_signed
+ : public integral_constant<bool, __is_signed_helper<_Tp>::value>
+ { };
+
+ /// is_unsigned
+ template<typename _Tp>
+ struct is_unsigned
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ && !is_signed<_Tp>::value)>
+ { };
+
+ // Member introspection.
+
+ /// is_pod
+ template<typename _Tp>
+ struct is_pod
+ : public integral_constant<bool, __is_pod(_Tp)>
+ { };
+
+ /// has_trivial_default_constructor
+ template<typename _Tp>
+ struct has_trivial_default_constructor
+ : public integral_constant<bool, __has_trivial_constructor(_Tp)>
+ { };
+
+ /// has_trivial_copy_constructor
+ template<typename _Tp>
+ struct has_trivial_copy_constructor
+ : public integral_constant<bool, __has_trivial_copy(_Tp)>
+ { };
+
+ /// has_trivial_assign
+ template<typename _Tp>
+ struct has_trivial_assign
+ : public integral_constant<bool, __has_trivial_assign(_Tp)>
+ { };
+
+ /// has_trivial_destructor
+ template<typename _Tp>
+ struct has_trivial_destructor
+ : public integral_constant<bool, __has_trivial_destructor(_Tp)>
+ { };
+
+ /// has_nothrow_default_constructor
+ template<typename _Tp>
+ struct has_nothrow_default_constructor
+ : public integral_constant<bool, __has_nothrow_constructor(_Tp)>
+ { };
+
+ /// has_nothrow_copy_constructor
+ template<typename _Tp>
+ struct has_nothrow_copy_constructor
+ : public integral_constant<bool, __has_nothrow_copy(_Tp)>
+ { };
+
+ /// has_nothrow_assign
+ template<typename _Tp>
+ struct has_nothrow_assign
+ : public integral_constant<bool, __has_nothrow_assign(_Tp)>
+ { };
+
+ /// is_base_of
+ template<typename _Base, typename _Derived>
+ struct is_base_of
+ : public integral_constant<bool, __is_base_of(_Base, _Derived)>
+ { };
+
+ // Relationships between types.
+ template<typename _From, typename _To>
+ struct __is_convertible_simple
+ : public __sfinae_types
+ {
+ private:
+ static __one __test(_To);
+ static __two __test(...);
+ static _From __makeFrom();
+
+ public:
+ static const bool __value = sizeof(__test(__makeFrom())) == 1;
+ };
+
+ template<typename _Tp>
+ struct __is_int_or_cref
+ {
+ typedef typename remove_reference<_Tp>::type __rr_Tp;
+ static const bool __value = (is_integral<_Tp>::value
+ || (is_integral<__rr_Tp>::value
+ && is_const<__rr_Tp>::value
+ && !is_volatile<__rr_Tp>::value));
+ };
+
+ template<typename _From, typename _To,
+ bool = (is_void<_From>::value || is_void<_To>::value
+ || is_function<_To>::value || is_array<_To>::value
+ // This special case is here only to avoid warnings.
+ || (is_floating_point<typename
+ remove_reference<_From>::type>::value
+ && __is_int_or_cref<_To>::__value))>
+ struct __is_convertible_helper
+ {
+ // "An imaginary lvalue of type From...".
+ static const bool __value = (__is_convertible_simple<typename
+ add_lvalue_reference<_From>::type,
+ _To>::__value);
+ };
+
+ template<typename _From, typename _To>
+ struct __is_convertible_helper<_From, _To, true>
+ { static const bool __value = (is_void<_To>::value
+ || (__is_int_or_cref<_To>::__value
+ && !is_void<_From>::value)); };
+
+ // XXX FIXME
+ // The C++0x specifications are different, see N2255.
+ /// is_convertible
+ template<typename _From, typename _To>
+ struct is_convertible
+ : public integral_constant<bool,
+ __is_convertible_helper<_From, _To>::__value>
+ { };
+
+ template<std::size_t _Len>
+ struct __aligned_storage_msa
+ {
+ union __type
+ {
+ unsigned char __data[_Len];
+ struct __attribute__((__aligned__)) { } __align;
+ };
+ };
+
+ /**
+ * @brief Alignment type.
+ *
+ * The value of _Align is a default-alignment which shall be the
+ * most stringent alignment requirement for any C++ object type
+ * whose size is no greater than _Len (3.9). The member typedef
+ * type shall be a POD type suitable for use as uninitialized
+ * storage for any object whose size is at most _Len and whose
+ * alignment is a divisor of _Align.
+ */
+ template<std::size_t _Len, std::size_t _Align =
+ __alignof__(typename __aligned_storage_msa<_Len>::__type)>
+ struct aligned_storage
+ {
+ union type
+ {
+ unsigned char __data[_Len];
+ struct __attribute__((__aligned__((_Align)))) { } __align;
+ };
+ };
+
+
+ // Define a nested type if some predicate holds.
+ // Primary template.
+ /// enable_if
+ template<bool, typename _Tp = void>
+ struct enable_if
+ { };
+
+ // Partial specialization for true.
+ template<typename _Tp>
+ struct enable_if<true, _Tp>
+ { typedef _Tp type; };
+
+
+ // A conditional expression, but for types. If true, first, if false, second.
+ // Primary template.
+ /// conditional
+ template<bool _Cond, typename _Iftrue, typename _Iffalse>
+ struct conditional
+ { typedef _Iftrue type; };
+
+ // Partial specialization for false.
+ template<typename _Iftrue, typename _Iffalse>
+ struct conditional<false, _Iftrue, _Iffalse>
+ { typedef _Iffalse type; };
+
+
+ // Decay trait for arrays and functions, used for perfect forwarding
+ // in make_pair, make_tuple, etc.
+ template<typename _Up,
+ bool _IsArray = is_array<_Up>::value,
+ bool _IsFunction = is_function<_Up>::value>
+ struct __decay_selector;
+
+ // NB: DR 705.
+ template<typename _Up>
+ struct __decay_selector<_Up, false, false>
+ { typedef typename remove_cv<_Up>::type __type; };
+
+ template<typename _Up>
+ struct __decay_selector<_Up, true, false>
+ { typedef typename remove_extent<_Up>::type* __type; };
+
+ template<typename _Up>
+ struct __decay_selector<_Up, false, true>
+ { typedef typename add_pointer<_Up>::type __type; };
+
+ /// decay
+ template<typename _Tp>
+ struct decay
+ {
+ private:
+ typedef typename remove_reference<_Tp>::type __remove_type;
+
+ public:
+ typedef typename __decay_selector<__remove_type>::__type type;
+ };
+
+
+ // Utility for constructing identically cv-qualified types.
+ template<typename _Unqualified, bool _IsConst, bool _IsVol>
+ struct __cv_selector;
+
+ template<typename _Unqualified>
+ struct __cv_selector<_Unqualified, false, false>
+ { typedef _Unqualified __type; };
+
+ template<typename _Unqualified>
+ struct __cv_selector<_Unqualified, false, true>
+ { typedef volatile _Unqualified __type; };
+
+ template<typename _Unqualified>
+ struct __cv_selector<_Unqualified, true, false>
+ { typedef const _Unqualified __type; };
+
+ template<typename _Unqualified>
+ struct __cv_selector<_Unqualified, true, true>
+ { typedef const volatile _Unqualified __type; };
+
+ template<typename _Qualified, typename _Unqualified,
+ bool _IsConst = is_const<_Qualified>::value,
+ bool _IsVol = is_volatile<_Qualified>::value>
+ struct __match_cv_qualifiers
+ {
+ private:
+ typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
+
+ public:
+ typedef typename __match::__type __type;
+ };
+
+
+ // Utility for finding the unsigned versions of signed integral types.
+ template<typename _Tp>
+ struct __make_unsigned
+ { typedef _Tp __type; };
+
+ template<>
+ struct __make_unsigned<char>
+ { typedef unsigned char __type; };
+
+ template<>
+ struct __make_unsigned<signed char>
+ { typedef unsigned char __type; };
+
+ template<>
+ struct __make_unsigned<short>
+ { typedef unsigned short __type; };
+
+ template<>
+ struct __make_unsigned<int>
+ { typedef unsigned int __type; };
+
+ template<>
+ struct __make_unsigned<long>
+ { typedef unsigned long __type; };
+
+ template<>
+ struct __make_unsigned<long long>
+ { typedef unsigned long long __type; };
+
+
+ // Select between integral and enum: not possible to be both.
+ template<typename _Tp,
+ bool _IsInt = is_integral<_Tp>::value,
+ bool _IsEnum = is_enum<_Tp>::value>
+ struct __make_unsigned_selector;
+
+ template<typename _Tp>
+ struct __make_unsigned_selector<_Tp, true, false>
+ {
+ private:
+ typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
+ typedef typename __unsignedt::__type __unsigned_type;
+ typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
+
+ public:
+ typedef typename __cv_unsigned::__type __type;
+ };
+
+ template<typename _Tp>
+ struct __make_unsigned_selector<_Tp, false, true>
+ {
+ private:
+ // With -fshort-enums, an enum may be as small as a char.
+ typedef unsigned char __smallest;
+ static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
+ static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
+ static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
+ typedef conditional<__b2, unsigned int, unsigned long> __cond2;
+ typedef typename __cond2::type __cond2_type;
+ typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
+ typedef typename __cond1::type __cond1_type;
+
+ public:
+ typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
+ };
+
+ // Given an integral/enum type, return the corresponding unsigned
+ // integer type.
+ // Primary template.
+ /// make_unsigned
+ template<typename _Tp>
+ struct make_unsigned
+ { typedef typename __make_unsigned_selector<_Tp>::__type type; };
+
+ // Integral, but don't define.
+ template<>
+ struct make_unsigned<bool>;
+
+
+ // Utility for finding the signed versions of unsigned integral types.
+ template<typename _Tp>
+ struct __make_signed
+ { typedef _Tp __type; };
+
+ template<>
+ struct __make_signed<char>
+ { typedef signed char __type; };
+
+ template<>
+ struct __make_signed<unsigned char>
+ { typedef signed char __type; };
+
+ template<>
+ struct __make_signed<unsigned short>
+ { typedef signed short __type; };
+
+ template<>
+ struct __make_signed<unsigned int>
+ { typedef signed int __type; };
+
+ template<>
+ struct __make_signed<unsigned long>
+ { typedef signed long __type; };
+
+ template<>
+ struct __make_signed<unsigned long long>
+ { typedef signed long long __type; };
+
+
+ // Select between integral and enum: not possible to be both.
+ template<typename _Tp,
+ bool _IsInt = is_integral<_Tp>::value,
+ bool _IsEnum = is_enum<_Tp>::value>
+ struct __make_signed_selector;
+
+ template<typename _Tp>
+ struct __make_signed_selector<_Tp, true, false>
+ {
+ private:
+ typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
+ typedef typename __signedt::__type __signed_type;
+ typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
+
+ public:
+ typedef typename __cv_signed::__type __type;
+ };
+
+ template<typename _Tp>
+ struct __make_signed_selector<_Tp, false, true>
+ {
+ private:
+ // With -fshort-enums, an enum may be as small as a char.
+ typedef signed char __smallest;
+ static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
+ static const bool __b1 = sizeof(_Tp) <= sizeof(signed short);
+ static const bool __b2 = sizeof(_Tp) <= sizeof(signed int);
+ typedef conditional<__b2, signed int, signed long> __cond2;
+ typedef typename __cond2::type __cond2_type;
+ typedef conditional<__b1, signed short, __cond2_type> __cond1;
+ typedef typename __cond1::type __cond1_type;
+
+ public:
+ typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
+ };
+
+ // Given an integral/enum type, return the corresponding signed
+ // integer type.
+ // Primary template.
+ /// make_signed
+ template<typename _Tp>
+ struct make_signed
+ { typedef typename __make_signed_selector<_Tp>::__type type; };
+
+ // Integral, but don't define.
+ template<>
+ struct make_signed<bool>;
+
+ /// common_type
+ template<typename... _Tp>
+ struct common_type;
+
+ template<typename _Tp>
+ struct common_type<_Tp>
+ {
+ static_assert(sizeof(_Tp) > 0, "must be complete type");
+ typedef _Tp type;
+ };
+
+ template<typename _Tp, typename _Up>
+ class common_type<_Tp, _Up>
+ {
+ static_assert(sizeof(_Tp) > 0, "must be complete type");
+ static_assert(sizeof(_Up) > 0, "must be complete type");
+
+ static _Tp&& __t();
+ static _Up&& __u();
+
+ // HACK: Prevents optimization of ?: in the decltype
+ // expression when the condition is the literal, "true".
+ // See, PR36628.
+ static bool __true_or_false();
+
+ public:
+ typedef decltype(__true_or_false() ? __t() : __u()) type;
+ };
+
+ template<typename _Tp, typename _Up, typename... _Vp>
+ struct common_type<_Tp, _Up, _Vp...>
+ {
+ typedef typename
+ common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
+ };
+
+ // @} group metaprogramming
+}
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_TYPE_TRAITS
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/unordered_map b/gcc-4.4.0/libstdc++-v3/include/std/unordered_map
new file mode 100644
index 000000000..56906d28b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/unordered_map
@@ -0,0 +1,78 @@
+// <unordered_map> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/unordered_map
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_UNORDERED_MAP
+#define _GLIBCXX_UNORDERED_MAP 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <utility>
+#include <type_traits>
+#include <initializer_list>
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
+#include <bits/stringfwd.h>
+#include <bits/functional_hash.h>
+#include <bits/hashtable.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/unordered_map>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL)
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace _GLIBCXX_STD_D {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 _GLIBCXX_STD_D
+#else
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+#endif
+# include <tr1_impl/unordered_map>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/unordered_map>
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_UNORDERED_MAP
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/unordered_set b/gcc-4.4.0/libstdc++-v3/include/std/unordered_set
new file mode 100644
index 000000000..880f3bef4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/unordered_set
@@ -0,0 +1,78 @@
+// <unordered_set> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/unordered_set
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_UNORDERED_SET
+#define _GLIBCXX_UNORDERED_SET 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#else
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+#endif
+
+#include <utility>
+#include <type_traits>
+#include <initializer_list>
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
+#include <bits/stringfwd.h>
+#include <bits/functional_hash.h>
+#include <bits/hashtable.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/unordered_set>
+#else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL)
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace _GLIBCXX_STD_D {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 _GLIBCXX_STD_D
+#else
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+#endif
+# include <tr1_impl/unordered_set>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/unordered_set>
+#endif
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_UNORDERED_SET
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/utility b/gcc-4.4.0/libstdc++-v3/include/std/utility
new file mode 100644
index 000000000..1a6d0b1b6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/utility
@@ -0,0 +1,94 @@
+// <utility> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/utility
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_UTILITY
+#define _GLIBCXX_UTILITY 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <bits/stl_relops.h>
+#include <bits/stl_pair.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# error C++0x header cannot be included from TR1 header
+# endif
+# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# include <tr1_impl/utility>
+# else
+# define _GLIBCXX_INCLUDE_AS_CXX0X
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1
+# define _GLIBCXX_END_NAMESPACE_TR1
+# define _GLIBCXX_TR1
+# include <tr1_impl/utility>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_CXX0X
+# endif
+# include <bits/move.h>
+# include <initializer_list>
+#endif
+
+/**
+ * @defgroup utilities Utilities
+ *
+ * Components deemed generally useful. Includes pair, tuple,
+ * forward/move helpers, ratio, function object, metaprogramming and
+ * type traits, time, date, and memory functions.
+ */
+
+#endif /* _GLIBCXX_UTILITY */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/valarray b/gcc-4.4.0/libstdc++-v3/include/std/valarray
new file mode 100644
index 000000000..79d3a16ec
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/valarray
@@ -0,0 +1,1086 @@
+// The template and inlines for the -*- C++ -*- valarray class.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file valarray
+ * This is a Standard C++ Library header.
+ */
+
+// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
+
+#ifndef _GLIBCXX_VALARRAY
+#define _GLIBCXX_VALARRAY 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#include <cstddef>
+#include <cmath>
+#include <algorithm>
+#include <debug/debug.h>
+#include <initializer_list>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ template<class _Clos, typename _Tp>
+ class _Expr;
+
+ template<typename _Tp1, typename _Tp2>
+ class _ValArray;
+
+ template<class _Oper, template<class, class> class _Meta, class _Dom>
+ struct _UnClos;
+
+ template<class _Oper,
+ template<class, class> class _Meta1,
+ template<class, class> class _Meta2,
+ class _Dom1, class _Dom2>
+ class _BinClos;
+
+ template<template<class, class> class _Meta, class _Dom>
+ class _SClos;
+
+ template<template<class, class> class _Meta, class _Dom>
+ class _GClos;
+
+ template<template<class, class> class _Meta, class _Dom>
+ class _IClos;
+
+ template<template<class, class> class _Meta, class _Dom>
+ class _ValFunClos;
+
+ template<template<class, class> class _Meta, class _Dom>
+ class _RefFunClos;
+
+ template<class _Tp> class valarray; // An array of type _Tp
+ class slice; // BLAS-like slice out of an array
+ template<class _Tp> class slice_array;
+ class gslice; // generalized slice out of an array
+ template<class _Tp> class gslice_array;
+ template<class _Tp> class mask_array; // masked array
+ template<class _Tp> class indirect_array; // indirected array
+
+_GLIBCXX_END_NAMESPACE
+
+#include <bits/valarray_array.h>
+#include <bits/valarray_before.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @defgroup numeric_arrays Numeric Arrays
+ * @ingroup numerics
+ *
+ * Classes and functions for representing and manipulating arrays of elements.
+ * @{
+ */
+
+ /**
+ * @brief Smart array designed to support numeric processing.
+ *
+ * A valarray is an array that provides constraints intended to allow for
+ * effective optimization of numeric array processing by reducing the
+ * aliasing that can result from pointer representations. It represents a
+ * one-dimensional array from which different multidimensional subsets can
+ * be accessed and modified.
+ *
+ * @param Tp Type of object in the array.
+ */
+ template<class _Tp>
+ class valarray
+ {
+ template<class _Op>
+ struct _UnaryOp
+ {
+ typedef typename __fun<_Op, _Tp>::result_type __rt;
+ typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt;
+ };
+ public:
+ typedef _Tp value_type;
+
+ // _lib.valarray.cons_ construct/destroy:
+ /// Construct an empty array.
+ valarray();
+
+ /// Construct an array with @a n elements.
+ explicit valarray(size_t);
+
+ /// Construct an array with @a n elements initialized to @a t.
+ valarray(const _Tp&, size_t);
+
+ /// Construct an array initialized to the first @a n elements of @a t.
+ valarray(const _Tp* __restrict__, size_t);
+
+ /// Copy constructor.
+ valarray(const valarray&);
+
+ /// Construct an array with the same size and values in @a sa.
+ valarray(const slice_array<_Tp>&);
+
+ /// Construct an array with the same size and values in @a ga.
+ valarray(const gslice_array<_Tp>&);
+
+ /// Construct an array with the same size and values in @a ma.
+ valarray(const mask_array<_Tp>&);
+
+ /// Construct an array with the same size and values in @a ia.
+ valarray(const indirect_array<_Tp>&);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /// Construct an array with an initializer_list of values.
+ valarray(initializer_list<_Tp>);
+#endif
+
+ template<class _Dom>
+ valarray(const _Expr<_Dom, _Tp>& __e);
+
+ ~valarray();
+
+ // _lib.valarray.assign_ assignment:
+ /**
+ * @brief Assign elements to an array.
+ *
+ * Assign elements of array to values in @a v. Results are undefined
+ * if @a v does not have the same size as this array.
+ *
+ * @param v Valarray to get values from.
+ */
+ valarray<_Tp>& operator=(const valarray<_Tp>&);
+
+ /**
+ * @brief Assign elements to a value.
+ *
+ * Assign all elements of array to @a t.
+ *
+ * @param t Value for elements.
+ */
+ valarray<_Tp>& operator=(const _Tp&);
+
+ /**
+ * @brief Assign elements to an array subset.
+ *
+ * Assign elements of array to values in @a sa. Results are undefined
+ * if @a sa does not have the same size as this array.
+ *
+ * @param sa Array slice to get values from.
+ */
+ valarray<_Tp>& operator=(const slice_array<_Tp>&);
+
+ /**
+ * @brief Assign elements to an array subset.
+ *
+ * Assign elements of array to values in @a ga. Results are undefined
+ * if @a ga does not have the same size as this array.
+ *
+ * @param ga Array slice to get values from.
+ */
+ valarray<_Tp>& operator=(const gslice_array<_Tp>&);
+
+ /**
+ * @brief Assign elements to an array subset.
+ *
+ * Assign elements of array to values in @a ma. Results are undefined
+ * if @a ma does not have the same size as this array.
+ *
+ * @param ma Array slice to get values from.
+ */
+ valarray<_Tp>& operator=(const mask_array<_Tp>&);
+
+ /**
+ * @brief Assign elements to an array subset.
+ *
+ * Assign elements of array to values in @a ia. Results are undefined
+ * if @a ia does not have the same size as this array.
+ *
+ * @param ia Array slice to get values from.
+ */
+ valarray<_Tp>& operator=(const indirect_array<_Tp>&);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Assign elements to an initializer_list.
+ *
+ * Assign elements of array to values in @a l. Results are undefined
+ * if @a l does not have the same size as this array.
+ *
+ * @param l initializer_list to get values from.
+ */
+ valarray& operator=(initializer_list<_Tp>);
+#endif
+
+ template<class _Dom> valarray<_Tp>&
+ operator= (const _Expr<_Dom, _Tp>&);
+
+ // _lib.valarray.access_ element access:
+ /**
+ * Return a reference to the i'th array element.
+ *
+ * @param i Index of element to return.
+ * @return Reference to the i'th element.
+ */
+ _Tp& operator[](size_t);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 389. Const overload of valarray::operator[] returns by value.
+ const _Tp& operator[](size_t) const;
+
+ // _lib.valarray.sub_ subset operations:
+ /**
+ * @brief Return an array subset.
+ *
+ * Returns a new valarray containing the elements of the array
+ * indicated by the slice argument. The new valarray has the same size
+ * as the input slice. @see slice.
+ *
+ * @param s The source slice.
+ * @return New valarray containing elements in @a s.
+ */
+ _Expr<_SClos<_ValArray, _Tp>, _Tp> operator[](slice) const;
+
+ /**
+ * @brief Return a reference to an array subset.
+ *
+ * Returns a new valarray containing the elements of the array
+ * indicated by the slice argument. The new valarray has the same size
+ * as the input slice. @see slice.
+ *
+ * @param s The source slice.
+ * @return New valarray containing elements in @a s.
+ */
+ slice_array<_Tp> operator[](slice);
+
+ /**
+ * @brief Return an array subset.
+ *
+ * Returns a slice_array referencing the elements of the array
+ * indicated by the slice argument. @see gslice.
+ *
+ * @param s The source slice.
+ * @return Slice_array referencing elements indicated by @a s.
+ */
+ _Expr<_GClos<_ValArray, _Tp>, _Tp> operator[](const gslice&) const;
+
+ /**
+ * @brief Return a reference to an array subset.
+ *
+ * Returns a new valarray containing the elements of the array
+ * indicated by the gslice argument. The new valarray has
+ * the same size as the input gslice. @see gslice.
+ *
+ * @param s The source gslice.
+ * @return New valarray containing elements in @a s.
+ */
+ gslice_array<_Tp> operator[](const gslice&);
+
+ /**
+ * @brief Return an array subset.
+ *
+ * Returns a new valarray containing the elements of the array
+ * indicated by the argument. The input is a valarray of bool which
+ * represents a bitmask indicating which elements should be copied into
+ * the new valarray. Each element of the array is added to the return
+ * valarray if the corresponding element of the argument is true.
+ *
+ * @param m The valarray bitmask.
+ * @return New valarray containing elements indicated by @a m.
+ */
+ valarray<_Tp> operator[](const valarray<bool>&) const;
+
+ /**
+ * @brief Return a reference to an array subset.
+ *
+ * Returns a new mask_array referencing the elements of the array
+ * indicated by the argument. The input is a valarray of bool which
+ * represents a bitmask indicating which elements are part of the
+ * subset. Elements of the array are part of the subset if the
+ * corresponding element of the argument is true.
+ *
+ * @param m The valarray bitmask.
+ * @return New valarray containing elements indicated by @a m.
+ */
+ mask_array<_Tp> operator[](const valarray<bool>&);
+
+ /**
+ * @brief Return an array subset.
+ *
+ * Returns a new valarray containing the elements of the array
+ * indicated by the argument. The elements in the argument are
+ * interpreted as the indices of elements of this valarray to copy to
+ * the return valarray.
+ *
+ * @param i The valarray element index list.
+ * @return New valarray containing elements in @a s.
+ */
+ _Expr<_IClos<_ValArray, _Tp>, _Tp>
+ operator[](const valarray<size_t>&) const;
+
+ /**
+ * @brief Return a reference to an array subset.
+ *
+ * Returns an indirect_array referencing the elements of the array
+ * indicated by the argument. The elements in the argument are
+ * interpreted as the indices of elements of this valarray to include
+ * in the subset. The returned indirect_array refers to these
+ * elements.
+ *
+ * @param i The valarray element index list.
+ * @return Indirect_array referencing elements in @a i.
+ */
+ indirect_array<_Tp> operator[](const valarray<size_t>&);
+
+ // _lib.valarray.unary_ unary operators:
+ /// Return a new valarray by applying unary + to each element.
+ typename _UnaryOp<__unary_plus>::_Rt operator+() const;
+
+ /// Return a new valarray by applying unary - to each element.
+ typename _UnaryOp<__negate>::_Rt operator-() const;
+
+ /// Return a new valarray by applying unary ~ to each element.
+ typename _UnaryOp<__bitwise_not>::_Rt operator~() const;
+
+ /// Return a new valarray by applying unary ! to each element.
+ typename _UnaryOp<__logical_not>::_Rt operator!() const;
+
+ // _lib.valarray.cassign_ computed assignment:
+ /// Multiply each element of array by @a t.
+ valarray<_Tp>& operator*=(const _Tp&);
+
+ /// Divide each element of array by @a t.
+ valarray<_Tp>& operator/=(const _Tp&);
+
+ /// Set each element e of array to e % @a t.
+ valarray<_Tp>& operator%=(const _Tp&);
+
+ /// Add @a t to each element of array.
+ valarray<_Tp>& operator+=(const _Tp&);
+
+ /// Subtract @a t to each element of array.
+ valarray<_Tp>& operator-=(const _Tp&);
+
+ /// Set each element e of array to e ^ @a t.
+ valarray<_Tp>& operator^=(const _Tp&);
+
+ /// Set each element e of array to e & @a t.
+ valarray<_Tp>& operator&=(const _Tp&);
+
+ /// Set each element e of array to e | @a t.
+ valarray<_Tp>& operator|=(const _Tp&);
+
+ /// Left shift each element e of array by @a t bits.
+ valarray<_Tp>& operator<<=(const _Tp&);
+
+ /// Right shift each element e of array by @a t bits.
+ valarray<_Tp>& operator>>=(const _Tp&);
+
+ /// Multiply elements of array by corresponding elements of @a v.
+ valarray<_Tp>& operator*=(const valarray<_Tp>&);
+
+ /// Divide elements of array by corresponding elements of @a v.
+ valarray<_Tp>& operator/=(const valarray<_Tp>&);
+
+ /// Modulo elements of array by corresponding elements of @a v.
+ valarray<_Tp>& operator%=(const valarray<_Tp>&);
+
+ /// Add corresponding elements of @a v to elements of array.
+ valarray<_Tp>& operator+=(const valarray<_Tp>&);
+
+ /// Subtract corresponding elements of @a v from elements of array.
+ valarray<_Tp>& operator-=(const valarray<_Tp>&);
+
+ /// Logical xor corresponding elements of @a v with elements of array.
+ valarray<_Tp>& operator^=(const valarray<_Tp>&);
+
+ /// Logical or corresponding elements of @a v with elements of array.
+ valarray<_Tp>& operator|=(const valarray<_Tp>&);
+
+ /// Logical and corresponding elements of @a v with elements of array.
+ valarray<_Tp>& operator&=(const valarray<_Tp>&);
+
+ /// Left shift elements of array by corresponding elements of @a v.
+ valarray<_Tp>& operator<<=(const valarray<_Tp>&);
+
+ /// Right shift elements of array by corresponding elements of @a v.
+ valarray<_Tp>& operator>>=(const valarray<_Tp>&);
+
+ template<class _Dom>
+ valarray<_Tp>& operator*=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator/=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator%=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator+=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator-=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator^=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator|=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator&=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&);
+ template<class _Dom>
+ valarray<_Tp>& operator>>=(const _Expr<_Dom, _Tp>&);
+
+ // _lib.valarray.members_ member functions:
+ /// Return the number of elements in array.
+ size_t size() const;
+
+ /**
+ * @brief Return the sum of all elements in the array.
+ *
+ * Accumulates the sum of all elements into a Tp using +=. The order
+ * of adding the elements is unspecified.
+ */
+ _Tp sum() const;
+
+ /// Return the minimum element using operator<().
+ _Tp min() const;
+
+ /// Return the maximum element using operator<().
+ _Tp max() const;
+
+ /**
+ * @brief Return a shifted array.
+ *
+ * A new valarray is constructed as a copy of this array with elements
+ * in shifted positions. For an element with index i, the new position
+ * is i - n. The new valarray has the same size as the current one.
+ * New elements without a value are set to 0. Elements whose new
+ * position is outside the bounds of the array are discarded.
+ *
+ * Positive arguments shift toward index 0, discarding elements [0, n).
+ * Negative arguments discard elements from the top of the array.
+ *
+ * @param n Number of element positions to shift.
+ * @return New valarray with elements in shifted positions.
+ */
+ valarray<_Tp> shift (int) const;
+
+ /**
+ * @brief Return a rotated array.
+ *
+ * A new valarray is constructed as a copy of this array with elements
+ * in shifted positions. For an element with index i, the new position
+ * is (i - n) % size(). The new valarray has the same size as the
+ * current one. Elements that are shifted beyond the array bounds are
+ * shifted into the other end of the array. No elements are lost.
+ *
+ * Positive arguments shift toward index 0, wrapping around the top.
+ * Negative arguments shift towards the top, wrapping around to 0.
+ *
+ * @param n Number of element positions to rotate.
+ * @return New valarray with elements in shifted positions.
+ */
+ valarray<_Tp> cshift(int) const;
+
+ /**
+ * @brief Apply a function to the array.
+ *
+ * Returns a new valarray with elements assigned to the result of
+ * applying func to the corresponding element of this array. The new
+ * array has the same size as this one.
+ *
+ * @param func Function of Tp returning Tp to apply.
+ * @return New valarray with transformed elements.
+ */
+ _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(_Tp)) const;
+
+ /**
+ * @brief Apply a function to the array.
+ *
+ * Returns a new valarray with elements assigned to the result of
+ * applying func to the corresponding element of this array. The new
+ * array has the same size as this one.
+ *
+ * @param func Function of const Tp& returning Tp to apply.
+ * @return New valarray with transformed elements.
+ */
+ _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(const _Tp&)) const;
+
+ /**
+ * @brief Resize array.
+ *
+ * Resize this array to @a size and set all elements to @a c. All
+ * references and iterators are invalidated.
+ *
+ * @param size New array size.
+ * @param c New value for all elements.
+ */
+ void resize(size_t __size, _Tp __c = _Tp());
+
+ private:
+ size_t _M_size;
+ _Tp* __restrict__ _M_data;
+
+ friend class _Array<_Tp>;
+ };
+
+ template<typename _Tp>
+ inline const _Tp&
+ valarray<_Tp>::operator[](size_t __i) const
+ {
+ __glibcxx_requires_subscript(__i);
+ return _M_data[__i];
+ }
+
+ template<typename _Tp>
+ inline _Tp&
+ valarray<_Tp>::operator[](size_t __i)
+ {
+ __glibcxx_requires_subscript(__i);
+ return _M_data[__i];
+ }
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#include <bits/valarray_after.h>
+#include <bits/slice_array.h>
+#include <bits/gslice.h>
+#include <bits/gslice_array.h>
+#include <bits/mask_array.h>
+#include <bits/indirect_array.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ /**
+ * @addtogroup numeric_arrays
+ * @{
+ */
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray() : _M_size(0), _M_data(0) {}
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(size_t __n)
+ : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
+ { std::__valarray_default_construct(_M_data, _M_data + __n); }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const _Tp& __t, size_t __n)
+ : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
+ { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n)
+ : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
+ {
+ _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0);
+ std::__valarray_copy_construct(__p, __p + __n, _M_data);
+ }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const valarray<_Tp>& __v)
+ : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size))
+ { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
+ _M_data); }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const slice_array<_Tp>& __sa)
+ : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz))
+ {
+ std::__valarray_copy_construct
+ (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data));
+ }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const gslice_array<_Tp>& __ga)
+ : _M_size(__ga._M_index.size()),
+ _M_data(__valarray_get_storage<_Tp>(_M_size))
+ {
+ std::__valarray_copy_construct
+ (__ga._M_array, _Array<size_t>(__ga._M_index),
+ _Array<_Tp>(_M_data), _M_size);
+ }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const mask_array<_Tp>& __ma)
+ : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz))
+ {
+ std::__valarray_copy_construct
+ (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size);
+ }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia)
+ : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz))
+ {
+ std::__valarray_copy_construct
+ (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::valarray(initializer_list<_Tp> __l)
+ : _M_size(__l.size()), _M_data(__valarray_get_storage<_Tp>(__l.size()))
+ { std::__valarray_copy_construct (__l.begin(), __l.end(), _M_data); }
+#endif
+
+ template<typename _Tp> template<class _Dom>
+ inline
+ valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e)
+ : _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size))
+ { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); }
+
+ template<typename _Tp>
+ inline
+ valarray<_Tp>::~valarray()
+ {
+ std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
+ std::__valarray_release_memory(_M_data);
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const valarray<_Tp>& __v)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size);
+ std::__valarray_copy(__v._M_data, _M_size, _M_data);
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(initializer_list<_Tp> __l)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __l.size());
+ std::__valarray_copy(__l.begin(), __l.size(), _M_data);
+ }
+#endif
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const _Tp& __t)
+ {
+ std::__valarray_fill(_M_data, _M_size, __t);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const slice_array<_Tp>& __sa)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz);
+ std::__valarray_copy(__sa._M_array, __sa._M_sz,
+ __sa._M_stride, _Array<_Tp>(_M_data));
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size());
+ std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index),
+ _Array<_Tp>(_M_data), _M_size);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const mask_array<_Tp>& __ma)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz);
+ std::__valarray_copy(__ma._M_array, __ma._M_mask,
+ _Array<_Tp>(_M_data), _M_size);
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz);
+ std::__valarray_copy(__ia._M_array, __ia._M_index,
+ _Array<_Tp>(_M_data), _M_size);
+ return *this;
+ }
+
+ template<typename _Tp> template<class _Dom>
+ inline valarray<_Tp>&
+ valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __e.size());
+ std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data));
+ return *this;
+ }
+
+ template<typename _Tp>
+ inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
+ valarray<_Tp>::operator[](slice __s) const
+ {
+ typedef _SClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s));
+ }
+
+ template<typename _Tp>
+ inline slice_array<_Tp>
+ valarray<_Tp>::operator[](slice __s)
+ { return slice_array<_Tp>(_Array<_Tp>(_M_data), __s); }
+
+ template<typename _Tp>
+ inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
+ valarray<_Tp>::operator[](const gslice& __gs) const
+ {
+ typedef _GClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, _Tp>
+ (_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index));
+ }
+
+ template<typename _Tp>
+ inline gslice_array<_Tp>
+ valarray<_Tp>::operator[](const gslice& __gs)
+ {
+ return gslice_array<_Tp>
+ (_Array<_Tp>(_M_data), __gs._M_index->_M_index);
+ }
+
+ template<typename _Tp>
+ inline valarray<_Tp>
+ valarray<_Tp>::operator[](const valarray<bool>& __m) const
+ {
+ size_t __s = 0;
+ size_t __e = __m.size();
+ for (size_t __i=0; __i<__e; ++__i)
+ if (__m[__i]) ++__s;
+ return valarray<_Tp>(mask_array<_Tp>(_Array<_Tp>(_M_data), __s,
+ _Array<bool> (__m)));
+ }
+
+ template<typename _Tp>
+ inline mask_array<_Tp>
+ valarray<_Tp>::operator[](const valarray<bool>& __m)
+ {
+ size_t __s = 0;
+ size_t __e = __m.size();
+ for (size_t __i=0; __i<__e; ++__i)
+ if (__m[__i]) ++__s;
+ return mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array<bool>(__m));
+ }
+
+ template<typename _Tp>
+ inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
+ valarray<_Tp>::operator[](const valarray<size_t>& __i) const
+ {
+ typedef _IClos<_ValArray,_Tp> _Closure;
+ return _Expr<_Closure, _Tp>(_Closure(*this, __i));
+ }
+
+ template<typename _Tp>
+ inline indirect_array<_Tp>
+ valarray<_Tp>::operator[](const valarray<size_t>& __i)
+ {
+ return indirect_array<_Tp>(_Array<_Tp>(_M_data), __i.size(),
+ _Array<size_t>(__i));
+ }
+
+ template<class _Tp>
+ inline size_t
+ valarray<_Tp>::size() const
+ { return _M_size; }
+
+ template<class _Tp>
+ inline _Tp
+ valarray<_Tp>::sum() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
+ return std::__valarray_sum(_M_data, _M_data + _M_size);
+ }
+
+ template<class _Tp>
+ inline valarray<_Tp>
+ valarray<_Tp>::shift(int __n) const
+ {
+ valarray<_Tp> __ret;
+
+ if (_M_size == 0)
+ return __ret;
+
+ _Tp* __restrict__ __tmp_M_data =
+ std::__valarray_get_storage<_Tp>(_M_size);
+
+ if (__n == 0)
+ std::__valarray_copy_construct(_M_data,
+ _M_data + _M_size, __tmp_M_data);
+ else if (__n > 0) // shift left
+ {
+ if (size_t(__n) > _M_size)
+ __n = int(_M_size);
+
+ std::__valarray_copy_construct(_M_data + __n,
+ _M_data + _M_size, __tmp_M_data);
+ std::__valarray_default_construct(__tmp_M_data + _M_size - __n,
+ __tmp_M_data + _M_size);
+ }
+ else // shift right
+ {
+ if (-size_t(__n) > _M_size)
+ __n = -int(_M_size);
+
+ std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
+ __tmp_M_data - __n);
+ std::__valarray_default_construct(__tmp_M_data,
+ __tmp_M_data - __n);
+ }
+
+ __ret._M_size = _M_size;
+ __ret._M_data = __tmp_M_data;
+ return __ret;
+ }
+
+ template<class _Tp>
+ inline valarray<_Tp>
+ valarray<_Tp>::cshift(int __n) const
+ {
+ valarray<_Tp> __ret;
+
+ if (_M_size == 0)
+ return __ret;
+
+ _Tp* __restrict__ __tmp_M_data =
+ std::__valarray_get_storage<_Tp>(_M_size);
+
+ if (__n == 0)
+ std::__valarray_copy_construct(_M_data,
+ _M_data + _M_size, __tmp_M_data);
+ else if (__n > 0) // cshift left
+ {
+ if (size_t(__n) > _M_size)
+ __n = int(__n % _M_size);
+
+ std::__valarray_copy_construct(_M_data, _M_data + __n,
+ __tmp_M_data + _M_size - __n);
+ std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size,
+ __tmp_M_data);
+ }
+ else // cshift right
+ {
+ if (-size_t(__n) > _M_size)
+ __n = -int(-size_t(__n) % _M_size);
+
+ std::__valarray_copy_construct(_M_data + _M_size + __n,
+ _M_data + _M_size, __tmp_M_data);
+ std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
+ __tmp_M_data - __n);
+ }
+
+ __ret._M_size = _M_size;
+ __ret._M_data = __tmp_M_data;
+ return __ret;
+ }
+
+ template<class _Tp>
+ inline void
+ valarray<_Tp>::resize(size_t __n, _Tp __c)
+ {
+ // This complication is so to make valarray<valarray<T> > work
+ // even though it is not required by the standard. Nobody should
+ // be saying valarray<valarray<T> > anyway. See the specs.
+ std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
+ if (_M_size != __n)
+ {
+ std::__valarray_release_memory(_M_data);
+ _M_size = __n;
+ _M_data = __valarray_get_storage<_Tp>(__n);
+ }
+ std::__valarray_fill_construct(_M_data, _M_data + __n, __c);
+ }
+
+ template<typename _Tp>
+ inline _Tp
+ valarray<_Tp>::min() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
+ return *std::min_element(_M_data, _M_data + _M_size);
+ }
+
+ template<typename _Tp>
+ inline _Tp
+ valarray<_Tp>::max() const
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
+ return *std::max_element(_M_data, _M_data + _M_size);
+ }
+
+ template<class _Tp>
+ inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>
+ valarray<_Tp>::apply(_Tp func(_Tp)) const
+ {
+ typedef _ValFunClos<_ValArray, _Tp> _Closure;
+ return _Expr<_Closure, _Tp>(_Closure(*this, func));
+ }
+
+ template<class _Tp>
+ inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>
+ valarray<_Tp>::apply(_Tp func(const _Tp &)) const
+ {
+ typedef _RefFunClos<_ValArray, _Tp> _Closure;
+ return _Expr<_Closure, _Tp>(_Closure(*this, func));
+ }
+
+#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
+ template<typename _Tp> \
+ inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \
+ valarray<_Tp>::operator _Op() const \
+ { \
+ typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \
+ typedef typename __fun<_Name, _Tp>::result_type _Rt; \
+ return _Expr<_Closure, _Rt>(_Closure(*this)); \
+ }
+
+ _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus)
+ _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate)
+ _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not)
+ _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not)
+
+#undef _DEFINE_VALARRAY_UNARY_OPERATOR
+
+#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
+ template<class _Tp> \
+ inline valarray<_Tp>& \
+ valarray<_Tp>::operator _Op##=(const _Tp &__t) \
+ { \
+ _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \
+ return *this; \
+ } \
+ \
+ template<class _Tp> \
+ inline valarray<_Tp>& \
+ valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \
+ { \
+ _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \
+ _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \
+ _Array<_Tp>(__v._M_data)); \
+ return *this; \
+ }
+
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left)
+_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right)
+
+#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
+
+#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
+ template<class _Tp> template<class _Dom> \
+ inline valarray<_Tp>& \
+ valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \
+ { \
+ _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \
+ return *this; \
+ }
+
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left)
+_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right)
+
+#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
+
+
+#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
+ template<typename _Tp> \
+ inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \
+ typename __fun<_Name, _Tp>::result_type> \
+ operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
+ { \
+ _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \
+ typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \
+ typedef typename __fun<_Name, _Tp>::result_type _Rt; \
+ return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \
+ } \
+ \
+ template<typename _Tp> \
+ inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \
+ typename __fun<_Name, _Tp>::result_type> \
+ operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \
+ { \
+ typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \
+ typedef typename __fun<_Name, _Tp>::result_type _Rt; \
+ return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \
+ } \
+ \
+ template<typename _Tp> \
+ inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \
+ typename __fun<_Name, _Tp>::result_type> \
+ operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \
+ { \
+ typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \
+ typedef typename __fun<_Name, _Tp>::result_type _Rt; \
+ return _Expr<_Closure, _Rt>(_Closure(__t, __v)); \
+ }
+
+_DEFINE_BINARY_OPERATOR(+, __plus)
+_DEFINE_BINARY_OPERATOR(-, __minus)
+_DEFINE_BINARY_OPERATOR(*, __multiplies)
+_DEFINE_BINARY_OPERATOR(/, __divides)
+_DEFINE_BINARY_OPERATOR(%, __modulus)
+_DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
+_DEFINE_BINARY_OPERATOR(&, __bitwise_and)
+_DEFINE_BINARY_OPERATOR(|, __bitwise_or)
+_DEFINE_BINARY_OPERATOR(<<, __shift_left)
+_DEFINE_BINARY_OPERATOR(>>, __shift_right)
+_DEFINE_BINARY_OPERATOR(&&, __logical_and)
+_DEFINE_BINARY_OPERATOR(||, __logical_or)
+_DEFINE_BINARY_OPERATOR(==, __equal_to)
+_DEFINE_BINARY_OPERATOR(!=, __not_equal_to)
+_DEFINE_BINARY_OPERATOR(<, __less)
+_DEFINE_BINARY_OPERATOR(>, __greater)
+_DEFINE_BINARY_OPERATOR(<=, __less_equal)
+_DEFINE_BINARY_OPERATOR(>=, __greater_equal)
+
+#undef _DEFINE_BINARY_OPERATOR
+
+ // @} group numeric_arrays
+
+_GLIBCXX_END_NAMESPACE
+
+#endif /* _GLIBCXX_VALARRAY */
diff --git a/gcc-4.4.0/libstdc++-v3/include/std/vector b/gcc-4.4.0/libstdc++-v3/include/std/vector
new file mode 100644
index 000000000..114665b6c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/std/vector
@@ -0,0 +1,77 @@
+// <vector> -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ */
+
+/** @file include/vector
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_VECTOR
+#define _GLIBCXX_VECTOR 1
+
+#pragma GCC system_header
+
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_construct.h>
+#include <bits/stl_uninitialized.h>
+#include <bits/stl_vector.h>
+#include <bits/stl_bvector.h>
+
+#ifndef _GLIBCXX_EXPORT_TEMPLATE
+# include <bits/vector.tcc>
+#endif
+
+#ifdef _GLIBCXX_DEBUG
+# include <debug/vector>
+#endif
+
+#endif /* _GLIBCXX_VECTOR */
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/array b/gcc-4.4.0/libstdc++-v3/include/tr1/array
new file mode 100644
index 000000000..17cf5d290
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/array
@@ -0,0 +1,54 @@
+// class template array -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/array
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_ARRAY
+#define _GLIBCXX_TR1_ARRAY 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <bits/stl_algobase.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/array>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/array>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_ARRAY
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/bessel_function.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/bessel_function.tcc
new file mode 100644
index 000000000..25102151b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/bessel_function.tcc
@@ -0,0 +1,627 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/bessel_function.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland.
+//
+// References:
+// (1) Handbook of Mathematical Functions,
+// ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 9, pp. 355-434, Section 10 pp. 435-478
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
+// 2nd ed, pp. 240-245
+
+#ifndef _GLIBCXX_TR1_BESSEL_FUNCTION_TCC
+#define _GLIBCXX_TR1_BESSEL_FUNCTION_TCC 1
+
+#include "special_function_util.h"
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Compute the gamma functions required by the Temme series
+ * expansions of @f$ N_\nu(x) @f$ and @f$ K_\nu(x) @f$.
+ * @f[
+ * \Gamma_1 = \frac{1}{2\mu}
+ * [\frac{1}{\Gamma(1 - \mu)} - \frac{1}{\Gamma(1 + \mu)}]
+ * @f]
+ * and
+ * @f[
+ * \Gamma_2 = \frac{1}{2}
+ * [\frac{1}{\Gamma(1 - \mu)} + \frac{1}{\Gamma(1 + \mu)}]
+ * @f]
+ * where @f$ -1/2 <= \mu <= 1/2 @f$ is @f$ \mu = \nu - N @f$ and @f$ N @f$.
+ * is the nearest integer to @f$ \nu @f$.
+ * The values of \f$ \Gamma(1 + \mu) \f$ and \f$ \Gamma(1 - \mu) \f$
+ * are returned as well.
+ *
+ * The accuracy requirements on this are exquisite.
+ *
+ * @param __mu The input parameter of the gamma functions.
+ * @param __gam1 The output function \f$ \Gamma_1(\mu) \f$
+ * @param __gam2 The output function \f$ \Gamma_2(\mu) \f$
+ * @param __gampl The output function \f$ \Gamma(1 + \mu) \f$
+ * @param __gammi The output function \f$ \Gamma(1 - \mu) \f$
+ */
+ template <typename _Tp>
+ void
+ __gamma_temme(const _Tp __mu,
+ _Tp & __gam1, _Tp & __gam2, _Tp & __gampl, _Tp & __gammi)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ __gampl = _Tp(1) / std::tr1::tgamma(_Tp(1) + __mu);
+ __gammi = _Tp(1) / std::tr1::tgamma(_Tp(1) - __mu);
+#else
+ __gampl = _Tp(1) / __gamma(_Tp(1) + __mu);
+ __gammi = _Tp(1) / __gamma(_Tp(1) - __mu);
+#endif
+
+ if (std::abs(__mu) < std::numeric_limits<_Tp>::epsilon())
+ __gam1 = -_Tp(__numeric_constants<_Tp>::__gamma_e());
+ else
+ __gam1 = (__gammi - __gampl) / (_Tp(2) * __mu);
+
+ __gam2 = (__gammi + __gampl) / (_Tp(2));
+
+ return;
+ }
+
+
+ /**
+ * @brief Compute the Bessel @f$ J_\nu(x) @f$ and Neumann
+ * @f$ N_\nu(x) @f$ functions and their first derivatives
+ * @f$ J'_\nu(x) @f$ and @f$ N'_\nu(x) @f$ respectively.
+ * These four functions are computed together for numerical
+ * stability.
+ *
+ * @param __nu The order of the Bessel functions.
+ * @param __x The argument of the Bessel functions.
+ * @param __Jnu The output Bessel function of the first kind.
+ * @param __Nnu The output Neumann function (Bessel function of the second kind).
+ * @param __Jpnu The output derivative of the Bessel function of the first kind.
+ * @param __Npnu The output derivative of the Neumann function.
+ */
+ template <typename _Tp>
+ void
+ __bessel_jn(const _Tp __nu, const _Tp __x,
+ _Tp & __Jnu, _Tp & __Nnu, _Tp & __Jpnu, _Tp & __Npnu)
+ {
+ if (__x == _Tp(0))
+ {
+ if (__nu == _Tp(0))
+ {
+ __Jnu = _Tp(1);
+ __Jpnu = _Tp(0);
+ }
+ else if (__nu == _Tp(1))
+ {
+ __Jnu = _Tp(0);
+ __Jpnu = _Tp(0.5L);
+ }
+ else
+ {
+ __Jnu = _Tp(0);
+ __Jpnu = _Tp(0);
+ }
+ __Nnu = -std::numeric_limits<_Tp>::infinity();
+ __Npnu = std::numeric_limits<_Tp>::infinity();
+ return;
+ }
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ // When the multiplier is N i.e.
+ // fp_min = N * min()
+ // Then J_0 and N_0 tank at x = 8 * N (J_0 = 0 and N_0 = nan)!
+ //const _Tp __fp_min = _Tp(20) * std::numeric_limits<_Tp>::min();
+ const _Tp __fp_min = std::sqrt(std::numeric_limits<_Tp>::min());
+ const int __max_iter = 15000;
+ const _Tp __x_min = _Tp(2);
+
+ const int __nl = (__x < __x_min
+ ? static_cast<int>(__nu + _Tp(0.5L))
+ : std::max(0, static_cast<int>(__nu - __x + _Tp(1.5L))));
+
+ const _Tp __mu = __nu - __nl;
+ const _Tp __mu2 = __mu * __mu;
+ const _Tp __xi = _Tp(1) / __x;
+ const _Tp __xi2 = _Tp(2) * __xi;
+ _Tp __w = __xi2 / __numeric_constants<_Tp>::__pi();
+ int __isign = 1;
+ _Tp __h = __nu * __xi;
+ if (__h < __fp_min)
+ __h = __fp_min;
+ _Tp __b = __xi2 * __nu;
+ _Tp __d = _Tp(0);
+ _Tp __c = __h;
+ int __i;
+ for (__i = 1; __i <= __max_iter; ++__i)
+ {
+ __b += __xi2;
+ __d = __b - __d;
+ if (std::abs(__d) < __fp_min)
+ __d = __fp_min;
+ __c = __b - _Tp(1) / __c;
+ if (std::abs(__c) < __fp_min)
+ __c = __fp_min;
+ __d = _Tp(1) / __d;
+ const _Tp __del = __c * __d;
+ __h *= __del;
+ if (__d < _Tp(0))
+ __isign = -__isign;
+ if (std::abs(__del - _Tp(1)) < __eps)
+ break;
+ }
+ if (__i > __max_iter)
+ std::__throw_runtime_error(__N("Argument x too large in __bessel_jn; "
+ "try asymptotic expansion."));
+ _Tp __Jnul = __isign * __fp_min;
+ _Tp __Jpnul = __h * __Jnul;
+ _Tp __Jnul1 = __Jnul;
+ _Tp __Jpnu1 = __Jpnul;
+ _Tp __fact = __nu * __xi;
+ for ( int __l = __nl; __l >= 1; --__l )
+ {
+ const _Tp __Jnutemp = __fact * __Jnul + __Jpnul;
+ __fact -= __xi;
+ __Jpnul = __fact * __Jnutemp - __Jnul;
+ __Jnul = __Jnutemp;
+ }
+ if (__Jnul == _Tp(0))
+ __Jnul = __eps;
+ _Tp __f= __Jpnul / __Jnul;
+ _Tp __Nmu, __Nnu1, __Npmu, __Jmu;
+ if (__x < __x_min)
+ {
+ const _Tp __x2 = __x / _Tp(2);
+ const _Tp __pimu = __numeric_constants<_Tp>::__pi() * __mu;
+ _Tp __fact = (std::abs(__pimu) < __eps
+ ? _Tp(1) : __pimu / std::sin(__pimu));
+ _Tp __d = -std::log(__x2);
+ _Tp __e = __mu * __d;
+ _Tp __fact2 = (std::abs(__e) < __eps
+ ? _Tp(1) : std::sinh(__e) / __e);
+ _Tp __gam1, __gam2, __gampl, __gammi;
+ __gamma_temme(__mu, __gam1, __gam2, __gampl, __gammi);
+ _Tp __ff = (_Tp(2) / __numeric_constants<_Tp>::__pi())
+ * __fact * (__gam1 * std::cosh(__e) + __gam2 * __fact2 * __d);
+ __e = std::exp(__e);
+ _Tp __p = __e / (__numeric_constants<_Tp>::__pi() * __gampl);
+ _Tp __q = _Tp(1) / (__e * __numeric_constants<_Tp>::__pi() * __gammi);
+ const _Tp __pimu2 = __pimu / _Tp(2);
+ _Tp __fact3 = (std::abs(__pimu2) < __eps
+ ? _Tp(1) : std::sin(__pimu2) / __pimu2 );
+ _Tp __r = __numeric_constants<_Tp>::__pi() * __pimu2 * __fact3 * __fact3;
+ _Tp __c = _Tp(1);
+ __d = -__x2 * __x2;
+ _Tp __sum = __ff + __r * __q;
+ _Tp __sum1 = __p;
+ for (__i = 1; __i <= __max_iter; ++__i)
+ {
+ __ff = (__i * __ff + __p + __q) / (__i * __i - __mu2);
+ __c *= __d / _Tp(__i);
+ __p /= _Tp(__i) - __mu;
+ __q /= _Tp(__i) + __mu;
+ const _Tp __del = __c * (__ff + __r * __q);
+ __sum += __del;
+ const _Tp __del1 = __c * __p - __i * __del;
+ __sum1 += __del1;
+ if ( std::abs(__del) < __eps * (_Tp(1) + std::abs(__sum)) )
+ break;
+ }
+ if ( __i > __max_iter )
+ std::__throw_runtime_error(__N("Bessel y series failed to converge "
+ "in __bessel_jn."));
+ __Nmu = -__sum;
+ __Nnu1 = -__sum1 * __xi2;
+ __Npmu = __mu * __xi * __Nmu - __Nnu1;
+ __Jmu = __w / (__Npmu - __f * __Nmu);
+ }
+ else
+ {
+ _Tp __a = _Tp(0.25L) - __mu2;
+ _Tp __q = _Tp(1);
+ _Tp __p = -__xi / _Tp(2);
+ _Tp __br = _Tp(2) * __x;
+ _Tp __bi = _Tp(2);
+ _Tp __fact = __a * __xi / (__p * __p + __q * __q);
+ _Tp __cr = __br + __q * __fact;
+ _Tp __ci = __bi + __p * __fact;
+ _Tp __den = __br * __br + __bi * __bi;
+ _Tp __dr = __br / __den;
+ _Tp __di = -__bi / __den;
+ _Tp __dlr = __cr * __dr - __ci * __di;
+ _Tp __dli = __cr * __di + __ci * __dr;
+ _Tp __temp = __p * __dlr - __q * __dli;
+ __q = __p * __dli + __q * __dlr;
+ __p = __temp;
+ int __i;
+ for (__i = 2; __i <= __max_iter; ++__i)
+ {
+ __a += _Tp(2 * (__i - 1));
+ __bi += _Tp(2);
+ __dr = __a * __dr + __br;
+ __di = __a * __di + __bi;
+ if (std::abs(__dr) + std::abs(__di) < __fp_min)
+ __dr = __fp_min;
+ __fact = __a / (__cr * __cr + __ci * __ci);
+ __cr = __br + __cr * __fact;
+ __ci = __bi - __ci * __fact;
+ if (std::abs(__cr) + std::abs(__ci) < __fp_min)
+ __cr = __fp_min;
+ __den = __dr * __dr + __di * __di;
+ __dr /= __den;
+ __di /= -__den;
+ __dlr = __cr * __dr - __ci * __di;
+ __dli = __cr * __di + __ci * __dr;
+ __temp = __p * __dlr - __q * __dli;
+ __q = __p * __dli + __q * __dlr;
+ __p = __temp;
+ if (std::abs(__dlr - _Tp(1)) + std::abs(__dli) < __eps)
+ break;
+ }
+ if (__i > __max_iter)
+ std::__throw_runtime_error(__N("Lentz's method failed "
+ "in __bessel_jn."));
+ const _Tp __gam = (__p - __f) / __q;
+ __Jmu = std::sqrt(__w / ((__p - __f) * __gam + __q));
+#if _GLIBCXX_USE_C99_MATH_TR1
+ __Jmu = std::tr1::copysign(__Jmu, __Jnul);
+#else
+ if (__Jmu * __Jnul < _Tp(0))
+ __Jmu = -__Jmu;
+#endif
+ __Nmu = __gam * __Jmu;
+ __Npmu = (__p + __q / __gam) * __Nmu;
+ __Nnu1 = __mu * __xi * __Nmu - __Npmu;
+ }
+ __fact = __Jmu / __Jnul;
+ __Jnu = __fact * __Jnul1;
+ __Jpnu = __fact * __Jpnu1;
+ for (__i = 1; __i <= __nl; ++__i)
+ {
+ const _Tp __Nnutemp = (__mu + __i) * __xi2 * __Nnu1 - __Nmu;
+ __Nmu = __Nnu1;
+ __Nnu1 = __Nnutemp;
+ }
+ __Nnu = __Nmu;
+ __Npnu = __nu * __xi * __Nmu - __Nnu1;
+
+ return;
+ }
+
+
+ /**
+ * @brief This routine computes the asymptotic cylindrical Bessel
+ * and Neumann functions of order nu: \f$ J_{\nu} \f$,
+ * \f$ N_{\nu} \f$.
+ *
+ * References:
+ * (1) Handbook of Mathematical Functions,
+ * ed. Milton Abramowitz and Irene A. Stegun,
+ * Dover Publications,
+ * Section 9 p. 364, Equations 9.2.5-9.2.10
+ *
+ * @param __nu The order of the Bessel functions.
+ * @param __x The argument of the Bessel functions.
+ * @param __Jnu The output Bessel function of the first kind.
+ * @param __Nnu The output Neumann function (Bessel function of the second kind).
+ */
+ template <typename _Tp>
+ void
+ __cyl_bessel_jn_asymp(const _Tp __nu, const _Tp __x,
+ _Tp & __Jnu, _Tp & __Nnu)
+ {
+ const _Tp __coef = std::sqrt(_Tp(2)
+ / (__numeric_constants<_Tp>::__pi() * __x));
+ const _Tp __mu = _Tp(4) * __nu * __nu;
+ const _Tp __mum1 = __mu - _Tp(1);
+ const _Tp __mum9 = __mu - _Tp(9);
+ const _Tp __mum25 = __mu - _Tp(25);
+ const _Tp __mum49 = __mu - _Tp(49);
+ const _Tp __xx = _Tp(64) * __x * __x;
+ const _Tp __P = _Tp(1) - __mum1 * __mum9 / (_Tp(2) * __xx)
+ * (_Tp(1) - __mum25 * __mum49 / (_Tp(12) * __xx));
+ const _Tp __Q = __mum1 / (_Tp(8) * __x)
+ * (_Tp(1) - __mum9 * __mum25 / (_Tp(6) * __xx));
+
+ const _Tp __chi = __x - (__nu + _Tp(0.5L))
+ * __numeric_constants<_Tp>::__pi_2();
+ const _Tp __c = std::cos(__chi);
+ const _Tp __s = std::sin(__chi);
+
+ __Jnu = __coef * (__c * __P - __s * __Q);
+ __Nnu = __coef * (__s * __P + __c * __Q);
+
+ return;
+ }
+
+
+ /**
+ * @brief This routine returns the cylindrical Bessel functions
+ * of order \f$ \nu \f$: \f$ J_{\nu} \f$ or \f$ I_{\nu} \f$
+ * by series expansion.
+ *
+ * The modified cylindrical Bessel function is:
+ * @f[
+ * Z_{\nu}(x) = \sum_{k=0}^{\infty}
+ * \frac{\sigma^k (x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)}
+ * @f]
+ * where \f$ \sigma = +1 \f$ or\f$ -1 \f$ for
+ * \f$ Z = I \f$ or \f$ J \f$ respectively.
+ *
+ * See Abramowitz & Stegun, 9.1.10
+ * Abramowitz & Stegun, 9.6.7
+ * (1) Handbook of Mathematical Functions,
+ * ed. Milton Abramowitz and Irene A. Stegun,
+ * Dover Publications,
+ * Equation 9.1.10 p. 360 and Equation 9.6.10 p. 375
+ *
+ * @param __nu The order of the Bessel function.
+ * @param __x The argument of the Bessel function.
+ * @param __sgn The sign of the alternate terms
+ * -1 for the Bessel function of the first kind.
+ * +1 for the modified Bessel function of the first kind.
+ * @return The output Bessel function.
+ */
+ template <typename _Tp>
+ _Tp
+ __cyl_bessel_ij_series(const _Tp __nu, const _Tp __x, const _Tp __sgn,
+ const unsigned int __max_iter)
+ {
+
+ const _Tp __x2 = __x / _Tp(2);
+ _Tp __fact = __nu * std::log(__x2);
+#if _GLIBCXX_USE_C99_MATH_TR1
+ __fact -= std::tr1::lgamma(__nu + _Tp(1));
+#else
+ __fact -= __log_gamma(__nu + _Tp(1));
+#endif
+ __fact = std::exp(__fact);
+ const _Tp __xx4 = __sgn * __x2 * __x2;
+ _Tp __Jn = _Tp(1);
+ _Tp __term = _Tp(1);
+
+ for (unsigned int __i = 1; __i < __max_iter; ++__i)
+ {
+ __term *= __xx4 / (_Tp(__i) * (__nu + _Tp(__i)));
+ __Jn += __term;
+ if (std::abs(__term / __Jn) < std::numeric_limits<_Tp>::epsilon())
+ break;
+ }
+
+ return __fact * __Jn;
+ }
+
+
+ /**
+ * @brief Return the Bessel function of order \f$ \nu \f$:
+ * \f$ J_{\nu}(x) \f$.
+ *
+ * The cylindrical Bessel function is:
+ * @f[
+ * J_{\nu}(x) = \sum_{k=0}^{\infty}
+ * \frac{(-1)^k (x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)}
+ * @f]
+ *
+ * @param __nu The order of the Bessel function.
+ * @param __x The argument of the Bessel function.
+ * @return The output Bessel function.
+ */
+ template<typename _Tp>
+ _Tp
+ __cyl_bessel_j(const _Tp __nu, const _Tp __x)
+ {
+ if (__nu < _Tp(0) || __x < _Tp(0))
+ std::__throw_domain_error(__N("Bad argument "
+ "in __cyl_bessel_j."));
+ else if (__isnan(__nu) || __isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x * __x < _Tp(10) * (__nu + _Tp(1)))
+ return __cyl_bessel_ij_series(__nu, __x, -_Tp(1), 200);
+ else if (__x > _Tp(1000))
+ {
+ _Tp __J_nu, __N_nu;
+ __cyl_bessel_jn_asymp(__nu, __x, __J_nu, __N_nu);
+ return __J_nu;
+ }
+ else
+ {
+ _Tp __J_nu, __N_nu, __Jp_nu, __Np_nu;
+ __bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu);
+ return __J_nu;
+ }
+ }
+
+
+ /**
+ * @brief Return the Neumann function of order \f$ \nu \f$:
+ * \f$ N_{\nu}(x) \f$.
+ *
+ * The Neumann function is defined by:
+ * @f[
+ * N_{\nu}(x) = \frac{J_{\nu}(x) \cos \nu\pi - J_{-\nu}(x)}
+ * {\sin \nu\pi}
+ * @f]
+ * where for integral \f$ \nu = n \f$ a limit is taken:
+ * \f$ lim_{\nu \to n} \f$.
+ *
+ * @param __nu The order of the Neumann function.
+ * @param __x The argument of the Neumann function.
+ * @return The output Neumann function.
+ */
+ template<typename _Tp>
+ _Tp
+ __cyl_neumann_n(const _Tp __nu, const _Tp __x)
+ {
+ if (__nu < _Tp(0) || __x < _Tp(0))
+ std::__throw_domain_error(__N("Bad argument "
+ "in __cyl_neumann_n."));
+ else if (__isnan(__nu) || __isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x > _Tp(1000))
+ {
+ _Tp __J_nu, __N_nu;
+ __cyl_bessel_jn_asymp(__nu, __x, __J_nu, __N_nu);
+ return __N_nu;
+ }
+ else
+ {
+ _Tp __J_nu, __N_nu, __Jp_nu, __Np_nu;
+ __bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu);
+ return __N_nu;
+ }
+ }
+
+
+ /**
+ * @brief Compute the spherical Bessel @f$ j_n(x) @f$
+ * and Neumann @f$ n_n(x) @f$ functions and their first
+ * derivatives @f$ j'_n(x) @f$ and @f$ n'_n(x) @f$
+ * respectively.
+ *
+ * @param __n The order of the spherical Bessel function.
+ * @param __x The argument of the spherical Bessel function.
+ * @param __j_n The output spherical Bessel function.
+ * @param __n_n The output spherical Neumann function.
+ * @param __jp_n The output derivative of the spherical Bessel function.
+ * @param __np_n The output derivative of the spherical Neumann function.
+ */
+ template <typename _Tp>
+ void
+ __sph_bessel_jn(const unsigned int __n, const _Tp __x,
+ _Tp & __j_n, _Tp & __n_n, _Tp & __jp_n, _Tp & __np_n)
+ {
+ const _Tp __nu = _Tp(__n) + _Tp(0.5L);
+
+ _Tp __J_nu, __N_nu, __Jp_nu, __Np_nu;
+ __bessel_jn(__nu, __x, __J_nu, __N_nu, __Jp_nu, __Np_nu);
+
+ const _Tp __factor = __numeric_constants<_Tp>::__sqrtpio2()
+ / std::sqrt(__x);
+
+ __j_n = __factor * __J_nu;
+ __n_n = __factor * __N_nu;
+ __jp_n = __factor * __Jp_nu - __j_n / (_Tp(2) * __x);
+ __np_n = __factor * __Np_nu - __n_n / (_Tp(2) * __x);
+
+ return;
+ }
+
+
+ /**
+ * @brief Return the spherical Bessel function
+ * @f$ j_n(x) @f$ of order n.
+ *
+ * The spherical Bessel function is defined by:
+ * @f[
+ * j_n(x) = \left( \frac{\pi}{2x} \right) ^{1/2} J_{n+1/2}(x)
+ * @f]
+ *
+ * @param __n The order of the spherical Bessel function.
+ * @param __x The argument of the spherical Bessel function.
+ * @return The output spherical Bessel function.
+ */
+ template <typename _Tp>
+ _Tp
+ __sph_bessel(const unsigned int __n, const _Tp __x)
+ {
+ if (__x < _Tp(0))
+ std::__throw_domain_error(__N("Bad argument "
+ "in __sph_bessel."));
+ else if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x == _Tp(0))
+ {
+ if (__n == 0)
+ return _Tp(1);
+ else
+ return _Tp(0);
+ }
+ else
+ {
+ _Tp __j_n, __n_n, __jp_n, __np_n;
+ __sph_bessel_jn(__n, __x, __j_n, __n_n, __jp_n, __np_n);
+ return __j_n;
+ }
+ }
+
+
+ /**
+ * @brief Return the spherical Neumann function
+ * @f$ n_n(x) @f$.
+ *
+ * The spherical Neumann function is defined by:
+ * @f[
+ * n_n(x) = \left( \frac{\pi}{2x} \right) ^{1/2} N_{n+1/2}(x)
+ * @f]
+ *
+ * @param __n The order of the spherical Neumann function.
+ * @param __x The argument of the spherical Neumann function.
+ * @return The output spherical Neumann function.
+ */
+ template <typename _Tp>
+ _Tp
+ __sph_neumann(const unsigned int __n, const _Tp __x)
+ {
+ if (__x < _Tp(0))
+ std::__throw_domain_error(__N("Bad argument "
+ "in __sph_neumann."));
+ else if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x == _Tp(0))
+ return -std::numeric_limits<_Tp>::infinity();
+ else
+ {
+ _Tp __j_n, __n_n, __jp_n, __np_n;
+ __sph_bessel_jn(__n, __x, __j_n, __n_n, __jp_n, __np_n);
+ return __n_n;
+ }
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_BESSEL_FUNCTION_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/beta_function.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/beta_function.tcc
new file mode 100644
index 000000000..f9d18604d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/beta_function.tcc
@@ -0,0 +1,197 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/beta_function.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) Handbook of Mathematical Functions,
+// ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 6, pp. 253-266
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
+// 2nd ed, pp. 213-216
+// (4) Gamma, Exploring Euler's Constant, Julian Havil,
+// Princeton, 2003.
+
+#ifndef _GLIBCXX_TR1_BETA_FUNCTION_TCC
+#define _GLIBCXX_TR1_BETA_FUNCTION_TCC 1
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Return the beta function: \f$B(x,y)\f$.
+ *
+ * The beta function is defined by
+ * @f[
+ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
+ * @f]
+ *
+ * @param __x The first argument of the beta function.
+ * @param __y The second argument of the beta function.
+ * @return The beta function.
+ */
+ template<typename _Tp>
+ _Tp
+ __beta_gamma(_Tp __x, _Tp __y)
+ {
+
+ _Tp __bet;
+#if _GLIBCXX_USE_C99_MATH_TR1
+ if (__x > __y)
+ {
+ __bet = std::tr1::tgamma(__x)
+ / std::tr1::tgamma(__x + __y);
+ __bet *= std::tr1::tgamma(__y);
+ }
+ else
+ {
+ __bet = std::tr1::tgamma(__y)
+ / std::tr1::tgamma(__x + __y);
+ __bet *= std::tr1::tgamma(__x);
+ }
+#else
+ if (__x > __y)
+ {
+ __bet = __gamma(__x) / __gamma(__x + __y);
+ __bet *= __gamma(__y);
+ }
+ else
+ {
+ __bet = __gamma(__y) / __gamma(__x + __y);
+ __bet *= __gamma(__x);
+ }
+#endif
+
+ return __bet;
+ }
+
+ /**
+ * @brief Return the beta function \f$B(x,y)\f$ using
+ * the log gamma functions.
+ *
+ * The beta function is defined by
+ * @f[
+ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
+ * @f]
+ *
+ * @param __x The first argument of the beta function.
+ * @param __y The second argument of the beta function.
+ * @return The beta function.
+ */
+ template<typename _Tp>
+ _Tp
+ __beta_lgamma(_Tp __x, _Tp __y)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _Tp __bet = std::tr1::lgamma(__x)
+ + std::tr1::lgamma(__y)
+ - std::tr1::lgamma(__x + __y);
+#else
+ _Tp __bet = __log_gamma(__x)
+ + __log_gamma(__y)
+ - __log_gamma(__x + __y);
+#endif
+ __bet = std::exp(__bet);
+ return __bet;
+ }
+
+
+ /**
+ * @brief Return the beta function \f$B(x,y)\f$ using
+ * the product form.
+ *
+ * The beta function is defined by
+ * @f[
+ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
+ * @f]
+ *
+ * @param __x The first argument of the beta function.
+ * @param __y The second argument of the beta function.
+ * @return The beta function.
+ */
+ template<typename _Tp>
+ _Tp
+ __beta_product(_Tp __x, _Tp __y)
+ {
+
+ _Tp __bet = (__x + __y) / (__x * __y);
+
+ unsigned int __max_iter = 1000000;
+ for (unsigned int __k = 1; __k < __max_iter; ++__k)
+ {
+ _Tp __term = (_Tp(1) + (__x + __y) / __k)
+ / ((_Tp(1) + __x / __k) * (_Tp(1) + __y / __k));
+ __bet *= __term;
+ }
+
+ return __bet;
+ }
+
+
+ /**
+ * @brief Return the beta function \f$ B(x,y) \f$.
+ *
+ * The beta function is defined by
+ * @f[
+ * B(x,y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
+ * @f]
+ *
+ * @param __x The first argument of the beta function.
+ * @param __y The second argument of the beta function.
+ * @return The beta function.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __beta(_Tp __x, _Tp __y)
+ {
+ if (__isnan(__x) || __isnan(__y))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else
+ return __beta_lgamma(__x, __y);
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // __GLIBCXX_TR1_BETA_FUNCTION_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/ccomplex b/gcc-4.4.0/libstdc++-v3/include/tr1/ccomplex
new file mode 100644
index 000000000..a0ae33e0c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/ccomplex
@@ -0,0 +1,34 @@
+// TR1 ccomplex -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/ccomplex
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CCOMPLEX
+#define _GLIBCXX_TR1_CCOMPLEX 1
+
+#include <tr1/complex>
+
+#endif // _GLIBCXX_TR1_CCOMPLEX
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cctype b/gcc-4.4.0/libstdc++-v3/include/tr1/cctype
new file mode 100644
index 000000000..93e864eb8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cctype
@@ -0,0 +1,49 @@
+// TR1 cctype -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cctype
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CCTYPE
+#define _GLIBCXX_TR1_CCTYPE 1
+
+#include <bits/c++config.h>
+#include <cctype>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cctype>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cctype>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CCTYPE
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cfenv b/gcc-4.4.0/libstdc++-v3/include/tr1/cfenv
new file mode 100644
index 000000000..e4c4facaa
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cfenv
@@ -0,0 +1,53 @@
+// TR1 cfenv -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cfenv
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CFENV
+#define _GLIBCXX_TR1_CFENV 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+#if _GLIBCXX_HAVE_FENV_H
+# include <fenv.h>
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cfenv>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cfenv>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CFENV
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cfloat b/gcc-4.4.0/libstdc++-v3/include/tr1/cfloat
new file mode 100644
index 000000000..801cfc39e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cfloat
@@ -0,0 +1,42 @@
+// TR1 cfloat -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cfloat
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CFLOAT
+#define _GLIBCXX_TR1_CFLOAT 1
+
+#include <cfloat>
+
+#ifndef DECIMAL_DIG
+#define DECIMAL_DIG __DECIMAL_DIG__
+#endif
+
+#ifndef FLT_EVAL_METHOD
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
+
+#endif //_GLIBCXX_TR1_CFLOAT
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cinttypes b/gcc-4.4.0/libstdc++-v3/include/tr1/cinttypes
new file mode 100644
index 000000000..71fd545d2
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cinttypes
@@ -0,0 +1,63 @@
+// TR1 cinttypes -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cinttypes
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CINTTYPES
+#define _GLIBCXX_TR1_CINTTYPES 1
+
+#pragma GCC system_header
+
+#include <tr1/cstdint>
+
+// For 8.11.1/1 (see C99, Note 184)
+#if _GLIBCXX_HAVE_INTTYPES_H
+# ifndef __STDC_FORMAT_MACROS
+# define _UNDEF__STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS
+# endif
+# include <inttypes.h>
+# ifdef _UNDEF__STDC_FORMAT_MACROS
+# undef __STDC_FORMAT_MACROS
+# undef _UNDEF__STDC_FORMAT_MACROS
+# endif
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cinttypes>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cinttypes>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CINTTYPES
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/climits b/gcc-4.4.0/libstdc++-v3/include/tr1/climits
new file mode 100644
index 000000000..91af96bae
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/climits
@@ -0,0 +1,46 @@
+// TR1 climits -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/climits
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CLIMITS
+#define _GLIBCXX_TR1_CLIMITS 1
+
+#include <climits>
+
+#ifndef LLONG_MIN
+#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
+#endif
+
+#ifndef LLONG_MAX
+#define LLONG_MAX __LONG_LONG_MAX__
+#endif
+
+#ifndef ULLONG_MAX
+#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
+#endif
+
+#endif // _GLIBCXX_TR1_CLIMITS
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cmath b/gcc-4.4.0/libstdc++-v3/include/tr1/cmath
new file mode 100644
index 000000000..a9fbf2b6b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cmath
@@ -0,0 +1,507 @@
+// TR1 cmath -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cmath
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CMATH
+#define _GLIBCXX_TR1_CMATH 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cmath>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cmath>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cmath>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+namespace std
+{
+namespace tr1
+{
+ // DR 550. What should the return type of pow(float,int) be?
+ // NB: C++0x and TR1 != C++03.
+ inline double
+ pow(double __x, double __y)
+ { return std::pow(__x, __y); }
+
+ inline float
+ pow(float __x, float __y)
+ { return std::pow(__x, __y); }
+
+ inline long double
+ pow(long double __x, long double __y)
+ { return std::pow(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ pow(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(__type(__x), __type(__y));
+ }
+}
+}
+
+#include <bits/stl_algobase.h>
+#include <limits>
+#include <tr1/type_traits>
+
+#include <tr1/gamma.tcc>
+#include <tr1/bessel_function.tcc>
+#include <tr1/beta_function.tcc>
+#include <tr1/ell_integral.tcc>
+#include <tr1/exp_integral.tcc>
+#include <tr1/hypergeometric.tcc>
+#include <tr1/legendre_function.tcc>
+#include <tr1/modified_bessel_func.tcc>
+#include <tr1/poly_hermite.tcc>
+#include <tr1/poly_laguerre.tcc>
+#include <tr1/riemann_zeta.tcc>
+
+namespace std
+{
+namespace tr1
+{
+ /**
+ * @defgroup tr1_math_spec_func Mathematical Special Functions
+ * @ingroup numerics
+ *
+ * A collection of advanced mathematical special functions.
+ * @{
+ */
+
+ inline float
+ assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
+ { return __detail::__assoc_laguerre<float>(__n, __m, __x); }
+
+ inline long double
+ assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
+ {
+ return __detail::__assoc_laguerre<long double>(__n, __m, __x);
+ }
+
+ /// 5.2.1.1 Associated Laguerre polynomials.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__assoc_laguerre<__type>(__n, __m, __x);
+ }
+
+ inline float
+ assoc_legendref(unsigned int __l, unsigned int __m, float __x)
+ { return __detail::__assoc_legendre_p<float>(__l, __m, __x); }
+
+ inline long double
+ assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
+ { return __detail::__assoc_legendre_p<long double>(__l, __m, __x); }
+
+ /// 5.2.1.2 Associated Legendre functions.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__assoc_legendre_p<__type>(__l, __m, __x);
+ }
+
+ inline float
+ betaf(float __x, float __y)
+ { return __detail::__beta<float>(__x, __y); }
+
+ inline long double
+ betal(long double __x, long double __y)
+ { return __detail::__beta<long double>(__x, __y); }
+
+ /// 5.2.1.3 Beta functions.
+ template<typename _Tpx, typename _Tpy>
+ inline typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type
+ beta(_Tpx __x, _Tpy __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tpx, _Tpy>::__type __type;
+ return __detail::__beta<__type>(__x, __y);
+ }
+
+ inline float
+ comp_ellint_1f(float __k)
+ { return __detail::__comp_ellint_1<float>(__k); }
+
+ inline long double
+ comp_ellint_1l(long double __k)
+ { return __detail::__comp_ellint_1<long double>(__k); }
+
+ /// 5.2.1.4 Complete elliptic integrals of the first kind.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ comp_ellint_1(_Tp __k)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__comp_ellint_1<__type>(__k);
+ }
+
+ inline float
+ comp_ellint_2f(float __k)
+ { return __detail::__comp_ellint_2<float>(__k); }
+
+ inline long double
+ comp_ellint_2l(long double __k)
+ { return __detail::__comp_ellint_2<long double>(__k); }
+
+ /// 5.2.1.5 Complete elliptic integrals of the second kind.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ comp_ellint_2(_Tp __k)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__comp_ellint_2<__type>(__k);
+ }
+
+ inline float
+ comp_ellint_3f(float __k, float __nu)
+ { return __detail::__comp_ellint_3<float>(__k, __nu); }
+
+ inline long double
+ comp_ellint_3l(long double __k, long double __nu)
+ { return __detail::__comp_ellint_3<long double>(__k, __nu); }
+
+ /// 5.2.1.6 Complete elliptic integrals of the third kind.
+ template<typename _Tp, typename _Tpn>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type
+ comp_ellint_3(_Tp __k, _Tpn __nu)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Tpn>::__type __type;
+ return __detail::__comp_ellint_3<__type>(__k, __nu);
+ }
+
+ inline float
+ conf_hypergf(float __a, float __c, float __x)
+ { return __detail::__conf_hyperg<float>(__a, __c, __x); }
+
+ inline long double
+ conf_hypergl(long double __a, long double __c, long double __x)
+ { return __detail::__conf_hyperg<long double>(__a, __c, __x); }
+
+ /// 5.2.1.7 Confluent hypergeometric functions.
+ template<typename _Tpa, typename _Tpc, typename _Tp>
+ inline typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type
+ conf_hyperg(_Tpa __a, _Tpc __c, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote_3<_Tpa, _Tpc, _Tp>::__type __type;
+ return __detail::__conf_hyperg<__type>(__a, __c, __x);
+ }
+
+ inline float
+ cyl_bessel_if(float __nu, float __x)
+ { return __detail::__cyl_bessel_i<float>(__nu, __x); }
+
+ inline long double
+ cyl_bessel_il(long double __nu, long double __x)
+ { return __detail::__cyl_bessel_i<long double>(__nu, __x); }
+
+ /// 5.2.1.8 Regular modified cylindrical Bessel functions.
+ template<typename _Tpnu, typename _Tp>
+ inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
+ cyl_bessel_i(_Tpnu __nu, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
+ return __detail::__cyl_bessel_i<__type>(__nu, __x);
+ }
+
+ inline float
+ cyl_bessel_jf(float __nu, float __x)
+ { return __detail::__cyl_bessel_j<float>(__nu, __x); }
+
+ inline long double
+ cyl_bessel_jl(long double __nu, long double __x)
+ { return __detail::__cyl_bessel_j<long double>(__nu, __x); }
+
+ /// 5.2.1.9 Cylindrical Bessel functions (of the first kind).
+ template<typename _Tpnu, typename _Tp>
+ inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
+ cyl_bessel_j(_Tpnu __nu, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
+ return __detail::__cyl_bessel_j<__type>(__nu, __x);
+ }
+
+ inline float
+ cyl_bessel_kf(float __nu, float __x)
+ { return __detail::__cyl_bessel_k<float>(__nu, __x); }
+
+ inline long double
+ cyl_bessel_kl(long double __nu, long double __x)
+ { return __detail::__cyl_bessel_k<long double>(__nu, __x); }
+
+ /// 5.2.1.10 Irregular modified cylindrical Bessel functions.
+ template<typename _Tpnu, typename _Tp>
+ inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
+ cyl_bessel_k(_Tpnu __nu, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
+ return __detail::__cyl_bessel_k<__type>(__nu, __x);
+ }
+
+ inline float
+ cyl_neumannf(float __nu, float __x)
+ { return __detail::__cyl_neumann_n<float>(__nu, __x); }
+
+ inline long double
+ cyl_neumannl(long double __nu, long double __x)
+ { return __detail::__cyl_neumann_n<long double>(__nu, __x); }
+
+ /// 5.2.1.11 Cylindrical Neumann functions.
+ template<typename _Tpnu, typename _Tp>
+ inline typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type
+ cyl_neumann(_Tpnu __nu, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tpnu, _Tp>::__type __type;
+ return __detail::__cyl_neumann_n<__type>(__nu, __x);
+ }
+
+ inline float
+ ellint_1f(float __k, float __phi)
+ { return __detail::__ellint_1<float>(__k, __phi); }
+
+ inline long double
+ ellint_1l(long double __k, long double __phi)
+ { return __detail::__ellint_1<long double>(__k, __phi); }
+
+ /// 5.2.1.12 Incomplete elliptic integrals of the first kind.
+ template<typename _Tp, typename _Tpp>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
+ ellint_1(_Tp __k, _Tpp __phi)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
+ return __detail::__ellint_1<__type>(__k, __phi);
+ }
+
+ inline float
+ ellint_2f(float __k, float __phi)
+ { return __detail::__ellint_2<float>(__k, __phi); }
+
+ inline long double
+ ellint_2l(long double __k, long double __phi)
+ { return __detail::__ellint_2<long double>(__k, __phi); }
+
+ /// 5.2.1.13 Incomplete elliptic integrals of the second kind.
+ template<typename _Tp, typename _Tpp>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type
+ ellint_2(_Tp __k, _Tpp __phi)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Tpp>::__type __type;
+ return __detail::__ellint_2<__type>(__k, __phi);
+ }
+
+ inline float
+ ellint_3f(float __k, float __nu, float __phi)
+ { return __detail::__ellint_3<float>(__k, __nu, __phi); }
+
+ inline long double
+ ellint_3l(long double __k, long double __nu, long double __phi)
+ { return __detail::__ellint_3<long double>(__k, __nu, __phi); }
+
+ /// 5.2.1.14 Incomplete elliptic integrals of the third kind.
+ template<typename _Tp, typename _Tpn, typename _Tpp>
+ inline typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type
+ ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
+ {
+ typedef typename __gnu_cxx::__promote_3<_Tp, _Tpn, _Tpp>::__type __type;
+ return __detail::__ellint_3<__type>(__k, __nu, __phi);
+ }
+
+ inline float
+ expintf(float __x)
+ { return __detail::__expint<float>(__x); }
+
+ inline long double
+ expintl(long double __x)
+ { return __detail::__expint<long double>(__x); }
+
+ /// 5.2.1.15 Exponential integrals.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ expint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__expint<__type>(__x);
+ }
+
+ inline float
+ hermitef(unsigned int __n, float __x)
+ { return __detail::__poly_hermite<float>(__n, __x); }
+
+ inline long double
+ hermitel(unsigned int __n, long double __x)
+ { return __detail::__poly_hermite<long double>(__n, __x); }
+
+ /// 5.2.1.16 Hermite polynomials.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ hermite(unsigned int __n, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__poly_hermite<__type>(__n, __x);
+ }
+
+ inline float
+ hypergf(float __a, float __b, float __c, float __x)
+ { return __detail::__hyperg<float>(__a, __b, __c, __x); }
+
+ inline long double
+ hypergl(long double __a, long double __b, long double __c, long double __x)
+ { return __detail::__hyperg<long double>(__a, __b, __c, __x); }
+
+ /// 5.2.1.17 Hypergeometric functions.
+ template<typename _Tpa, typename _Tpb, typename _Tpc, typename _Tp>
+ inline typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type
+ hyperg(_Tpa __a, _Tpb __b, _Tpc __c, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote_4<_Tpa, _Tpb, _Tpc, _Tp>::__type __type;
+ return __detail::__hyperg<__type>(__a, __b, __c, __x);
+ }
+
+ inline float
+ laguerref(unsigned int __n, float __x)
+ { return __detail::__laguerre<float>(__n, __x); }
+
+ inline long double
+ laguerrel(unsigned int __n, long double __x)
+ { return __detail::__laguerre<long double>(__n, __x); }
+
+ /// 5.2.1.18 Laguerre polynomials.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ laguerre(unsigned int __n, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__laguerre<__type>(__n, __x);
+ }
+
+ inline float
+ legendref(unsigned int __n, float __x)
+ { return __detail::__poly_legendre_p<float>(__n, __x); }
+
+ inline long double
+ legendrel(unsigned int __n, long double __x)
+ { return __detail::__poly_legendre_p<long double>(__n, __x); }
+
+ /// 5.2.1.19 Legendre polynomials.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ legendre(unsigned int __n, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__poly_legendre_p<__type>(__n, __x);
+ }
+
+ inline float
+ riemann_zetaf(float __x)
+ { return __detail::__riemann_zeta<float>(__x); }
+
+ inline long double
+ riemann_zetal(long double __x)
+ { return __detail::__riemann_zeta<long double>(__x); }
+
+ /// 5.2.1.20 Riemann zeta function.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ riemann_zeta(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__riemann_zeta<__type>(__x);
+ }
+
+ inline float
+ sph_besself(unsigned int __n, float __x)
+ { return __detail::__sph_bessel<float>(__n, __x); }
+
+ inline long double
+ sph_bessell(unsigned int __n, long double __x)
+ { return __detail::__sph_bessel<long double>(__n, __x); }
+
+ /// 5.2.1.21 Spherical Bessel functions.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ sph_bessel(unsigned int __n, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__sph_bessel<__type>(__n, __x);
+ }
+
+ inline float
+ sph_legendref(unsigned int __l, unsigned int __m, float __theta)
+ { return __detail::__sph_legendre<float>(__l, __m, __theta); }
+
+ inline long double
+ sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
+ { return __detail::__sph_legendre<long double>(__l, __m, __theta); }
+
+ /// 5.2.1.22 Spherical associated Legendre functions.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__sph_legendre<__type>(__l, __m, __theta);
+ }
+
+ inline float
+ sph_neumannf(unsigned int __n, float __x)
+ { return __detail::__sph_neumann<float>(__n, __x); }
+
+ inline long double
+ sph_neumannl(unsigned int __n, long double __x)
+ { return __detail::__sph_neumann<long double>(__n, __x); }
+
+ /// 5.2.1.23 Spherical Neumann functions.
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ sph_neumann(unsigned int __n, _Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __detail::__sph_neumann<__type>(__n, __x);
+ }
+
+ /* @} */ // tr1_math_spec_func
+}
+}
+
+#endif // _GLIBCXX_TR1_CMATH
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/complex b/gcc-4.4.0/libstdc++-v3/include/tr1/complex
new file mode 100644
index 000000000..3ed1eb97f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/complex
@@ -0,0 +1,91 @@
+// TR1 complex -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/complex
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_COMPLEX
+#define _GLIBCXX_TR1_COMPLEX 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <complex>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/complex>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/complex>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+namespace std
+{
+namespace tr1
+{
+ using std::arg;
+ using std::conj;
+ using std::imag;
+ using std::norm;
+ using std::polar;
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ polar(const _Tp& __rho, const _Up& __theta)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::polar(__type(__rho), __type(__theta));
+ }
+
+ using std::real;
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ pow(const std::complex<_Tp>& __x, const _Tp& __y)
+ { return std::pow(__x, __y); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ pow(const _Tp& __x, const std::complex<_Tp>& __y)
+ { return std::pow(__x, __y); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ pow(const std::complex<_Tp>& __x, const std::complex<_Tp>& __y)
+ { return std::pow(__x, __y); }
+}
+}
+
+#endif // _GLIBCXX_TR1_COMPLEX
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/complex.h b/gcc-4.4.0/libstdc++-v3/include/tr1/complex.h
new file mode 100644
index 000000000..0f28810b7
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/complex.h
@@ -0,0 +1,34 @@
+// TR1 complex.h -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/complex.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_COMPLEX_H
+#define _GLIBCXX_TR1_COMPLEX_H 1
+
+#include <tr1/ccomplex>
+
+#endif // _GLIBCXX_TR1_COMPLEX_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cstdarg b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdarg
new file mode 100644
index 000000000..bc2e88153
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdarg
@@ -0,0 +1,34 @@
+// TR1 cstdarg -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cstdarg
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CSTDARG
+#define _GLIBCXX_TR1_CSTDARG 1
+
+#include <cstdarg>
+
+#endif // _GLIBCXX_TR1_CSTDARG
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cstdbool b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdbool
new file mode 100644
index 000000000..d68e4b896
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdbool
@@ -0,0 +1,40 @@
+// TR1 cstdbool -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cstdbool
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CSTDBOOL
+#define _GLIBCXX_TR1_CSTDBOOL 1
+
+#pragma GCC system_header
+
+#include <bits/c++config.h>
+
+#if _GLIBCXX_HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+
+#endif // _GLIBCXX_TR1_CSTDBOOL
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cstdint b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdint
new file mode 100644
index 000000000..1e6cc3714
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdint
@@ -0,0 +1,76 @@
+// TR1 cstdint -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cstdint
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CSTDINT
+#define _GLIBCXX_TR1_CSTDINT 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <bits/c++config.h>
+
+// For 8.22.1/1 (see C99, Notes 219, 220, 222)
+# if _GLIBCXX_HAVE_STDINT_H
+# ifndef __STDC_LIMIT_MACROS
+# define _UNDEF__STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS
+# endif
+# ifndef __STDC_CONSTANT_MACROS
+# define _UNDEF__STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+# endif
+# include <stdint.h>
+# ifdef _UNDEF__STDC_LIMIT_MACROS
+# undef __STDC_LIMIT_MACROS
+# undef _UNDEF__STDC_LIMIT_MACROS
+# endif
+# ifdef _UNDEF__STDC_CONSTANT_MACROS
+# undef __STDC_CONSTANT_MACROS
+# undef _UNDEF__STDC_CONSTANT_MACROS
+# endif
+# endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cstdint>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cstdint>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CSTDINT
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cstdio b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdio
new file mode 100644
index 000000000..cfcf31a3f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdio
@@ -0,0 +1,54 @@
+// TR1 cstdio -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cstdio
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CSTDIO
+#define _GLIBCXX_TR1_CSTDIO 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cstdio>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cstdio>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cstdio>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CSTDIO
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cstdlib b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdlib
new file mode 100644
index 000000000..c9fab202d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cstdlib
@@ -0,0 +1,54 @@
+// TR1 cstdlib -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cstdlib
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CSTDLIB
+#define _GLIBCXX_TR1_CSTDLIB 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cstdlib>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cstdlib>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cstdlib>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CSTDLIB
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/ctgmath b/gcc-4.4.0/libstdc++-v3/include/tr1/ctgmath
new file mode 100644
index 000000000..e82a9a15f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/ctgmath
@@ -0,0 +1,34 @@
+// TR1 ctgmath -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/ctgmath
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CTGMATH
+#define _GLIBCXX_TR1_CTGMATH 1
+
+#include <tr1/cmath>
+
+#endif // _GLIBCXX_TR1_CTGMATH
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/ctime b/gcc-4.4.0/libstdc++-v3/include/tr1/ctime
new file mode 100644
index 000000000..bf763377d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/ctime
@@ -0,0 +1,34 @@
+// TR1 ctime -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/ctime
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CTIME
+#define _GLIBCXX_TR1_CTIME 1
+
+#include <ctime>
+
+#endif // _GLIBCXX_TR1_CTIME
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/ctype.h b/gcc-4.4.0/libstdc++-v3/include/tr1/ctype.h
new file mode 100644
index 000000000..712bedb67
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/ctype.h
@@ -0,0 +1,34 @@
+// TR1 ctype.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/ctype.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_CTYPE_H
+#define _TR1_CTYPE_H 1
+
+#include <tr1/cctype>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cwchar b/gcc-4.4.0/libstdc++-v3/include/tr1/cwchar
new file mode 100644
index 000000000..a27ebc3b4
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cwchar
@@ -0,0 +1,54 @@
+// TR1 cwchar -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cwchar
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CWCHAR
+#define _GLIBCXX_TR1_CWCHAR 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cwchar>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cwchar>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cwchar>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CWCHAR
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/cwctype b/gcc-4.4.0/libstdc++-v3/include/tr1/cwctype
new file mode 100644
index 000000000..77cbb14a1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/cwctype
@@ -0,0 +1,54 @@
+// TR1 cwctype -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/cwctype
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_CWCTYPE
+#define _GLIBCXX_TR1_CWCTYPE 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cwctype>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/cwctype>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/cwctype>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_CWCTYPE
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/ell_integral.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/ell_integral.tcc
new file mode 100644
index 000000000..09bda9aa9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/ell_integral.tcc
@@ -0,0 +1,750 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/ell_integral.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) B. C. Carlson Numer. Math. 33, 1 (1979)
+// (2) B. C. Carlson, Special Functions of Applied Mathematics (1977)
+// (3) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (4) Numerical Recipes in C, 2nd ed, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press
+// (1992), pp. 261-269
+
+#ifndef _GLIBCXX_TR1_ELL_INTEGRAL_TCC
+#define _GLIBCXX_TR1_ELL_INTEGRAL_TCC 1
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Return the Carlson elliptic function @f$ R_F(x,y,z) @f$
+ * of the first kind.
+ *
+ * The Carlson elliptic function of the first kind is defined by:
+ * @f[
+ * R_F(x,y,z) = \frac{1}{2} \int_0^\infty
+ * \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{1/2}}
+ * @f]
+ *
+ * @param __x The first of three symmetric arguments.
+ * @param __y The second of three symmetric arguments.
+ * @param __z The third of three symmetric arguments.
+ * @return The Carlson elliptic function of the first kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_rf(const _Tp __x, const _Tp __y, const _Tp __z)
+ {
+ const _Tp __min = std::numeric_limits<_Tp>::min();
+ const _Tp __max = std::numeric_limits<_Tp>::max();
+ const _Tp __lolim = _Tp(5) * __min;
+ const _Tp __uplim = __max / _Tp(5);
+
+ if (__x < _Tp(0) || __y < _Tp(0) || __z < _Tp(0))
+ std::__throw_domain_error(__N("Argument less than zero "
+ "in __ellint_rf."));
+ else if (__x + __y < __lolim || __x + __z < __lolim
+ || __y + __z < __lolim)
+ std::__throw_domain_error(__N("Argument too small in __ellint_rf"));
+ else
+ {
+ const _Tp __c0 = _Tp(1) / _Tp(4);
+ const _Tp __c1 = _Tp(1) / _Tp(24);
+ const _Tp __c2 = _Tp(1) / _Tp(10);
+ const _Tp __c3 = _Tp(3) / _Tp(44);
+ const _Tp __c4 = _Tp(1) / _Tp(14);
+
+ _Tp __xn = __x;
+ _Tp __yn = __y;
+ _Tp __zn = __z;
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __errtol = std::pow(__eps, _Tp(1) / _Tp(6));
+ _Tp __mu;
+ _Tp __xndev, __yndev, __zndev;
+
+ const unsigned int __max_iter = 100;
+ for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
+ {
+ __mu = (__xn + __yn + __zn) / _Tp(3);
+ __xndev = 2 - (__mu + __xn) / __mu;
+ __yndev = 2 - (__mu + __yn) / __mu;
+ __zndev = 2 - (__mu + __zn) / __mu;
+ _Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev));
+ __epsilon = std::max(__epsilon, std::abs(__zndev));
+ if (__epsilon < __errtol)
+ break;
+ const _Tp __xnroot = std::sqrt(__xn);
+ const _Tp __ynroot = std::sqrt(__yn);
+ const _Tp __znroot = std::sqrt(__zn);
+ const _Tp __lambda = __xnroot * (__ynroot + __znroot)
+ + __ynroot * __znroot;
+ __xn = __c0 * (__xn + __lambda);
+ __yn = __c0 * (__yn + __lambda);
+ __zn = __c0 * (__zn + __lambda);
+ }
+
+ const _Tp __e2 = __xndev * __yndev - __zndev * __zndev;
+ const _Tp __e3 = __xndev * __yndev * __zndev;
+ const _Tp __s = _Tp(1) + (__c1 * __e2 - __c2 - __c3 * __e3) * __e2
+ + __c4 * __e3;
+
+ return __s / std::sqrt(__mu);
+ }
+ }
+
+
+ /**
+ * @brief Return the complete elliptic integral of the first kind
+ * @f$ K(k) @f$ by series expansion.
+ *
+ * The complete elliptic integral of the first kind is defined as
+ * @f[
+ * K(k) = F(k,\pi/2) = \int_0^{\pi/2}\frac{d\theta}
+ * {\sqrt{1 - k^2sin^2\theta}}
+ * @f]
+ *
+ * This routine is not bad as long as |k| is somewhat smaller than 1
+ * but is not is good as the Carlson elliptic integral formulation.
+ *
+ * @param __k The argument of the complete elliptic function.
+ * @return The complete elliptic function of the first kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __comp_ellint_1_series(const _Tp __k)
+ {
+
+ const _Tp __kk = __k * __k;
+
+ _Tp __term = __kk / _Tp(4);
+ _Tp __sum = _Tp(1) + __term;
+
+ const unsigned int __max_iter = 1000;
+ for (unsigned int __i = 2; __i < __max_iter; ++__i)
+ {
+ __term *= (2 * __i - 1) * __kk / (2 * __i);
+ if (__term < std::numeric_limits<_Tp>::epsilon())
+ break;
+ __sum += __term;
+ }
+
+ return __numeric_constants<_Tp>::__pi_2() * __sum;
+ }
+
+
+ /**
+ * @brief Return the complete elliptic integral of the first kind
+ * @f$ K(k) @f$ using the Carlson formulation.
+ *
+ * The complete elliptic integral of the first kind is defined as
+ * @f[
+ * K(k) = F(k,\pi/2) = \int_0^{\pi/2}\frac{d\theta}
+ * {\sqrt{1 - k^2 sin^2\theta}}
+ * @f]
+ * where @f$ F(k,\phi) @f$ is the incomplete elliptic integral of the
+ * first kind.
+ *
+ * @param __k The argument of the complete elliptic function.
+ * @return The complete elliptic function of the first kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __comp_ellint_1(const _Tp __k)
+ {
+
+ if (__isnan(__k))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (std::abs(__k) >= _Tp(1))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else
+ return __ellint_rf(_Tp(0), _Tp(1) - __k * __k, _Tp(1));
+ }
+
+
+ /**
+ * @brief Return the incomplete elliptic integral of the first kind
+ * @f$ F(k,\phi) @f$ using the Carlson formulation.
+ *
+ * The incomplete elliptic integral of the first kind is defined as
+ * @f[
+ * F(k,\phi) = \int_0^{\phi}\frac{d\theta}
+ * {\sqrt{1 - k^2 sin^2\theta}}
+ * @f]
+ *
+ * @param __k The argument of the elliptic function.
+ * @param __phi The integral limit argument of the elliptic function.
+ * @return The elliptic function of the first kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_1(const _Tp __k, const _Tp __phi)
+ {
+
+ if (__isnan(__k) || __isnan(__phi))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (std::abs(__k) > _Tp(1))
+ std::__throw_domain_error(__N("Bad argument in __ellint_1."));
+ else
+ {
+ // Reduce phi to -pi/2 < phi < +pi/2.
+ const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi()
+ + _Tp(0.5L));
+ const _Tp __phi_red = __phi
+ - __n * __numeric_constants<_Tp>::__pi();
+
+ const _Tp __s = std::sin(__phi_red);
+ const _Tp __c = std::cos(__phi_red);
+
+ const _Tp __F = __s
+ * __ellint_rf(__c * __c,
+ _Tp(1) - __k * __k * __s * __s, _Tp(1));
+
+ if (__n == 0)
+ return __F;
+ else
+ return __F + _Tp(2) * __n * __comp_ellint_1(__k);
+ }
+ }
+
+
+ /**
+ * @brief Return the complete elliptic integral of the second kind
+ * @f$ E(k) @f$ by series expansion.
+ *
+ * The complete elliptic integral of the second kind is defined as
+ * @f[
+ * E(k,\pi/2) = \int_0^{\pi/2}\sqrt{1 - k^2 sin^2\theta}
+ * @f]
+ *
+ * This routine is not bad as long as |k| is somewhat smaller than 1
+ * but is not is good as the Carlson elliptic integral formulation.
+ *
+ * @param __k The argument of the complete elliptic function.
+ * @return The complete elliptic function of the second kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __comp_ellint_2_series(const _Tp __k)
+ {
+
+ const _Tp __kk = __k * __k;
+
+ _Tp __term = __kk;
+ _Tp __sum = __term;
+
+ const unsigned int __max_iter = 1000;
+ for (unsigned int __i = 2; __i < __max_iter; ++__i)
+ {
+ const _Tp __i2m = 2 * __i - 1;
+ const _Tp __i2 = 2 * __i;
+ __term *= __i2m * __i2m * __kk / (__i2 * __i2);
+ if (__term < std::numeric_limits<_Tp>::epsilon())
+ break;
+ __sum += __term / __i2m;
+ }
+
+ return __numeric_constants<_Tp>::__pi_2() * (_Tp(1) - __sum);
+ }
+
+
+ /**
+ * @brief Return the Carlson elliptic function of the second kind
+ * @f$ R_D(x,y,z) = R_J(x,y,z,z) @f$ where
+ * @f$ R_J(x,y,z,p) @f$ is the Carlson elliptic function
+ * of the third kind.
+ *
+ * The Carlson elliptic function of the second kind is defined by:
+ * @f[
+ * R_D(x,y,z) = \frac{3}{2} \int_0^\infty
+ * \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{3/2}}
+ * @f]
+ *
+ * Based on Carlson's algorithms:
+ * - B. C. Carlson Numer. Math. 33, 1 (1979)
+ * - B. C. Carlson, Special Functions of Applied Mathematics (1977)
+ * - Numerical Recipes in C, 2nd ed, pp. 261-269,
+ * by Press, Teukolsky, Vetterling, Flannery (1992)
+ *
+ * @param __x The first of two symmetric arguments.
+ * @param __y The second of two symmetric arguments.
+ * @param __z The third argument.
+ * @return The Carlson elliptic function of the second kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_rd(const _Tp __x, const _Tp __y, const _Tp __z)
+ {
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __errtol = std::pow(__eps / _Tp(8), _Tp(1) / _Tp(6));
+ const _Tp __min = std::numeric_limits<_Tp>::min();
+ const _Tp __max = std::numeric_limits<_Tp>::max();
+ const _Tp __lolim = _Tp(2) / std::pow(__max, _Tp(2) / _Tp(3));
+ const _Tp __uplim = std::pow(_Tp(0.1L) * __errtol / __min, _Tp(2) / _Tp(3));
+
+ if (__x < _Tp(0) || __y < _Tp(0))
+ std::__throw_domain_error(__N("Argument less than zero "
+ "in __ellint_rd."));
+ else if (__x + __y < __lolim || __z < __lolim)
+ std::__throw_domain_error(__N("Argument too small "
+ "in __ellint_rd."));
+ else
+ {
+ const _Tp __c0 = _Tp(1) / _Tp(4);
+ const _Tp __c1 = _Tp(3) / _Tp(14);
+ const _Tp __c2 = _Tp(1) / _Tp(6);
+ const _Tp __c3 = _Tp(9) / _Tp(22);
+ const _Tp __c4 = _Tp(3) / _Tp(26);
+
+ _Tp __xn = __x;
+ _Tp __yn = __y;
+ _Tp __zn = __z;
+ _Tp __sigma = _Tp(0);
+ _Tp __power4 = _Tp(1);
+
+ _Tp __mu;
+ _Tp __xndev, __yndev, __zndev;
+
+ const unsigned int __max_iter = 100;
+ for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
+ {
+ __mu = (__xn + __yn + _Tp(3) * __zn) / _Tp(5);
+ __xndev = (__mu - __xn) / __mu;
+ __yndev = (__mu - __yn) / __mu;
+ __zndev = (__mu - __zn) / __mu;
+ _Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev));
+ __epsilon = std::max(__epsilon, std::abs(__zndev));
+ if (__epsilon < __errtol)
+ break;
+ _Tp __xnroot = std::sqrt(__xn);
+ _Tp __ynroot = std::sqrt(__yn);
+ _Tp __znroot = std::sqrt(__zn);
+ _Tp __lambda = __xnroot * (__ynroot + __znroot)
+ + __ynroot * __znroot;
+ __sigma += __power4 / (__znroot * (__zn + __lambda));
+ __power4 *= __c0;
+ __xn = __c0 * (__xn + __lambda);
+ __yn = __c0 * (__yn + __lambda);
+ __zn = __c0 * (__zn + __lambda);
+ }
+
+ // Note: __ea is an SPU badname.
+ _Tp __eaa = __xndev * __yndev;
+ _Tp __eb = __zndev * __zndev;
+ _Tp __ec = __eaa - __eb;
+ _Tp __ed = __eaa - _Tp(6) * __eb;
+ _Tp __ef = __ed + __ec + __ec;
+ _Tp __s1 = __ed * (-__c1 + __c3 * __ed
+ / _Tp(3) - _Tp(3) * __c4 * __zndev * __ef
+ / _Tp(2));
+ _Tp __s2 = __zndev
+ * (__c2 * __ef
+ + __zndev * (-__c3 * __ec - __zndev * __c4 - __eaa));
+
+ return _Tp(3) * __sigma + __power4 * (_Tp(1) + __s1 + __s2)
+ / (__mu * std::sqrt(__mu));
+ }
+ }
+
+
+ /**
+ * @brief Return the complete elliptic integral of the second kind
+ * @f$ E(k) @f$ using the Carlson formulation.
+ *
+ * The complete elliptic integral of the second kind is defined as
+ * @f[
+ * E(k,\pi/2) = \int_0^{\pi/2}\sqrt{1 - k^2 sin^2\theta}
+ * @f]
+ *
+ * @param __k The argument of the complete elliptic function.
+ * @return The complete elliptic function of the second kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __comp_ellint_2(const _Tp __k)
+ {
+
+ if (__isnan(__k))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (std::abs(__k) == 1)
+ return _Tp(1);
+ else if (std::abs(__k) > _Tp(1))
+ std::__throw_domain_error(__N("Bad argument in __comp_ellint_2."));
+ else
+ {
+ const _Tp __kk = __k * __k;
+
+ return __ellint_rf(_Tp(0), _Tp(1) - __kk, _Tp(1))
+ - __kk * __ellint_rd(_Tp(0), _Tp(1) - __kk, _Tp(1)) / _Tp(3);
+ }
+ }
+
+
+ /**
+ * @brief Return the incomplete elliptic integral of the second kind
+ * @f$ E(k,\phi) @f$ using the Carlson formulation.
+ *
+ * The incomplete elliptic integral of the second kind is defined as
+ * @f[
+ * E(k,\phi) = \int_0^{\phi} \sqrt{1 - k^2 sin^2\theta}
+ * @f]
+ *
+ * @param __k The argument of the elliptic function.
+ * @param __phi The integral limit argument of the elliptic function.
+ * @return The elliptic function of the second kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_2(const _Tp __k, const _Tp __phi)
+ {
+
+ if (__isnan(__k) || __isnan(__phi))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (std::abs(__k) > _Tp(1))
+ std::__throw_domain_error(__N("Bad argument in __ellint_2."));
+ else
+ {
+ // Reduce phi to -pi/2 < phi < +pi/2.
+ const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi()
+ + _Tp(0.5L));
+ const _Tp __phi_red = __phi
+ - __n * __numeric_constants<_Tp>::__pi();
+
+ const _Tp __kk = __k * __k;
+ const _Tp __s = std::sin(__phi_red);
+ const _Tp __ss = __s * __s;
+ const _Tp __sss = __ss * __s;
+ const _Tp __c = std::cos(__phi_red);
+ const _Tp __cc = __c * __c;
+
+ const _Tp __E = __s
+ * __ellint_rf(__cc, _Tp(1) - __kk * __ss, _Tp(1))
+ - __kk * __sss
+ * __ellint_rd(__cc, _Tp(1) - __kk * __ss, _Tp(1))
+ / _Tp(3);
+
+ if (__n == 0)
+ return __E;
+ else
+ return __E + _Tp(2) * __n * __comp_ellint_2(__k);
+ }
+ }
+
+
+ /**
+ * @brief Return the Carlson elliptic function
+ * @f$ R_C(x,y) = R_F(x,y,y) @f$ where @f$ R_F(x,y,z) @f$
+ * is the Carlson elliptic function of the first kind.
+ *
+ * The Carlson elliptic function is defined by:
+ * @f[
+ * R_C(x,y) = \frac{1}{2} \int_0^\infty
+ * \frac{dt}{(t + x)^{1/2}(t + y)}
+ * @f]
+ *
+ * Based on Carlson's algorithms:
+ * - B. C. Carlson Numer. Math. 33, 1 (1979)
+ * - B. C. Carlson, Special Functions of Applied Mathematics (1977)
+ * - Numerical Recipes in C, 2nd ed, pp. 261-269,
+ * by Press, Teukolsky, Vetterling, Flannery (1992)
+ *
+ * @param __x The first argument.
+ * @param __y The second argument.
+ * @return The Carlson elliptic function.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_rc(const _Tp __x, const _Tp __y)
+ {
+ const _Tp __min = std::numeric_limits<_Tp>::min();
+ const _Tp __max = std::numeric_limits<_Tp>::max();
+ const _Tp __lolim = _Tp(5) * __min;
+ const _Tp __uplim = __max / _Tp(5);
+
+ if (__x < _Tp(0) || __y < _Tp(0) || __x + __y < __lolim)
+ std::__throw_domain_error(__N("Argument less than zero "
+ "in __ellint_rc."));
+ else
+ {
+ const _Tp __c0 = _Tp(1) / _Tp(4);
+ const _Tp __c1 = _Tp(1) / _Tp(7);
+ const _Tp __c2 = _Tp(9) / _Tp(22);
+ const _Tp __c3 = _Tp(3) / _Tp(10);
+ const _Tp __c4 = _Tp(3) / _Tp(8);
+
+ _Tp __xn = __x;
+ _Tp __yn = __y;
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __errtol = std::pow(__eps / _Tp(30), _Tp(1) / _Tp(6));
+ _Tp __mu;
+ _Tp __sn;
+
+ const unsigned int __max_iter = 100;
+ for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
+ {
+ __mu = (__xn + _Tp(2) * __yn) / _Tp(3);
+ __sn = (__yn + __mu) / __mu - _Tp(2);
+ if (std::abs(__sn) < __errtol)
+ break;
+ const _Tp __lambda = _Tp(2) * std::sqrt(__xn) * std::sqrt(__yn)
+ + __yn;
+ __xn = __c0 * (__xn + __lambda);
+ __yn = __c0 * (__yn + __lambda);
+ }
+
+ _Tp __s = __sn * __sn
+ * (__c3 + __sn*(__c1 + __sn * (__c4 + __sn * __c2)));
+
+ return (_Tp(1) + __s) / std::sqrt(__mu);
+ }
+ }
+
+
+ /**
+ * @brief Return the Carlson elliptic function @f$ R_J(x,y,z,p) @f$
+ * of the third kind.
+ *
+ * The Carlson elliptic function of the third kind is defined by:
+ * @f[
+ * R_J(x,y,z,p) = \frac{3}{2} \int_0^\infty
+ * \frac{dt}{(t + x)^{1/2}(t + y)^{1/2}(t + z)^{1/2}(t + p)}
+ * @f]
+ *
+ * Based on Carlson's algorithms:
+ * - B. C. Carlson Numer. Math. 33, 1 (1979)
+ * - B. C. Carlson, Special Functions of Applied Mathematics (1977)
+ * - Numerical Recipes in C, 2nd ed, pp. 261-269,
+ * by Press, Teukolsky, Vetterling, Flannery (1992)
+ *
+ * @param __x The first of three symmetric arguments.
+ * @param __y The second of three symmetric arguments.
+ * @param __z The third of three symmetric arguments.
+ * @param __p The fourth argument.
+ * @return The Carlson elliptic function of the fourth kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_rj(const _Tp __x, const _Tp __y, const _Tp __z, const _Tp __p)
+ {
+ const _Tp __min = std::numeric_limits<_Tp>::min();
+ const _Tp __max = std::numeric_limits<_Tp>::max();
+ const _Tp __lolim = std::pow(_Tp(5) * __min, _Tp(1)/_Tp(3));
+ const _Tp __uplim = _Tp(0.3L)
+ * std::pow(_Tp(0.2L) * __max, _Tp(1)/_Tp(3));
+
+ if (__x < _Tp(0) || __y < _Tp(0) || __z < _Tp(0))
+ std::__throw_domain_error(__N("Argument less than zero "
+ "in __ellint_rj."));
+ else if (__x + __y < __lolim || __x + __z < __lolim
+ || __y + __z < __lolim || __p < __lolim)
+ std::__throw_domain_error(__N("Argument too small "
+ "in __ellint_rj"));
+ else
+ {
+ const _Tp __c0 = _Tp(1) / _Tp(4);
+ const _Tp __c1 = _Tp(3) / _Tp(14);
+ const _Tp __c2 = _Tp(1) / _Tp(3);
+ const _Tp __c3 = _Tp(3) / _Tp(22);
+ const _Tp __c4 = _Tp(3) / _Tp(26);
+
+ _Tp __xn = __x;
+ _Tp __yn = __y;
+ _Tp __zn = __z;
+ _Tp __pn = __p;
+ _Tp __sigma = _Tp(0);
+ _Tp __power4 = _Tp(1);
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __errtol = std::pow(__eps / _Tp(8), _Tp(1) / _Tp(6));
+
+ _Tp __lambda, __mu;
+ _Tp __xndev, __yndev, __zndev, __pndev;
+
+ const unsigned int __max_iter = 100;
+ for (unsigned int __iter = 0; __iter < __max_iter; ++__iter)
+ {
+ __mu = (__xn + __yn + __zn + _Tp(2) * __pn) / _Tp(5);
+ __xndev = (__mu - __xn) / __mu;
+ __yndev = (__mu - __yn) / __mu;
+ __zndev = (__mu - __zn) / __mu;
+ __pndev = (__mu - __pn) / __mu;
+ _Tp __epsilon = std::max(std::abs(__xndev), std::abs(__yndev));
+ __epsilon = std::max(__epsilon, std::abs(__zndev));
+ __epsilon = std::max(__epsilon, std::abs(__pndev));
+ if (__epsilon < __errtol)
+ break;
+ const _Tp __xnroot = std::sqrt(__xn);
+ const _Tp __ynroot = std::sqrt(__yn);
+ const _Tp __znroot = std::sqrt(__zn);
+ const _Tp __lambda = __xnroot * (__ynroot + __znroot)
+ + __ynroot * __znroot;
+ const _Tp __alpha1 = __pn * (__xnroot + __ynroot + __znroot)
+ + __xnroot * __ynroot * __znroot;
+ const _Tp __alpha2 = __alpha1 * __alpha1;
+ const _Tp __beta = __pn * (__pn + __lambda)
+ * (__pn + __lambda);
+ __sigma += __power4 * __ellint_rc(__alpha2, __beta);
+ __power4 *= __c0;
+ __xn = __c0 * (__xn + __lambda);
+ __yn = __c0 * (__yn + __lambda);
+ __zn = __c0 * (__zn + __lambda);
+ __pn = __c0 * (__pn + __lambda);
+ }
+
+ // Note: __ea is an SPU badname.
+ _Tp __eaa = __xndev * (__yndev + __zndev) + __yndev * __zndev;
+ _Tp __eb = __xndev * __yndev * __zndev;
+ _Tp __ec = __pndev * __pndev;
+ _Tp __e2 = __eaa - _Tp(3) * __ec;
+ _Tp __e3 = __eb + _Tp(2) * __pndev * (__eaa - __ec);
+ _Tp __s1 = _Tp(1) + __e2 * (-__c1 + _Tp(3) * __c3 * __e2 / _Tp(4)
+ - _Tp(3) * __c4 * __e3 / _Tp(2));
+ _Tp __s2 = __eb * (__c2 / _Tp(2)
+ + __pndev * (-__c3 - __c3 + __pndev * __c4));
+ _Tp __s3 = __pndev * __eaa * (__c2 - __pndev * __c3)
+ - __c2 * __pndev * __ec;
+
+ return _Tp(3) * __sigma + __power4 * (__s1 + __s2 + __s3)
+ / (__mu * std::sqrt(__mu));
+ }
+ }
+
+
+ /**
+ * @brief Return the complete elliptic integral of the third kind
+ * @f$ \Pi(k,\nu) = \Pi(k,\nu,\pi/2) @f$ using the
+ * Carlson formulation.
+ *
+ * The complete elliptic integral of the third kind is defined as
+ * @f[
+ * \Pi(k,\nu) = \int_0^{\pi/2}
+ * \frac{d\theta}
+ * {(1 - \nu \sin^2\theta)\sqrt{1 - k^2 \sin^2\theta}}
+ * @f]
+ *
+ * @param __k The argument of the elliptic function.
+ * @param __nu The second argument of the elliptic function.
+ * @return The complete elliptic function of the third kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __comp_ellint_3(const _Tp __k, const _Tp __nu)
+ {
+
+ if (__isnan(__k) || __isnan(__nu))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__nu == _Tp(1))
+ return std::numeric_limits<_Tp>::infinity();
+ else if (std::abs(__k) > _Tp(1))
+ std::__throw_domain_error(__N("Bad argument in __comp_ellint_3."));
+ else
+ {
+ const _Tp __kk = __k * __k;
+
+ return __ellint_rf(_Tp(0), _Tp(1) - __kk, _Tp(1))
+ - __nu
+ * __ellint_rj(_Tp(0), _Tp(1) - __kk, _Tp(1), _Tp(1) + __nu)
+ / _Tp(3);
+ }
+ }
+
+
+ /**
+ * @brief Return the incomplete elliptic integral of the third kind
+ * @f$ \Pi(k,\nu,\phi) @f$ using the Carlson formulation.
+ *
+ * The incomplete elliptic integral of the third kind is defined as
+ * @f[
+ * \Pi(k,\nu,\phi) = \int_0^{\phi}
+ * \frac{d\theta}
+ * {(1 - \nu \sin^2\theta)
+ * \sqrt{1 - k^2 \sin^2\theta}}
+ * @f]
+ *
+ * @param __k The argument of the elliptic function.
+ * @param __nu The second argument of the elliptic function.
+ * @param __phi The integral limit argument of the elliptic function.
+ * @return The elliptic function of the third kind.
+ */
+ template<typename _Tp>
+ _Tp
+ __ellint_3(const _Tp __k, const _Tp __nu, const _Tp __phi)
+ {
+
+ if (__isnan(__k) || __isnan(__nu) || __isnan(__phi))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (std::abs(__k) > _Tp(1))
+ std::__throw_domain_error(__N("Bad argument in __ellint_3."));
+ else
+ {
+ // Reduce phi to -pi/2 < phi < +pi/2.
+ const int __n = std::floor(__phi / __numeric_constants<_Tp>::__pi()
+ + _Tp(0.5L));
+ const _Tp __phi_red = __phi
+ - __n * __numeric_constants<_Tp>::__pi();
+
+ const _Tp __kk = __k * __k;
+ const _Tp __s = std::sin(__phi_red);
+ const _Tp __ss = __s * __s;
+ const _Tp __sss = __ss * __s;
+ const _Tp __c = std::cos(__phi_red);
+ const _Tp __cc = __c * __c;
+
+ const _Tp __Pi = __s
+ * __ellint_rf(__cc, _Tp(1) - __kk * __ss, _Tp(1))
+ - __nu * __sss
+ * __ellint_rj(__cc, _Tp(1) - __kk * __ss, _Tp(1),
+ _Tp(1) + __nu * __ss) / _Tp(3);
+
+ if (__n == 0)
+ return __Pi;
+ else
+ return __Pi + _Tp(2) * __n * __comp_ellint_3(__k, __nu);
+ }
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_ELL_INTEGRAL_TCC
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/exp_integral.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/exp_integral.tcc
new file mode 100644
index 000000000..5b3af5d8e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/exp_integral.tcc
@@ -0,0 +1,524 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/exp_integral.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+//
+// (1) Handbook of Mathematical Functions,
+// Ed. by Milton Abramowitz and Irene A. Stegun,
+// Dover Publications, New-York, Section 5, pp. 228-251.
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
+// 2nd ed, pp. 222-225.
+//
+
+#ifndef _GLIBCXX_TR1_EXP_INTEGRAL_TCC
+#define _GLIBCXX_TR1_EXP_INTEGRAL_TCC 1
+
+#include "special_function_util.h"
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Return the exponential integral @f$ E_1(x) @f$
+ * by series summation. This should be good
+ * for @f$ x < 1 @f$.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_1(x) = \int_{1}^{\infty} \frac{e^{-xt}}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_E1_series(const _Tp __x)
+ {
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ _Tp __term = _Tp(1);
+ _Tp __esum = _Tp(0);
+ _Tp __osum = _Tp(0);
+ const unsigned int __max_iter = 100;
+ for (unsigned int __i = 1; __i < __max_iter; ++__i)
+ {
+ __term *= - __x / __i;
+ if (std::abs(__term) < __eps)
+ break;
+ if (__term >= _Tp(0))
+ __esum += __term / __i;
+ else
+ __osum += __term / __i;
+ }
+
+ return - __esum - __osum
+ - __numeric_constants<_Tp>::__gamma_e() - std::log(__x);
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_1(x) @f$
+ * by asymptotic expansion.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_1(x) = \int_{1}^\infty \frac{e^{-xt}}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_E1_asymp(const _Tp __x)
+ {
+ _Tp __term = _Tp(1);
+ _Tp __esum = _Tp(1);
+ _Tp __osum = _Tp(0);
+ const unsigned int __max_iter = 1000;
+ for (unsigned int __i = 1; __i < __max_iter; ++__i)
+ {
+ _Tp __prev = __term;
+ __term *= - __i / __x;
+ if (std::abs(__term) > std::abs(__prev))
+ break;
+ if (__term >= _Tp(0))
+ __esum += __term;
+ else
+ __osum += __term;
+ }
+
+ return std::exp(- __x) * (__esum + __osum) / __x;
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_n(x) @f$
+ * by series summation.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
+ * \f]
+ *
+ * @param __n The order of the exponential integral function.
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_En_series(const unsigned int __n, const _Tp __x)
+ {
+ const unsigned int __max_iter = 100;
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const int __nm1 = __n - 1;
+ _Tp __ans = (__nm1 != 0
+ ? _Tp(1) / __nm1 : -std::log(__x)
+ - __numeric_constants<_Tp>::__gamma_e());
+ _Tp __fact = _Tp(1);
+ for (int __i = 1; __i <= __max_iter; ++__i)
+ {
+ __fact *= -__x / _Tp(__i);
+ _Tp __del;
+ if ( __i != __nm1 )
+ __del = -__fact / _Tp(__i - __nm1);
+ else
+ {
+ _Tp __psi = -_TR1_GAMMA_TCC;
+ for (int __ii = 1; __ii <= __nm1; ++__ii)
+ __psi += _Tp(1) / _Tp(__ii);
+ __del = __fact * (__psi - std::log(__x));
+ }
+ __ans += __del;
+ if (std::abs(__del) < __eps * std::abs(__ans))
+ return __ans;
+ }
+ std::__throw_runtime_error(__N("Series summation failed "
+ "in __expint_En_series."));
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_n(x) @f$
+ * by continued fractions.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
+ * \f]
+ *
+ * @param __n The order of the exponential integral function.
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_En_cont_frac(const unsigned int __n, const _Tp __x)
+ {
+ const unsigned int __max_iter = 100;
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __fp_min = std::numeric_limits<_Tp>::min();
+ const int __nm1 = __n - 1;
+ _Tp __b = __x + _Tp(__n);
+ _Tp __c = _Tp(1) / __fp_min;
+ _Tp __d = _Tp(1) / __b;
+ _Tp __h = __d;
+ for ( unsigned int __i = 1; __i <= __max_iter; ++__i )
+ {
+ _Tp __a = -_Tp(__i * (__nm1 + __i));
+ __b += _Tp(2);
+ __d = _Tp(1) / (__a * __d + __b);
+ __c = __b + __a / __c;
+ const _Tp __del = __c * __d;
+ __h *= __del;
+ if (std::abs(__del - _Tp(1)) < __eps)
+ {
+ const _Tp __ans = __h * std::exp(-__x);
+ return __ans;
+ }
+ }
+ std::__throw_runtime_error(__N("Continued fraction failed "
+ "in __expint_En_cont_frac."));
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_n(x) @f$
+ * by recursion. Use upward recursion for @f$ x < n @f$
+ * and downward recursion (Miller's algorithm) otherwise.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
+ * \f]
+ *
+ * @param __n The order of the exponential integral function.
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_En_recursion(const unsigned int __n, const _Tp __x)
+ {
+ _Tp __En;
+ _Tp __E1 = __expint_E1(__x);
+ if (__x < _Tp(__n))
+ {
+ // Forward recursion is stable only for n < x.
+ __En = __E1;
+ for (unsigned int __j = 2; __j < __n; ++__j)
+ __En = (std::exp(-__x) - __x * __En) / _Tp(__j - 1);
+ }
+ else
+ {
+ // Backward recursion is stable only for n >= x.
+ __En = _Tp(1);
+ const int __N = __n + 20; // TODO: Check this starting number.
+ _Tp __save = _Tp(0);
+ for (int __j = __N; __j > 0; --__j)
+ {
+ __En = (std::exp(-__x) - __j * __En) / __x;
+ if (__j == __n)
+ __save = __En;
+ }
+ _Tp __norm = __En / __E1;
+ __En /= __norm;
+ }
+
+ return __En;
+ }
+
+ /**
+ * @brief Return the exponential integral @f$ Ei(x) @f$
+ * by series summation.
+ *
+ * The exponential integral is given by
+ * \f[
+ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_Ei_series(const _Tp __x)
+ {
+ _Tp __term = _Tp(1);
+ _Tp __sum = _Tp(0);
+ const unsigned int __max_iter = 1000;
+ for (unsigned int __i = 1; __i < __max_iter; ++__i)
+ {
+ __term *= __x / __i;
+ __sum += __term / __i;
+ if (__term < std::numeric_limits<_Tp>::epsilon() * __sum)
+ break;
+ }
+
+ return __numeric_constants<_Tp>::__gamma_e() + __sum + std::log(__x);
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ Ei(x) @f$
+ * by asymptotic expansion.
+ *
+ * The exponential integral is given by
+ * \f[
+ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_Ei_asymp(const _Tp __x)
+ {
+ _Tp __term = _Tp(1);
+ _Tp __sum = _Tp(1);
+ const unsigned int __max_iter = 1000;
+ for (unsigned int __i = 1; __i < __max_iter; ++__i)
+ {
+ _Tp __prev = __term;
+ __term *= __i / __x;
+ if (__term < std::numeric_limits<_Tp>::epsilon())
+ break;
+ if (__term >= __prev)
+ break;
+ __sum += __term;
+ }
+
+ return std::exp(__x) * __sum / __x;
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ Ei(x) @f$.
+ *
+ * The exponential integral is given by
+ * \f[
+ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_Ei(const _Tp __x)
+ {
+ if (__x < _Tp(0))
+ return -__expint_E1(-__x);
+ else if (__x < -std::log(std::numeric_limits<_Tp>::epsilon()))
+ return __expint_Ei_series(__x);
+ else
+ return __expint_Ei_asymp(__x);
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_1(x) @f$.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_1(x) = \int_{1}^\infty \frac{e^{-xt}}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_E1(const _Tp __x)
+ {
+ if (__x < _Tp(0))
+ return -__expint_Ei(-__x);
+ else if (__x < _Tp(1))
+ return __expint_E1_series(__x);
+ else if (__x < _Tp(100)) // TODO: Find a good asymptotic switch point.
+ return __expint_En_cont_frac(1, __x);
+ else
+ return __expint_E1_asymp(__x);
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_n(x) @f$
+ * for large argument.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
+ * \f]
+ *
+ * This is something of an extension.
+ *
+ * @param __n The order of the exponential integral function.
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_asymp(const unsigned int __n, const _Tp __x)
+ {
+ _Tp __term = _Tp(1);
+ _Tp __sum = _Tp(1);
+ for (unsigned int __i = 1; __i <= __n; ++__i)
+ {
+ _Tp __prev = __term;
+ __term *= -(__n - __i + 1) / __x;
+ if (std::abs(__term) > std::abs(__prev))
+ break;
+ __sum += __term;
+ }
+
+ return std::exp(-__x) * __sum / __x;
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_n(x) @f$
+ * for large order.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
+ * \f]
+ *
+ * This is something of an extension.
+ *
+ * @param __n The order of the exponential integral function.
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint_large_n(const unsigned int __n, const _Tp __x)
+ {
+ const _Tp __xpn = __x + __n;
+ const _Tp __xpn2 = __xpn * __xpn;
+ _Tp __term = _Tp(1);
+ _Tp __sum = _Tp(1);
+ for (unsigned int __i = 1; __i <= __n; ++__i)
+ {
+ _Tp __prev = __term;
+ __term *= (__n - 2 * (__i - 1) * __x) / __xpn2;
+ if (std::abs(__term) < std::numeric_limits<_Tp>::epsilon())
+ break;
+ __sum += __term;
+ }
+
+ return std::exp(-__x) * __sum / __xpn;
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ E_n(x) @f$.
+ *
+ * The exponential integral is given by
+ * \f[
+ * E_n(x) = \int_{1}^\infty \frac{e^{-xt}}{t^n} dt
+ * \f]
+ * This is something of an extension.
+ *
+ * @param __n The order of the exponential integral function.
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ _Tp
+ __expint(const unsigned int __n, const _Tp __x)
+ {
+ // Return NaN on NaN input.
+ if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__n <= 1 && __x == _Tp(0))
+ return std::numeric_limits<_Tp>::infinity();
+ else
+ {
+ _Tp __E0 = std::exp(__x) / __x;
+ if (__n == 0)
+ return __E0;
+
+ _Tp __E1 = __expint_E1(__x);
+ if (__n == 1)
+ return __E1;
+
+ if (__x == _Tp(0))
+ return _Tp(1) / static_cast<_Tp>(__n - 1);
+
+ _Tp __En = __expint_En_recursion(__n, __x);
+
+ return __En;
+ }
+ }
+
+
+ /**
+ * @brief Return the exponential integral @f$ Ei(x) @f$.
+ *
+ * The exponential integral is given by
+ * \f[
+ * Ei(x) = -\int_{-x}^\infty \frac{e^t}{t} dt
+ * \f]
+ *
+ * @param __x The argument of the exponential integral function.
+ * @return The exponential integral.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __expint(const _Tp __x)
+ {
+ if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else
+ return __expint_Ei(__x);
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_EXP_INTEGRAL_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/fenv.h b/gcc-4.4.0/libstdc++-v3/include/tr1/fenv.h
new file mode 100644
index 000000000..118630e49
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/fenv.h
@@ -0,0 +1,34 @@
+// TR1 fenv.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/fenv.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_FENV_H
+#define _TR1_FENV_H 1
+
+#include <tr1/cfenv>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/float.h b/gcc-4.4.0/libstdc++-v3/include/tr1/float.h
new file mode 100644
index 000000000..bbeff6e3a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/float.h
@@ -0,0 +1,34 @@
+// TR1 float.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/float.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_FLOAT_H
+#define _TR1_FLOAT_H 1
+
+#include <tr1/cfloat>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/functional b/gcc-4.4.0/libstdc++-v3/include/tr1/functional
new file mode 100644
index 000000000..3deaa5ea5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/functional
@@ -0,0 +1,63 @@
+// TR1 functional header -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/functional
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_FUNCTIONAL
+#define _GLIBCXX_TR1_FUNCTIONAL 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <bits/c++config.h>
+#include <bits/stl_function.h>
+
+#include <typeinfo>
+#include <new>
+#include <tr1/tuple>
+#include <tr1/type_traits>
+#include <bits/stringfwd.h>
+#include <tr1/functional_hash.h>
+#include <ext/type_traits.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/functional>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/functional>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_FUNCTIONAL
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/functional_hash.h b/gcc-4.4.0/libstdc++-v3/include/tr1/functional_hash.h
new file mode 100644
index 000000000..933ded9ac
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/functional_hash.h
@@ -0,0 +1,53 @@
+// TR1 functional_hash.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/functional_hash.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_TR1_FUNCTIONAL_HASH_H
+#define _GLIBCXX_TR1_FUNCTIONAL_HASH_H 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/functional_hash.h>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/functional_hash.h>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_FUNCTIONAL_HASH_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/gamma.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/gamma.tcc
new file mode 100644
index 000000000..f456da32b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/gamma.tcc
@@ -0,0 +1,471 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/gamma.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) Handbook of Mathematical Functions,
+// ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 6, pp. 253-266
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
+// 2nd ed, pp. 213-216
+// (4) Gamma, Exploring Euler's Constant, Julian Havil,
+// Princeton, 2003.
+
+#ifndef _TR1_GAMMA_TCC
+#define _TR1_GAMMA_TCC 1
+
+#include "special_function_util.h"
+
+namespace std
+{
+namespace tr1
+{
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief This returns Bernoulli numbers from a table or by summation
+ * for larger values.
+ *
+ * Recursion is unstable.
+ *
+ * @param __n the order n of the Bernoulli number.
+ * @return The Bernoulli number of order n.
+ */
+ template <typename _Tp>
+ _Tp __bernoulli_series(unsigned int __n)
+ {
+
+ static const _Tp __num[28] = {
+ _Tp(1UL), -_Tp(1UL) / _Tp(2UL),
+ _Tp(1UL) / _Tp(6UL), _Tp(0UL),
+ -_Tp(1UL) / _Tp(30UL), _Tp(0UL),
+ _Tp(1UL) / _Tp(42UL), _Tp(0UL),
+ -_Tp(1UL) / _Tp(30UL), _Tp(0UL),
+ _Tp(5UL) / _Tp(66UL), _Tp(0UL),
+ -_Tp(691UL) / _Tp(2730UL), _Tp(0UL),
+ _Tp(7UL) / _Tp(6UL), _Tp(0UL),
+ -_Tp(3617UL) / _Tp(510UL), _Tp(0UL),
+ _Tp(43867UL) / _Tp(798UL), _Tp(0UL),
+ -_Tp(174611) / _Tp(330UL), _Tp(0UL),
+ _Tp(854513UL) / _Tp(138UL), _Tp(0UL),
+ -_Tp(236364091UL) / _Tp(2730UL), _Tp(0UL),
+ _Tp(8553103UL) / _Tp(6UL), _Tp(0UL)
+ };
+
+ if (__n == 0)
+ return _Tp(1);
+
+ if (__n == 1)
+ return -_Tp(1) / _Tp(2);
+
+ // Take care of the rest of the odd ones.
+ if (__n % 2 == 1)
+ return _Tp(0);
+
+ // Take care of some small evens that are painful for the series.
+ if (__n < 28)
+ return __num[__n];
+
+
+ _Tp __fact = _Tp(1);
+ if ((__n / 2) % 2 == 0)
+ __fact *= _Tp(-1);
+ for (unsigned int __k = 1; __k <= __n; ++__k)
+ __fact *= __k / (_Tp(2) * __numeric_constants<_Tp>::__pi());
+ __fact *= _Tp(2);
+
+ _Tp __sum = _Tp(0);
+ for (unsigned int __i = 1; __i < 1000; ++__i)
+ {
+ _Tp __term = std::pow(_Tp(__i), -_Tp(__n));
+ if (__term < std::numeric_limits<_Tp>::epsilon())
+ break;
+ __sum += __term;
+ }
+
+ return __fact * __sum;
+ }
+
+
+ /**
+ * @brief This returns Bernoulli number \f$B_n\f$.
+ *
+ * @param __n the order n of the Bernoulli number.
+ * @return The Bernoulli number of order n.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __bernoulli(const int __n)
+ {
+ return __bernoulli_series<_Tp>(__n);
+ }
+
+
+ /**
+ * @brief Return \f$log(\Gamma(x))\f$ by asymptotic expansion
+ * with Bernoulli number coefficients. This is like
+ * Sterling's approximation.
+ *
+ * @param __x The argument of the log of the gamma function.
+ * @return The logarithm of the gamma function.
+ */
+ template<typename _Tp>
+ _Tp
+ __log_gamma_bernoulli(const _Tp __x)
+ {
+ _Tp __lg = (__x - _Tp(0.5L)) * std::log(__x) - __x
+ + _Tp(0.5L) * std::log(_Tp(2)
+ * __numeric_constants<_Tp>::__pi());
+
+ const _Tp __xx = __x * __x;
+ _Tp __help = _Tp(1) / __x;
+ for ( unsigned int __i = 1; __i < 20; ++__i )
+ {
+ const _Tp __2i = _Tp(2 * __i);
+ __help /= __2i * (__2i - _Tp(1)) * __xx;
+ __lg += __bernoulli<_Tp>(2 * __i) * __help;
+ }
+
+ return __lg;
+ }
+
+
+ /**
+ * @brief Return \f$log(\Gamma(x))\f$ by the Lanczos method.
+ * This method dominates all others on the positive axis I think.
+ *
+ * @param __x The argument of the log of the gamma function.
+ * @return The logarithm of the gamma function.
+ */
+ template<typename _Tp>
+ _Tp
+ __log_gamma_lanczos(const _Tp __x)
+ {
+ const _Tp __xm1 = __x - _Tp(1);
+
+ static const _Tp __lanczos_cheb_7[9] = {
+ _Tp( 0.99999999999980993227684700473478L),
+ _Tp( 676.520368121885098567009190444019L),
+ _Tp(-1259.13921672240287047156078755283L),
+ _Tp( 771.3234287776530788486528258894L),
+ _Tp(-176.61502916214059906584551354L),
+ _Tp( 12.507343278686904814458936853L),
+ _Tp(-0.13857109526572011689554707L),
+ _Tp( 9.984369578019570859563e-6L),
+ _Tp( 1.50563273514931155834e-7L)
+ };
+
+ static const _Tp __LOGROOT2PI
+ = _Tp(0.9189385332046727417803297364056176L);
+
+ _Tp __sum = __lanczos_cheb_7[0];
+ for(unsigned int __k = 1; __k < 9; ++__k)
+ __sum += __lanczos_cheb_7[__k] / (__xm1 + __k);
+
+ const _Tp __term1 = (__xm1 + _Tp(0.5L))
+ * std::log((__xm1 + _Tp(7.5L))
+ / __numeric_constants<_Tp>::__euler());
+ const _Tp __term2 = __LOGROOT2PI + std::log(__sum);
+ const _Tp __result = __term1 + (__term2 - _Tp(7));
+
+ return __result;
+ }
+
+
+ /**
+ * @brief Return \f$ log(|\Gamma(x)|) \f$.
+ * This will return values even for \f$ x < 0 \f$.
+ * To recover the sign of \f$ \Gamma(x) \f$ for
+ * any argument use @a __log_gamma_sign.
+ *
+ * @param __x The argument of the log of the gamma function.
+ * @return The logarithm of the gamma function.
+ */
+ template<typename _Tp>
+ _Tp
+ __log_gamma(const _Tp __x)
+ {
+ if (__x > _Tp(0.5L))
+ return __log_gamma_lanczos(__x);
+ else
+ {
+ const _Tp __sin_fact
+ = std::abs(std::sin(__numeric_constants<_Tp>::__pi() * __x));
+ if (__sin_fact == _Tp(0))
+ std::__throw_domain_error(__N("Argument is nonpositive integer "
+ "in __log_gamma"));
+ return __numeric_constants<_Tp>::__lnpi()
+ - std::log(__sin_fact)
+ - __log_gamma_lanczos(_Tp(1) - __x);
+ }
+ }
+
+
+ /**
+ * @brief Return the sign of \f$ \Gamma(x) \f$.
+ * At nonpositive integers zero is returned.
+ *
+ * @param __x The argument of the gamma function.
+ * @return The sign of the gamma function.
+ */
+ template<typename _Tp>
+ _Tp
+ __log_gamma_sign(const _Tp __x)
+ {
+ if (__x > _Tp(0))
+ return _Tp(1);
+ else
+ {
+ const _Tp __sin_fact
+ = std::sin(__numeric_constants<_Tp>::__pi() * __x);
+ if (__sin_fact > _Tp(0))
+ return (1);
+ else if (__sin_fact < _Tp(0))
+ return -_Tp(1);
+ else
+ return _Tp(0);
+ }
+ }
+
+
+ /**
+ * @brief Return the logarithm of the binomial coefficient.
+ * The binomial coefficient is given by:
+ * @f[
+ * \left( \right) = \frac{n!}{(n-k)! k!}
+ * @f]
+ *
+ * @param __n The first argument of the binomial coefficient.
+ * @param __k The second argument of the binomial coefficient.
+ * @return The binomial coefficient.
+ */
+ template<typename _Tp>
+ _Tp
+ __log_bincoef(const unsigned int __n, const unsigned int __k)
+ {
+ // Max e exponent before overflow.
+ static const _Tp __max_bincoeff
+ = std::numeric_limits<_Tp>::max_exponent10
+ * std::log(_Tp(10)) - _Tp(1);
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _Tp __coeff = std::tr1::lgamma(_Tp(1 + __n))
+ - std::tr1::lgamma(_Tp(1 + __k))
+ - std::tr1::lgamma(_Tp(1 + __n - __k));
+#else
+ _Tp __coeff = __log_gamma(_Tp(1 + __n))
+ - __log_gamma(_Tp(1 + __k))
+ - __log_gamma(_Tp(1 + __n - __k));
+#endif
+ }
+
+
+ /**
+ * @brief Return the binomial coefficient.
+ * The binomial coefficient is given by:
+ * @f[
+ * \left( \right) = \frac{n!}{(n-k)! k!}
+ * @f]
+ *
+ * @param __n The first argument of the binomial coefficient.
+ * @param __k The second argument of the binomial coefficient.
+ * @return The binomial coefficient.
+ */
+ template<typename _Tp>
+ _Tp
+ __bincoef(const unsigned int __n, const unsigned int __k)
+ {
+ // Max e exponent before overflow.
+ static const _Tp __max_bincoeff
+ = std::numeric_limits<_Tp>::max_exponent10
+ * std::log(_Tp(10)) - _Tp(1);
+
+ const _Tp __log_coeff = __log_bincoef<_Tp>(__n, __k);
+ if (__log_coeff > __max_bincoeff)
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else
+ return std::exp(__log_coeff);
+ }
+
+
+ /**
+ * @brief Return \f$ \Gamma(x) \f$.
+ *
+ * @param __x The argument of the gamma function.
+ * @return The gamma function.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __gamma(const _Tp __x)
+ {
+ return std::exp(__log_gamma(__x));
+ }
+
+
+ /**
+ * @brief Return the digamma function by series expansion.
+ * The digamma or @f$ \psi(x) @f$ function is defined by
+ * @f[
+ * \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}
+ * @f]
+ *
+ * The series is given by:
+ * @f[
+ * \psi(x) = -\gamma_E - \frac{1}{x}
+ * \sum_{k=1}^{\infty} \frac{x}{k(x + k)}
+ * @f]
+ */
+ template<typename _Tp>
+ _Tp
+ __psi_series(const _Tp __x)
+ {
+ _Tp __sum = -__numeric_constants<_Tp>::__gamma_e() - _Tp(1) / __x;
+ const unsigned int __max_iter = 100000;
+ for (unsigned int __k = 1; __k < __max_iter; ++__k)
+ {
+ const _Tp __term = __x / (__k * (__k + __x));
+ __sum += __term;
+ if (std::abs(__term / __sum) < std::numeric_limits<_Tp>::epsilon())
+ break;
+ }
+ return __sum;
+ }
+
+
+ /**
+ * @brief Return the digamma function for large argument.
+ * The digamma or @f$ \psi(x) @f$ function is defined by
+ * @f[
+ * \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}
+ * @f]
+ *
+ * The asymptotic series is given by:
+ * @f[
+ * \psi(x) = \ln(x) - \frac{1}{2x}
+ * - \sum_{n=1}^{\infty} \frac{B_{2n}}{2 n x^{2n}}
+ * @f]
+ */
+ template<typename _Tp>
+ _Tp
+ __psi_asymp(const _Tp __x)
+ {
+ _Tp __sum = std::log(__x) - _Tp(0.5L) / __x;
+ const _Tp __xx = __x * __x;
+ _Tp __xp = __xx;
+ const unsigned int __max_iter = 100;
+ for (unsigned int __k = 1; __k < __max_iter; ++__k)
+ {
+ const _Tp __term = __bernoulli<_Tp>(2 * __k) / (2 * __k * __xp);
+ __sum -= __term;
+ if (std::abs(__term / __sum) < std::numeric_limits<_Tp>::epsilon())
+ break;
+ __xp *= __xx;
+ }
+ return __sum;
+ }
+
+
+ /**
+ * @brief Return the digamma function.
+ * The digamma or @f$ \psi(x) @f$ function is defined by
+ * @f[
+ * \psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}
+ * @f]
+ * For negative argument the reflection formula is used:
+ * @f[
+ * \psi(x) = \psi(1-x) - \pi \cot(\pi x)
+ * @f]
+ */
+ template<typename _Tp>
+ _Tp
+ __psi(const _Tp __x)
+ {
+ const int __n = static_cast<int>(__x + 0.5L);
+ const _Tp __eps = _Tp(4) * std::numeric_limits<_Tp>::epsilon();
+ if (__n <= 0 && std::abs(__x - _Tp(__n)) < __eps)
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x < _Tp(0))
+ {
+ const _Tp __pi = __numeric_constants<_Tp>::__pi();
+ return __psi(_Tp(1) - __x)
+ - __pi * std::cos(__pi * __x) / std::sin(__pi * __x);
+ }
+ else if (__x > _Tp(100))
+ return __psi_asymp(__x);
+ else
+ return __psi_series(__x);
+ }
+
+
+ /**
+ * @brief Return the polygamma function @f$ \psi^{(n)}(x) @f$.
+ *
+ * The polygamma function is related to the Hurwitz zeta function:
+ * @f[
+ * \psi^{(n)}(x) = (-1)^{n+1} m! \zeta(m+1,x)
+ * @f]
+ */
+ template<typename _Tp>
+ _Tp
+ __psi(const unsigned int __n, const _Tp __x)
+ {
+ if (__x <= _Tp(0))
+ std::__throw_domain_error(__N("Argument out of range "
+ "in __psi"));
+ else if (__n == 0)
+ return __psi(__x);
+ else
+ {
+ const _Tp __hzeta = __hurwitz_zeta(_Tp(__n + 1), __x);
+#if _GLIBCXX_USE_C99_MATH_TR1
+ const _Tp __ln_nfact = std::tr1::lgamma(_Tp(__n + 1));
+#else
+ const _Tp __ln_nfact = __log_gamma(_Tp(__n + 1));
+#endif
+ _Tp __result = std::exp(__ln_nfact) * __hzeta;
+ if (__n % 2 == 1)
+ __result = -__result;
+ return __result;
+ }
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _TR1_GAMMA_TCC
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/hashtable.h b/gcc-4.4.0/libstdc++-v3/include/tr1/hashtable.h
new file mode 100644
index 000000000..22fdbff6f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/hashtable.h
@@ -0,0 +1,53 @@
+// TR1 hashtable.h header -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/hashtable.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_TR1_HASHTABLE_H
+#define _GLIBCXX_TR1_HASHTABLE_H 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/hashtable>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/hashtable>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_HASHTABLE_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/hypergeometric.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/hypergeometric.tcc
new file mode 100644
index 000000000..c975afa59
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/hypergeometric.tcc
@@ -0,0 +1,774 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/hypergeometric.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based:
+// (1) Handbook of Mathematical Functions,
+// ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 6, pp. 555-566
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+
+#ifndef _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
+#define _GLIBCXX_TR1_HYPERGEOMETRIC_TCC 1
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief This routine returns the confluent hypergeometric function
+ * by series expansion.
+ *
+ * @f[
+ * _1F_1(a;c;x) = \frac{\Gamma(c)}{\Gamma(a)}
+ * \sum_{n=0}^{\infty}
+ * \frac{\Gamma(a+n)}{\Gamma(c+n)}
+ * \frac{x^n}{n!}
+ * @f]
+ *
+ * If a and b are integers and a < 0 and either b > 0 or b < a then the
+ * series is a polynomial with a finite number of terms. If b is an integer
+ * and b <= 0 the confluent hypergeometric function is undefined.
+ *
+ * @param __a The "numerator" parameter.
+ * @param __c The "denominator" parameter.
+ * @param __x The argument of the confluent hypergeometric function.
+ * @return The confluent hypergeometric function.
+ */
+ template<typename _Tp>
+ _Tp
+ __conf_hyperg_series(const _Tp __a, const _Tp __c, const _Tp __x)
+ {
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+
+ _Tp __term = _Tp(1);
+ _Tp __Fac = _Tp(1);
+ const unsigned int __max_iter = 100000;
+ unsigned int __i;
+ for (__i = 0; __i < __max_iter; ++__i)
+ {
+ __term *= (__a + _Tp(__i)) * __x
+ / ((__c + _Tp(__i)) * _Tp(1 + __i));
+ if (std::abs(__term) < __eps)
+ {
+ break;
+ }
+ __Fac += __term;
+ }
+ if (__i == __max_iter)
+ std::__throw_runtime_error(__N("Series failed to converge "
+ "in __conf_hyperg_series."));
+
+ return __Fac;
+ }
+
+
+ /**
+ * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
+ * by an iterative procedure described in
+ * Luke, Algorithms for the Computation of Mathematical Functions.
+ *
+ * Like the case of the 2F1 rational approximations, these are
+ * probably guaranteed to converge for x < 0, barring gross
+ * numerical instability in the pre-asymptotic regime.
+ */
+ template<typename _Tp>
+ _Tp
+ __conf_hyperg_luke(const _Tp __a, const _Tp __c, const _Tp __xin)
+ {
+ const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
+ const int __nmax = 20000;
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __x = -__xin;
+ const _Tp __x3 = __x * __x * __x;
+ const _Tp __t0 = __a / __c;
+ const _Tp __t1 = (__a + _Tp(1)) / (_Tp(2) * __c);
+ const _Tp __t2 = (__a + _Tp(2)) / (_Tp(2) * (__c + _Tp(1)));
+ _Tp __F = _Tp(1);
+ _Tp __prec;
+
+ _Tp __Bnm3 = _Tp(1);
+ _Tp __Bnm2 = _Tp(1) + __t1 * __x;
+ _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
+
+ _Tp __Anm3 = _Tp(1);
+ _Tp __Anm2 = __Bnm2 - __t0 * __x;
+ _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
+ + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
+
+ int __n = 3;
+ while(1)
+ {
+ _Tp __npam1 = _Tp(__n - 1) + __a;
+ _Tp __npcm1 = _Tp(__n - 1) + __c;
+ _Tp __npam2 = _Tp(__n - 2) + __a;
+ _Tp __npcm2 = _Tp(__n - 2) + __c;
+ _Tp __tnm1 = _Tp(2 * __n - 1);
+ _Tp __tnm3 = _Tp(2 * __n - 3);
+ _Tp __tnm5 = _Tp(2 * __n - 5);
+ _Tp __F1 = (_Tp(__n - 2) - __a) / (_Tp(2) * __tnm3 * __npcm1);
+ _Tp __F2 = (_Tp(__n) + __a) * __npam1
+ / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
+ _Tp __F3 = -__npam2 * __npam1 * (_Tp(__n - 2) - __a)
+ / (_Tp(8) * __tnm3 * __tnm3 * __tnm5
+ * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
+ _Tp __E = -__npam1 * (_Tp(__n - 1) - __c)
+ / (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
+
+ _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
+ + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
+ _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
+ + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
+ _Tp __r = __An / __Bn;
+
+ __prec = std::abs((__F - __r) / __F);
+ __F = __r;
+
+ if (__prec < __eps || __n > __nmax)
+ break;
+
+ if (std::abs(__An) > __big || std::abs(__Bn) > __big)
+ {
+ __An /= __big;
+ __Bn /= __big;
+ __Anm1 /= __big;
+ __Bnm1 /= __big;
+ __Anm2 /= __big;
+ __Bnm2 /= __big;
+ __Anm3 /= __big;
+ __Bnm3 /= __big;
+ }
+ else if (std::abs(__An) < _Tp(1) / __big
+ || std::abs(__Bn) < _Tp(1) / __big)
+ {
+ __An *= __big;
+ __Bn *= __big;
+ __Anm1 *= __big;
+ __Bnm1 *= __big;
+ __Anm2 *= __big;
+ __Bnm2 *= __big;
+ __Anm3 *= __big;
+ __Bnm3 *= __big;
+ }
+
+ ++__n;
+ __Bnm3 = __Bnm2;
+ __Bnm2 = __Bnm1;
+ __Bnm1 = __Bn;
+ __Anm3 = __Anm2;
+ __Anm2 = __Anm1;
+ __Anm1 = __An;
+ }
+
+ if (__n >= __nmax)
+ std::__throw_runtime_error(__N("Iteration failed to converge "
+ "in __conf_hyperg_luke."));
+
+ return __F;
+ }
+
+
+ /**
+ * @brief Return the confluent hypogeometric function
+ * @f$ _1F_1(a;c;x) @f$.
+ *
+ * @todo Handle b == nonpositive integer blowup - return NaN.
+ *
+ * @param __a The "numerator" parameter.
+ * @param __c The "denominator" parameter.
+ * @param __x The argument of the confluent hypergeometric function.
+ * @return The confluent hypergeometric function.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __conf_hyperg(const _Tp __a, const _Tp __c, const _Tp __x)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ const _Tp __c_nint = std::tr1::nearbyint(__c);
+#else
+ const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
+#endif
+ if (__isnan(__a) || __isnan(__c) || __isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__c_nint == __c && __c_nint <= 0)
+ return std::numeric_limits<_Tp>::infinity();
+ else if (__a == _Tp(0))
+ return _Tp(1);
+ else if (__c == __a)
+ return std::exp(__x);
+ else if (__x < _Tp(0))
+ return __conf_hyperg_luke(__a, __c, __x);
+ else
+ return __conf_hyperg_series(__a, __c, __x);
+ }
+
+
+ /**
+ * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
+ * by series expansion.
+ *
+ * The hypogeometric function is defined by
+ * @f[
+ * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
+ * \sum_{n=0}^{\infty}
+ * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
+ * \frac{x^n}{n!}
+ * @f]
+ *
+ * This works and it's pretty fast.
+ *
+ * @param __a The first "numerator" parameter.
+ * @param __a The second "numerator" parameter.
+ * @param __c The "denominator" parameter.
+ * @param __x The argument of the confluent hypergeometric function.
+ * @return The confluent hypergeometric function.
+ */
+ template<typename _Tp>
+ _Tp
+ __hyperg_series(const _Tp __a, const _Tp __b,
+ const _Tp __c, const _Tp __x)
+ {
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+
+ _Tp __term = _Tp(1);
+ _Tp __Fabc = _Tp(1);
+ const unsigned int __max_iter = 100000;
+ unsigned int __i;
+ for (__i = 0; __i < __max_iter; ++__i)
+ {
+ __term *= (__a + _Tp(__i)) * (__b + _Tp(__i)) * __x
+ / ((__c + _Tp(__i)) * _Tp(1 + __i));
+ if (std::abs(__term) < __eps)
+ {
+ break;
+ }
+ __Fabc += __term;
+ }
+ if (__i == __max_iter)
+ std::__throw_runtime_error(__N("Series failed to converge "
+ "in __hyperg_series."));
+
+ return __Fabc;
+ }
+
+
+ /**
+ * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
+ * by an iterative procedure described in
+ * Luke, Algorithms for the Computation of Mathematical Functions.
+ */
+ template<typename _Tp>
+ _Tp
+ __hyperg_luke(const _Tp __a, const _Tp __b, const _Tp __c,
+ const _Tp __xin)
+ {
+ const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
+ const int __nmax = 20000;
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __x = -__xin;
+ const _Tp __x3 = __x * __x * __x;
+ const _Tp __t0 = __a * __b / __c;
+ const _Tp __t1 = (__a + _Tp(1)) * (__b + _Tp(1)) / (_Tp(2) * __c);
+ const _Tp __t2 = (__a + _Tp(2)) * (__b + _Tp(2))
+ / (_Tp(2) * (__c + _Tp(1)));
+
+ _Tp __F = _Tp(1);
+
+ _Tp __Bnm3 = _Tp(1);
+ _Tp __Bnm2 = _Tp(1) + __t1 * __x;
+ _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
+
+ _Tp __Anm3 = _Tp(1);
+ _Tp __Anm2 = __Bnm2 - __t0 * __x;
+ _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
+ + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
+
+ int __n = 3;
+ while (1)
+ {
+ const _Tp __npam1 = _Tp(__n - 1) + __a;
+ const _Tp __npbm1 = _Tp(__n - 1) + __b;
+ const _Tp __npcm1 = _Tp(__n - 1) + __c;
+ const _Tp __npam2 = _Tp(__n - 2) + __a;
+ const _Tp __npbm2 = _Tp(__n - 2) + __b;
+ const _Tp __npcm2 = _Tp(__n - 2) + __c;
+ const _Tp __tnm1 = _Tp(2 * __n - 1);
+ const _Tp __tnm3 = _Tp(2 * __n - 3);
+ const _Tp __tnm5 = _Tp(2 * __n - 5);
+ const _Tp __n2 = __n * __n;
+ const _Tp __F1 = (_Tp(3) * __n2 + (__a + __b - _Tp(6)) * __n
+ + _Tp(2) - __a * __b - _Tp(2) * (__a + __b))
+ / (_Tp(2) * __tnm3 * __npcm1);
+ const _Tp __F2 = -(_Tp(3) * __n2 - (__a + __b + _Tp(6)) * __n
+ + _Tp(2) - __a * __b) * __npam1 * __npbm1
+ / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
+ const _Tp __F3 = (__npam2 * __npam1 * __npbm2 * __npbm1
+ * (_Tp(__n - 2) - __a) * (_Tp(__n - 2) - __b))
+ / (_Tp(8) * __tnm3 * __tnm3 * __tnm5
+ * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
+ const _Tp __E = -__npam1 * __npbm1 * (_Tp(__n - 1) - __c)
+ / (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
+
+ _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
+ + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
+ _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
+ + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
+ const _Tp __r = __An / __Bn;
+
+ const _Tp __prec = std::abs((__F - __r) / __F);
+ __F = __r;
+
+ if (__prec < __eps || __n > __nmax)
+ break;
+
+ if (std::abs(__An) > __big || std::abs(__Bn) > __big)
+ {
+ __An /= __big;
+ __Bn /= __big;
+ __Anm1 /= __big;
+ __Bnm1 /= __big;
+ __Anm2 /= __big;
+ __Bnm2 /= __big;
+ __Anm3 /= __big;
+ __Bnm3 /= __big;
+ }
+ else if (std::abs(__An) < _Tp(1) / __big
+ || std::abs(__Bn) < _Tp(1) / __big)
+ {
+ __An *= __big;
+ __Bn *= __big;
+ __Anm1 *= __big;
+ __Bnm1 *= __big;
+ __Anm2 *= __big;
+ __Bnm2 *= __big;
+ __Anm3 *= __big;
+ __Bnm3 *= __big;
+ }
+
+ ++__n;
+ __Bnm3 = __Bnm2;
+ __Bnm2 = __Bnm1;
+ __Bnm1 = __Bn;
+ __Anm3 = __Anm2;
+ __Anm2 = __Anm1;
+ __Anm1 = __An;
+ }
+
+ if (__n >= __nmax)
+ std::__throw_runtime_error(__N("Iteration failed to converge "
+ "in __hyperg_luke."));
+
+ return __F;
+ }
+
+
+ /**
+ * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ by the reflection
+ * formulae in Abramowitz & Stegun formula 15.3.6 for d = c - a - b not integral
+ * and formula 15.3.11 for d = c - a - b integral.
+ * This assumes a, b, c != negative integer.
+ *
+ * The hypogeometric function is defined by
+ * @f[
+ * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
+ * \sum_{n=0}^{\infty}
+ * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
+ * \frac{x^n}{n!}
+ * @f]
+ *
+ * The reflection formula for nonintegral @f$ d = c - a - b @f$ is:
+ * @f[
+ * _2F_1(a,b;c;x) = \frac{\Gamma(c)\Gamma(d)}{\Gamma(c-a)\Gamma(c-b)}
+ * _2F_1(a,b;1-d;1-x)
+ * + \frac{\Gamma(c)\Gamma(-d)}{\Gamma(a)\Gamma(b)}
+ * _2F_1(c-a,c-b;1+d;1-x)
+ * @f]
+ *
+ * The reflection formula for integral @f$ m = c - a - b @f$ is:
+ * @f[
+ * _2F_1(a,b;a+b+m;x) = \frac{\Gamma(m)\Gamma(a+b+m)}{\Gamma(a+m)\Gamma(b+m)}
+ * \sum_{k=0}^{m-1} \frac{(m+a)_k(m+b)_k}{k!(1-m)_k}
+ * -
+ * @f]
+ */
+ template<typename _Tp>
+ _Tp
+ __hyperg_reflect(const _Tp __a, const _Tp __b, const _Tp __c,
+ const _Tp __x)
+ {
+ const _Tp __d = __c - __a - __b;
+ const int __intd = std::floor(__d + _Tp(0.5L));
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __toler = _Tp(1000) * __eps;
+ const _Tp __log_max = std::log(std::numeric_limits<_Tp>::max());
+ const bool __d_integer = (std::abs(__d - __intd) < __toler);
+
+ if (__d_integer)
+ {
+ const _Tp __ln_omx = std::log(_Tp(1) - __x);
+ const _Tp __ad = std::abs(__d);
+ _Tp __F1, __F2;
+
+ _Tp __d1, __d2;
+ if (__d >= _Tp(0))
+ {
+ __d1 = __d;
+ __d2 = _Tp(0);
+ }
+ else
+ {
+ __d1 = _Tp(0);
+ __d2 = __d;
+ }
+
+ const _Tp __lng_c = __log_gamma(__c);
+
+ // Evaluate F1.
+ if (__ad < __eps)
+ {
+ // d = c - a - b = 0.
+ __F1 = _Tp(0);
+ }
+ else
+ {
+
+ bool __ok_d1 = true;
+ _Tp __lng_ad, __lng_ad1, __lng_bd1;
+ __try
+ {
+ __lng_ad = __log_gamma(__ad);
+ __lng_ad1 = __log_gamma(__a + __d1);
+ __lng_bd1 = __log_gamma(__b + __d1);
+ }
+ __catch(...)
+ {
+ __ok_d1 = false;
+ }
+
+ if (__ok_d1)
+ {
+ /* Gamma functions in the denominator are ok.
+ * Proceed with evaluation.
+ */
+ _Tp __sum1 = _Tp(1);
+ _Tp __term = _Tp(1);
+ _Tp __ln_pre1 = __lng_ad + __lng_c + __d2 * __ln_omx
+ - __lng_ad1 - __lng_bd1;
+
+ /* Do F1 sum.
+ */
+ for (int __i = 1; __i < __ad; ++__i)
+ {
+ const int __j = __i - 1;
+ __term *= (__a + __d2 + __j) * (__b + __d2 + __j)
+ / (_Tp(1) + __d2 + __j) / __i * (_Tp(1) - __x);
+ __sum1 += __term;
+ }
+
+ if (__ln_pre1 > __log_max)
+ std::__throw_runtime_error(__N("Overflow of gamma functions "
+ "in __hyperg_luke."));
+ else
+ __F1 = std::exp(__ln_pre1) * __sum1;
+ }
+ else
+ {
+ // Gamma functions in the denominator were not ok.
+ // So the F1 term is zero.
+ __F1 = _Tp(0);
+ }
+ } // end F1 evaluation
+
+ // Evaluate F2.
+ bool __ok_d2 = true;
+ _Tp __lng_ad2, __lng_bd2;
+ __try
+ {
+ __lng_ad2 = __log_gamma(__a + __d2);
+ __lng_bd2 = __log_gamma(__b + __d2);
+ }
+ __catch(...)
+ {
+ __ok_d2 = false;
+ }
+
+ if (__ok_d2)
+ {
+ // Gamma functions in the denominator are ok.
+ // Proceed with evaluation.
+ const int __maxiter = 2000;
+ const _Tp __psi_1 = -__numeric_constants<_Tp>::__gamma_e();
+ const _Tp __psi_1pd = __psi(_Tp(1) + __ad);
+ const _Tp __psi_apd1 = __psi(__a + __d1);
+ const _Tp __psi_bpd1 = __psi(__b + __d1);
+
+ _Tp __psi_term = __psi_1 + __psi_1pd - __psi_apd1
+ - __psi_bpd1 - __ln_omx;
+ _Tp __fact = _Tp(1);
+ _Tp __sum2 = __psi_term;
+ _Tp __ln_pre2 = __lng_c + __d1 * __ln_omx
+ - __lng_ad2 - __lng_bd2;
+
+ // Do F2 sum.
+ int __j;
+ for (__j = 1; __j < __maxiter; ++__j)
+ {
+ // Values for psi functions use recurrence; Abramowitz & Stegun 6.3.5
+ const _Tp __term1 = _Tp(1) / _Tp(__j)
+ + _Tp(1) / (__ad + __j);
+ const _Tp __term2 = _Tp(1) / (__a + __d1 + _Tp(__j - 1))
+ + _Tp(1) / (__b + __d1 + _Tp(__j - 1));
+ __psi_term += __term1 - __term2;
+ __fact *= (__a + __d1 + _Tp(__j - 1))
+ * (__b + __d1 + _Tp(__j - 1))
+ / ((__ad + __j) * __j) * (_Tp(1) - __x);
+ const _Tp __delta = __fact * __psi_term;
+ __sum2 += __delta;
+ if (std::abs(__delta) < __eps * std::abs(__sum2))
+ break;
+ }
+ if (__j == __maxiter)
+ std::__throw_runtime_error(__N("Sum F2 failed to converge "
+ "in __hyperg_reflect"));
+
+ if (__sum2 == _Tp(0))
+ __F2 = _Tp(0);
+ else
+ __F2 = std::exp(__ln_pre2) * __sum2;
+ }
+ else
+ {
+ // Gamma functions in the denominator not ok.
+ // So the F2 term is zero.
+ __F2 = _Tp(0);
+ } // end F2 evaluation
+
+ const _Tp __sgn_2 = (__intd % 2 == 1 ? -_Tp(1) : _Tp(1));
+ const _Tp __F = __F1 + __sgn_2 * __F2;
+
+ return __F;
+ }
+ else
+ {
+ // d = c - a - b not an integer.
+
+ // These gamma functions appear in the denominator, so we
+ // catch their harmless domain errors and set the terms to zero.
+ bool __ok1 = true;
+ _Tp __sgn_g1ca = _Tp(0), __ln_g1ca = _Tp(0);
+ _Tp __sgn_g1cb = _Tp(0), __ln_g1cb = _Tp(0);
+ __try
+ {
+ __sgn_g1ca = __log_gamma_sign(__c - __a);
+ __ln_g1ca = __log_gamma(__c - __a);
+ __sgn_g1cb = __log_gamma_sign(__c - __b);
+ __ln_g1cb = __log_gamma(__c - __b);
+ }
+ __catch(...)
+ {
+ __ok1 = false;
+ }
+
+ bool __ok2 = true;
+ _Tp __sgn_g2a = _Tp(0), __ln_g2a = _Tp(0);
+ _Tp __sgn_g2b = _Tp(0), __ln_g2b = _Tp(0);
+ __try
+ {
+ __sgn_g2a = __log_gamma_sign(__a);
+ __ln_g2a = __log_gamma(__a);
+ __sgn_g2b = __log_gamma_sign(__b);
+ __ln_g2b = __log_gamma(__b);
+ }
+ __catch(...)
+ {
+ __ok2 = false;
+ }
+
+ const _Tp __sgn_gc = __log_gamma_sign(__c);
+ const _Tp __ln_gc = __log_gamma(__c);
+ const _Tp __sgn_gd = __log_gamma_sign(__d);
+ const _Tp __ln_gd = __log_gamma(__d);
+ const _Tp __sgn_gmd = __log_gamma_sign(-__d);
+ const _Tp __ln_gmd = __log_gamma(-__d);
+
+ const _Tp __sgn1 = __sgn_gc * __sgn_gd * __sgn_g1ca * __sgn_g1cb;
+ const _Tp __sgn2 = __sgn_gc * __sgn_gmd * __sgn_g2a * __sgn_g2b;
+
+ _Tp __pre1, __pre2;
+ if (__ok1 && __ok2)
+ {
+ _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
+ _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
+ + __d * std::log(_Tp(1) - __x);
+ if (__ln_pre1 < __log_max && __ln_pre2 < __log_max)
+ {
+ __pre1 = std::exp(__ln_pre1);
+ __pre2 = std::exp(__ln_pre2);
+ __pre1 *= __sgn1;
+ __pre2 *= __sgn2;
+ }
+ else
+ {
+ std::__throw_runtime_error(__N("Overflow of gamma functions "
+ "in __hyperg_reflect"));
+ }
+ }
+ else if (__ok1 && !__ok2)
+ {
+ _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
+ if (__ln_pre1 < __log_max)
+ {
+ __pre1 = std::exp(__ln_pre1);
+ __pre1 *= __sgn1;
+ __pre2 = _Tp(0);
+ }
+ else
+ {
+ std::__throw_runtime_error(__N("Overflow of gamma functions "
+ "in __hyperg_reflect"));
+ }
+ }
+ else if (!__ok1 && __ok2)
+ {
+ _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
+ + __d * std::log(_Tp(1) - __x);
+ if (__ln_pre2 < __log_max)
+ {
+ __pre1 = _Tp(0);
+ __pre2 = std::exp(__ln_pre2);
+ __pre2 *= __sgn2;
+ }
+ else
+ {
+ std::__throw_runtime_error(__N("Overflow of gamma functions "
+ "in __hyperg_reflect"));
+ }
+ }
+ else
+ {
+ __pre1 = _Tp(0);
+ __pre2 = _Tp(0);
+ std::__throw_runtime_error(__N("Underflow of gamma functions "
+ "in __hyperg_reflect"));
+ }
+
+ const _Tp __F1 = __hyperg_series(__a, __b, _Tp(1) - __d,
+ _Tp(1) - __x);
+ const _Tp __F2 = __hyperg_series(__c - __a, __c - __b, _Tp(1) + __d,
+ _Tp(1) - __x);
+
+ const _Tp __F = __pre1 * __F1 + __pre2 * __F2;
+
+ return __F;
+ }
+ }
+
+
+ /**
+ * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$.
+ *
+ * The hypogeometric function is defined by
+ * @f[
+ * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
+ * \sum_{n=0}^{\infty}
+ * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
+ * \frac{x^n}{n!}
+ * @f]
+ *
+ * @param __a The first "numerator" parameter.
+ * @param __a The second "numerator" parameter.
+ * @param __c The "denominator" parameter.
+ * @param __x The argument of the confluent hypergeometric function.
+ * @return The confluent hypergeometric function.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __hyperg(const _Tp __a, const _Tp __b, const _Tp __c, const _Tp __x)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ const _Tp __a_nint = std::tr1::nearbyint(__a);
+ const _Tp __b_nint = std::tr1::nearbyint(__b);
+ const _Tp __c_nint = std::tr1::nearbyint(__c);
+#else
+ const _Tp __a_nint = static_cast<int>(__a + _Tp(0.5L));
+ const _Tp __b_nint = static_cast<int>(__b + _Tp(0.5L));
+ const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
+#endif
+ const _Tp __toler = _Tp(1000) * std::numeric_limits<_Tp>::epsilon();
+ if (std::abs(__x) >= _Tp(1))
+ std::__throw_domain_error(__N("Argument outside unit circle "
+ "in __hyperg."));
+ else if (__isnan(__a) || __isnan(__b)
+ || __isnan(__c) || __isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__c_nint == __c && __c_nint <= _Tp(0))
+ return std::numeric_limits<_Tp>::infinity();
+ else if (std::abs(__c - __b) < __toler || std::abs(__c - __a) < __toler)
+ return std::pow(_Tp(1) - __x, __c - __a - __b);
+ else if (__a >= _Tp(0) && __b >= _Tp(0) && __c >= _Tp(0)
+ && __x >= _Tp(0) && __x < _Tp(0.995L))
+ return __hyperg_series(__a, __b, __c, __x);
+ else if (std::abs(__a) < _Tp(10) && std::abs(__b) < _Tp(10))
+ {
+ // For integer a and b the hypergeometric function is a finite polynomial.
+ if (__a < _Tp(0) && std::abs(__a - __a_nint) < __toler)
+ return __hyperg_series(__a_nint, __b, __c, __x);
+ else if (__b < _Tp(0) && std::abs(__b - __b_nint) < __toler)
+ return __hyperg_series(__a, __b_nint, __c, __x);
+ else if (__x < -_Tp(0.25L))
+ return __hyperg_luke(__a, __b, __c, __x);
+ else if (__x < _Tp(0.5L))
+ return __hyperg_series(__a, __b, __c, __x);
+ else
+ if (std::abs(__c) > _Tp(10))
+ return __hyperg_series(__a, __b, __c, __x);
+ else
+ return __hyperg_reflect(__a, __b, __c, __x);
+ }
+ else
+ return __hyperg_luke(__a, __b, __c, __x);
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/inttypes.h b/gcc-4.4.0/libstdc++-v3/include/tr1/inttypes.h
new file mode 100644
index 000000000..4c8fd45d8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/inttypes.h
@@ -0,0 +1,34 @@
+// TR1 inttypes.h -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/inttypes.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_INTTYPES_H
+#define _GLIBCXX_TR1_INTTYPES_H 1
+
+#include <tr1/cinttypes>
+
+#endif // _GLIBCXX_TR1_INTTYPES_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/legendre_function.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/legendre_function.tcc
new file mode 100644
index 000000000..8b59814da
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/legendre_function.tcc
@@ -0,0 +1,305 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/legendre_function.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) Handbook of Mathematical Functions,
+// ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 8, pp. 331-341
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
+// 2nd ed, pp. 252-254
+
+#ifndef _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC
+#define _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC 1
+
+#include "special_function_util.h"
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Return the Legendre polynomial by recursion on order
+ * @f$ l @f$.
+ *
+ * The Legendre function of @f$ l @f$ and @f$ x @f$,
+ * @f$ P_l(x) @f$, is defined by:
+ * @f[
+ * P_l(x) = \frac{1}{2^l l!}\frac{d^l}{dx^l}(x^2 - 1)^{l}
+ * @f]
+ *
+ * @param l The order of the Legendre polynomial. @f$l >= 0@f$.
+ * @param x The argument of the Legendre polynomial. @f$|x| <= 1@f$.
+ */
+ template<typename _Tp>
+ _Tp
+ __poly_legendre_p(const unsigned int __l, const _Tp __x)
+ {
+
+ if ((__x < _Tp(-1)) || (__x > _Tp(+1)))
+ std::__throw_domain_error(__N("Argument out of range"
+ " in __poly_legendre_p."));
+ else if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x == +_Tp(1))
+ return +_Tp(1);
+ else if (__x == -_Tp(1))
+ return (__l % 2 == 1 ? -_Tp(1) : +_Tp(1));
+ else
+ {
+ _Tp __p_lm2 = _Tp(1);
+ if (__l == 0)
+ return __p_lm2;
+
+ _Tp __p_lm1 = __x;
+ if (__l == 1)
+ return __p_lm1;
+
+ _Tp __p_l = 0;
+ for (unsigned int __ll = 2; __ll <= __l; ++__ll)
+ {
+ // This arrangement is supposed to be better for roundoff
+ // protection, Arfken, 2nd Ed, Eq 12.17a.
+ __p_l = _Tp(2) * __x * __p_lm1 - __p_lm2
+ - (__x * __p_lm1 - __p_lm2) / _Tp(__ll);
+ __p_lm2 = __p_lm1;
+ __p_lm1 = __p_l;
+ }
+
+ return __p_l;
+ }
+ }
+
+
+ /**
+ * @brief Return the associated Legendre function by recursion
+ * on @f$ l @f$.
+ *
+ * The associated Legendre function is derived from the Legendre function
+ * @f$ P_l(x) @f$ by the Rodrigues formula:
+ * @f[
+ * P_l^m(x) = (1 - x^2)^{m/2}\frac{d^m}{dx^m}P_l(x)
+ * @f]
+ *
+ * @param l The order of the associated Legendre function.
+ * @f$ l >= 0 @f$.
+ * @param m The order of the associated Legendre function.
+ * @f$ m <= l @f$.
+ * @param x The argument of the associated Legendre function.
+ * @f$ |x| <= 1 @f$.
+ */
+ template<typename _Tp>
+ _Tp
+ __assoc_legendre_p(const unsigned int __l, const unsigned int __m,
+ const _Tp __x)
+ {
+
+ if (__x < _Tp(-1) || __x > _Tp(+1))
+ std::__throw_domain_error(__N("Argument out of range"
+ " in __assoc_legendre_p."));
+ else if (__m > __l)
+ std::__throw_domain_error(__N("Degree out of range"
+ " in __assoc_legendre_p."));
+ else if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__m == 0)
+ return __poly_legendre_p(__l, __x);
+ else
+ {
+ _Tp __p_mm = _Tp(1);
+ if (__m > 0)
+ {
+ // Two square roots seem more accurate more of the time
+ // than just one.
+ _Tp __root = std::sqrt(_Tp(1) - __x) * std::sqrt(_Tp(1) + __x);
+ _Tp __fact = _Tp(1);
+ for (unsigned int __i = 1; __i <= __m; ++__i)
+ {
+ __p_mm *= -__fact * __root;
+ __fact += _Tp(2);
+ }
+ }
+ if (__l == __m)
+ return __p_mm;
+
+ _Tp __p_mp1m = _Tp(2 * __m + 1) * __x * __p_mm;
+ if (__l == __m + 1)
+ return __p_mp1m;
+
+ _Tp __p_lm2m = __p_mm;
+ _Tp __P_lm1m = __p_mp1m;
+ _Tp __p_lm = _Tp(0);
+ for (unsigned int __j = __m + 2; __j <= __l; ++__j)
+ {
+ __p_lm = (_Tp(2 * __j - 1) * __x * __P_lm1m
+ - _Tp(__j + __m - 1) * __p_lm2m) / _Tp(__j - __m);
+ __p_lm2m = __P_lm1m;
+ __P_lm1m = __p_lm;
+ }
+
+ return __p_lm;
+ }
+ }
+
+
+ /**
+ * @brief Return the spherical associated Legendre function.
+ *
+ * The spherical associated Legendre function of @f$ l @f$, @f$ m @f$,
+ * and @f$ \theta @f$ is defined as @f$ Y_l^m(\theta,0) @f$ where
+ * @f[
+ * Y_l^m(\theta,\phi) = (-1)^m[\frac{(2l+1)}{4\pi}
+ * \frac{(l-m)!}{(l+m)!}]
+ * P_l^m(\cos\theta) \exp^{im\phi}
+ * @f]
+ * is the spherical harmonic function and @f$ P_l^m(x) @f$ is the
+ * associated Legendre function.
+ *
+ * This function differs from the associated Legendre function by
+ * argument (@f$x = \cos(\theta)@f$) and by a normalization factor
+ * but this factor is rather large for large @f$ l @f$ and @f$ m @f$
+ * and so this function is stable for larger differences of @f$ l @f$
+ * and @f$ m @f$.
+ *
+ * @param l The order of the spherical associated Legendre function.
+ * @f$ l >= 0 @f$.
+ * @param m The order of the spherical associated Legendre function.
+ * @f$ m <= l @f$.
+ * @param theta The radian angle argument of the spherical associated
+ * Legendre function.
+ */
+ template <typename _Tp>
+ _Tp
+ __sph_legendre(const unsigned int __l, const unsigned int __m,
+ const _Tp __theta)
+ {
+ if (__isnan(__theta))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+
+ const _Tp __x = std::cos(__theta);
+
+ if (__l < __m)
+ {
+ std::__throw_domain_error(__N("Bad argument "
+ "in __sph_legendre."));
+ }
+ else if (__m == 0)
+ {
+ _Tp __P = __poly_legendre_p(__l, __x);
+ _Tp __fact = std::sqrt(_Tp(2 * __l + 1)
+ / (_Tp(4) * __numeric_constants<_Tp>::__pi()));
+ __P *= __fact;
+ return __P;
+ }
+ else if (__x == _Tp(1) || __x == -_Tp(1))
+ {
+ // m > 0 here
+ return _Tp(0);
+ }
+ else
+ {
+ // m > 0 and |x| < 1 here
+
+ // Starting value for recursion.
+ // Y_m^m(x) = sqrt( (2m+1)/(4pi m) gamma(m+1/2)/gamma(m) )
+ // (-1)^m (1-x^2)^(m/2) / pi^(1/4)
+ const _Tp __sgn = ( __m % 2 == 1 ? -_Tp(1) : _Tp(1));
+ const _Tp __y_mp1m_factor = __x * std::sqrt(_Tp(2 * __m + 3));
+#if _GLIBCXX_USE_C99_MATH_TR1
+ const _Tp __lncirc = std::tr1::log1p(-__x * __x);
+#else
+ const _Tp __lncirc = std::log(_Tp(1) - __x * __x);
+#endif
+ // Gamma(m+1/2) / Gamma(m)
+#if _GLIBCXX_USE_C99_MATH_TR1
+ const _Tp __lnpoch = std::tr1::lgamma(_Tp(__m + _Tp(0.5L)))
+ - std::tr1::lgamma(_Tp(__m));
+#else
+ const _Tp __lnpoch = __log_gamma(_Tp(__m + _Tp(0.5L)))
+ - __log_gamma(_Tp(__m));
+#endif
+ const _Tp __lnpre_val =
+ -_Tp(0.25L) * __numeric_constants<_Tp>::__lnpi()
+ + _Tp(0.5L) * (__lnpoch + __m * __lncirc);
+ _Tp __sr = std::sqrt((_Tp(2) + _Tp(1) / __m)
+ / (_Tp(4) * __numeric_constants<_Tp>::__pi()));
+ _Tp __y_mm = __sgn * __sr * std::exp(__lnpre_val);
+ _Tp __y_mp1m = __y_mp1m_factor * __y_mm;
+
+ if (__l == __m)
+ {
+ return __y_mm;
+ }
+ else if (__l == __m + 1)
+ {
+ return __y_mp1m;
+ }
+ else
+ {
+ _Tp __y_lm = _Tp(0);
+
+ // Compute Y_l^m, l > m+1, upward recursion on l.
+ for ( int __ll = __m + 2; __ll <= __l; ++__ll)
+ {
+ const _Tp __rat1 = _Tp(__ll - __m) / _Tp(__ll + __m);
+ const _Tp __rat2 = _Tp(__ll - __m - 1) / _Tp(__ll + __m - 1);
+ const _Tp __fact1 = std::sqrt(__rat1 * _Tp(2 * __ll + 1)
+ * _Tp(2 * __ll - 1));
+ const _Tp __fact2 = std::sqrt(__rat1 * __rat2 * _Tp(2 * __ll + 1)
+ / _Tp(2 * __ll - 3));
+ __y_lm = (__x * __y_mp1m * __fact1
+ - (__ll + __m - 1) * __y_mm * __fact2) / _Tp(__ll - __m);
+ __y_mm = __y_mp1m;
+ __y_mp1m = __y_lm;
+ }
+
+ return __y_lm;
+ }
+ }
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_LEGENDRE_FUNCTION_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/limits.h b/gcc-4.4.0/libstdc++-v3/include/tr1/limits.h
new file mode 100644
index 000000000..d95d360fd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/limits.h
@@ -0,0 +1,34 @@
+// TR1 limits.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/limits.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_LIMITS_H
+#define _TR1_LIMITS_H 1
+
+#include <tr1/climits>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/math.h b/gcc-4.4.0/libstdc++-v3/include/tr1/math.h
new file mode 100644
index 000000000..15d6d6419
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/math.h
@@ -0,0 +1,186 @@
+// TR1 math.h -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/math.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_MATH_H
+#define _GLIBCXX_TR1_MATH_H 1
+
+#include <tr1/cmath>
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+using std::tr1::acos;
+using std::tr1::acosh;
+using std::tr1::asin;
+using std::tr1::asinh;
+using std::tr1::atan;
+using std::tr1::atan2;
+using std::tr1::atanh;
+using std::tr1::cbrt;
+using std::tr1::ceil;
+using std::tr1::copysign;
+using std::tr1::cos;
+using std::tr1::cosh;
+using std::tr1::erf;
+using std::tr1::erfc;
+using std::tr1::exp;
+using std::tr1::exp2;
+using std::tr1::expm1;
+using std::tr1::fabs;
+using std::tr1::fdim;
+using std::tr1::floor;
+using std::tr1::fma;
+using std::tr1::fmax;
+using std::tr1::fmin;
+using std::tr1::fmod;
+using std::tr1::frexp;
+using std::tr1::hypot;
+using std::tr1::ilogb;
+using std::tr1::ldexp;
+using std::tr1::lgamma;
+using std::tr1::llrint;
+using std::tr1::llround;
+using std::tr1::log;
+using std::tr1::log10;
+using std::tr1::log1p;
+using std::tr1::log2;
+using std::tr1::logb;
+using std::tr1::lrint;
+using std::tr1::lround;
+using std::tr1::nearbyint;
+using std::tr1::nextafter;
+using std::tr1::nexttoward;
+using std::tr1::pow;
+using std::tr1::remainder;
+using std::tr1::remquo;
+using std::tr1::rint;
+using std::tr1::round;
+using std::tr1::scalbln;
+using std::tr1::scalbn;
+using std::tr1::sin;
+using std::tr1::sinh;
+using std::tr1::sqrt;
+using std::tr1::tan;
+using std::tr1::tanh;
+using std::tr1::tgamma;
+using std::tr1::trunc;
+
+#endif
+
+using std::tr1::assoc_laguerref;
+using std::tr1::assoc_laguerre;
+using std::tr1::assoc_laguerrel;
+
+using std::tr1::assoc_legendref;
+using std::tr1::assoc_legendre;
+using std::tr1::assoc_legendrel;
+
+using std::tr1::betaf;
+using std::tr1::beta;
+using std::tr1::betal;
+
+using std::tr1::comp_ellint_1f;
+using std::tr1::comp_ellint_1;
+using std::tr1::comp_ellint_1l;
+
+using std::tr1::comp_ellint_2f;
+using std::tr1::comp_ellint_2;
+using std::tr1::comp_ellint_2l;
+
+using std::tr1::comp_ellint_3f;
+using std::tr1::comp_ellint_3;
+using std::tr1::comp_ellint_3l;
+
+using std::tr1::conf_hypergf;
+using std::tr1::conf_hyperg;
+using std::tr1::conf_hypergl;
+
+using std::tr1::cyl_bessel_if;
+using std::tr1::cyl_bessel_i;
+using std::tr1::cyl_bessel_il;
+
+using std::tr1::cyl_bessel_jf;
+using std::tr1::cyl_bessel_j;
+using std::tr1::cyl_bessel_jl;
+
+using std::tr1::cyl_bessel_kf;
+using std::tr1::cyl_bessel_k;
+using std::tr1::cyl_bessel_kl;
+
+using std::tr1::cyl_neumannf;
+using std::tr1::cyl_neumann;
+using std::tr1::cyl_neumannl;
+
+using std::tr1::ellint_1f;
+using std::tr1::ellint_1;
+using std::tr1::ellint_1l;
+
+using std::tr1::ellint_2f;
+using std::tr1::ellint_2;
+using std::tr1::ellint_2l;
+
+using std::tr1::ellint_3f;
+using std::tr1::ellint_3;
+using std::tr1::ellint_3l;
+
+using std::tr1::expintf;
+using std::tr1::expint;
+using std::tr1::expintl;
+
+using std::tr1::hermitef;
+using std::tr1::hermite;
+using std::tr1::hermitel;
+
+using std::tr1::hypergf;
+using std::tr1::hyperg;
+using std::tr1::hypergl;
+
+using std::tr1::laguerref;
+using std::tr1::laguerre;
+using std::tr1::laguerrel;
+
+using std::tr1::legendref;
+using std::tr1::legendre;
+using std::tr1::legendrel;
+
+using std::tr1::riemann_zetaf;
+using std::tr1::riemann_zeta;
+using std::tr1::riemann_zetal;
+
+using std::tr1::sph_besself;
+using std::tr1::sph_bessel;
+using std::tr1::sph_bessell;
+
+using std::tr1::sph_legendref;
+using std::tr1::sph_legendre;
+using std::tr1::sph_legendrel;
+
+using std::tr1::sph_neumannf;
+using std::tr1::sph_neumann;
+using std::tr1::sph_neumannl;
+
+#endif // _GLIBCXX_TR1_MATH_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/memory b/gcc-4.4.0/libstdc++-v3/include/tr1/memory
new file mode 100644
index 000000000..8b021a1b1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/memory
@@ -0,0 +1,67 @@
+// <tr1/memory> -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file tr1/memory
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_MEMORY
+#define _GLIBCXX_TR1_MEMORY 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <memory>
+#include <exception> // std::exception
+#include <typeinfo> // std::type_info in get_deleter
+#include <bits/stl_algobase.h> // std::swap
+#include <iosfwd> // std::basic_ostream
+#include <ext/atomicity.h>
+#include <ext/concurrence.h>
+#include <bits/functexcept.h>
+#include <bits/stl_function.h> // std::less
+#include <debug/debug.h>
+#include <tr1/type_traits>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/boost_sp_counted_base.h>
+# include <tr1/shared_ptr.h>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/boost_sp_counted_base.h>
+# include <tr1/shared_ptr.h>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_MEMORY
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/modified_bessel_func.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/modified_bessel_func.tcc
new file mode 100644
index 000000000..7b8aebc3b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/modified_bessel_func.tcc
@@ -0,0 +1,436 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/modified_bessel_func.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland.
+//
+// References:
+// (1) Handbook of Mathematical Functions,
+// Ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 9, pp. 355-434, Section 10 pp. 435-478
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Numerical Recipes in C, by W. H. Press, S. A. Teukolsky,
+// W. T. Vetterling, B. P. Flannery, Cambridge University Press (1992),
+// 2nd ed, pp. 246-249.
+
+#ifndef _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC
+#define _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC 1
+
+#include "special_function_util.h"
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Compute the modified Bessel functions @f$ I_\nu(x) @f$ and
+ * @f$ K_\nu(x) @f$ and their first derivatives
+ * @f$ I'_\nu(x) @f$ and @f$ K'_\nu(x) @f$ respectively.
+ * These four functions are computed together for numerical
+ * stability.
+ *
+ * @param __nu The order of the Bessel functions.
+ * @param __x The argument of the Bessel functions.
+ * @param __Inu The output regular modified Bessel function.
+ * @param __Knu The output irregular modified Bessel function.
+ * @param __Ipnu The output derivative of the regular
+ * modified Bessel function.
+ * @param __Kpnu The output derivative of the irregular
+ * modified Bessel function.
+ */
+ template <typename _Tp>
+ void
+ __bessel_ik(const _Tp __nu, const _Tp __x,
+ _Tp & __Inu, _Tp & __Knu, _Tp & __Ipnu, _Tp & __Kpnu)
+ {
+ if (__x == _Tp(0))
+ {
+ if (__nu == _Tp(0))
+ {
+ __Inu = _Tp(1);
+ __Ipnu = _Tp(0);
+ }
+ else if (__nu == _Tp(1))
+ {
+ __Inu = _Tp(0);
+ __Ipnu = _Tp(0.5L);
+ }
+ else
+ {
+ __Inu = _Tp(0);
+ __Ipnu = _Tp(0);
+ }
+ __Knu = std::numeric_limits<_Tp>::infinity();
+ __Kpnu = -std::numeric_limits<_Tp>::infinity();
+ return;
+ }
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ const _Tp __fp_min = _Tp(10) * std::numeric_limits<_Tp>::epsilon();
+ const int __max_iter = 15000;
+ const _Tp __x_min = _Tp(2);
+
+ const int __nl = static_cast<int>(__nu + _Tp(0.5L));
+
+ const _Tp __mu = __nu - __nl;
+ const _Tp __mu2 = __mu * __mu;
+ const _Tp __xi = _Tp(1) / __x;
+ const _Tp __xi2 = _Tp(2) * __xi;
+ _Tp __h = __nu * __xi;
+ if ( __h < __fp_min )
+ __h = __fp_min;
+ _Tp __b = __xi2 * __nu;
+ _Tp __d = _Tp(0);
+ _Tp __c = __h;
+ int __i;
+ for ( __i = 1; __i <= __max_iter; ++__i )
+ {
+ __b += __xi2;
+ __d = _Tp(1) / (__b + __d);
+ __c = __b + _Tp(1) / __c;
+ const _Tp __del = __c * __d;
+ __h *= __del;
+ if (std::abs(__del - _Tp(1)) < __eps)
+ break;
+ }
+ if (__i > __max_iter)
+ std::__throw_runtime_error(__N("Argument x too large "
+ "in __bessel_jn; "
+ "try asymptotic expansion."));
+ _Tp __Inul = __fp_min;
+ _Tp __Ipnul = __h * __Inul;
+ _Tp __Inul1 = __Inul;
+ _Tp __Ipnu1 = __Ipnul;
+ _Tp __fact = __nu * __xi;
+ for (int __l = __nl; __l >= 1; --__l)
+ {
+ const _Tp __Inutemp = __fact * __Inul + __Ipnul;
+ __fact -= __xi;
+ __Ipnul = __fact * __Inutemp + __Inul;
+ __Inul = __Inutemp;
+ }
+ _Tp __f = __Ipnul / __Inul;
+ _Tp __Kmu, __Knu1;
+ if (__x < __x_min)
+ {
+ const _Tp __x2 = __x / _Tp(2);
+ const _Tp __pimu = __numeric_constants<_Tp>::__pi() * __mu;
+ const _Tp __fact = (std::abs(__pimu) < __eps
+ ? _Tp(1) : __pimu / std::sin(__pimu));
+ _Tp __d = -std::log(__x2);
+ _Tp __e = __mu * __d;
+ const _Tp __fact2 = (std::abs(__e) < __eps
+ ? _Tp(1) : std::sinh(__e) / __e);
+ _Tp __gam1, __gam2, __gampl, __gammi;
+ __gamma_temme(__mu, __gam1, __gam2, __gampl, __gammi);
+ _Tp __ff = __fact
+ * (__gam1 * std::cosh(__e) + __gam2 * __fact2 * __d);
+ _Tp __sum = __ff;
+ __e = std::exp(__e);
+ _Tp __p = __e / (_Tp(2) * __gampl);
+ _Tp __q = _Tp(1) / (_Tp(2) * __e * __gammi);
+ _Tp __c = _Tp(1);
+ __d = __x2 * __x2;
+ _Tp __sum1 = __p;
+ int __i;
+ for (__i = 1; __i <= __max_iter; ++__i)
+ {
+ __ff = (__i * __ff + __p + __q) / (__i * __i - __mu2);
+ __c *= __d / __i;
+ __p /= __i - __mu;
+ __q /= __i + __mu;
+ const _Tp __del = __c * __ff;
+ __sum += __del;
+ const _Tp __del1 = __c * (__p - __i * __ff);
+ __sum1 += __del1;
+ if (std::abs(__del) < __eps * std::abs(__sum))
+ break;
+ }
+ if (__i > __max_iter)
+ std::__throw_runtime_error(__N("Bessel k series failed to converge "
+ "in __bessel_jn."));
+ __Kmu = __sum;
+ __Knu1 = __sum1 * __xi2;
+ }
+ else
+ {
+ _Tp __b = _Tp(2) * (_Tp(1) + __x);
+ _Tp __d = _Tp(1) / __b;
+ _Tp __delh = __d;
+ _Tp __h = __delh;
+ _Tp __q1 = _Tp(0);
+ _Tp __q2 = _Tp(1);
+ _Tp __a1 = _Tp(0.25L) - __mu2;
+ _Tp __q = __c = __a1;
+ _Tp __a = -__a1;
+ _Tp __s = _Tp(1) + __q * __delh;
+ int __i;
+ for (__i = 2; __i <= __max_iter; ++__i)
+ {
+ __a -= 2 * (__i - 1);
+ __c = -__a * __c / __i;
+ const _Tp __qnew = (__q1 - __b * __q2) / __a;
+ __q1 = __q2;
+ __q2 = __qnew;
+ __q += __c * __qnew;
+ __b += _Tp(2);
+ __d = _Tp(1) / (__b + __a * __d);
+ __delh = (__b * __d - _Tp(1)) * __delh;
+ __h += __delh;
+ const _Tp __dels = __q * __delh;
+ __s += __dels;
+ if ( std::abs(__dels / __s) < __eps )
+ break;
+ }
+ if (__i > __max_iter)
+ std::__throw_runtime_error(__N("Steed's method failed "
+ "in __bessel_jn."));
+ __h = __a1 * __h;
+ __Kmu = std::sqrt(__numeric_constants<_Tp>::__pi() / (_Tp(2) * __x))
+ * std::exp(-__x) / __s;
+ __Knu1 = __Kmu * (__mu + __x + _Tp(0.5L) - __h) * __xi;
+ }
+
+ _Tp __Kpmu = __mu * __xi * __Kmu - __Knu1;
+ _Tp __Inumu = __xi / (__f * __Kmu - __Kpmu);
+ __Inu = __Inumu * __Inul1 / __Inul;
+ __Ipnu = __Inumu * __Ipnu1 / __Inul;
+ for ( __i = 1; __i <= __nl; ++__i )
+ {
+ const _Tp __Knutemp = (__mu + __i) * __xi2 * __Knu1 + __Kmu;
+ __Kmu = __Knu1;
+ __Knu1 = __Knutemp;
+ }
+ __Knu = __Kmu;
+ __Kpnu = __nu * __xi * __Kmu - __Knu1;
+
+ return;
+ }
+
+
+ /**
+ * @brief Return the regular modified Bessel function of order
+ * \f$ \nu \f$: \f$ I_{\nu}(x) \f$.
+ *
+ * The regular modified cylindrical Bessel function is:
+ * @f[
+ * I_{\nu}(x) = \sum_{k=0}^{\infty}
+ * \frac{(x/2)^{\nu + 2k}}{k!\Gamma(\nu+k+1)}
+ * @f]
+ *
+ * @param __nu The order of the regular modified Bessel function.
+ * @param __x The argument of the regular modified Bessel function.
+ * @return The output regular modified Bessel function.
+ */
+ template<typename _Tp>
+ _Tp
+ __cyl_bessel_i(const _Tp __nu, const _Tp __x)
+ {
+ if (__nu < _Tp(0) || __x < _Tp(0))
+ std::__throw_domain_error(__N("Bad argument "
+ "in __cyl_bessel_i."));
+ else if (__isnan(__nu) || __isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x * __x < _Tp(10) * (__nu + _Tp(1)))
+ return __cyl_bessel_ij_series(__nu, __x, +_Tp(1), 200);
+ else
+ {
+ _Tp __I_nu, __K_nu, __Ip_nu, __Kp_nu;
+ __bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
+ return __I_nu;
+ }
+ }
+
+
+ /**
+ * @brief Return the irregular modified Bessel function
+ * \f$ K_{\nu}(x) \f$ of order \f$ \nu \f$.
+ *
+ * The irregular modified Bessel function is defined by:
+ * @f[
+ * K_{\nu}(x) = \frac{\pi}{2}
+ * \frac{I_{-\nu}(x) - I_{\nu}(x)}{\sin \nu\pi}
+ * @f]
+ * where for integral \f$ \nu = n \f$ a limit is taken:
+ * \f$ lim_{\nu \to n} \f$.
+ *
+ * @param __nu The order of the irregular modified Bessel function.
+ * @param __x The argument of the irregular modified Bessel function.
+ * @return The output irregular modified Bessel function.
+ */
+ template<typename _Tp>
+ _Tp
+ __cyl_bessel_k(const _Tp __nu, const _Tp __x)
+ {
+ if (__nu < _Tp(0) || __x < _Tp(0))
+ std::__throw_domain_error(__N("Bad argument "
+ "in __cyl_bessel_k."));
+ else if (__isnan(__nu) || __isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else
+ {
+ _Tp __I_nu, __K_nu, __Ip_nu, __Kp_nu;
+ __bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
+ return __K_nu;
+ }
+ }
+
+
+ /**
+ * @brief Compute the spherical modified Bessel functions
+ * @f$ i_n(x) @f$ and @f$ k_n(x) @f$ and their first
+ * derivatives @f$ i'_n(x) @f$ and @f$ k'_n(x) @f$
+ * respectively.
+ *
+ * @param __n The order of the modified spherical Bessel function.
+ * @param __x The argument of the modified spherical Bessel function.
+ * @param __i_n The output regular modified spherical Bessel function.
+ * @param __k_n The output irregular modified spherical
+ * Bessel function.
+ * @param __ip_n The output derivative of the regular modified
+ * spherical Bessel function.
+ * @param __kp_n The output derivative of the irregular modified
+ * spherical Bessel function.
+ */
+ template <typename _Tp>
+ void
+ __sph_bessel_ik(const unsigned int __n, const _Tp __x,
+ _Tp & __i_n, _Tp & __k_n, _Tp & __ip_n, _Tp & __kp_n)
+ {
+ const _Tp __nu = _Tp(__n) + _Tp(0.5L);
+
+ _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu;
+ __bessel_ik(__nu, __x, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
+
+ const _Tp __factor = __numeric_constants<_Tp>::__sqrtpio2()
+ / std::sqrt(__x);
+
+ __i_n = __factor * __I_nu;
+ __k_n = __factor * __K_nu;
+ __ip_n = __factor * __Ip_nu - __i_n / (_Tp(2) * __x);
+ __kp_n = __factor * __Kp_nu - __k_n / (_Tp(2) * __x);
+
+ return;
+ }
+
+
+ /**
+ * @brief Compute the Airy functions
+ * @f$ Ai(x) @f$ and @f$ Bi(x) @f$ and their first
+ * derivatives @f$ Ai'(x) @f$ and @f$ Bi(x) @f$
+ * respectively.
+ *
+ * @param __n The order of the Airy functions.
+ * @param __x The argument of the Airy functions.
+ * @param __i_n The output Airy function.
+ * @param __k_n The output Airy function.
+ * @param __ip_n The output derivative of the Airy function.
+ * @param __kp_n The output derivative of the Airy function.
+ */
+ template <typename _Tp>
+ void
+ __airy(const _Tp __x,
+ _Tp & __Ai, _Tp & __Bi, _Tp & __Aip, _Tp & __Bip)
+ {
+ const _Tp __absx = std::abs(__x);
+ const _Tp __rootx = std::sqrt(__absx);
+ const _Tp __z = _Tp(2) * __absx * __rootx / _Tp(3);
+
+ if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__x > _Tp(0))
+ {
+ _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu;
+
+ __bessel_ik(_Tp(1) / _Tp(3), __z, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
+ __Ai = __rootx * __K_nu
+ / (__numeric_constants<_Tp>::__sqrt3()
+ * __numeric_constants<_Tp>::__pi());
+ __Bi = __rootx * (__K_nu / __numeric_constants<_Tp>::__pi()
+ + _Tp(2) * __I_nu / __numeric_constants<_Tp>::__sqrt3());
+
+ __bessel_ik(_Tp(2) / _Tp(3), __z, __I_nu, __K_nu, __Ip_nu, __Kp_nu);
+ __Aip = -__x * __K_nu
+ / (__numeric_constants<_Tp>::__sqrt3()
+ * __numeric_constants<_Tp>::__pi());
+ __Bip = __x * (__K_nu / __numeric_constants<_Tp>::__pi()
+ + _Tp(2) * __I_nu
+ / __numeric_constants<_Tp>::__sqrt3());
+ }
+ else if (__x < _Tp(0))
+ {
+ _Tp __J_nu, __Jp_nu, __N_nu, __Np_nu;
+
+ __bessel_jn(_Tp(1) / _Tp(3), __z, __J_nu, __N_nu, __Jp_nu, __Np_nu);
+ __Ai = __rootx * (__J_nu
+ - __N_nu / __numeric_constants<_Tp>::__sqrt3()) / _Tp(2);
+ __Bi = -__rootx * (__N_nu
+ + __J_nu / __numeric_constants<_Tp>::__sqrt3()) / _Tp(2);
+
+ __bessel_jn(_Tp(2) / _Tp(3), __z, __J_nu, __N_nu, __Jp_nu, __Np_nu);
+ __Aip = __absx * (__N_nu / __numeric_constants<_Tp>::__sqrt3()
+ + __J_nu) / _Tp(2);
+ __Bip = __absx * (__J_nu / __numeric_constants<_Tp>::__sqrt3()
+ - __N_nu) / _Tp(2);
+ }
+ else
+ {
+ // Reference:
+ // Abramowitz & Stegun, page 446 section 10.4.4 on Airy functions.
+ // The number is Ai(0) = 3^{-2/3}/\Gamma(2/3).
+ __Ai = _Tp(0.35502805388781723926L);
+ __Bi = __Ai * __numeric_constants<_Tp>::__sqrt3();
+
+ // Reference:
+ // Abramowitz & Stegun, page 446 section 10.4.5 on Airy functions.
+ // The number is Ai'(0) = -3^{-1/3}/\Gamma(1/3).
+ __Aip = -_Tp(0.25881940379280679840L);
+ __Bip = -__Aip * __numeric_constants<_Tp>::__sqrt3();
+ }
+
+ return;
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_MODIFIED_BESSEL_FUNC_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/poly_hermite.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/poly_hermite.tcc
new file mode 100644
index 000000000..d4825a31e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/poly_hermite.tcc
@@ -0,0 +1,124 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/poly_hermite.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) Handbook of Mathematical Functions,
+// Ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications, Section 22 pp. 773-802
+
+#ifndef _GLIBCXX_TR1_POLY_HERMITE_TCC
+#define _GLIBCXX_TR1_POLY_HERMITE_TCC 1
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief This routine returns the Hermite polynomial
+ * of order n: \f$ H_n(x) \f$ by recursion on n.
+ *
+ * The Hermite polynomial is defined by:
+ * @f[
+ * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
+ * @f]
+ *
+ * @param __n The order of the Hermite polynomial.
+ * @param __x The argument of the Hermite polynomial.
+ * @return The value of the Hermite polynomial of order n
+ * and argument x.
+ */
+ template<typename _Tp>
+ _Tp
+ __poly_hermite_recursion(const unsigned int __n, const _Tp __x)
+ {
+ // Compute H_0.
+ _Tp __H_0 = 1;
+ if (__n == 0)
+ return __H_0;
+
+ // Compute H_1.
+ _Tp __H_1 = 2 * __x;
+ if (__n == 1)
+ return __H_1;
+
+ // Compute H_n.
+ _Tp __H_n, __H_nm1, __H_nm2;
+ unsigned int __i;
+ for (__H_nm2 = __H_0, __H_nm1 = __H_1, __i = 2; __i <= __n; ++__i)
+ {
+ __H_n = 2 * (__x * __H_nm1 + (__i - 1) * __H_nm2);
+ __H_nm2 = __H_nm1;
+ __H_nm1 = __H_n;
+ }
+
+ return __H_n;
+ }
+
+
+ /**
+ * @brief This routine returns the Hermite polynomial
+ * of order n: \f$ H_n(x) \f$.
+ *
+ * The Hermite polynomial is defined by:
+ * @f[
+ * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
+ * @f]
+ *
+ * @param __n The order of the Hermite polynomial.
+ * @param __x The argument of the Hermite polynomial.
+ * @return The value of the Hermite polynomial of order n
+ * and argument x.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __poly_hermite(const unsigned int __n, const _Tp __x)
+ {
+ if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else
+ return __poly_hermite_recursion(__n, __x);
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_POLY_HERMITE_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/poly_laguerre.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/poly_laguerre.tcc
new file mode 100644
index 000000000..9c999dbdf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/poly_laguerre.tcc
@@ -0,0 +1,329 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/poly_laguerre.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) Handbook of Mathematical Functions,
+// Ed. Milton Abramowitz and Irene A. Stegun,
+// Dover Publications,
+// Section 13, pp. 509-510, Section 22 pp. 773-802
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+
+#ifndef _GLIBCXX_TR1_POLY_LAGUERRE_TCC
+#define _GLIBCXX_TR1_POLY_LAGUERRE_TCC 1
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+
+ /**
+ * @brief This routine returns the associated Laguerre polynomial
+ * of order @f$ n @f$, degree @f$ \alpha @f$ for large n.
+ * Abramowitz & Stegun, 13.5.21
+ *
+ * @param __n The order of the Laguerre function.
+ * @param __alpha The degree of the Laguerre function.
+ * @param __x The argument of the Laguerre function.
+ * @return The value of the Laguerre function of order n,
+ * degree @f$ \alpha @f$, and argument x.
+ *
+ * This is from the GNU Scientific Library.
+ */
+ template<typename _Tpa, typename _Tp>
+ _Tp
+ __poly_laguerre_large_n(const unsigned __n, const _Tpa __alpha1,
+ const _Tp __x)
+ {
+ const _Tp __a = -_Tp(__n);
+ const _Tp __b = _Tp(__alpha1) + _Tp(1);
+ const _Tp __eta = _Tp(2) * __b - _Tp(4) * __a;
+ const _Tp __cos2th = __x / __eta;
+ const _Tp __sin2th = _Tp(1) - __cos2th;
+ const _Tp __th = std::acos(std::sqrt(__cos2th));
+ const _Tp __pre_h = __numeric_constants<_Tp>::__pi_2()
+ * __numeric_constants<_Tp>::__pi_2()
+ * __eta * __eta * __cos2th * __sin2th;
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+ const _Tp __lg_b = std::tr1::lgamma(_Tp(__n) + __b);
+ const _Tp __lnfact = std::tr1::lgamma(_Tp(__n + 1));
+#else
+ const _Tp __lg_b = __log_gamma(_Tp(__n) + __b);
+ const _Tp __lnfact = __log_gamma(_Tp(__n + 1));
+#endif
+
+ _Tp __pre_term1 = _Tp(0.5L) * (_Tp(1) - __b)
+ * std::log(_Tp(0.25L) * __x * __eta);
+ _Tp __pre_term2 = _Tp(0.25L) * std::log(__pre_h);
+ _Tp __lnpre = __lg_b - __lnfact + _Tp(0.5L) * __x
+ + __pre_term1 - __pre_term2;
+ _Tp __ser_term1 = std::sin(__a * __numeric_constants<_Tp>::__pi());
+ _Tp __ser_term2 = std::sin(_Tp(0.25L) * __eta
+ * (_Tp(2) * __th
+ - std::sin(_Tp(2) * __th))
+ + __numeric_constants<_Tp>::__pi_4());
+ _Tp __ser = __ser_term1 + __ser_term2;
+
+ return std::exp(__lnpre) * __ser;
+ }
+
+
+ /**
+ * @brief Evaluate the polynomial based on the confluent hypergeometric
+ * function in a safe way, with no restriction on the arguments.
+ *
+ * The associated Laguerre function is defined by
+ * @f[
+ * L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!}
+ * _1F_1(-n; \alpha + 1; x)
+ * @f]
+ * where @f$ (\alpha)_n @f$ is the Pochhammer symbol and
+ * @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function.
+ *
+ * This function assumes x != 0.
+ *
+ * This is from the GNU Scientific Library.
+ */
+ template<typename _Tpa, typename _Tp>
+ _Tp
+ __poly_laguerre_hyperg(const unsigned int __n, const _Tpa __alpha1,
+ const _Tp __x)
+ {
+ const _Tp __b = _Tp(__alpha1) + _Tp(1);
+ const _Tp __mx = -__x;
+ const _Tp __tc_sgn = (__x < _Tp(0) ? _Tp(1)
+ : ((__n % 2 == 1) ? -_Tp(1) : _Tp(1)));
+ // Get |x|^n/n!
+ _Tp __tc = _Tp(1);
+ const _Tp __ax = std::abs(__x);
+ for (unsigned int __k = 1; __k <= __n; ++__k)
+ __tc *= (__ax / __k);
+
+ _Tp __term = __tc * __tc_sgn;
+ _Tp __sum = __term;
+ for (int __k = int(__n) - 1; __k >= 0; --__k)
+ {
+ __term *= ((__b + _Tp(__k)) / _Tp(int(__n) - __k))
+ * _Tp(__k + 1) / __mx;
+ __sum += __term;
+ }
+
+ return __sum;
+ }
+
+
+ /**
+ * @brief This routine returns the associated Laguerre polynomial
+ * of order @f$ n @f$, degree @f$ \alpha @f$: @f$ L_n^\alpha(x) @f$
+ * by recursion.
+ *
+ * The associated Laguerre function is defined by
+ * @f[
+ * L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!}
+ * _1F_1(-n; \alpha + 1; x)
+ * @f]
+ * where @f$ (\alpha)_n @f$ is the Pochhammer symbol and
+ * @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function.
+ *
+ * The associated Laguerre polynomial is defined for integral
+ * @f$ \alpha = m @f$ by:
+ * @f[
+ * L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x)
+ * @f]
+ * where the Laguerre polynomial is defined by:
+ * @f[
+ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
+ * @f]
+ *
+ * @param __n The order of the Laguerre function.
+ * @param __alpha The degree of the Laguerre function.
+ * @param __x The argument of the Laguerre function.
+ * @return The value of the Laguerre function of order n,
+ * degree @f$ \alpha @f$, and argument x.
+ */
+ template<typename _Tpa, typename _Tp>
+ _Tp
+ __poly_laguerre_recursion(const unsigned int __n,
+ const _Tpa __alpha1, const _Tp __x)
+ {
+ // Compute l_0.
+ _Tp __l_0 = _Tp(1);
+ if (__n == 0)
+ return __l_0;
+
+ // Compute l_1^alpha.
+ _Tp __l_1 = -__x + _Tp(1) + _Tp(__alpha1);
+ if (__n == 1)
+ return __l_1;
+
+ // Compute l_n^alpha by recursion on n.
+ _Tp __l_n2 = __l_0;
+ _Tp __l_n1 = __l_1;
+ _Tp __l_n = _Tp(0);
+ for (unsigned int __nn = 2; __nn <= __n; ++__nn)
+ {
+ __l_n = (_Tp(2 * __nn - 1) + _Tp(__alpha1) - __x)
+ * __l_n1 / _Tp(__nn)
+ - (_Tp(__nn - 1) + _Tp(__alpha1)) * __l_n2 / _Tp(__nn);
+ __l_n2 = __l_n1;
+ __l_n1 = __l_n;
+ }
+
+ return __l_n;
+ }
+
+
+ /**
+ * @brief This routine returns the associated Laguerre polynomial
+ * of order n, degree @f$ \alpha @f$: @f$ L_n^alpha(x) @f$.
+ *
+ * The associated Laguerre function is defined by
+ * @f[
+ * L_n^\alpha(x) = \frac{(\alpha + 1)_n}{n!}
+ * _1F_1(-n; \alpha + 1; x)
+ * @f]
+ * where @f$ (\alpha)_n @f$ is the Pochhammer symbol and
+ * @f$ _1F_1(a; c; x) @f$ is the confluent hypergeometric function.
+ *
+ * The associated Laguerre polynomial is defined for integral
+ * @f$ \alpha = m @f$ by:
+ * @f[
+ * L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x)
+ * @f]
+ * where the Laguerre polynomial is defined by:
+ * @f[
+ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
+ * @f]
+ *
+ * @param __n The order of the Laguerre function.
+ * @param __alpha The degree of the Laguerre function.
+ * @param __x The argument of the Laguerre function.
+ * @return The value of the Laguerre function of order n,
+ * degree @f$ \alpha @f$, and argument x.
+ */
+ template<typename _Tpa, typename _Tp>
+ inline _Tp
+ __poly_laguerre(const unsigned int __n, const _Tpa __alpha1,
+ const _Tp __x)
+ {
+ if (__x < _Tp(0))
+ std::__throw_domain_error(__N("Negative argument "
+ "in __poly_laguerre."));
+ // Return NaN on NaN input.
+ else if (__isnan(__x))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__n == 0)
+ return _Tp(1);
+ else if (__n == 1)
+ return _Tp(1) + _Tp(__alpha1) - __x;
+ else if (__x == _Tp(0))
+ {
+ _Tp __prod = _Tp(__alpha1) + _Tp(1);
+ for (unsigned int __k = 2; __k <= __n; ++__k)
+ __prod *= (_Tp(__alpha1) + _Tp(__k)) / _Tp(__k);
+ return __prod;
+ }
+ else if (__n > 10000000 && _Tp(__alpha1) > -_Tp(1)
+ && __x < _Tp(2) * (_Tp(__alpha1) + _Tp(1)) + _Tp(4 * __n))
+ return __poly_laguerre_large_n(__n, __alpha1, __x);
+ else if (_Tp(__alpha1) >= _Tp(0)
+ || (__x > _Tp(0) && _Tp(__alpha1) < -_Tp(__n + 1)))
+ return __poly_laguerre_recursion(__n, __alpha1, __x);
+ else
+ return __poly_laguerre_hyperg(__n, __alpha1, __x);
+ }
+
+
+ /**
+ * @brief This routine returns the associated Laguerre polynomial
+ * of order n, degree m: @f$ L_n^m(x) @f$.
+ *
+ * The associated Laguerre polynomial is defined for integral
+ * @f$ \alpha = m @f$ by:
+ * @f[
+ * L_n^m(x) = (-1)^m \frac{d^m}{dx^m} L_{n + m}(x)
+ * @f]
+ * where the Laguerre polynomial is defined by:
+ * @f[
+ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
+ * @f]
+ *
+ * @param __n The order of the Laguerre polynomial.
+ * @param __m The degree of the Laguerre polynomial.
+ * @param __x The argument of the Laguerre polynomial.
+ * @return The value of the associated Laguerre polynomial of order n,
+ * degree m, and argument x.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __assoc_laguerre(const unsigned int __n, const unsigned int __m,
+ const _Tp __x)
+ {
+ return __poly_laguerre<unsigned int, _Tp>(__n, __m, __x);
+ }
+
+
+ /**
+ * @brief This routine returns the Laguerre polynomial
+ * of order n: @f$ L_n(x) @f$.
+ *
+ * The Laguerre polynomial is defined by:
+ * @f[
+ * L_n(x) = \frac{e^x}{n!} \frac{d^n}{dx^n} (x^ne^{-x})
+ * @f]
+ *
+ * @param __n The order of the Laguerre polynomial.
+ * @param __x The argument of the Laguerre polynomial.
+ * @return The value of the Laguerre polynomial of order n
+ * and argument x.
+ */
+ template<typename _Tp>
+ inline _Tp
+ __laguerre(const unsigned int __n, const _Tp __x)
+ {
+ return __poly_laguerre<unsigned int, _Tp>(__n, 0, __x);
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_POLY_LAGUERRE_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/random b/gcc-4.4.0/libstdc++-v3/include/tr1/random
new file mode 100644
index 000000000..a23519c52
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/random
@@ -0,0 +1,66 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file tr1/random
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_RANDOM
+#define _GLIBCXX_TR1_RANDOM 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <iosfwd>
+#include <limits>
+#include <ext/type_traits.h>
+#include <ext/numeric_traits.h>
+#include <bits/concept_check.h>
+#include <debug/debug.h>
+#include <tr1/type_traits>
+#include <tr1/cmath>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/random>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/random>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_RANDOM
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/regex b/gcc-4.4.0/libstdc++-v3/include/tr1/regex
new file mode 100644
index 000000000..b7e2cdfc8
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/regex
@@ -0,0 +1,64 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file tr1/regex
+ * @author Stephen M. Webb <stephen.webb@bregmasoft.ca>
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_REGEX
+#define _GLIBCXX_TR1_REGEX 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <algorithm>
+#include <bitset>
+#include <iterator>
+#include <locale>
+#include <stdexcept>
+#include <string>
+#include <vector>
+#include <utility>
+#include <sstream>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/regex>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/regex>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_REGEX
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/riemann_zeta.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1/riemann_zeta.tcc
new file mode 100644
index 000000000..c646c2e40
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/riemann_zeta.tcc
@@ -0,0 +1,435 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/riemann_zeta.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on:
+// (1) Handbook of Mathematical Functions,
+// Ed. by Milton Abramowitz and Irene A. Stegun,
+// Dover Publications, New-York, Section 5, pp. 807-808.
+// (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
+// (3) Gamma, Exploring Euler's Constant, Julian Havil,
+// Princeton, 2003.
+
+#ifndef _GLIBCXX_TR1_RIEMANN_ZETA_TCC
+#define _GLIBCXX_TR1_RIEMANN_ZETA_TCC 1
+
+#include "special_function_util.h"
+
+namespace std
+{
+namespace tr1
+{
+
+ // [5.2] Special functions
+
+ // Implementation-space details.
+ namespace __detail
+ {
+
+ /**
+ * @brief Compute the Riemann zeta function @f$ \zeta(s) @f$
+ * by summation for s > 1.
+ *
+ * The Riemann zeta function is defined by:
+ * \f[
+ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
+ * \f]
+ * For s < 1 use the reflection formula:
+ * \f[
+ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
+ * \f]
+ */
+ template<typename _Tp>
+ _Tp
+ __riemann_zeta_sum(const _Tp __s)
+ {
+ // A user shouldn't get to this.
+ if (__s < _Tp(1))
+ std::__throw_domain_error(__N("Bad argument in zeta sum."));
+
+ const unsigned int max_iter = 10000;
+ _Tp __zeta = _Tp(0);
+ for (unsigned int __k = 1; __k < max_iter; ++__k)
+ {
+ _Tp __term = std::pow(static_cast<_Tp>(__k), -__s);
+ if (__term < std::numeric_limits<_Tp>::epsilon())
+ {
+ break;
+ }
+ __zeta += __term;
+ }
+
+ return __zeta;
+ }
+
+
+ /**
+ * @brief Evaluate the Riemann zeta function @f$ \zeta(s) @f$
+ * by an alternate series for s > 0.
+ *
+ * The Riemann zeta function is defined by:
+ * \f[
+ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
+ * \f]
+ * For s < 1 use the reflection formula:
+ * \f[
+ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
+ * \f]
+ */
+ template<typename _Tp>
+ _Tp
+ __riemann_zeta_alt(const _Tp __s)
+ {
+ _Tp __sgn = _Tp(1);
+ _Tp __zeta = _Tp(0);
+ for (unsigned int __i = 1; __i < 10000000; ++__i)
+ {
+ _Tp __term = __sgn / std::pow(__i, __s);
+ if (std::abs(__term) < std::numeric_limits<_Tp>::epsilon())
+ break;
+ __zeta += __term;
+ __sgn *= _Tp(-1);
+ }
+ __zeta /= _Tp(1) - std::pow(_Tp(2), _Tp(1) - __s);
+
+ return __zeta;
+ }
+
+
+ /**
+ * @brief Evaluate the Riemann zeta function by series for all s != 1.
+ * Convergence is great until largish negative numbers.
+ * Then the convergence of the > 0 sum gets better.
+ *
+ * The series is:
+ * \f[
+ * \zeta(s) = \frac{1}{1-2^{1-s}}
+ * \sum_{n=0}^{\infty} \frac{1}{2^{n+1}}
+ * \sum_{k=0}^{n} (-1)^k \frac{n!}{(n-k)!k!} (k+1)^{-s}
+ * \f]
+ * Havil 2003, p. 206.
+ *
+ * The Riemann zeta function is defined by:
+ * \f[
+ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
+ * \f]
+ * For s < 1 use the reflection formula:
+ * \f[
+ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
+ * \f]
+ */
+ template<typename _Tp>
+ _Tp
+ __riemann_zeta_glob(const _Tp __s)
+ {
+ _Tp __zeta = _Tp(0);
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ // Max e exponent before overflow.
+ const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10
+ * std::log(_Tp(10)) - _Tp(1);
+
+ // This series works until the binomial coefficient blows up
+ // so use reflection.
+ if (__s < _Tp(0))
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ if (std::tr1::fmod(__s,_Tp(2)) == _Tp(0))
+ return _Tp(0);
+ else
+#endif
+ {
+ _Tp __zeta = __riemann_zeta_glob(_Tp(1) - __s);
+ __zeta *= std::pow(_Tp(2)
+ * __numeric_constants<_Tp>::__pi(), __s)
+ * std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
+#if _GLIBCXX_USE_C99_MATH_TR1
+ * std::exp(std::tr1::lgamma(_Tp(1) - __s))
+#else
+ * std::exp(__log_gamma(_Tp(1) - __s))
+#endif
+ / __numeric_constants<_Tp>::__pi();
+ return __zeta;
+ }
+ }
+
+ _Tp __num = _Tp(0.5L);
+ const unsigned int __maxit = 10000;
+ for (unsigned int __i = 0; __i < __maxit; ++__i)
+ {
+ bool __punt = false;
+ _Tp __sgn = _Tp(1);
+ _Tp __term = _Tp(0);
+ for (unsigned int __j = 0; __j <= __i; ++__j)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _Tp __bincoeff = std::tr1::lgamma(_Tp(1 + __i))
+ - std::tr1::lgamma(_Tp(1 + __j))
+ - std::tr1::lgamma(_Tp(1 + __i - __j));
+#else
+ _Tp __bincoeff = __log_gamma(_Tp(1 + __i))
+ - __log_gamma(_Tp(1 + __j))
+ - __log_gamma(_Tp(1 + __i - __j));
+#endif
+ if (__bincoeff > __max_bincoeff)
+ {
+ // This only gets hit for x << 0.
+ __punt = true;
+ break;
+ }
+ __bincoeff = std::exp(__bincoeff);
+ __term += __sgn * __bincoeff * std::pow(_Tp(1 + __j), -__s);
+ __sgn *= _Tp(-1);
+ }
+ if (__punt)
+ break;
+ __term *= __num;
+ __zeta += __term;
+ if (std::abs(__term/__zeta) < __eps)
+ break;
+ __num *= _Tp(0.5L);
+ }
+
+ __zeta /= _Tp(1) - std::pow(_Tp(2), _Tp(1) - __s);
+
+ return __zeta;
+ }
+
+
+ /**
+ * @brief Compute the Riemann zeta function @f$ \zeta(s) @f$
+ * using the product over prime factors.
+ * \f[
+ * \zeta(s) = \Pi_{i=1}^\infty \frac{1}{1 - p_i^{-s}}
+ * \f]
+ * where @f$ {p_i} @f$ are the prime numbers.
+ *
+ * The Riemann zeta function is defined by:
+ * \f[
+ * \zeta(s) = \sum_{k=1}^{\infty} \frac{1}{k^{s}} for s > 1
+ * \f]
+ * For s < 1 use the reflection formula:
+ * \f[
+ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
+ * \f]
+ */
+ template<typename _Tp>
+ _Tp
+ __riemann_zeta_product(const _Tp __s)
+ {
+ static const _Tp __prime[] = {
+ _Tp(2), _Tp(3), _Tp(5), _Tp(7), _Tp(11), _Tp(13), _Tp(17), _Tp(19),
+ _Tp(23), _Tp(29), _Tp(31), _Tp(37), _Tp(41), _Tp(43), _Tp(47),
+ _Tp(53), _Tp(59), _Tp(61), _Tp(67), _Tp(71), _Tp(73), _Tp(79),
+ _Tp(83), _Tp(89), _Tp(97), _Tp(101), _Tp(103), _Tp(107), _Tp(109)
+ };
+ static const unsigned int __num_primes = sizeof(__prime) / sizeof(_Tp);
+
+ _Tp __zeta = _Tp(1);
+ for (unsigned int __i = 0; __i < __num_primes; ++__i)
+ {
+ const _Tp __fact = _Tp(1) - std::pow(__prime[__i], -__s);
+ __zeta *= __fact;
+ if (_Tp(1) - __fact < std::numeric_limits<_Tp>::epsilon())
+ break;
+ }
+
+ __zeta = _Tp(1) / __zeta;
+
+ return __zeta;
+ }
+
+
+ /**
+ * @brief Return the Riemann zeta function @f$ \zeta(s) @f$.
+ *
+ * The Riemann zeta function is defined by:
+ * \f[
+ * \zeta(s) = \sum_{k=1}^{\infty} k^{-s} for s > 1
+ * \frac{(2\pi)^s}{pi} sin(\frac{\pi s}{2})
+ * \Gamma (1 - s) \zeta (1 - s) for s < 1
+ * \f]
+ * For s < 1 use the reflection formula:
+ * \f[
+ * \zeta(s) = 2^s \pi^{s-1} \Gamma(1-s) \zeta(1-s)
+ * \f]
+ */
+ template<typename _Tp>
+ _Tp
+ __riemann_zeta(const _Tp __s)
+ {
+ if (__isnan(__s))
+ return std::numeric_limits<_Tp>::quiet_NaN();
+ else if (__s == _Tp(1))
+ return std::numeric_limits<_Tp>::infinity();
+ else if (__s < -_Tp(19))
+ {
+ _Tp __zeta = __riemann_zeta_product(_Tp(1) - __s);
+ __zeta *= std::pow(_Tp(2) * __numeric_constants<_Tp>::__pi(), __s)
+ * std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
+#if _GLIBCXX_USE_C99_MATH_TR1
+ * std::exp(std::tr1::lgamma(_Tp(1) - __s))
+#else
+ * std::exp(__log_gamma(_Tp(1) - __s))
+#endif
+ / __numeric_constants<_Tp>::__pi();
+ return __zeta;
+ }
+ else if (__s < _Tp(20))
+ {
+ // Global double sum or McLaurin?
+ bool __glob = true;
+ if (__glob)
+ return __riemann_zeta_glob(__s);
+ else
+ {
+ if (__s > _Tp(1))
+ return __riemann_zeta_sum(__s);
+ else
+ {
+ _Tp __zeta = std::pow(_Tp(2)
+ * __numeric_constants<_Tp>::__pi(), __s)
+ * std::sin(__numeric_constants<_Tp>::__pi_2() * __s)
+#if _GLIBCXX_USE_C99_MATH_TR1
+ * std::tr1::tgamma(_Tp(1) - __s)
+#else
+ * std::exp(__log_gamma(_Tp(1) - __s))
+#endif
+ * __riemann_zeta_sum(_Tp(1) - __s);
+ return __zeta;
+ }
+ }
+ }
+ else
+ return __riemann_zeta_product(__s);
+ }
+
+
+ /**
+ * @brief Return the Hurwitz zeta function @f$ \zeta(x,s) @f$
+ * for all s != 1 and x > -1.
+ *
+ * The Hurwitz zeta function is defined by:
+ * @f[
+ * \zeta(x,s) = \sum_{n=0}^{\infty} \frac{1}{(n + x)^s}
+ * @f]
+ * The Riemann zeta function is a special case:
+ * @f[
+ * \zeta(s) = \zeta(1,s)
+ * @f]
+ *
+ * This functions uses the double sum that converges for s != 1
+ * and x > -1:
+ * @f[
+ * \zeta(x,s) = \frac{1}{s-1}
+ * \sum_{n=0}^{\infty} \frac{1}{n + 1}
+ * \sum_{k=0}^{n} (-1)^k \frac{n!}{(n-k)!k!} (x+k)^{-s}
+ * @f]
+ */
+ template<typename _Tp>
+ _Tp
+ __hurwitz_zeta_glob(const _Tp __a, const _Tp __s)
+ {
+ _Tp __zeta = _Tp(0);
+
+ const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
+ // Max e exponent before overflow.
+ const _Tp __max_bincoeff = std::numeric_limits<_Tp>::max_exponent10
+ * std::log(_Tp(10)) - _Tp(1);
+
+ const unsigned int __maxit = 10000;
+ for (unsigned int __i = 0; __i < __maxit; ++__i)
+ {
+ bool __punt = false;
+ _Tp __sgn = _Tp(1);
+ _Tp __term = _Tp(0);
+ for (unsigned int __j = 0; __j <= __i; ++__j)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _Tp __bincoeff = std::tr1::lgamma(_Tp(1 + __i))
+ - std::tr1::lgamma(_Tp(1 + __j))
+ - std::tr1::lgamma(_Tp(1 + __i - __j));
+#else
+ _Tp __bincoeff = __log_gamma(_Tp(1 + __i))
+ - __log_gamma(_Tp(1 + __j))
+ - __log_gamma(_Tp(1 + __i - __j));
+#endif
+ if (__bincoeff > __max_bincoeff)
+ {
+ // This only gets hit for x << 0.
+ __punt = true;
+ break;
+ }
+ __bincoeff = std::exp(__bincoeff);
+ __term += __sgn * __bincoeff * std::pow(_Tp(__a + __j), -__s);
+ __sgn *= _Tp(-1);
+ }
+ if (__punt)
+ break;
+ __term /= _Tp(__i + 1);
+ if (std::abs(__term / __zeta) < __eps)
+ break;
+ __zeta += __term;
+ }
+
+ __zeta /= __s - _Tp(1);
+
+ return __zeta;
+ }
+
+
+ /**
+ * @brief Return the Hurwitz zeta function @f$ \zeta(x,s) @f$
+ * for all s != 1 and x > -1.
+ *
+ * The Hurwitz zeta function is defined by:
+ * @f[
+ * \zeta(x,s) = \sum_{n=0}^{\infty} \frac{1}{(n + x)^s}
+ * @f]
+ * The Riemann zeta function is a special case:
+ * @f[
+ * \zeta(s) = \zeta(1,s)
+ * @f]
+ */
+ template<typename _Tp>
+ inline _Tp
+ __hurwitz_zeta(const _Tp __a, const _Tp __s)
+ {
+ return __hurwitz_zeta_glob(__a, __s);
+ }
+
+ } // namespace std::tr1::__detail
+}
+}
+
+#endif // _GLIBCXX_TR1_RIEMANN_ZETA_TCC
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/shared_ptr.h b/gcc-4.4.0/libstdc++-v3/include/tr1/shared_ptr.h
new file mode 100644
index 000000000..0afce0155
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/shared_ptr.h
@@ -0,0 +1,1020 @@
+// <tr1/shared_ptr.h> -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// shared_count.hpp
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+
+// shared_ptr.hpp
+// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
+// Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+// weak_ptr.hpp
+// Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+// enable_shared_from_this.hpp
+// Copyright (C) 2002 Peter Dimov
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// GCC Note: based on version 1.32.0 of the Boost library.
+
+/** @file tr1/shared_ptr.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _TR1_SHARED_PTR_H
+#define _TR1_SHARED_PTR_H 1
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+namespace std
+{
+namespace tr1
+{
+
+ template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
+ class _Sp_counted_base_impl
+ : public _Sp_counted_base<_Lp>
+ {
+ public:
+ /**
+ * @brief
+ * @pre __d(__p) must not throw.
+ */
+ _Sp_counted_base_impl(_Ptr __p, _Deleter __d)
+ : _M_ptr(__p), _M_del(__d) { }
+
+ virtual void
+ _M_dispose() // nothrow
+ { _M_del(_M_ptr); }
+
+ virtual void*
+ _M_get_deleter(const std::type_info& __ti)
+ { return __ti == typeid(_Deleter) ? &_M_del : 0; }
+
+ private:
+ _Sp_counted_base_impl(const _Sp_counted_base_impl&);
+ _Sp_counted_base_impl& operator=(const _Sp_counted_base_impl&);
+
+ _Ptr _M_ptr; // copy constructor must not throw
+ _Deleter _M_del; // copy constructor must not throw
+ };
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class __weak_count;
+
+ template<typename _Tp>
+ struct _Sp_deleter
+ {
+ typedef void result_type;
+ typedef _Tp* argument_type;
+ void operator()(_Tp* __p) const { delete __p; }
+ };
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class __shared_count
+ {
+ public:
+ __shared_count()
+ : _M_pi(0) // nothrow
+ { }
+
+ template<typename _Ptr>
+ __shared_count(_Ptr __p) : _M_pi(0)
+ {
+ __try
+ {
+ typedef typename std::tr1::remove_pointer<_Ptr>::type _Tp;
+ _M_pi = new _Sp_counted_base_impl<_Ptr, _Sp_deleter<_Tp>, _Lp>(
+ __p, _Sp_deleter<_Tp>());
+ }
+ __catch(...)
+ {
+ delete __p;
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Ptr, typename _Deleter>
+ __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0)
+ {
+ __try
+ {
+ _M_pi = new _Sp_counted_base_impl<_Ptr, _Deleter, _Lp>(__p, __d);
+ }
+ __catch(...)
+ {
+ __d(__p); // Call _Deleter on __p.
+ __throw_exception_again;
+ }
+ }
+
+ // Special case for auto_ptr<_Tp> to provide the strong guarantee.
+ template<typename _Tp>
+ explicit
+ __shared_count(std::auto_ptr<_Tp>& __r)
+ : _M_pi(new _Sp_counted_base_impl<_Tp*,
+ _Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))
+ { __r.release(); }
+
+ // Throw bad_weak_ptr when __r._M_get_use_count() == 0.
+ explicit
+ __shared_count(const __weak_count<_Lp>& __r);
+
+ ~__shared_count() // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_release();
+ }
+
+ __shared_count(const __shared_count& __r)
+ : _M_pi(__r._M_pi) // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_add_ref_copy();
+ }
+
+ __shared_count&
+ operator=(const __shared_count& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ if (__tmp != _M_pi)
+ {
+ if (__tmp != 0)
+ __tmp->_M_add_ref_copy();
+ if (_M_pi != 0)
+ _M_pi->_M_release();
+ _M_pi = __tmp;
+ }
+ return *this;
+ }
+
+ void
+ _M_swap(__shared_count& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ __r._M_pi = _M_pi;
+ _M_pi = __tmp;
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
+
+ bool
+ _M_unique() const // nothrow
+ { return this->_M_get_use_count() == 1; }
+
+ friend inline bool
+ operator==(const __shared_count& __a, const __shared_count& __b)
+ { return __a._M_pi == __b._M_pi; }
+
+ friend inline bool
+ operator<(const __shared_count& __a, const __shared_count& __b)
+ { return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); }
+
+ void*
+ _M_get_deleter(const std::type_info& __ti) const
+ { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; }
+
+ private:
+ friend class __weak_count<_Lp>;
+
+ _Sp_counted_base<_Lp>* _M_pi;
+ };
+
+
+ template<_Lock_policy _Lp>
+ class __weak_count
+ {
+ public:
+ __weak_count()
+ : _M_pi(0) // nothrow
+ { }
+
+ __weak_count(const __shared_count<_Lp>& __r)
+ : _M_pi(__r._M_pi) // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_weak_add_ref();
+ }
+
+ __weak_count(const __weak_count<_Lp>& __r)
+ : _M_pi(__r._M_pi) // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_weak_add_ref();
+ }
+
+ ~__weak_count() // nothrow
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_weak_release();
+ }
+
+ __weak_count<_Lp>&
+ operator=(const __shared_count<_Lp>& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ if (__tmp != 0)
+ __tmp->_M_weak_add_ref();
+ if (_M_pi != 0)
+ _M_pi->_M_weak_release();
+ _M_pi = __tmp;
+ return *this;
+ }
+
+ __weak_count<_Lp>&
+ operator=(const __weak_count<_Lp>& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ if (__tmp != 0)
+ __tmp->_M_weak_add_ref();
+ if (_M_pi != 0)
+ _M_pi->_M_weak_release();
+ _M_pi = __tmp;
+ return *this;
+ }
+
+ void
+ _M_swap(__weak_count<_Lp>& __r) // nothrow
+ {
+ _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+ __r._M_pi = _M_pi;
+ _M_pi = __tmp;
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
+
+ friend inline bool
+ operator==(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b)
+ { return __a._M_pi == __b._M_pi; }
+
+ friend inline bool
+ operator<(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b)
+ { return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); }
+
+ private:
+ friend class __shared_count<_Lp>;
+
+ _Sp_counted_base<_Lp>* _M_pi;
+ };
+
+ // now that __weak_count is defined we can define this constructor:
+ template<_Lock_policy _Lp>
+ inline
+ __shared_count<_Lp>::
+ __shared_count(const __weak_count<_Lp>& __r)
+ : _M_pi(__r._M_pi)
+ {
+ if (_M_pi != 0)
+ _M_pi->_M_add_ref_lock();
+ else
+ __throw_bad_weak_ptr();
+ }
+
+ // Forward declarations.
+ template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+ class __shared_ptr;
+
+ template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+ class __weak_ptr;
+
+ template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+ class __enable_shared_from_this;
+
+ template<typename _Tp>
+ class shared_ptr;
+
+ template<typename _Tp>
+ class weak_ptr;
+
+ template<typename _Tp>
+ class enable_shared_from_this;
+
+ // Support for enable_shared_from_this.
+
+ // Friend of __enable_shared_from_this.
+ template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
+ void
+ __enable_shared_from_this_helper(const __shared_count<_Lp>&,
+ const __enable_shared_from_this<_Tp1,
+ _Lp>*, const _Tp2*);
+
+ // Friend of enable_shared_from_this.
+ template<typename _Tp1, typename _Tp2>
+ void
+ __enable_shared_from_this_helper(const __shared_count<>&,
+ const enable_shared_from_this<_Tp1>*,
+ const _Tp2*);
+
+ template<_Lock_policy _Lp>
+ inline void
+ __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...)
+ { }
+
+
+ struct __static_cast_tag { };
+ struct __const_cast_tag { };
+ struct __dynamic_cast_tag { };
+
+ /**
+ * @class __shared_ptr
+ *
+ * A smart pointer with reference-counted copy semantics.
+ * The object pointed to is deleted when the last shared_ptr pointing to
+ * it is destroyed or reset.
+ */
+ template<typename _Tp, _Lock_policy _Lp>
+ class __shared_ptr
+ {
+ public:
+ typedef _Tp element_type;
+
+ /** @brief Construct an empty %__shared_ptr.
+ * @post use_count()==0 && get()==0
+ */
+ __shared_ptr()
+ : _M_ptr(0), _M_refcount() // never throws
+ { }
+
+ /** @brief Construct a %__shared_ptr that owns the pointer @a __p.
+ * @param __p A pointer that is convertible to element_type*.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @c delete @a __p is called.
+ */
+ template<typename _Tp1>
+ explicit
+ __shared_ptr(_Tp1* __p)
+ : _M_ptr(__p), _M_refcount(__p)
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // __glibcxx_function_requires(_CompleteConcept<_Tp1*>)
+ __enable_shared_from_this_helper(_M_refcount, __p, __p);
+ }
+
+ //
+ // Requirements: _Deleter's copy constructor and destructor must
+ // not throw
+ //
+ // __shared_ptr will release __p by calling __d(__p)
+ //
+ /** @brief Construct a %__shared_ptr that owns the pointer @a __p
+ * and the deleter @a __d.
+ * @param __p A pointer.
+ * @param __d A deleter.
+ * @post use_count() == 1 && get() == __p
+ * @throw std::bad_alloc, in which case @a __d(__p) is called.
+ */
+ template<typename _Tp1, typename _Deleter>
+ __shared_ptr(_Tp1* __p, _Deleter __d)
+ : _M_ptr(__p), _M_refcount(__p, __d)
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
+ __enable_shared_from_this_helper(_M_refcount, __p, __p);
+ }
+
+ // generated copy constructor, assignment, destructor are fine.
+
+ /** @brief If @a __r is empty, constructs an empty %__shared_ptr;
+ * otherwise construct a %__shared_ptr that shares ownership
+ * with @a __r.
+ * @param __r A %__shared_ptr.
+ * @post get() == __r.get() && use_count() == __r.use_count()
+ */
+ template<typename _Tp1>
+ __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+ : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+ { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+
+ /** @brief Constructs a %__shared_ptr that shares ownership with @a __r
+ * and stores a copy of the pointer stored in @a __r.
+ * @param __r A weak_ptr.
+ * @post use_count() == __r.use_count()
+ * @throw bad_weak_ptr when __r.expired(),
+ * in which case the constructor has no effect.
+ */
+ template<typename _Tp1>
+ explicit
+ __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+ : _M_refcount(__r._M_refcount) // may throw
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // It is now safe to copy __r._M_ptr, as _M_refcount(__r._M_refcount)
+ // did not throw.
+ _M_ptr = __r._M_ptr;
+ }
+
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
+ /**
+ * @post use_count() == 1 and __r.get() == 0
+ */
+ template<typename _Tp1>
+ explicit
+ __shared_ptr(std::auto_ptr<_Tp1>& __r)
+ : _M_ptr(__r.get()), _M_refcount()
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ // TODO requires _Tp1 is complete, delete __r.release() well-formed
+ _Tp1* __tmp = __r.get();
+ _M_refcount = __shared_count<_Lp>(__r);
+ __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+ }
+
+#endif
+
+ template<typename _Tp1>
+ __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __static_cast_tag)
+ : _M_ptr(static_cast<element_type*>(__r._M_ptr)),
+ _M_refcount(__r._M_refcount)
+ { }
+
+ template<typename _Tp1>
+ __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __const_cast_tag)
+ : _M_ptr(const_cast<element_type*>(__r._M_ptr)),
+ _M_refcount(__r._M_refcount)
+ { }
+
+ template<typename _Tp1>
+ __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __dynamic_cast_tag)
+ : _M_ptr(dynamic_cast<element_type*>(__r._M_ptr)),
+ _M_refcount(__r._M_refcount)
+ {
+ if (_M_ptr == 0) // need to allocate new counter -- the cast failed
+ _M_refcount = __shared_count<_Lp>();
+ }
+
+ template<typename _Tp1>
+ __shared_ptr&
+ operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
+ {
+ _M_ptr = __r._M_ptr;
+ _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw
+ return *this;
+ }
+
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
+ template<typename _Tp1>
+ __shared_ptr&
+ operator=(std::auto_ptr<_Tp1>& __r)
+ {
+ __shared_ptr(__r).swap(*this);
+ return *this;
+ }
+#endif
+
+ void
+ reset() // never throws
+ { __shared_ptr().swap(*this); }
+
+ template<typename _Tp1>
+ void
+ reset(_Tp1* __p) // _Tp1 must be complete.
+ {
+ // Catch self-reset errors.
+ _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr);
+ __shared_ptr(__p).swap(*this);
+ }
+
+ template<typename _Tp1, typename _Deleter>
+ void
+ reset(_Tp1* __p, _Deleter __d)
+ { __shared_ptr(__p, __d).swap(*this); }
+
+ // Allow class instantiation when _Tp is [cv-qual] void.
+ typename std::tr1::add_reference<_Tp>::type
+ operator*() const // never throws
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return *_M_ptr;
+ }
+
+ _Tp*
+ operator->() const // never throws
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+ return _M_ptr;
+ }
+
+ _Tp*
+ get() const // never throws
+ { return _M_ptr; }
+
+ // Implicit conversion to "bool"
+ private:
+ typedef _Tp* __shared_ptr::*__unspecified_bool_type;
+
+ public:
+ operator __unspecified_bool_type() const // never throws
+ { return _M_ptr == 0 ? 0 : &__shared_ptr::_M_ptr; }
+
+ bool
+ unique() const // never throws
+ { return _M_refcount._M_unique(); }
+
+ long
+ use_count() const // never throws
+ { return _M_refcount._M_get_use_count(); }
+
+ void
+ swap(__shared_ptr<_Tp, _Lp>& __other) // never throws
+ {
+ std::swap(_M_ptr, __other._M_ptr);
+ _M_refcount._M_swap(__other._M_refcount);
+ }
+
+ private:
+ void*
+ _M_get_deleter(const std::type_info& __ti) const
+ { return _M_refcount._M_get_deleter(__ti); }
+
+ template<typename _Tp1, _Lock_policy _Lp1>
+ bool
+ _M_less(const __shared_ptr<_Tp1, _Lp1>& __rhs) const
+ { return _M_refcount < __rhs._M_refcount; }
+
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
+
+ template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
+ friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&);
+
+ // Friends injected into enclosing namespace and found by ADL:
+ template<typename _Tp1>
+ friend inline bool
+ operator==(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)
+ { return __a.get() == __b.get(); }
+
+ template<typename _Tp1>
+ friend inline bool
+ operator!=(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)
+ { return __a.get() != __b.get(); }
+
+ template<typename _Tp1>
+ friend inline bool
+ operator<(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)
+ { return __a._M_less(__b); }
+
+ _Tp* _M_ptr; // Contained pointer.
+ __shared_count<_Lp> _M_refcount; // Reference counter.
+ };
+
+ // 2.2.3.8 shared_ptr specialized algorithms.
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
+ { __a.swap(__b); }
+
+ // 2.2.3.9 shared_ptr casts
+ /** @warning The seemingly equivalent
+ * <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>
+ * will eventually result in undefined behaviour,
+ * attempting to delete the same object twice.
+ */
+ template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+ { return __shared_ptr<_Tp, _Lp>(__r, __static_cast_tag()); }
+
+ /** @warning The seemingly equivalent
+ * <code>shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))</code>
+ * will eventually result in undefined behaviour,
+ * attempting to delete the same object twice.
+ */
+ template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+ { return __shared_ptr<_Tp, _Lp>(__r, __const_cast_tag()); }
+
+ /** @warning The seemingly equivalent
+ * <code>shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))</code>
+ * will eventually result in undefined behaviour,
+ * attempting to delete the same object twice.
+ */
+ template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+ inline __shared_ptr<_Tp, _Lp>
+ dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+ { return __shared_ptr<_Tp, _Lp>(__r, __dynamic_cast_tag()); }
+
+ // 2.2.3.7 shared_ptr I/O
+ template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
+ std::basic_ostream<_Ch, _Tr>&
+ operator<<(std::basic_ostream<_Ch, _Tr>& __os,
+ const __shared_ptr<_Tp, _Lp>& __p)
+ {
+ __os << __p.get();
+ return __os;
+ }
+
+ // 2.2.3.10 shared_ptr get_deleter (experimental)
+ template<typename _Del, typename _Tp, _Lock_policy _Lp>
+ inline _Del*
+ get_deleter(const __shared_ptr<_Tp, _Lp>& __p)
+ { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); }
+
+
+ template<typename _Tp, _Lock_policy _Lp>
+ class __weak_ptr
+ {
+ public:
+ typedef _Tp element_type;
+
+ __weak_ptr()
+ : _M_ptr(0), _M_refcount() // never throws
+ { }
+
+ // Generated copy constructor, assignment, destructor are fine.
+
+ // The "obvious" converting constructor implementation:
+ //
+ // template<typename _Tp1>
+ // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+ // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+ // { }
+ //
+ // has a serious problem.
+ //
+ // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr)
+ // conversion may require access to *__r._M_ptr (virtual inheritance).
+ //
+ // It is not possible to avoid spurious access violations since
+ // in multithreaded programs __r._M_ptr may be invalidated at any point.
+ template<typename _Tp1>
+ __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+ : _M_refcount(__r._M_refcount) // never throws
+ {
+ __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+ _M_ptr = __r.lock().get();
+ }
+
+ template<typename _Tp1>
+ __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+ : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+ { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+
+ template<typename _Tp1>
+ __weak_ptr&
+ operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws
+ {
+ _M_ptr = __r.lock().get();
+ _M_refcount = __r._M_refcount;
+ return *this;
+ }
+
+ template<typename _Tp1>
+ __weak_ptr&
+ operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
+ {
+ _M_ptr = __r._M_ptr;
+ _M_refcount = __r._M_refcount;
+ return *this;
+ }
+
+ __shared_ptr<_Tp, _Lp>
+ lock() const // never throws
+ {
+#ifdef __GTHREADS
+ // Optimization: avoid throw overhead.
+ if (expired())
+ return __shared_ptr<element_type, _Lp>();
+
+ __try
+ {
+ return __shared_ptr<element_type, _Lp>(*this);
+ }
+ __catch(const bad_weak_ptr&)
+ {
+ // Q: How can we get here?
+ // A: Another thread may have invalidated r after the
+ // use_count test above.
+ return __shared_ptr<element_type, _Lp>();
+ }
+
+#else
+ // Optimization: avoid try/catch overhead when single threaded.
+ return expired() ? __shared_ptr<element_type, _Lp>()
+ : __shared_ptr<element_type, _Lp>(*this);
+
+#endif
+ } // XXX MT
+
+ long
+ use_count() const // never throws
+ { return _M_refcount._M_get_use_count(); }
+
+ bool
+ expired() const // never throws
+ { return _M_refcount._M_get_use_count() == 0; }
+
+ void
+ reset() // never throws
+ { __weak_ptr().swap(*this); }
+
+ void
+ swap(__weak_ptr& __s) // never throws
+ {
+ std::swap(_M_ptr, __s._M_ptr);
+ _M_refcount._M_swap(__s._M_refcount);
+ }
+
+ private:
+ // Used by __enable_shared_from_this.
+ void
+ _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount)
+ {
+ _M_ptr = __ptr;
+ _M_refcount = __refcount;
+ }
+
+ template<typename _Tp1>
+ bool
+ _M_less(const __weak_ptr<_Tp1, _Lp>& __rhs) const
+ { return _M_refcount < __rhs._M_refcount; }
+
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
+ template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
+ friend class __enable_shared_from_this<_Tp, _Lp>;
+ friend class enable_shared_from_this<_Tp>;
+
+ // Friend injected into namespace and found by ADL.
+ template<typename _Tp1>
+ friend inline bool
+ operator<(const __weak_ptr& __lhs, const __weak_ptr<_Tp1, _Lp>& __rhs)
+ { return __lhs._M_less(__rhs); }
+
+ _Tp* _M_ptr; // Contained pointer.
+ __weak_count<_Lp> _M_refcount; // Reference counter.
+ };
+
+ // 2.2.4.7 weak_ptr specialized algorithms.
+ template<typename _Tp, _Lock_policy _Lp>
+ inline void
+ swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b)
+ { __a.swap(__b); }
+
+
+ template<typename _Tp, _Lock_policy _Lp>
+ class __enable_shared_from_this
+ {
+ protected:
+ __enable_shared_from_this() { }
+
+ __enable_shared_from_this(const __enable_shared_from_this&) { }
+
+ __enable_shared_from_this&
+ operator=(const __enable_shared_from_this&)
+ { return *this; }
+
+ ~__enable_shared_from_this() { }
+
+ public:
+ __shared_ptr<_Tp, _Lp>
+ shared_from_this()
+ { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); }
+
+ __shared_ptr<const _Tp, _Lp>
+ shared_from_this() const
+ { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); }
+
+ private:
+ template<typename _Tp1>
+ void
+ _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const
+ { _M_weak_this._M_assign(__p, __n); }
+
+ template<typename _Tp1>
+ friend void
+ __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn,
+ const __enable_shared_from_this* __pe,
+ const _Tp1* __px)
+ {
+ if (__pe != 0)
+ __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
+ }
+
+ mutable __weak_ptr<_Tp, _Lp> _M_weak_this;
+ };
+
+
+ /// shared_ptr
+ // The actual shared_ptr, with forwarding constructors and
+ // assignment operators.
+ template<typename _Tp>
+ class shared_ptr
+ : public __shared_ptr<_Tp>
+ {
+ public:
+ shared_ptr()
+ : __shared_ptr<_Tp>() { }
+
+ template<typename _Tp1>
+ explicit
+ shared_ptr(_Tp1* __p)
+ : __shared_ptr<_Tp>(__p) { }
+
+ template<typename _Tp1, typename _Deleter>
+ shared_ptr(_Tp1* __p, _Deleter __d)
+ : __shared_ptr<_Tp>(__p, __d) { }
+
+ template<typename _Tp1>
+ shared_ptr(const shared_ptr<_Tp1>& __r)
+ : __shared_ptr<_Tp>(__r) { }
+
+ template<typename _Tp1>
+ explicit
+ shared_ptr(const weak_ptr<_Tp1>& __r)
+ : __shared_ptr<_Tp>(__r) { }
+
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
+ template<typename _Tp1>
+ explicit
+ shared_ptr(std::auto_ptr<_Tp1>& __r)
+ : __shared_ptr<_Tp>(__r) { }
+#endif
+
+ template<typename _Tp1>
+ shared_ptr(const shared_ptr<_Tp1>& __r, __static_cast_tag)
+ : __shared_ptr<_Tp>(__r, __static_cast_tag()) { }
+
+ template<typename _Tp1>
+ shared_ptr(const shared_ptr<_Tp1>& __r, __const_cast_tag)
+ : __shared_ptr<_Tp>(__r, __const_cast_tag()) { }
+
+ template<typename _Tp1>
+ shared_ptr(const shared_ptr<_Tp1>& __r, __dynamic_cast_tag)
+ : __shared_ptr<_Tp>(__r, __dynamic_cast_tag()) { }
+
+ template<typename _Tp1>
+ shared_ptr&
+ operator=(const shared_ptr<_Tp1>& __r) // never throws
+ {
+ this->__shared_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+
+#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
+ template<typename _Tp1>
+ shared_ptr&
+ operator=(std::auto_ptr<_Tp1>& __r)
+ {
+ this->__shared_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+#endif
+ };
+
+ // 2.2.3.8 shared_ptr specialized algorithms.
+ template<typename _Tp>
+ inline void
+ swap(__shared_ptr<_Tp>& __a, __shared_ptr<_Tp>& __b)
+ { __a.swap(__b); }
+
+ template<typename _Tp, typename _Tp1>
+ inline shared_ptr<_Tp>
+ static_pointer_cast(const shared_ptr<_Tp1>& __r)
+ { return shared_ptr<_Tp>(__r, __static_cast_tag()); }
+
+ template<typename _Tp, typename _Tp1>
+ inline shared_ptr<_Tp>
+ const_pointer_cast(const shared_ptr<_Tp1>& __r)
+ { return shared_ptr<_Tp>(__r, __const_cast_tag()); }
+
+ template<typename _Tp, typename _Tp1>
+ inline shared_ptr<_Tp>
+ dynamic_pointer_cast(const shared_ptr<_Tp1>& __r)
+ { return shared_ptr<_Tp>(__r, __dynamic_cast_tag()); }
+
+
+ /// weak_ptr
+ // The actual weak_ptr, with forwarding constructors and
+ // assignment operators.
+ template<typename _Tp>
+ class weak_ptr
+ : public __weak_ptr<_Tp>
+ {
+ public:
+ weak_ptr()
+ : __weak_ptr<_Tp>() { }
+
+ template<typename _Tp1>
+ weak_ptr(const weak_ptr<_Tp1>& __r)
+ : __weak_ptr<_Tp>(__r) { }
+
+ template<typename _Tp1>
+ weak_ptr(const shared_ptr<_Tp1>& __r)
+ : __weak_ptr<_Tp>(__r) { }
+
+ template<typename _Tp1>
+ weak_ptr&
+ operator=(const weak_ptr<_Tp1>& __r) // never throws
+ {
+ this->__weak_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+
+ template<typename _Tp1>
+ weak_ptr&
+ operator=(const shared_ptr<_Tp1>& __r) // never throws
+ {
+ this->__weak_ptr<_Tp>::operator=(__r);
+ return *this;
+ }
+
+ shared_ptr<_Tp>
+ lock() const // never throws
+ {
+#ifdef __GTHREADS
+ if (this->expired())
+ return shared_ptr<_Tp>();
+
+ __try
+ {
+ return shared_ptr<_Tp>(*this);
+ }
+ __catch(const bad_weak_ptr&)
+ {
+ return shared_ptr<_Tp>();
+ }
+#else
+ return this->expired() ? shared_ptr<_Tp>()
+ : shared_ptr<_Tp>(*this);
+#endif
+ }
+ };
+
+ /// enable_shared_from_this
+ template<typename _Tp>
+ class enable_shared_from_this
+ {
+ protected:
+ enable_shared_from_this() { }
+
+ enable_shared_from_this(const enable_shared_from_this&) { }
+
+ enable_shared_from_this&
+ operator=(const enable_shared_from_this&)
+ { return *this; }
+
+ ~enable_shared_from_this() { }
+
+ public:
+ shared_ptr<_Tp>
+ shared_from_this()
+ { return shared_ptr<_Tp>(this->_M_weak_this); }
+
+ shared_ptr<const _Tp>
+ shared_from_this() const
+ { return shared_ptr<const _Tp>(this->_M_weak_this); }
+
+ private:
+ template<typename _Tp1>
+ void
+ _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const
+ { _M_weak_this._M_assign(__p, __n); }
+
+ template<typename _Tp1>
+ friend void
+ __enable_shared_from_this_helper(const __shared_count<>& __pn,
+ const enable_shared_from_this* __pe,
+ const _Tp1* __px)
+ {
+ if (__pe != 0)
+ __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
+ }
+
+ mutable weak_ptr<_Tp> _M_weak_this;
+ };
+
+}
+}
+
+#endif // _TR1_SHARED_PTR_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/special_function_util.h b/gcc-4.4.0/libstdc++-v3/include/tr1/special_function_util.h
new file mode 100644
index 000000000..d2699bd85
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/special_function_util.h
@@ -0,0 +1,144 @@
+// Special functions -*- C++ -*-
+
+// Copyright (C) 2006, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/special_function_util.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+//
+// ISO C++ 14882 TR1: 5.2 Special functions
+//
+
+// Written by Edward Smith-Rowland based on numerous mathematics books.
+
+#ifndef _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H
+#define _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H 1
+
+namespace std
+{
+namespace tr1
+{
+
+ namespace __detail
+ {
+
+ /// A class to encapsulate type dependent floating point
+ /// constants. Not everything will be able to be expressed as
+ /// type logic.
+ template<typename _Tp>
+ struct __floating_point_constant
+ {
+ static const _Tp __value;
+ };
+
+
+ /// A structure for numeric constants.
+ template<typename _Tp>
+ struct __numeric_constants
+ {
+ /// Constant @f$ \pi @f$.
+ static _Tp __pi() throw()
+ { return static_cast<_Tp>(3.1415926535897932384626433832795029L); }
+ /// Constant @f$ \pi / 2 @f$.
+ static _Tp __pi_2() throw()
+ { return static_cast<_Tp>(1.5707963267948966192313216916397514L); }
+ /// Constant @f$ \pi / 3 @f$.
+ static _Tp __pi_3() throw()
+ { return static_cast<_Tp>(1.0471975511965977461542144610931676L); }
+ /// Constant @f$ \pi / 4 @f$.
+ static _Tp __pi_4() throw()
+ { return static_cast<_Tp>(0.7853981633974483096156608458198757L); }
+ /// Constant @f$ 1 / \pi @f$.
+ static _Tp __1_pi() throw()
+ { return static_cast<_Tp>(0.3183098861837906715377675267450287L); }
+ /// Constant @f$ 2 / \sqrt(\pi) @f$.
+ static _Tp __2_sqrtpi() throw()
+ { return static_cast<_Tp>(1.1283791670955125738961589031215452L); }
+ /// Constant @f$ \sqrt(2) @f$.
+ static _Tp __sqrt2() throw()
+ { return static_cast<_Tp>(1.4142135623730950488016887242096981L); }
+ /// Constant @f$ \sqrt(3) @f$.
+ static _Tp __sqrt3() throw()
+ { return static_cast<_Tp>(1.7320508075688772935274463415058723L); }
+ /// Constant @f$ \sqrt(\pi/2) @f$.
+ static _Tp __sqrtpio2() throw()
+ { return static_cast<_Tp>(1.2533141373155002512078826424055226L); }
+ /// Constant @f$ 1 / sqrt(2) @f$.
+ static _Tp __sqrt1_2() throw()
+ { return static_cast<_Tp>(0.7071067811865475244008443621048490L); }
+ /// Constant @f$ \log(\pi) @f$.
+ static _Tp __lnpi() throw()
+ { return static_cast<_Tp>(1.1447298858494001741434273513530587L); }
+ /// Constant Euler's constant @f$ \gamma_E @f$.
+ static _Tp __gamma_e() throw()
+ { return static_cast<_Tp>(0.5772156649015328606065120900824024L); }
+ /// Constant Euler-Mascheroni @f$ e @f$
+ static _Tp __euler() throw()
+ { return static_cast<_Tp>(2.7182818284590452353602874713526625L); }
+ };
+
+
+#if _GLIBCXX_USE_C99_MATH && !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+ /// This is a wrapper for the isnan function. Otherwise, for NaN,
+ /// all comparisons result in false. If/when we build a std::isnan
+ /// out of intrinsics, this will disappear completely in favor of
+ /// std::isnan.
+ template<typename _Tp>
+ inline bool __isnan(const _Tp __x)
+ {
+ return std::isnan(__x);
+ }
+
+#else
+
+ template<typename _Tp>
+ inline bool __isnan(const _Tp __x)
+ {
+ return __builtin_isnan(__x);
+ }
+
+ template<>
+ inline bool __isnan<float>(const float __x)
+ {
+ return __builtin_isnanf(__x);
+ }
+
+ template<>
+ inline bool __isnan<long double>(const long double __x)
+ {
+ return __builtin_isnanl(__x);
+ }
+
+#endif
+
+ } // namespace __detail
+
+}
+}
+
+#endif // _GLIBCXX_TR1_SPECIAL_FUNCTION_UTIL_H
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/stdarg.h b/gcc-4.4.0/libstdc++-v3/include/tr1/stdarg.h
new file mode 100644
index 000000000..41173e847
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/stdarg.h
@@ -0,0 +1,34 @@
+// TR1 stdarg.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/stdarg.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_STDARG_H
+#define _TR1_STDARG_H 1
+
+#include <tr1/cstdarg>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/stdbool.h b/gcc-4.4.0/libstdc++-v3/include/tr1/stdbool.h
new file mode 100644
index 000000000..3861e4457
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/stdbool.h
@@ -0,0 +1,34 @@
+// TR1 stdbool.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/stdbool.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_STDBOOL_H
+#define _TR1_STDBOOL_H 1
+
+#include <tr1/cstdbool>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/stdint.h b/gcc-4.4.0/libstdc++-v3/include/tr1/stdint.h
new file mode 100644
index 000000000..8113fa5ad
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/stdint.h
@@ -0,0 +1,34 @@
+// TR1 stdint.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/stdint.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_STDINT_H
+#define _TR1_STDINT_H 1
+
+#include <tr1/cstdint>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/stdio.h b/gcc-4.4.0/libstdc++-v3/include/tr1/stdio.h
new file mode 100644
index 000000000..f1edf8395
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/stdio.h
@@ -0,0 +1,34 @@
+// TR1 stdio.h -*- C++ -*-
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/stdio.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _TR1_STDIO_H
+#define _TR1_STDIO_H 1
+
+#include <tr1/cstdio>
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/stdlib.h b/gcc-4.4.0/libstdc++-v3/include/tr1/stdlib.h
new file mode 100644
index 000000000..5e57aecbf
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/stdlib.h
@@ -0,0 +1,52 @@
+// TR1 stdlib.h -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/stdlib.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_STDLIB_H
+#define _GLIBCXX_TR1_STDLIB_H 1
+
+#include <tr1/cstdlib>
+
+#if _GLIBCXX_HOSTED
+
+#if _GLIBCXX_USE_C99
+
+using std::tr1::atoll;
+using std::tr1::strtoll;
+using std::tr1::strtoull;
+
+using std::tr1::abs;
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+using std::tr1::div;
+#endif
+
+#endif
+
+#endif
+
+#endif // _GLIBCXX_TR1_STDLIB_H
+
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/tgmath.h b/gcc-4.4.0/libstdc++-v3/include/tr1/tgmath.h
new file mode 100644
index 000000000..c807031e5
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/tgmath.h
@@ -0,0 +1,34 @@
+// TR1 tgmath.h -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/tgmath.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_TGMATH_H
+#define _GLIBCXX_TR1_TGMATH_H 1
+
+#include <tr1/ctgmath>
+
+#endif // _GLIBCXX_TR1_TGMATH_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/tuple b/gcc-4.4.0/libstdc++-v3/include/tr1/tuple
new file mode 100644
index 000000000..ff9f22061
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/tuple
@@ -0,0 +1,422 @@
+// class template tuple -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/tuple
+* This is a TR1 C++ Library header.
+*/
+
+// Chris Jefferson <chris@bubblescope.net>
+// Variadic Templates support by Douglas Gregor <doug.gregor@gmail.com>
+
+#ifndef _GLIBCXX_TR1_TUPLE
+#define _GLIBCXX_TR1_TUPLE 1
+
+#pragma GCC system_header
+
+#include <utility>
+
+namespace std
+{
+namespace tr1
+{
+ // Adds a const reference to a non-reference type.
+ template<typename _Tp>
+ struct __add_c_ref
+ { typedef const _Tp& type; };
+
+ template<typename _Tp>
+ struct __add_c_ref<_Tp&>
+ { typedef _Tp& type; };
+
+ // Adds a reference to a non-reference type.
+ template<typename _Tp>
+ struct __add_ref
+ { typedef _Tp& type; };
+
+ template<typename _Tp>
+ struct __add_ref<_Tp&>
+ { typedef _Tp& type; };
+
+ /**
+ * Contains the actual implementation of the @c tuple template, stored
+ * as a recursive inheritance hierarchy from the first element (most
+ * derived class) to the last (least derived class). The @c Idx
+ * parameter gives the 0-based index of the element stored at this
+ * point in the hierarchy; we use it to implement a constant-time
+ * get() operation.
+ */
+ template<int _Idx, typename... _Elements>
+ struct _Tuple_impl;
+
+ /**
+ * Zero-element tuple implementation. This is the basis case for the
+ * inheritance recursion.
+ */
+ template<int _Idx>
+ struct _Tuple_impl<_Idx> { };
+
+ /**
+ * Recursive tuple implementation. Here we store the @c Head element
+ * and derive from a @c Tuple_impl containing the remaining elements
+ * (which contains the @c Tail).
+ */
+ template<int _Idx, typename _Head, typename... _Tail>
+ struct _Tuple_impl<_Idx, _Head, _Tail...>
+ : public _Tuple_impl<_Idx + 1, _Tail...>
+ {
+ typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited;
+
+ _Head _M_head;
+
+ _Inherited& _M_tail() { return *this; }
+ const _Inherited& _M_tail() const { return *this; }
+
+ _Tuple_impl() : _Inherited(), _M_head() { }
+
+ explicit
+ _Tuple_impl(typename __add_c_ref<_Head>::type __head,
+ typename __add_c_ref<_Tail>::type... __tail)
+ : _Inherited(__tail...), _M_head(__head) { }
+
+ template<typename... _UElements>
+ _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
+ : _Inherited(__in._M_tail()), _M_head(__in._M_head) { }
+
+ _Tuple_impl(const _Tuple_impl& __in)
+ : _Inherited(__in._M_tail()), _M_head(__in._M_head) { }
+
+ template<typename... _UElements>
+ _Tuple_impl&
+ operator=(const _Tuple_impl<_Idx, _UElements...>& __in)
+ {
+ _M_head = __in._M_head;
+ _M_tail() = __in._M_tail();
+ return *this;
+ }
+
+ _Tuple_impl&
+ operator=(const _Tuple_impl& __in)
+ {
+ _M_head = __in._M_head;
+ _M_tail() = __in._M_tail();
+ return *this;
+ }
+ };
+
+ template<typename... _Elements>
+ class tuple : public _Tuple_impl<0, _Elements...>
+ {
+ typedef _Tuple_impl<0, _Elements...> _Inherited;
+
+ public:
+ tuple() : _Inherited() { }
+
+ explicit
+ tuple(typename __add_c_ref<_Elements>::type... __elements)
+ : _Inherited(__elements...) { }
+
+ template<typename... _UElements>
+ tuple(const tuple<_UElements...>& __in)
+ : _Inherited(__in) { }
+
+ tuple(const tuple& __in)
+ : _Inherited(__in) { }
+
+ template<typename... _UElements>
+ tuple&
+ operator=(const tuple<_UElements...>& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ tuple&
+ operator=(const tuple& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+ };
+
+ template<> class tuple<> { };
+
+ // 2-element tuple, with construction and assignment from a pair.
+ template<typename _T1, typename _T2>
+ class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
+ {
+ typedef _Tuple_impl<0, _T1, _T2> _Inherited;
+
+ public:
+ tuple() : _Inherited() { }
+
+ explicit
+ tuple(typename __add_c_ref<_T1>::type __a1,
+ typename __add_c_ref<_T2>::type __a2)
+ : _Inherited(__a1, __a2) { }
+
+ template<typename _U1, typename _U2>
+ tuple(const tuple<_U1, _U2>& __in)
+ : _Inherited(__in) { }
+
+ tuple(const tuple& __in)
+ : _Inherited(__in) { }
+
+ template<typename _U1, typename _U2>
+ tuple(const pair<_U1, _U2>& __in)
+ : _Inherited(_Tuple_impl<0,
+ typename __add_c_ref<_U1>::type,
+ typename __add_c_ref<_U2>::type>(__in.first,
+ __in.second))
+ { }
+
+ template<typename _U1, typename _U2>
+ tuple&
+ operator=(const tuple<_U1, _U2>& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ tuple&
+ operator=(const tuple& __in)
+ {
+ static_cast<_Inherited&>(*this) = __in;
+ return *this;
+ }
+
+ template<typename _U1, typename _U2>
+ tuple&
+ operator=(const pair<_U1, _U2>& __in)
+ {
+ this->_M_head = __in.first;
+ this->_M_tail()._M_head = __in.second;
+ return *this;
+ }
+ };
+
+
+ /// Gives the type of the ith element of a given tuple type.
+ template<int __i, typename _Tp>
+ struct tuple_element;
+
+ /**
+ * Recursive case for tuple_element: strip off the first element in
+ * the tuple and retrieve the (i-1)th element of the remaining tuple.
+ */
+ template<int __i, typename _Head, typename... _Tail>
+ struct tuple_element<__i, tuple<_Head, _Tail...> >
+ : tuple_element<__i - 1, tuple<_Tail...> > { };
+
+ /**
+ * Basis case for tuple_element: The first element is the one we're seeking.
+ */
+ template<typename _Head, typename... _Tail>
+ struct tuple_element<0, tuple<_Head, _Tail...> >
+ {
+ typedef _Head type;
+ };
+
+ /// Finds the size of a given tuple type.
+ template<typename _Tp>
+ struct tuple_size;
+
+ /// class tuple_size
+ template<typename... _Elements>
+ struct tuple_size<tuple<_Elements...> >
+ {
+ static const int value = sizeof...(_Elements);
+ };
+
+ template<typename... _Elements>
+ const int tuple_size<tuple<_Elements...> >::value;
+
+ template<int __i, typename _Head, typename... _Tail>
+ inline typename __add_ref<_Head>::type
+ __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t)
+ {
+ return __t._M_head;
+ }
+
+ template<int __i, typename _Head, typename... _Tail>
+ inline typename __add_c_ref<_Head>::type
+ __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t)
+ {
+ return __t._M_head;
+ }
+
+ // Return a reference (const reference) to the ith element of a tuple.
+ // Any const or non-const ref elements are returned with their original type.
+ template<int __i, typename... _Elements>
+ inline typename __add_ref<
+ typename tuple_element<__i, tuple<_Elements...> >::type
+ >::type
+ get(tuple<_Elements...>& __t)
+ {
+ return __get_helper<__i>(__t);
+ }
+
+ template<int __i, typename... _Elements>
+ inline typename __add_c_ref<
+ typename tuple_element<__i, tuple<_Elements...> >::type
+ >::type
+ get(const tuple<_Elements...>& __t)
+ {
+ return __get_helper<__i>(__t);
+ }
+
+ // This class helps construct the various comparison operations on tuples
+ template<int __check_equal_size, int __i, int __j,
+ typename _Tp, typename _Up>
+ struct __tuple_compare;
+
+ template<int __i, int __j, typename _Tp, typename _Up>
+ struct __tuple_compare<0, __i, __j, _Tp, _Up>
+ {
+ static bool __eq(const _Tp& __t, const _Up& __u)
+ {
+ return (get<__i>(__t) == get<__i>(__u) &&
+ __tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u));
+ }
+
+ static bool __less(const _Tp& __t, const _Up& __u)
+ {
+ return ((get<__i>(__t) < get<__i>(__u))
+ || !(get<__i>(__u) < get<__i>(__t)) &&
+ __tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u));
+ }
+ };
+
+ template<int __i, typename _Tp, typename _Up>
+ struct __tuple_compare<0, __i, __i, _Tp, _Up>
+ {
+ static bool __eq(const _Tp&, const _Up&)
+ { return true; }
+
+ static bool __less(const _Tp&, const _Up&)
+ { return false; }
+ };
+
+ template<typename... _TElements, typename... _UElements>
+ bool
+ operator==(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ {
+ typedef tuple<_TElements...> _Tp;
+ typedef tuple<_UElements...> _Up;
+ return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
+ 0, tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u));
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ bool
+ operator<(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ {
+ typedef tuple<_TElements...> _Tp;
+ typedef tuple<_UElements...> _Up;
+ return (__tuple_compare<tuple_size<_Tp>::value - tuple_size<_Up>::value,
+ 0, tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u));
+ }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator!=(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return !(__t == __u); }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator>(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return __u < __t; }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator<=(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return !(__u < __t); }
+
+ template<typename... _TElements, typename... _UElements>
+ inline bool
+ operator>=(const tuple<_TElements...>& __t,
+ const tuple<_UElements...>& __u)
+ { return !(__t < __u); }
+
+ template<typename _Tp>
+ class reference_wrapper;
+
+ // Helper which adds a reference to a type when given a reference_wrapper
+ template<typename _Tp>
+ struct __strip_reference_wrapper
+ {
+ typedef _Tp __type;
+ };
+
+ template<typename _Tp>
+ struct __strip_reference_wrapper<reference_wrapper<_Tp> >
+ {
+ typedef _Tp& __type;
+ };
+
+ template<typename _Tp>
+ struct __strip_reference_wrapper<const reference_wrapper<_Tp> >
+ {
+ typedef _Tp& __type;
+ };
+
+ template<typename... _Elements>
+ inline tuple<typename __strip_reference_wrapper<_Elements>::__type...>
+ make_tuple(_Elements... __args)
+ {
+ typedef tuple<typename __strip_reference_wrapper<_Elements>::__type...>
+ __result_type;
+ return __result_type(__args...);
+ }
+
+ template<typename... _Elements>
+ inline tuple<_Elements&...>
+ tie(_Elements&... __args)
+ {
+ return tuple<_Elements&...>(__args...);
+ }
+
+ // A class (and instance) which can be used in 'tie' when an element
+ // of a tuple is not required
+ struct _Swallow_assign
+ {
+ template<class _Tp>
+ _Swallow_assign&
+ operator=(const _Tp&)
+ { return *this; }
+ };
+
+ // TODO: Put this in some kind of shared file.
+ namespace
+ {
+ _Swallow_assign ignore;
+ }; // anonymous namespace
+}
+}
+
+#endif // _GLIBCXX_TR1_TUPLE
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/type_traits b/gcc-4.4.0/libstdc++-v3/include/tr1/type_traits
new file mode 100644
index 000000000..fe28f8478
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/type_traits
@@ -0,0 +1,249 @@
+// TR1 type_traits -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/type_traits
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_TYPE_TRAITS
+#define _GLIBCXX_TR1_TYPE_TRAITS 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <cstddef>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/type_traits>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/type_traits>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+namespace std
+{
+namespace tr1
+{
+#define _DEFINE_SPEC(_Trait, _Type) \
+ template<> \
+ struct _Trait<_Type> \
+ : public true_type { };
+
+ template<typename>
+ struct is_reference
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_reference<_Tp&>
+ : public true_type { };
+
+ template<typename _Tp>
+ struct is_pod
+ : public integral_constant<bool, __is_pod(_Tp) || is_void<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_trivial_constructor
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_trivial_copy
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_trivial_assign
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_trivial_destructor
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_nothrow_constructor
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_nothrow_copy
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename _Tp>
+ struct has_nothrow_assign
+ : public integral_constant<bool, is_pod<_Tp>::value>
+ { };
+
+ template<typename>
+ struct __is_signed_helper
+ : public false_type { };
+ _DEFINE_SPEC(__is_signed_helper, signed char)
+ _DEFINE_SPEC(__is_signed_helper, short)
+ _DEFINE_SPEC(__is_signed_helper, int)
+ _DEFINE_SPEC(__is_signed_helper, long)
+ _DEFINE_SPEC(__is_signed_helper, long long)
+
+ template<typename _Tp>
+ struct is_signed
+ : public integral_constant<bool, (__is_signed_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_unsigned_helper
+ : public false_type { };
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned char)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned short)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned int)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned long)
+ _DEFINE_SPEC(__is_unsigned_helper, unsigned long long)
+
+ template<typename _Tp>
+ struct is_unsigned
+ : public integral_constant<bool, (__is_unsigned_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename _Base, typename _Derived>
+ struct __is_base_of_helper
+ {
+ typedef typename remove_cv<_Base>::type _NoCv_Base;
+ typedef typename remove_cv<_Derived>::type _NoCv_Derived;
+ static const bool __value = (is_same<_Base, _Derived>::value
+ || (__is_base_of(_Base, _Derived)
+ && !is_same<_NoCv_Base,
+ _NoCv_Derived>::value));
+ };
+
+ template<typename _Base, typename _Derived>
+ struct is_base_of
+ : public integral_constant<bool,
+ __is_base_of_helper<_Base, _Derived>::__value>
+ { };
+
+ template<typename _From, typename _To>
+ struct __is_convertible_simple
+ : public __sfinae_types
+ {
+ private:
+ static __one __test(_To);
+ static __two __test(...);
+ static _From __makeFrom();
+
+ public:
+ static const bool __value = sizeof(__test(__makeFrom())) == 1;
+ };
+
+ template<typename _Tp>
+ struct add_reference;
+
+ template<typename _Tp>
+ struct __is_int_or_cref
+ {
+ typedef typename remove_reference<_Tp>::type __rr_Tp;
+ static const bool __value = (is_integral<_Tp>::value
+ || (is_integral<__rr_Tp>::value
+ && is_const<__rr_Tp>::value
+ && !is_volatile<__rr_Tp>::value));
+ };
+
+ template<typename _From, typename _To,
+ bool = (is_void<_From>::value || is_void<_To>::value
+ || is_function<_To>::value || is_array<_To>::value
+ // This special case is here only to avoid warnings.
+ || (is_floating_point<typename
+ remove_reference<_From>::type>::value
+ && __is_int_or_cref<_To>::__value))>
+ struct __is_convertible_helper
+ {
+ // "An imaginary lvalue of type From...".
+ static const bool __value = (__is_convertible_simple<typename
+ add_reference<_From>::type, _To>::__value);
+ };
+
+ template<typename _From, typename _To>
+ struct __is_convertible_helper<_From, _To, true>
+ { static const bool __value = (is_void<_To>::value
+ || (__is_int_or_cref<_To>::__value
+ && !is_void<_From>::value)); };
+
+ template<typename _From, typename _To>
+ struct is_convertible
+ : public integral_constant<bool,
+ __is_convertible_helper<_From, _To>::__value>
+ { };
+
+ // reference modifications [4.7.2].
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ // NB: Careful with reference to void.
+ template<typename _Tp, bool = (is_void<_Tp>::value
+ || is_reference<_Tp>::value)>
+ struct __add_reference_helper
+ { typedef _Tp& type; };
+
+ template<typename _Tp>
+ struct __add_reference_helper<_Tp, true>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct add_reference
+ : public __add_reference_helper<_Tp>
+ { };
+
+ // other transformations [4.8].
+ template<std::size_t _Len, std::size_t _Align>
+ struct aligned_storage
+ {
+ union type
+ {
+ unsigned char __data[_Len];
+ struct __attribute__((__aligned__((_Align)))) { } __align;
+ };
+ };
+
+#undef _DEFINE_SPEC
+}
+}
+
+#endif // _GLIBCXX_TR1_TYPE_TRAITS
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/unordered_map b/gcc-4.4.0/libstdc++-v3/include/tr1/unordered_map
new file mode 100644
index 000000000..316630f4c
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/unordered_map
@@ -0,0 +1,61 @@
+// TR1 unordered_map -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/unordered_map
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_UNORDERED_MAP
+#define _GLIBCXX_TR1_UNORDERED_MAP 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <utility>
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
+#include <bits/stringfwd.h>
+#include <tr1/type_traits>
+#include <tr1/functional_hash.h>
+#include <tr1/hashtable.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/unordered_map>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/unordered_map>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_UNORDERED_MAP
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/unordered_set b/gcc-4.4.0/libstdc++-v3/include/tr1/unordered_set
new file mode 100644
index 000000000..3bd09444e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/unordered_set
@@ -0,0 +1,61 @@
+// TR1 unordered_set -*- C++ -*-
+
+// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/unordered_set
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_UNORDERED_SET
+#define _GLIBCXX_TR1_UNORDERED_SET 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <utility>
+#include <bits/stl_algobase.h>
+#include <bits/allocator.h>
+#include <bits/stl_function.h> // equal_to, _Identity, _Select1st
+#include <bits/stringfwd.h>
+#include <tr1/type_traits>
+#include <tr1/functional_hash.h>
+#include <tr1/hashtable.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/unordered_set>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/unordered_set>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_UNORDERED_SET
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/utility b/gcc-4.4.0/libstdc++-v3/include/tr1/utility
new file mode 100644
index 000000000..0aac2b282
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/utility
@@ -0,0 +1,56 @@
+// TR1 utility -*- C++ -*-
+
+// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/utility
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_UTILITY
+#define _GLIBCXX_TR1_UTILITY 1
+
+#pragma GCC system_header
+
+#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
+# error TR1 header cannot be included from C++0x header
+#endif
+
+#include <bits/c++config.h>
+#include <bits/stl_relops.h>
+#include <bits/stl_pair.h>
+
+#if defined(_GLIBCXX_INCLUDE_AS_TR1)
+# include <tr1_impl/utility>
+#else
+# define _GLIBCXX_INCLUDE_AS_TR1
+# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
+# define _GLIBCXX_END_NAMESPACE_TR1 }
+# define _GLIBCXX_TR1 tr1::
+# include <tr1_impl/utility>
+# undef _GLIBCXX_TR1
+# undef _GLIBCXX_END_NAMESPACE_TR1
+# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
+# undef _GLIBCXX_INCLUDE_AS_TR1
+#endif
+
+#endif // _GLIBCXX_TR1_UTILITY
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/wchar.h b/gcc-4.4.0/libstdc++-v3/include/tr1/wchar.h
new file mode 100644
index 000000000..599604896
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/wchar.h
@@ -0,0 +1,34 @@
+// TR1 wchar.h -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/wchar.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_WCHAR_H
+#define _GLIBCXX_TR1_WCHAR_H 1
+
+#include <tr1/cwchar>
+
+#endif // _GLIBCXX_TR1_WCHAR_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1/wctype.h b/gcc-4.4.0/libstdc++-v3/include/tr1/wctype.h
new file mode 100644
index 000000000..604948a58
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1/wctype.h
@@ -0,0 +1,34 @@
+// TR1 wctype.h -*- C++ -*-
+
+// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1/wctype.h
+ * This is a TR1 C++ Library header.
+ */
+
+#ifndef _GLIBCXX_TR1_WCTYPE_H
+#define _GLIBCXX_TR1_WCTYPE_H 1
+
+#include <tr1/cwctype>
+
+#endif // _GLIBCXX_TR1_WCTYPE_H
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/array b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/array
new file mode 100644
index 000000000..c0bd24076
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/array
@@ -0,0 +1,287 @@
+// class template array -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/array
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ /**
+ * @brief A standard container for storing a fixed size sequence of elements.
+ *
+ * @ingroup sequences
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, a
+ * <a href="tables.html#66">reversible container</a>, and a
+ * <a href="tables.html#67">sequence</a>.
+ *
+ * Sets support random access iterators.
+ *
+ * @param Tp Type of element. Required to be a complete type.
+ * @param N Number of elements.
+ */
+ template<typename _Tp, std::size_t _Nm>
+ struct array
+ {
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // Support for zero-sized arrays mandatory.
+ value_type _M_instance[_Nm ? _Nm : 1];
+
+ // No explicit construct/copy/destroy for aggregate type.
+
+ void
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // DR 776.
+ fill(const value_type& __u)
+#else
+ assign(const value_type& __u)
+#endif
+ { std::fill_n(begin(), size(), __u); }
+
+ void
+ swap(array& __other)
+ { std::swap_ranges(begin(), end(), __other.begin()); }
+
+ // Iterators.
+ iterator
+ begin()
+ { return iterator(&_M_instance[0]); }
+
+ const_iterator
+ begin() const
+ { return const_iterator(&_M_instance[0]); }
+
+ iterator
+ end()
+ { return iterator(&_M_instance[_Nm]); }
+
+ const_iterator
+ end() const
+ { return const_iterator(&_M_instance[_Nm]); }
+
+ reverse_iterator
+ rbegin()
+ { return reverse_iterator(end()); }
+
+ const_reverse_iterator
+ rbegin() const
+ { return const_reverse_iterator(end()); }
+
+ reverse_iterator
+ rend()
+ { return reverse_iterator(begin()); }
+
+ const_reverse_iterator
+ rend() const
+ { return const_reverse_iterator(begin()); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ const_iterator
+ cbegin() const
+ { return const_iterator(&_M_instance[0]); }
+
+ const_iterator
+ cend() const
+ { return const_iterator(&_M_instance[_Nm]); }
+
+ const_reverse_iterator
+ crbegin() const
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const
+ { return const_reverse_iterator(begin()); }
+#endif
+
+ // Capacity.
+ size_type
+ size() const { return _Nm; }
+
+ size_type
+ max_size() const { return _Nm; }
+
+ bool
+ empty() const { return size() == 0; }
+
+ // Element access.
+ reference
+ operator[](size_type __n)
+ { return _M_instance[__n]; }
+
+ const_reference
+ operator[](size_type __n) const
+ { return _M_instance[__n]; }
+
+ reference
+ at(size_type __n)
+ {
+ if (__builtin_expect(__n >= _Nm, false))
+ std::__throw_out_of_range(__N("array::at"));
+ return _M_instance[__n];
+ }
+
+ const_reference
+ at(size_type __n) const
+ {
+ if (__builtin_expect(__n >= _Nm, false))
+ std::__throw_out_of_range(__N("array::at"));
+ return _M_instance[__n];
+ }
+
+ reference
+ front()
+ { return *begin(); }
+
+ const_reference
+ front() const
+ { return *begin(); }
+
+ reference
+ back()
+ { return _Nm ? *(end() - 1) : *end(); }
+
+ const_reference
+ back() const
+ { return _Nm ? *(end() - 1) : *end(); }
+
+ _Tp*
+ data()
+ { return &_M_instance[0]; }
+
+ const _Tp*
+ data() const
+ { return &_M_instance[0]; }
+ };
+
+ // Array comparisons.
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return std::equal(__one.begin(), __one.end(), __two.begin()); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one == __two); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
+ {
+ return std::lexicographical_compare(__a.begin(), __a.end(),
+ __b.begin(), __b.end());
+ }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return __two < __one; }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one > __two); }
+
+ template<typename _Tp, std::size_t _Nm>
+ inline bool
+ operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
+ { return !(__one < __two); }
+
+ // Specialized algorithms [6.2.2.2].
+ template<typename _Tp, std::size_t _Nm>
+ inline void
+ swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
+ { std::swap_ranges(__one.begin(), __one.end(), __two.begin()); }
+
+ // Tuple interface to class template array [6.2.2.5].
+
+ /// tuple_size
+ template<typename _Tp>
+ class tuple_size;
+
+ /// tuple_element
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp>
+#else
+ template<int _Int, typename _Tp>
+#endif
+ class tuple_element;
+
+ template<typename _Tp, std::size_t _Nm>
+ struct tuple_size<array<_Tp, _Nm> >
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ { static const std::size_t value = _Nm; };
+#else
+ { static const int value = _Nm; };
+#endif
+
+ template<typename _Tp, std::size_t _Nm>
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ const std::size_t
+#else
+ const int
+#endif
+ tuple_size<array<_Tp, _Nm> >::value;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+#else
+ template<int _Int, typename _Tp, std::size_t _Nm>
+#endif
+ struct tuple_element<_Int, array<_Tp, _Nm> >
+ { typedef _Tp type; };
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+#else
+ template<int _Int, typename _Tp, std::size_t _Nm>
+#endif
+ inline _Tp&
+ get(array<_Tp, _Nm>& __arr)
+ { return __arr[_Int]; }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+#else
+ template<int _Int, typename _Tp, std::size_t _Nm>
+#endif
+ inline const _Tp&
+ get(const array<_Tp, _Nm>& __arr)
+ { return __arr[_Int]; }
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h
new file mode 100644
index 000000000..48e601f21
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h
@@ -0,0 +1,239 @@
+// <tr1_impl/boost_sp_counted_base.h> -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+// shared_count.hpp
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+
+// shared_ptr.hpp
+// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
+// Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+// weak_ptr.hpp
+// Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+// enable_shared_from_this.hpp
+// Copyright (C) 2002 Peter Dimov
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// GCC Note: based on version 1.32.0 of the Boost library.
+
+/** @file tr1_impl/boost_sp_counted_base.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ class bad_weak_ptr : public std::exception
+ {
+ public:
+ virtual char const*
+ what() const throw()
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ { return "std::bad_weak_ptr"; }
+#else
+ { return "tr1::bad_weak_ptr"; }
+#endif
+ };
+
+ // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
+ inline void
+ __throw_bad_weak_ptr()
+ {
+#if __EXCEPTIONS
+ throw bad_weak_ptr();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ using __gnu_cxx::_Lock_policy;
+ using __gnu_cxx::__default_lock_policy;
+ using __gnu_cxx::_S_single;
+ using __gnu_cxx::_S_mutex;
+ using __gnu_cxx::_S_atomic;
+
+ // Empty helper class except when the template argument is _S_mutex.
+ template<_Lock_policy _Lp>
+ class _Mutex_base
+ {
+ protected:
+ // The atomic policy uses fully-fenced builtins, single doesn't care.
+ enum { _S_need_barriers = 0 };
+ };
+
+ template<>
+ class _Mutex_base<_S_mutex>
+ : public __gnu_cxx::__mutex
+ {
+ protected:
+ // This policy is used when atomic builtins are not available.
+ // The replacement atomic operations might not have the necessary
+ // memory barriers.
+ enum { _S_need_barriers = 1 };
+ };
+
+ template<_Lock_policy _Lp = __default_lock_policy>
+ class _Sp_counted_base
+ : public _Mutex_base<_Lp>
+ {
+ public:
+ _Sp_counted_base()
+ : _M_use_count(1), _M_weak_count(1) { }
+
+ virtual
+ ~_Sp_counted_base() // nothrow
+ { }
+
+ // Called when _M_use_count drops to zero, to release the resources
+ // managed by *this.
+ virtual void
+ _M_dispose() = 0; // nothrow
+
+ // Called when _M_weak_count drops to zero.
+ virtual void
+ _M_destroy() // nothrow
+ { delete this; }
+
+ virtual void*
+ _M_get_deleter(const std::type_info&) = 0;
+
+ void
+ _M_add_ref_copy()
+ { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
+
+ void
+ _M_add_ref_lock();
+
+ void
+ _M_release() // nothrow
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
+ {
+ _M_dispose();
+ // There must be a memory barrier between dispose() and destroy()
+ // to ensure that the effects of dispose() are observed in the
+ // thread that runs destroy().
+ // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
+ if (_Mutex_base<_Lp>::_S_need_barriers)
+ {
+ _GLIBCXX_READ_MEM_BARRIER;
+ _GLIBCXX_WRITE_MEM_BARRIER;
+ }
+
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
+ -1) == 1)
+ _M_destroy();
+ }
+ }
+
+ void
+ _M_weak_add_ref() // nothrow
+ { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
+
+ void
+ _M_weak_release() // nothrow
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
+ {
+ if (_Mutex_base<_Lp>::_S_need_barriers)
+ {
+ // See _M_release(),
+ // destroy() must observe results of dispose()
+ _GLIBCXX_READ_MEM_BARRIER;
+ _GLIBCXX_WRITE_MEM_BARRIER;
+ }
+ _M_destroy();
+ }
+ }
+
+ long
+ _M_get_use_count() const // nothrow
+ {
+ // No memory barrier is used here so there is no synchronization
+ // with other threads.
+ return const_cast<const volatile _Atomic_word&>(_M_use_count);
+ }
+
+ private:
+ _Sp_counted_base(_Sp_counted_base const&);
+ _Sp_counted_base& operator=(_Sp_counted_base const&);
+
+ _Atomic_word _M_use_count; // #shared
+ _Atomic_word _M_weak_count; // #weak + (#shared != 0)
+ };
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_single>::
+ _M_add_ref_lock()
+ {
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
+ {
+ _M_use_count = 0;
+ __throw_bad_weak_ptr();
+ }
+ }
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_mutex>::
+ _M_add_ref_lock()
+ {
+ __gnu_cxx::__scoped_lock sentry(*this);
+ if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
+ {
+ _M_use_count = 0;
+ __throw_bad_weak_ptr();
+ }
+ }
+
+ template<>
+ inline void
+ _Sp_counted_base<_S_atomic>::
+ _M_add_ref_lock()
+ {
+ // Perform lock-free add-if-not-zero operation.
+ _Atomic_word __count;
+ do
+ {
+ __count = _M_use_count;
+ if (__count == 0)
+ __throw_bad_weak_ptr();
+
+ // Replace the current counter value with the old value + 1, as
+ // long as it's not changed meanwhile.
+ }
+ while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
+ __count + 1));
+ }
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cctype b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cctype
new file mode 100644
index 000000000..c76d38c87
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cctype
@@ -0,0 +1,43 @@
+// TR1 cctype -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cctype
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_C99_CTYPE_TR1
+
+#undef isblank
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ using ::isblank;
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cfenv b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cfenv
new file mode 100644
index 000000000..3078c7de6
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cfenv
@@ -0,0 +1,70 @@
+// TR1 cfenv -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cfenv
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_C99_FENV_TR1
+
+#undef feclearexcept
+#undef fegetexceptflag
+#undef feraiseexcept
+#undef fesetexceptflag
+#undef fetestexcept
+#undef fegetround
+#undef fesetround
+#undef fegetenv
+#undef feholdexcept
+#undef fesetenv
+#undef feupdateenv
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ // types
+ using ::fenv_t;
+ using ::fexcept_t;
+
+ // functions
+ using ::feclearexcept;
+ using ::fegetexceptflag;
+ using ::feraiseexcept;
+ using ::fesetexceptflag;
+ using ::fetestexcept;
+
+ using ::fegetround;
+ using ::fesetround;
+
+ using ::fegetenv;
+ using ::feholdexcept;
+ using ::fesetenv;
+ using ::feupdateenv;
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cinttypes b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cinttypes
new file mode 100644
index 000000000..4a0f9f19d
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cinttypes
@@ -0,0 +1,64 @@
+// TR1 cinttypes -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cinttypes
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_C99_INTTYPES_TR1
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ // types
+ using ::imaxdiv_t;
+
+ // functions
+ using ::imaxabs;
+
+ // May collide with _Longlong abs(_Longlong), and is not described
+ // anywhere outside the synopsis. Likely, a defect.
+ //
+ // intmax_t abs(intmax_t)
+
+ using ::imaxdiv;
+
+ // Likewise, with lldiv_t div(_Longlong, _Longlong).
+ //
+ // imaxdiv_t div(intmax_t, intmax_t)
+
+ using ::strtoimax;
+ using ::strtoumax;
+
+#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+ using ::wcstoimax;
+ using ::wcstoumax;
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cmath b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cmath
new file mode 100644
index 000000000..5807380f1
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cmath
@@ -0,0 +1,902 @@
+// TR1 cmath -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cmath
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+#undef acosh
+#undef acoshf
+#undef acoshl
+#undef asinh
+#undef asinhf
+#undef asinhl
+#undef atanh
+#undef atanhf
+#undef atanhl
+#undef cbrt
+#undef cbrtf
+#undef cbrtl
+#undef copysign
+#undef copysignf
+#undef copysignl
+#undef erf
+#undef erff
+#undef erfl
+#undef erfc
+#undef erfcf
+#undef erfcl
+#undef exp2
+#undef exp2f
+#undef exp2l
+#undef expm1
+#undef expm1f
+#undef expm1l
+#undef fdim
+#undef fdimf
+#undef fdiml
+#undef fma
+#undef fmaf
+#undef fmal
+#undef fmax
+#undef fmaxf
+#undef fmaxl
+#undef fmin
+#undef fminf
+#undef fminl
+#undef hypot
+#undef hypotf
+#undef hypotl
+#undef ilogb
+#undef ilogbf
+#undef ilogbl
+#undef lgamma
+#undef lgammaf
+#undef lgammal
+#undef llrint
+#undef llrintf
+#undef llrintl
+#undef llround
+#undef llroundf
+#undef llroundl
+#undef log1p
+#undef log1pf
+#undef log1pl
+#undef log2
+#undef log2f
+#undef log2l
+#undef logb
+#undef logbf
+#undef logbl
+#undef lrint
+#undef lrintf
+#undef lrintl
+#undef lround
+#undef lroundf
+#undef lroundl
+#undef nan
+#undef nanf
+#undef nanl
+#undef nearbyint
+#undef nearbyintf
+#undef nearbyintl
+#undef nextafter
+#undef nextafterf
+#undef nextafterl
+#undef nexttoward
+#undef nexttowardf
+#undef nexttowardl
+#undef remainder
+#undef remainderf
+#undef remainderl
+#undef remquo
+#undef remquof
+#undef remquol
+#undef rint
+#undef rintf
+#undef rintl
+#undef round
+#undef roundf
+#undef roundl
+#undef scalbln
+#undef scalblnf
+#undef scalblnl
+#undef scalbn
+#undef scalbnf
+#undef scalbnl
+#undef tgamma
+#undef tgammaf
+#undef tgammal
+#undef trunc
+#undef truncf
+#undef truncl
+
+#endif
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ // types
+ using ::double_t;
+ using ::float_t;
+
+ // functions
+ using ::acosh;
+ using ::acoshf;
+ using ::acoshl;
+
+ using ::asinh;
+ using ::asinhf;
+ using ::asinhl;
+
+ using ::atanh;
+ using ::atanhf;
+ using ::atanhl;
+
+ using ::cbrt;
+ using ::cbrtf;
+ using ::cbrtl;
+
+ using ::copysign;
+ using ::copysignf;
+ using ::copysignl;
+
+ using ::erf;
+ using ::erff;
+ using ::erfl;
+
+ using ::erfc;
+ using ::erfcf;
+ using ::erfcl;
+
+ using ::exp2;
+ using ::exp2f;
+ using ::exp2l;
+
+ using ::expm1;
+ using ::expm1f;
+ using ::expm1l;
+
+ using ::fdim;
+ using ::fdimf;
+ using ::fdiml;
+
+ using ::fma;
+ using ::fmaf;
+ using ::fmal;
+
+ using ::fmax;
+ using ::fmaxf;
+ using ::fmaxl;
+
+ using ::fmin;
+ using ::fminf;
+ using ::fminl;
+
+ using ::hypot;
+ using ::hypotf;
+ using ::hypotl;
+
+ using ::ilogb;
+ using ::ilogbf;
+ using ::ilogbl;
+
+ using ::lgamma;
+ using ::lgammaf;
+ using ::lgammal;
+
+ using ::llrint;
+ using ::llrintf;
+ using ::llrintl;
+
+ using ::llround;
+ using ::llroundf;
+ using ::llroundl;
+
+ using ::log1p;
+ using ::log1pf;
+ using ::log1pl;
+
+ using ::log2;
+ using ::log2f;
+ using ::log2l;
+
+ using ::logb;
+ using ::logbf;
+ using ::logbl;
+
+ using ::lrint;
+ using ::lrintf;
+ using ::lrintl;
+
+ using ::lround;
+ using ::lroundf;
+ using ::lroundl;
+
+ using ::nan;
+ using ::nanf;
+ using ::nanl;
+
+ using ::nearbyint;
+ using ::nearbyintf;
+ using ::nearbyintl;
+
+ using ::nextafter;
+ using ::nextafterf;
+ using ::nextafterl;
+
+ using ::nexttoward;
+ using ::nexttowardf;
+ using ::nexttowardl;
+
+ using ::remainder;
+ using ::remainderf;
+ using ::remainderl;
+
+ using ::remquo;
+ using ::remquof;
+ using ::remquol;
+
+ using ::rint;
+ using ::rintf;
+ using ::rintl;
+
+ using ::round;
+ using ::roundf;
+ using ::roundl;
+
+ using ::scalbln;
+ using ::scalblnf;
+ using ::scalblnl;
+
+ using ::scalbn;
+ using ::scalbnf;
+ using ::scalbnl;
+
+ using ::tgamma;
+ using ::tgammaf;
+ using ::tgammal;
+
+ using ::trunc;
+ using ::truncf;
+ using ::truncl;
+
+#endif
+
+#if _GLIBCXX_USE_C99_MATH
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+ /// Function template definitions [8.16.3].
+ using std::signbit;
+
+ using std::fpclassify;
+
+ using std::isfinite;
+ using std::isinf;
+ using std::isnan;
+ using std::isnormal;
+
+ using std::isgreater;
+ using std::isgreaterequal;
+ using std::isless;
+ using std::islessequal;
+ using std::islessgreater;
+ using std::isunordered;
+#endif
+#endif
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ /// Additional overloads [8.16.4].
+ using std::acos;
+
+ inline float
+ acosh(float __x)
+ { return __builtin_acoshf(__x); }
+
+ inline long double
+ acosh(long double __x)
+ { return __builtin_acoshl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ acosh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return acosh(__type(__x));
+ }
+
+ using std::asin;
+
+ inline float
+ asinh(float __x)
+ { return __builtin_asinhf(__x); }
+
+ inline long double
+ asinh(long double __x)
+ { return __builtin_asinhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ asinh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return asinh(__type(__x));
+ }
+
+ using std::atan;
+ using std::atan2;
+
+ inline float
+ atanh(float __x)
+ { return __builtin_atanhf(__x); }
+
+ inline long double
+ atanh(long double __x)
+ { return __builtin_atanhl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ atanh(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return atanh(__type(__x));
+ }
+
+ inline float
+ cbrt(float __x)
+ { return __builtin_cbrtf(__x); }
+
+ inline long double
+ cbrt(long double __x)
+ { return __builtin_cbrtl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ cbrt(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return cbrt(__type(__x));
+ }
+
+ using std::ceil;
+
+ inline float
+ copysign(float __x, float __y)
+ { return __builtin_copysignf(__x, __y); }
+
+ inline long double
+ copysign(long double __x, long double __y)
+ { return __builtin_copysignl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ copysign(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return copysign(__type(__x), __type(__y));
+ }
+
+ using std::cos;
+ using std::cosh;
+
+ inline float
+ erf(float __x)
+ { return __builtin_erff(__x); }
+
+ inline long double
+ erf(long double __x)
+ { return __builtin_erfl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ erf(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return erf(__type(__x));
+ }
+
+ inline float
+ erfc(float __x)
+ { return __builtin_erfcf(__x); }
+
+ inline long double
+ erfc(long double __x)
+ { return __builtin_erfcl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ erfc(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return erfc(__type(__x));
+ }
+
+ using std::exp;
+
+ inline float
+ exp2(float __x)
+ { return __builtin_exp2f(__x); }
+
+ inline long double
+ exp2(long double __x)
+ { return __builtin_exp2l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ exp2(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return exp2(__type(__x));
+ }
+
+ inline float
+ expm1(float __x)
+ { return __builtin_expm1f(__x); }
+
+ inline long double
+ expm1(long double __x)
+ { return __builtin_expm1l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ expm1(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return expm1(__type(__x));
+ }
+
+ using std::fabs;
+
+ inline float
+ fdim(float __x, float __y)
+ { return __builtin_fdimf(__x, __y); }
+
+ inline long double
+ fdim(long double __x, long double __y)
+ { return __builtin_fdiml(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fdim(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fdim(__type(__x), __type(__y));
+ }
+
+ using std::floor;
+
+ inline float
+ fma(float __x, float __y, float __z)
+ { return __builtin_fmaf(__x, __y, __z); }
+
+ inline long double
+ fma(long double __x, long double __y, long double __z)
+ { return __builtin_fmal(__x, __y, __z); }
+
+ template<typename _Tp, typename _Up, typename _Vp>
+ inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
+ fma(_Tp __x, _Up __y, _Vp __z)
+ {
+ typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
+ return fma(__type(__x), __type(__y), __type(__z));
+ }
+
+ inline float
+ fmax(float __x, float __y)
+ { return __builtin_fmaxf(__x, __y); }
+
+ inline long double
+ fmax(long double __x, long double __y)
+ { return __builtin_fmaxl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fmax(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmax(__type(__x), __type(__y));
+ }
+
+ inline float
+ fmin(float __x, float __y)
+ { return __builtin_fminf(__x, __y); }
+
+ inline long double
+ fmin(long double __x, long double __y)
+ { return __builtin_fminl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ fmin(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return fmin(__type(__x), __type(__y));
+ }
+
+ using std::fmod;
+ using std::frexp;
+
+ inline float
+ hypot(float __x, float __y)
+ { return __builtin_hypotf(__x, __y); }
+
+ inline long double
+ hypot(long double __x, long double __y)
+ { return __builtin_hypotl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ hypot(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return hypot(__type(__x), __type(__y));
+ }
+
+ inline int
+ ilogb(float __x)
+ { return __builtin_ilogbf(__x); }
+
+ inline int
+ ilogb(long double __x)
+ { return __builtin_ilogbl(__x); }
+
+ template<typename _Tp>
+ inline int
+ ilogb(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return ilogb(__type(__x));
+ }
+
+ using std::ldexp;
+
+ inline float
+ lgamma(float __x)
+ { return __builtin_lgammaf(__x); }
+
+ inline long double
+ lgamma(long double __x)
+ { return __builtin_lgammal(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ lgamma(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lgamma(__type(__x));
+ }
+
+ inline long long
+ llrint(float __x)
+ { return __builtin_llrintf(__x); }
+
+ inline long long
+ llrint(long double __x)
+ { return __builtin_llrintl(__x); }
+
+ template<typename _Tp>
+ inline long long
+ llrint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return llrint(__type(__x));
+ }
+
+ inline long long
+ llround(float __x)
+ { return __builtin_llroundf(__x); }
+
+ inline long long
+ llround(long double __x)
+ { return __builtin_llroundl(__x); }
+
+ template<typename _Tp>
+ inline long long
+ llround(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return llround(__type(__x));
+ }
+
+ using std::log;
+ using std::log10;
+
+ inline float
+ log1p(float __x)
+ { return __builtin_log1pf(__x); }
+
+ inline long double
+ log1p(long double __x)
+ { return __builtin_log1pl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ log1p(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return log1p(__type(__x));
+ }
+
+ // DR 568.
+ inline float
+ log2(float __x)
+ { return __builtin_log2f(__x); }
+
+ inline long double
+ log2(long double __x)
+ { return __builtin_log2l(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ log2(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return log2(__type(__x));
+ }
+
+ inline float
+ logb(float __x)
+ { return __builtin_logbf(__x); }
+
+ inline long double
+ logb(long double __x)
+ { return __builtin_logbl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ logb(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return logb(__type(__x));
+ }
+
+ inline long
+ lrint(float __x)
+ { return __builtin_lrintf(__x); }
+
+ inline long
+ lrint(long double __x)
+ { return __builtin_lrintl(__x); }
+
+ template<typename _Tp>
+ inline long
+ lrint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lrint(__type(__x));
+ }
+
+ inline long
+ lround(float __x)
+ { return __builtin_lroundf(__x); }
+
+ inline long
+ lround(long double __x)
+ { return __builtin_lroundl(__x); }
+
+ template<typename _Tp>
+ inline long
+ lround(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return lround(__type(__x));
+ }
+
+ inline float
+ nearbyint(float __x)
+ { return __builtin_nearbyintf(__x); }
+
+ inline long double
+ nearbyint(long double __x)
+ { return __builtin_nearbyintl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ nearbyint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return nearbyint(__type(__x));
+ }
+
+ inline float
+ nextafter(float __x, float __y)
+ { return __builtin_nextafterf(__x, __y); }
+
+ inline long double
+ nextafter(long double __x, long double __y)
+ { return __builtin_nextafterl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ nextafter(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return nextafter(__type(__x), __type(__y));
+ }
+
+ inline float
+ nexttoward(float __x, long double __y)
+ { return __builtin_nexttowardf(__x, __y); }
+
+ inline long double
+ nexttoward(long double __x, long double __y)
+ { return __builtin_nexttowardl(__x, __y); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ nexttoward(_Tp __x, long double __y)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return nexttoward(__type(__x), __y);
+ }
+
+ // DR 550. What should the return type of pow(float,int) be?
+ // NB: C++0x and TR1 != C++03.
+ // using std::pow;
+
+ inline float
+ remainder(float __x, float __y)
+ { return __builtin_remainderf(__x, __y); }
+
+ inline long double
+ remainder(long double __x, long double __y)
+ { return __builtin_remainderl(__x, __y); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ remainder(_Tp __x, _Up __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return remainder(__type(__x), __type(__y));
+ }
+
+ inline float
+ remquo(float __x, float __y, int* __pquo)
+ { return __builtin_remquof(__x, __y, __pquo); }
+
+ inline long double
+ remquo(long double __x, long double __y, int* __pquo)
+ { return __builtin_remquol(__x, __y, __pquo); }
+
+ template<typename _Tp, typename _Up>
+ inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ remquo(_Tp __x, _Up __y, int* __pquo)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return remquo(__type(__x), __type(__y), __pquo);
+ }
+
+ inline float
+ rint(float __x)
+ { return __builtin_rintf(__x); }
+
+ inline long double
+ rint(long double __x)
+ { return __builtin_rintl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ rint(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return rint(__type(__x));
+ }
+
+ inline float
+ round(float __x)
+ { return __builtin_roundf(__x); }
+
+ inline long double
+ round(long double __x)
+ { return __builtin_roundl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ round(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return round(__type(__x));
+ }
+
+ inline float
+ scalbln(float __x, long __ex)
+ { return __builtin_scalblnf(__x, __ex); }
+
+ inline long double
+ scalbln(long double __x, long __ex)
+ { return __builtin_scalblnl(__x, __ex); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ scalbln(_Tp __x, long __ex)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return scalbln(__type(__x), __ex);
+ }
+
+ inline float
+ scalbn(float __x, int __ex)
+ { return __builtin_scalbnf(__x, __ex); }
+
+ inline long double
+ scalbn(long double __x, int __ex)
+ { return __builtin_scalbnl(__x, __ex); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ scalbn(_Tp __x, int __ex)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return scalbn(__type(__x), __ex);
+ }
+
+ using std::sin;
+ using std::sinh;
+ using std::sqrt;
+ using std::tan;
+ using std::tanh;
+
+ inline float
+ tgamma(float __x)
+ { return __builtin_tgammaf(__x); }
+
+ inline long double
+ tgamma(long double __x)
+ { return __builtin_tgammal(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ tgamma(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return tgamma(__type(__x));
+ }
+
+ inline float
+ trunc(float __x)
+ { return __builtin_truncf(__x); }
+
+ inline long double
+ trunc(long double __x)
+ { return __builtin_truncl(__x); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ trunc(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return trunc(__type(__x));
+ }
+
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/complex b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/complex
new file mode 100644
index 000000000..615fe1886
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/complex
@@ -0,0 +1,370 @@
+// TR1 complex -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/complex
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ /**
+ * @addtogroup complex_numbers
+ * @{
+ */
+
+ // Forward declarations.
+ template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);
+
+ template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);
+ template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // DR 595.
+ template<typename _Tp> _Tp fabs(const std::complex<_Tp>&);
+#else
+ template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&);
+#endif
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ __complex_acos(const std::complex<_Tp>& __z)
+ {
+ const std::complex<_Tp> __t = std::_GLIBCXX_TR1 asin(__z);
+ const _Tp __pi_2 = 1.5707963267948966192313216916397514L;
+ return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_acos(__complex__ float __z)
+ { return __builtin_cacosf(__z); }
+
+ inline __complex__ double
+ __complex_acos(__complex__ double __z)
+ { return __builtin_cacos(__z); }
+
+ inline __complex__ long double
+ __complex_acos(const __complex__ long double& __z)
+ { return __builtin_cacosl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acos(const std::complex<_Tp>& __z)
+ { return __complex_acos(__z.__rep()); }
+#else
+ /// acos(__z) [8.1.2].
+ // Effects: Behaves the same as C99 function cacos, defined
+ // in subclause 7.3.5.1.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acos(const std::complex<_Tp>& __z)
+ { return __complex_acos(__z); }
+#endif
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ __complex_asin(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t(-__z.imag(), __z.real());
+ __t = std::_GLIBCXX_TR1 asinh(__t);
+ return std::complex<_Tp>(__t.imag(), -__t.real());
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_asin(__complex__ float __z)
+ { return __builtin_casinf(__z); }
+
+ inline __complex__ double
+ __complex_asin(__complex__ double __z)
+ { return __builtin_casin(__z); }
+
+ inline __complex__ long double
+ __complex_asin(const __complex__ long double& __z)
+ { return __builtin_casinl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asin(const std::complex<_Tp>& __z)
+ { return __complex_asin(__z.__rep()); }
+#else
+ /// asin(__z) [8.1.3].
+ // Effects: Behaves the same as C99 function casin, defined
+ // in subclause 7.3.5.2.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asin(const std::complex<_Tp>& __z)
+ { return __complex_asin(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_atan(const std::complex<_Tp>& __z)
+ {
+ const _Tp __r2 = __z.real() * __z.real();
+ const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();
+
+ _Tp __num = __z.imag() + _Tp(1.0);
+ _Tp __den = __z.imag() - _Tp(1.0);
+
+ __num = __r2 + __num * __num;
+ __den = __r2 + __den * __den;
+
+ return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),
+ _Tp(0.25) * log(__num / __den));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_atan(__complex__ float __z)
+ { return __builtin_catanf(__z); }
+
+ inline __complex__ double
+ __complex_atan(__complex__ double __z)
+ { return __builtin_catan(__z); }
+
+ inline __complex__ long double
+ __complex_atan(const __complex__ long double& __z)
+ { return __builtin_catanl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atan(const std::complex<_Tp>& __z)
+ { return __complex_atan(__z.__rep()); }
+#else
+ /// atan(__z) [8.1.4].
+ // Effects: Behaves the same as C99 function catan, defined
+ // in subclause 7.3.5.3.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atan(const std::complex<_Tp>& __z)
+ { return __complex_atan(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_acosh(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t((__z.real() - __z.imag())
+ * (__z.real() + __z.imag()) - _Tp(1.0),
+ _Tp(2.0) * __z.real() * __z.imag());
+ __t = std::sqrt(__t);
+
+ return std::log(__t + __z);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_acosh(__complex__ float __z)
+ { return __builtin_cacoshf(__z); }
+
+ inline __complex__ double
+ __complex_acosh(__complex__ double __z)
+ { return __builtin_cacosh(__z); }
+
+ inline __complex__ long double
+ __complex_acosh(const __complex__ long double& __z)
+ { return __builtin_cacoshl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acosh(const std::complex<_Tp>& __z)
+ { return __complex_acosh(__z.__rep()); }
+#else
+ /// acosh(__z) [8.1.5].
+ // Effects: Behaves the same as C99 function cacosh, defined
+ // in subclause 7.3.6.1.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ acosh(const std::complex<_Tp>& __z)
+ { return __complex_acosh(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_asinh(const std::complex<_Tp>& __z)
+ {
+ std::complex<_Tp> __t((__z.real() - __z.imag())
+ * (__z.real() + __z.imag()) + _Tp(1.0),
+ _Tp(2.0) * __z.real() * __z.imag());
+ __t = std::sqrt(__t);
+
+ return std::log(__t + __z);
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_asinh(__complex__ float __z)
+ { return __builtin_casinhf(__z); }
+
+ inline __complex__ double
+ __complex_asinh(__complex__ double __z)
+ { return __builtin_casinh(__z); }
+
+ inline __complex__ long double
+ __complex_asinh(const __complex__ long double& __z)
+ { return __builtin_casinhl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asinh(const std::complex<_Tp>& __z)
+ { return __complex_asinh(__z.__rep()); }
+#else
+ /// asinh(__z) [8.1.6].
+ // Effects: Behaves the same as C99 function casin, defined
+ // in subclause 7.3.6.2.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ asinh(const std::complex<_Tp>& __z)
+ { return __complex_asinh(__z); }
+#endif
+
+ template<typename _Tp>
+ std::complex<_Tp>
+ __complex_atanh(const std::complex<_Tp>& __z)
+ {
+ const _Tp __i2 = __z.imag() * __z.imag();
+ const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();
+
+ _Tp __num = _Tp(1.0) + __z.real();
+ _Tp __den = _Tp(1.0) - __z.real();
+
+ __num = __i2 + __num * __num;
+ __den = __i2 + __den * __den;
+
+ return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),
+ _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
+ }
+
+#if _GLIBCXX_USE_C99_COMPLEX_TR1
+ inline __complex__ float
+ __complex_atanh(__complex__ float __z)
+ { return __builtin_catanhf(__z); }
+
+ inline __complex__ double
+ __complex_atanh(__complex__ double __z)
+ { return __builtin_catanh(__z); }
+
+ inline __complex__ long double
+ __complex_atanh(const __complex__ long double& __z)
+ { return __builtin_catanhl(__z); }
+
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atanh(const std::complex<_Tp>& __z)
+ { return __complex_atanh(__z.__rep()); }
+#else
+ /// atanh(__z) [8.1.7].
+ // Effects: Behaves the same as C99 function catanh, defined
+ // in subclause 7.3.6.3.
+ template<typename _Tp>
+ inline std::complex<_Tp>
+ atanh(const std::complex<_Tp>& __z)
+ { return __complex_atanh(__z); }
+#endif
+
+ template<typename _Tp>
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ inline _Tp
+#else
+ inline std::complex<_Tp>
+#endif
+ /// fabs(__z) [8.1.8].
+ // Effects: Behaves the same as C99 function cabs, defined
+ // in subclause 7.3.8.1.
+ fabs(const std::complex<_Tp>& __z)
+ { return std::abs(__z); }
+
+ /// Additional overloads [8.1.9].
+#if (defined(_GLIBCXX_INCLUDE_AS_CXX0X) \
+ || (defined(_GLIBCXX_INCLUDE_AS_TR1) \
+ && !defined(__GXX_EXPERIMENTAL_CXX0X__)))
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ arg(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return std::arg(std::complex<__type>(__x));
+ }
+
+ template<typename _Tp>
+ inline std::complex<typename __gnu_cxx::__promote<_Tp>::__type>
+ conj(_Tp __x)
+ { return __x; }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ imag(_Tp)
+ { return _Tp(); }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ norm(_Tp __x)
+ {
+ typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+ return __type(__x) * __type(__x);
+ }
+
+ template<typename _Tp>
+ inline typename __gnu_cxx::__promote<_Tp>::__type
+ real(_Tp __x)
+ { return __x; }
+
+#endif
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const std::complex<_Tp>& __x, const _Up& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(std::complex<__type>(__x), __type(__y));
+ }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const _Tp& __x, const std::complex<_Up>& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(__type(__x), std::complex<__type>(__y));
+ }
+
+ template<typename _Tp, typename _Up>
+ inline std::complex<typename __gnu_cxx::__promote_2<_Tp, _Up>::__type>
+ pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)
+ {
+ typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
+ return std::pow(std::complex<__type>(__x),
+ std::complex<__type>(__y));
+ }
+
+ // @} group complex_numbers
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdint b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdint
new file mode 100644
index 000000000..d1403887a
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdint
@@ -0,0 +1,75 @@
+// TR1 cstdint -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cstdint
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_C99_STDINT_TR1
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ using ::int8_t;
+ using ::int16_t;
+ using ::int32_t;
+ using ::int64_t;
+
+ using ::int_fast8_t;
+ using ::int_fast16_t;
+ using ::int_fast32_t;
+ using ::int_fast64_t;
+
+ using ::int_least8_t;
+ using ::int_least16_t;
+ using ::int_least32_t;
+ using ::int_least64_t;
+
+ using ::intmax_t;
+ using ::intptr_t;
+
+ using ::uint8_t;
+ using ::uint16_t;
+ using ::uint32_t;
+ using ::uint64_t;
+
+ using ::uint_fast8_t;
+ using ::uint_fast16_t;
+ using ::uint_fast32_t;
+ using ::uint_fast64_t;
+
+ using ::uint_least8_t;
+ using ::uint_least16_t;
+ using ::uint_least32_t;
+ using ::uint_least64_t;
+
+ using ::uintmax_t;
+ using ::uintptr_t;
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdio b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdio
new file mode 100644
index 000000000..8b100cceb
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdio
@@ -0,0 +1,44 @@
+// TR1 cstdio -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cstdio
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+#if _GLIBCXX_USE_C99
+ using std::snprintf;
+ using std::vsnprintf;
+
+ using std::vfscanf;
+ using std::vscanf;
+ using std::vsscanf;
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdlib b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdlib
new file mode 100644
index 000000000..e9a590f0b
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cstdlib
@@ -0,0 +1,65 @@
+// TR1 cstdlib -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cstdlib
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_HOSTED
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+#if _GLIBCXX_USE_C99
+
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ // types
+ using std::lldiv_t;
+
+ // functions
+ using std::llabs;
+ using std::lldiv;
+#endif
+
+ using std::atoll;
+ using std::strtoll;
+ using std::strtoull;
+
+ using std::strtof;
+ using std::strtold;
+
+ // overloads
+ using std::abs;
+#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
+ using std::div;
+#endif
+
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwchar b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwchar
new file mode 100644
index 000000000..2a9004d40
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwchar
@@ -0,0 +1,58 @@
+// TR1 cwchar -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cwchar
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_WCHAR_T
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+#if _GLIBCXX_HAVE_WCSTOF
+ using std::wcstof;
+#endif
+#if _GLIBCXX_HAVE_VFWSCANF
+ using std::vfwscanf;
+#endif
+#if _GLIBCXX_HAVE_VSWSCANF
+ using std::vswscanf;
+#endif
+#if _GLIBCXX_HAVE_VWSCANF
+ using std::vwscanf;
+#endif
+
+#if _GLIBCXX_USE_C99
+ using std::wcstold;
+ using std::wcstoll;
+ using std::wcstoull;
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwctype b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwctype
new file mode 100644
index 000000000..3135d3641
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/cwctype
@@ -0,0 +1,43 @@
+// TR1 cwctype -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/cwctype
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#if _GLIBCXX_USE_WCHAR_T
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+#if _GLIBCXX_HAVE_ISWBLANK
+ using std::iswblank;
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#endif
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional
new file mode 100644
index 000000000..7e6eaeb26
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional
@@ -0,0 +1,2130 @@
+// TR1 functional header -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/functional
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ template<typename _MemberPointer>
+ class _Mem_fn;
+
+ /**
+ * Actual implementation of _Has_result_type, which uses SFINAE to
+ * determine if the type _Tp has a publicly-accessible member type
+ * result_type.
+ */
+ template<typename _Tp>
+ class _Has_result_type_helper : __sfinae_types
+ {
+ template<typename _Up>
+ struct _Wrap_type
+ { };
+
+ template<typename _Up>
+ static __one __test(_Wrap_type<typename _Up::result_type>*);
+
+ template<typename _Up>
+ static __two __test(...);
+
+ public:
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ };
+
+ template<typename _Tp>
+ struct _Has_result_type
+ : integral_constant<bool,
+ _Has_result_type_helper<typename remove_cv<_Tp>::type>::value>
+ { };
+
+ /**
+ *
+ */
+ /// If we have found a result_type, extract it.
+ template<bool _Has_result_type, typename _Functor>
+ struct _Maybe_get_result_type
+ { };
+
+ template<typename _Functor>
+ struct _Maybe_get_result_type<true, _Functor>
+ {
+ typedef typename _Functor::result_type result_type;
+ };
+
+ /**
+ * Base class for any function object that has a weak result type, as
+ * defined in 3.3/3 of TR1.
+ */
+ template<typename _Functor>
+ struct _Weak_result_type_impl
+ : _Maybe_get_result_type<_Has_result_type<_Functor>::value, _Functor>
+ {
+ };
+
+ /// Retrieve the result type for a function type.
+ template<typename _Res, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res(_ArgTypes...)>
+ {
+ typedef _Res result_type;
+ };
+
+ /// Retrieve the result type for a function reference.
+ template<typename _Res, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res(&)(_ArgTypes...)>
+ {
+ typedef _Res result_type;
+ };
+
+ /// Retrieve the result type for a function pointer.
+ template<typename _Res, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res(*)(_ArgTypes...)>
+ {
+ typedef _Res result_type;
+ };
+
+ /// Retrieve result type for a member function pointer.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)>
+ {
+ typedef _Res result_type;
+ };
+
+ /// Retrieve result type for a const member function pointer.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const>
+ {
+ typedef _Res result_type;
+ };
+
+ /// Retrieve result type for a volatile member function pointer.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile>
+ {
+ typedef _Res result_type;
+ };
+
+ /// Retrieve result type for a const volatile member function pointer.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)const volatile>
+ {
+ typedef _Res result_type;
+ };
+
+ /**
+ * Strip top-level cv-qualifiers from the function object and let
+ * _Weak_result_type_impl perform the real work.
+ */
+ template<typename _Functor>
+ struct _Weak_result_type
+ : _Weak_result_type_impl<typename remove_cv<_Functor>::type>
+ {
+ };
+
+ template<typename _Signature>
+ class result_of;
+
+ /**
+ * Actual implementation of result_of. When _Has_result_type is
+ * true, gets its result from _Weak_result_type. Otherwise, uses
+ * the function object's member template result to extract the
+ * result type.
+ */
+ template<bool _Has_result_type, typename _Signature>
+ struct _Result_of_impl;
+
+ // Handle member data pointers using _Mem_fn's logic
+ template<typename _Res, typename _Class, typename _T1>
+ struct _Result_of_impl<false, _Res _Class::*(_T1)>
+ {
+ typedef typename _Mem_fn<_Res _Class::*>
+ ::template _Result_type<_T1>::type type;
+ };
+
+ /**
+ * Determine whether we can determine a result type from @c Functor
+ * alone.
+ */
+ template<typename _Functor, typename... _ArgTypes>
+ class result_of<_Functor(_ArgTypes...)>
+ : public _Result_of_impl<
+ _Has_result_type<_Weak_result_type<_Functor> >::value,
+ _Functor(_ArgTypes...)>
+ {
+ };
+
+ /// We already know the result type for @c Functor; use it.
+ template<typename _Functor, typename... _ArgTypes>
+ struct _Result_of_impl<true, _Functor(_ArgTypes...)>
+ {
+ typedef typename _Weak_result_type<_Functor>::result_type type;
+ };
+
+ /**
+ * We need to compute the result type for this invocation the hard
+ * way.
+ */
+ template<typename _Functor, typename... _ArgTypes>
+ struct _Result_of_impl<false, _Functor(_ArgTypes...)>
+ {
+ typedef typename _Functor
+ ::template result<_Functor(_ArgTypes...)>::type type;
+ };
+
+ /**
+ * It is unsafe to access ::result when there are zero arguments, so we
+ * return @c void instead.
+ */
+ template<typename _Functor>
+ struct _Result_of_impl<false, _Functor()>
+ {
+ typedef void type;
+ };
+
+ /// Determines if the type _Tp derives from unary_function.
+ template<typename _Tp>
+ struct _Derives_from_unary_function : __sfinae_types
+ {
+ private:
+ template<typename _T1, typename _Res>
+ static __one __test(const volatile unary_function<_T1, _Res>*);
+
+ // It's tempting to change "..." to const volatile void*, but
+ // that fails when _Tp is a function type.
+ static __two __test(...);
+
+ public:
+ static const bool value = sizeof(__test((_Tp*)0)) == 1;
+ };
+
+ /// Determines if the type _Tp derives from binary_function.
+ template<typename _Tp>
+ struct _Derives_from_binary_function : __sfinae_types
+ {
+ private:
+ template<typename _T1, typename _T2, typename _Res>
+ static __one __test(const volatile binary_function<_T1, _T2, _Res>*);
+
+ // It's tempting to change "..." to const volatile void*, but
+ // that fails when _Tp is a function type.
+ static __two __test(...);
+
+ public:
+ static const bool value = sizeof(__test((_Tp*)0)) == 1;
+ };
+
+ /// Turns a function type into a function pointer type
+ template<typename _Tp, bool _IsFunctionType = is_function<_Tp>::value>
+ struct _Function_to_function_pointer
+ {
+ typedef _Tp type;
+ };
+
+ template<typename _Tp>
+ struct _Function_to_function_pointer<_Tp, true>
+ {
+ typedef _Tp* type;
+ };
+
+ /**
+ * Invoke a function object, which may be either a member pointer or a
+ * function object. The first parameter will tell which.
+ */
+ template<typename _Functor, typename... _Args>
+ inline
+ typename __gnu_cxx::__enable_if<
+ (!is_member_pointer<_Functor>::value
+ && !is_function<_Functor>::value
+ && !is_function<typename remove_pointer<_Functor>::type>::value),
+ typename result_of<_Functor(_Args...)>::type
+ >::__type
+ __invoke(_Functor& __f, _Args&... __args)
+ {
+ return __f(__args...);
+ }
+
+ template<typename _Functor, typename... _Args>
+ inline
+ typename __gnu_cxx::__enable_if<
+ (is_member_pointer<_Functor>::value
+ && !is_function<_Functor>::value
+ && !is_function<typename remove_pointer<_Functor>::type>::value),
+ typename result_of<_Functor(_Args...)>::type
+ >::__type
+ __invoke(_Functor& __f, _Args&... __args)
+ {
+ return mem_fn(__f)(__args...);
+ }
+
+ // To pick up function references (that will become function pointers)
+ template<typename _Functor, typename... _Args>
+ inline
+ typename __gnu_cxx::__enable_if<
+ (is_pointer<_Functor>::value
+ && is_function<typename remove_pointer<_Functor>::type>::value),
+ typename result_of<_Functor(_Args...)>::type
+ >::__type
+ __invoke(_Functor __f, _Args&... __args)
+ {
+ return __f(__args...);
+ }
+
+ /**
+ * Knowing which of unary_function and binary_function _Tp derives
+ * from, derives from the same and ensures that reference_wrapper
+ * will have a weak result type. See cases below.
+ */
+ template<bool _Unary, bool _Binary, typename _Tp>
+ struct _Reference_wrapper_base_impl;
+
+ // Not a unary_function or binary_function, so try a weak result type.
+ template<typename _Tp>
+ struct _Reference_wrapper_base_impl<false, false, _Tp>
+ : _Weak_result_type<_Tp>
+ { };
+
+ // unary_function but not binary_function
+ template<typename _Tp>
+ struct _Reference_wrapper_base_impl<true, false, _Tp>
+ : unary_function<typename _Tp::argument_type,
+ typename _Tp::result_type>
+ { };
+
+ // binary_function but not unary_function
+ template<typename _Tp>
+ struct _Reference_wrapper_base_impl<false, true, _Tp>
+ : binary_function<typename _Tp::first_argument_type,
+ typename _Tp::second_argument_type,
+ typename _Tp::result_type>
+ { };
+
+ // Both unary_function and binary_function. Import result_type to
+ // avoid conflicts.
+ template<typename _Tp>
+ struct _Reference_wrapper_base_impl<true, true, _Tp>
+ : unary_function<typename _Tp::argument_type,
+ typename _Tp::result_type>,
+ binary_function<typename _Tp::first_argument_type,
+ typename _Tp::second_argument_type,
+ typename _Tp::result_type>
+ {
+ typedef typename _Tp::result_type result_type;
+ };
+
+ /**
+ * Derives from unary_function or binary_function when it
+ * can. Specializations handle all of the easy cases. The primary
+ * template determines what to do with a class type, which may
+ * derive from both unary_function and binary_function.
+ */
+ template<typename _Tp>
+ struct _Reference_wrapper_base
+ : _Reference_wrapper_base_impl<
+ _Derives_from_unary_function<_Tp>::value,
+ _Derives_from_binary_function<_Tp>::value,
+ _Tp>
+ { };
+
+ // - a function type (unary)
+ template<typename _Res, typename _T1>
+ struct _Reference_wrapper_base<_Res(_T1)>
+ : unary_function<_T1, _Res>
+ { };
+
+ // - a function type (binary)
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Reference_wrapper_base<_Res(_T1, _T2)>
+ : binary_function<_T1, _T2, _Res>
+ { };
+
+ // - a function pointer type (unary)
+ template<typename _Res, typename _T1>
+ struct _Reference_wrapper_base<_Res(*)(_T1)>
+ : unary_function<_T1, _Res>
+ { };
+
+ // - a function pointer type (binary)
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Reference_wrapper_base<_Res(*)(_T1, _T2)>
+ : binary_function<_T1, _T2, _Res>
+ { };
+
+ // - a pointer to member function type (unary, no qualifiers)
+ template<typename _Res, typename _T1>
+ struct _Reference_wrapper_base<_Res (_T1::*)()>
+ : unary_function<_T1*, _Res>
+ { };
+
+ // - a pointer to member function type (binary, no qualifiers)
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2)>
+ : binary_function<_T1*, _T2, _Res>
+ { };
+
+ // - a pointer to member function type (unary, const)
+ template<typename _Res, typename _T1>
+ struct _Reference_wrapper_base<_Res (_T1::*)() const>
+ : unary_function<const _T1*, _Res>
+ { };
+
+ // - a pointer to member function type (binary, const)
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const>
+ : binary_function<const _T1*, _T2, _Res>
+ { };
+
+ // - a pointer to member function type (unary, volatile)
+ template<typename _Res, typename _T1>
+ struct _Reference_wrapper_base<_Res (_T1::*)() volatile>
+ : unary_function<volatile _T1*, _Res>
+ { };
+
+ // - a pointer to member function type (binary, volatile)
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile>
+ : binary_function<volatile _T1*, _T2, _Res>
+ { };
+
+ // - a pointer to member function type (unary, const volatile)
+ template<typename _Res, typename _T1>
+ struct _Reference_wrapper_base<_Res (_T1::*)() const volatile>
+ : unary_function<const volatile _T1*, _Res>
+ { };
+
+ // - a pointer to member function type (binary, const volatile)
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile>
+ : binary_function<const volatile _T1*, _T2, _Res>
+ { };
+
+ /// reference_wrapper
+ template<typename _Tp>
+ class reference_wrapper
+ : public _Reference_wrapper_base<typename remove_cv<_Tp>::type>
+ {
+ // If _Tp is a function type, we can't form result_of<_Tp(...)>,
+ // so turn it into a function pointer type.
+ typedef typename _Function_to_function_pointer<_Tp>::type
+ _M_func_type;
+
+ _Tp* _M_data;
+ public:
+ typedef _Tp type;
+
+ explicit
+ reference_wrapper(_Tp& __indata): _M_data(&__indata)
+ { }
+
+ reference_wrapper(const reference_wrapper<_Tp>& __inref):
+ _M_data(__inref._M_data)
+ { }
+
+ reference_wrapper&
+ operator=(const reference_wrapper<_Tp>& __inref)
+ {
+ _M_data = __inref._M_data;
+ return *this;
+ }
+
+ operator _Tp&() const
+ { return this->get(); }
+
+ _Tp&
+ get() const
+ { return *_M_data; }
+
+ template<typename... _Args>
+ typename result_of<_M_func_type(_Args...)>::type
+ operator()(_Args&... __args) const
+ {
+ return __invoke(get(), __args...);
+ }
+ };
+
+
+ // Denotes a reference should be taken to a variable.
+ template<typename _Tp>
+ inline reference_wrapper<_Tp>
+ ref(_Tp& __t)
+ { return reference_wrapper<_Tp>(__t); }
+
+ // Denotes a const reference should be taken to a variable.
+ template<typename _Tp>
+ inline reference_wrapper<const _Tp>
+ cref(const _Tp& __t)
+ { return reference_wrapper<const _Tp>(__t); }
+
+ template<typename _Tp>
+ inline reference_wrapper<_Tp>
+ ref(reference_wrapper<_Tp> __t)
+ { return ref(__t.get()); }
+
+ template<typename _Tp>
+ inline reference_wrapper<const _Tp>
+ cref(reference_wrapper<_Tp> __t)
+ { return cref(__t.get()); }
+
+ template<typename _Tp, bool>
+ struct _Mem_fn_const_or_non
+ {
+ typedef const _Tp& type;
+ };
+
+ template<typename _Tp>
+ struct _Mem_fn_const_or_non<_Tp, false>
+ {
+ typedef _Tp& type;
+ };
+
+ /**
+ * Derives from @c unary_function or @c binary_function, or perhaps
+ * nothing, depending on the number of arguments provided. The
+ * primary template is the basis case, which derives nothing.
+ */
+ template<typename _Res, typename... _ArgTypes>
+ struct _Maybe_unary_or_binary_function { };
+
+ /// Derives from @c unary_function, as appropriate.
+ template<typename _Res, typename _T1>
+ struct _Maybe_unary_or_binary_function<_Res, _T1>
+ : std::unary_function<_T1, _Res> { };
+
+ /// Derives from @c binary_function, as appropriate.
+ template<typename _Res, typename _T1, typename _T2>
+ struct _Maybe_unary_or_binary_function<_Res, _T1, _T2>
+ : std::binary_function<_T1, _T2, _Res> { };
+
+ /// Implementation of @c mem_fn for member function pointers.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ class _Mem_fn<_Res (_Class::*)(_ArgTypes...)>
+ : public _Maybe_unary_or_binary_function<_Res, _Class*, _ArgTypes...>
+ {
+ typedef _Res (_Class::*_Functor)(_ArgTypes...);
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __object, const volatile _Class *,
+ _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+ { return ((*__ptr).*__pmf)(__args...); }
+
+ public:
+ typedef _Res result_type;
+
+ explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
+
+ // Handle objects
+ _Res
+ operator()(_Class& __object, _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ // Handle pointers
+ _Res
+ operator()(_Class* __object, _ArgTypes... __args) const
+ { return (__object->*__pmf)(__args...); }
+
+ // Handle smart pointers, references and pointers to derived
+ template<typename _Tp>
+ _Res
+ operator()(_Tp& __object, _ArgTypes... __args) const
+ { return _M_call(__object, &__object, __args...); }
+
+ private:
+ _Functor __pmf;
+ };
+
+ /// Implementation of @c mem_fn for const member function pointers.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const>
+ : public _Maybe_unary_or_binary_function<_Res, const _Class*,
+ _ArgTypes...>
+ {
+ typedef _Res (_Class::*_Functor)(_ArgTypes...) const;
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __object, const volatile _Class *,
+ _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+ { return ((*__ptr).*__pmf)(__args...); }
+
+ public:
+ typedef _Res result_type;
+
+ explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
+
+ // Handle objects
+ _Res
+ operator()(const _Class& __object, _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ // Handle pointers
+ _Res
+ operator()(const _Class* __object, _ArgTypes... __args) const
+ { return (__object->*__pmf)(__args...); }
+
+ // Handle smart pointers, references and pointers to derived
+ template<typename _Tp>
+ _Res operator()(_Tp& __object, _ArgTypes... __args) const
+ { return _M_call(__object, &__object, __args...); }
+
+ private:
+ _Functor __pmf;
+ };
+
+ /// Implementation of @c mem_fn for volatile member function pointers.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ class _Mem_fn<_Res (_Class::*)(_ArgTypes...) volatile>
+ : public _Maybe_unary_or_binary_function<_Res, volatile _Class*,
+ _ArgTypes...>
+ {
+ typedef _Res (_Class::*_Functor)(_ArgTypes...) volatile;
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __object, const volatile _Class *,
+ _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+ { return ((*__ptr).*__pmf)(__args...); }
+
+ public:
+ typedef _Res result_type;
+
+ explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
+
+ // Handle objects
+ _Res
+ operator()(volatile _Class& __object, _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ // Handle pointers
+ _Res
+ operator()(volatile _Class* __object, _ArgTypes... __args) const
+ { return (__object->*__pmf)(__args...); }
+
+ // Handle smart pointers, references and pointers to derived
+ template<typename _Tp>
+ _Res
+ operator()(_Tp& __object, _ArgTypes... __args) const
+ { return _M_call(__object, &__object, __args...); }
+
+ private:
+ _Functor __pmf;
+ };
+
+ /// Implementation of @c mem_fn for const volatile member function pointers.
+ template<typename _Res, typename _Class, typename... _ArgTypes>
+ class _Mem_fn<_Res (_Class::*)(_ArgTypes...) const volatile>
+ : public _Maybe_unary_or_binary_function<_Res, const volatile _Class*,
+ _ArgTypes...>
+ {
+ typedef _Res (_Class::*_Functor)(_ArgTypes...) const volatile;
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __object, const volatile _Class *,
+ _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ template<typename _Tp>
+ _Res
+ _M_call(_Tp& __ptr, const volatile void *, _ArgTypes... __args) const
+ { return ((*__ptr).*__pmf)(__args...); }
+
+ public:
+ typedef _Res result_type;
+
+ explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { }
+
+ // Handle objects
+ _Res
+ operator()(const volatile _Class& __object, _ArgTypes... __args) const
+ { return (__object.*__pmf)(__args...); }
+
+ // Handle pointers
+ _Res
+ operator()(const volatile _Class* __object, _ArgTypes... __args) const
+ { return (__object->*__pmf)(__args...); }
+
+ // Handle smart pointers, references and pointers to derived
+ template<typename _Tp>
+ _Res operator()(_Tp& __object, _ArgTypes... __args) const
+ { return _M_call(__object, &__object, __args...); }
+
+ private:
+ _Functor __pmf;
+ };
+
+
+ template<typename _Res, typename _Class>
+ class _Mem_fn<_Res _Class::*>
+ {
+ // This bit of genius is due to Peter Dimov, improved slightly by
+ // Douglas Gregor.
+ template<typename _Tp>
+ _Res&
+ _M_call(_Tp& __object, _Class *) const
+ { return __object.*__pm; }
+
+ template<typename _Tp, typename _Up>
+ _Res&
+ _M_call(_Tp& __object, _Up * const *) const
+ { return (*__object).*__pm; }
+
+ template<typename _Tp, typename _Up>
+ const _Res&
+ _M_call(_Tp& __object, const _Up * const *) const
+ { return (*__object).*__pm; }
+
+ template<typename _Tp>
+ const _Res&
+ _M_call(_Tp& __object, const _Class *) const
+ { return __object.*__pm; }
+
+ template<typename _Tp>
+ const _Res&
+ _M_call(_Tp& __ptr, const volatile void*) const
+ { return (*__ptr).*__pm; }
+
+ template<typename _Tp> static _Tp& __get_ref();
+
+ template<typename _Tp>
+ static __sfinae_types::__one __check_const(_Tp&, _Class*);
+ template<typename _Tp, typename _Up>
+ static __sfinae_types::__one __check_const(_Tp&, _Up * const *);
+ template<typename _Tp, typename _Up>
+ static __sfinae_types::__two __check_const(_Tp&, const _Up * const *);
+ template<typename _Tp>
+ static __sfinae_types::__two __check_const(_Tp&, const _Class*);
+ template<typename _Tp>
+ static __sfinae_types::__two __check_const(_Tp&, const volatile void*);
+
+ public:
+ template<typename _Tp>
+ struct _Result_type
+ : _Mem_fn_const_or_non<_Res,
+ (sizeof(__sfinae_types::__two)
+ == sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))>
+ { };
+
+ template<typename _Signature>
+ struct result;
+
+ template<typename _CVMem, typename _Tp>
+ struct result<_CVMem(_Tp)>
+ : public _Result_type<_Tp> { };
+
+ template<typename _CVMem, typename _Tp>
+ struct result<_CVMem(_Tp&)>
+ : public _Result_type<_Tp> { };
+
+ explicit
+ _Mem_fn(_Res _Class::*__pm) : __pm(__pm) { }
+
+ // Handle objects
+ _Res&
+ operator()(_Class& __object) const
+ { return __object.*__pm; }
+
+ const _Res&
+ operator()(const _Class& __object) const
+ { return __object.*__pm; }
+
+ // Handle pointers
+ _Res&
+ operator()(_Class* __object) const
+ { return __object->*__pm; }
+
+ const _Res&
+ operator()(const _Class* __object) const
+ { return __object->*__pm; }
+
+ // Handle smart pointers and derived
+ template<typename _Tp>
+ typename _Result_type<_Tp>::type
+ operator()(_Tp& __unknown) const
+ { return _M_call(__unknown, &__unknown); }
+
+ private:
+ _Res _Class::*__pm;
+ };
+
+ /**
+ * @brief Returns a function object that forwards to the member
+ * pointer @a pm.
+ */
+ template<typename _Tp, typename _Class>
+ inline _Mem_fn<_Tp _Class::*>
+ mem_fn(_Tp _Class::* __pm)
+ {
+ return _Mem_fn<_Tp _Class::*>(__pm);
+ }
+
+ /**
+ * @brief Determines if the given type _Tp is a function object
+ * should be treated as a subexpression when evaluating calls to
+ * function objects returned by bind(). [TR1 3.6.1]
+ */
+ template<typename _Tp>
+ struct is_bind_expression
+ { static const bool value = false; };
+
+ template<typename _Tp>
+ const bool is_bind_expression<_Tp>::value;
+
+ /**
+ * @brief Determines if the given type _Tp is a placeholder in a
+ * bind() expression and, if so, which placeholder it is. [TR1 3.6.2]
+ */
+ template<typename _Tp>
+ struct is_placeholder
+ { static const int value = 0; };
+
+ template<typename _Tp>
+ const int is_placeholder<_Tp>::value;
+
+ /// The type of placeholder objects defined by libstdc++.
+ template<int _Num> struct _Placeholder { };
+
+ /** @namespace std::placeholders
+ * @brief ISO C++ 0x entities sub namespace for functional.
+ *
+ * Define a large number of placeholders. There is no way to
+ * simplify this with variadic templates, because we're introducing
+ * unique names for each.
+ */
+ namespace placeholders
+ {
+ namespace
+ {
+ _Placeholder<1> _1;
+ _Placeholder<2> _2;
+ _Placeholder<3> _3;
+ _Placeholder<4> _4;
+ _Placeholder<5> _5;
+ _Placeholder<6> _6;
+ _Placeholder<7> _7;
+ _Placeholder<8> _8;
+ _Placeholder<9> _9;
+ _Placeholder<10> _10;
+ _Placeholder<11> _11;
+ _Placeholder<12> _12;
+ _Placeholder<13> _13;
+ _Placeholder<14> _14;
+ _Placeholder<15> _15;
+ _Placeholder<16> _16;
+ _Placeholder<17> _17;
+ _Placeholder<18> _18;
+ _Placeholder<19> _19;
+ _Placeholder<20> _20;
+ _Placeholder<21> _21;
+ _Placeholder<22> _22;
+ _Placeholder<23> _23;
+ _Placeholder<24> _24;
+ _Placeholder<25> _25;
+ _Placeholder<26> _26;
+ _Placeholder<27> _27;
+ _Placeholder<28> _28;
+ _Placeholder<29> _29;
+ }
+ }
+
+ /**
+ * Partial specialization of is_placeholder that provides the placeholder
+ * number for the placeholder objects defined by libstdc++.
+ */
+ template<int _Num>
+ struct is_placeholder<_Placeholder<_Num> >
+ { static const int value = _Num; };
+
+ template<int _Num>
+ const int is_placeholder<_Placeholder<_Num> >::value;
+
+ /**
+ * Stores a tuple of indices. Used by bind() to extract the elements
+ * in a tuple.
+ */
+ template<int... _Indexes>
+ struct _Index_tuple { };
+
+ /// Builds an _Index_tuple<0, 1, 2, ..., _Num-1>.
+ template<std::size_t _Num, typename _Tuple = _Index_tuple<> >
+ struct _Build_index_tuple;
+
+ template<std::size_t _Num, int... _Indexes>
+ struct _Build_index_tuple<_Num, _Index_tuple<_Indexes...> >
+ : _Build_index_tuple<_Num - 1,
+ _Index_tuple<_Indexes..., sizeof...(_Indexes)> >
+ {
+ };
+
+ template<int... _Indexes>
+ struct _Build_index_tuple<0, _Index_tuple<_Indexes...> >
+ {
+ typedef _Index_tuple<_Indexes...> __type;
+ };
+
+ /**
+ * Used by _Safe_tuple_element to indicate that there is no tuple
+ * element at this position.
+ */
+ struct _No_tuple_element;
+
+ /**
+ * Implementation helper for _Safe_tuple_element. This primary
+ * template handles the case where it is safe to use @c
+ * tuple_element.
+ */
+ template<int __i, typename _Tuple, bool _IsSafe>
+ struct _Safe_tuple_element_impl
+ : tuple_element<__i, _Tuple> { };
+
+ /**
+ * Implementation helper for _Safe_tuple_element. This partial
+ * specialization handles the case where it is not safe to use @c
+ * tuple_element. We just return @c _No_tuple_element.
+ */
+ template<int __i, typename _Tuple>
+ struct _Safe_tuple_element_impl<__i, _Tuple, false>
+ {
+ typedef _No_tuple_element type;
+ };
+
+ /**
+ * Like tuple_element, but returns @c _No_tuple_element when
+ * tuple_element would return an error.
+ */
+ template<int __i, typename _Tuple>
+ struct _Safe_tuple_element
+ : _Safe_tuple_element_impl<__i, _Tuple,
+ (__i >= 0 && __i < tuple_size<_Tuple>::value)>
+ {
+ };
+
+ /**
+ * Maps an argument to bind() into an actual argument to the bound
+ * function object [TR1 3.6.3/5]. Only the first parameter should
+ * be specified: the rest are used to determine among the various
+ * implementations. Note that, although this class is a function
+ * object, it isn't entirely normal because it takes only two
+ * parameters regardless of the number of parameters passed to the
+ * bind expression. The first parameter is the bound argument and
+ * the second parameter is a tuple containing references to the
+ * rest of the arguments.
+ */
+ template<typename _Arg,
+ bool _IsBindExp = is_bind_expression<_Arg>::value,
+ bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)>
+ class _Mu;
+
+ /**
+ * If the argument is reference_wrapper<_Tp>, returns the
+ * underlying reference. [TR1 3.6.3/5 bullet 1]
+ */
+ template<typename _Tp>
+ class _Mu<reference_wrapper<_Tp>, false, false>
+ {
+ public:
+ typedef _Tp& result_type;
+
+ /* Note: This won't actually work for const volatile
+ * reference_wrappers, because reference_wrapper::get() is const
+ * but not volatile-qualified. This might be a defect in the TR.
+ */
+ template<typename _CVRef, typename _Tuple>
+ result_type
+ operator()(_CVRef& __arg, const _Tuple&) const volatile
+ { return __arg.get(); }
+ };
+
+ /**
+ * If the argument is a bind expression, we invoke the underlying
+ * function object with the same cv-qualifiers as we are given and
+ * pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2]
+ */
+ template<typename _Arg>
+ class _Mu<_Arg, true, false>
+ {
+ public:
+ template<typename _Signature> class result;
+
+ // Determine the result type when we pass the arguments along. This
+ // involves passing along the cv-qualifiers placed on _Mu and
+ // unwrapping the argument bundle.
+ template<typename _CVMu, typename _CVArg, typename... _Args>
+ class result<_CVMu(_CVArg, tuple<_Args...>)>
+ : public result_of<_CVArg(_Args...)> { };
+
+ template<typename _CVArg, typename... _Args>
+ typename result_of<_CVArg(_Args...)>::type
+ operator()(_CVArg& __arg,
+ const tuple<_Args...>& __tuple) const volatile
+ {
+ // Construct an index tuple and forward to __call
+ typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
+ _Indexes;
+ return this->__call(__arg, __tuple, _Indexes());
+ }
+
+ private:
+ // Invokes the underlying function object __arg by unpacking all
+ // of the arguments in the tuple.
+ template<typename _CVArg, typename... _Args, int... _Indexes>
+ typename result_of<_CVArg(_Args...)>::type
+ __call(_CVArg& __arg, const tuple<_Args...>& __tuple,
+ const _Index_tuple<_Indexes...>&) const volatile
+ {
+ return __arg(_GLIBCXX_TR1 get<_Indexes>(__tuple)...);
+ }
+ };
+
+ /**
+ * If the argument is a placeholder for the Nth argument, returns
+ * a reference to the Nth argument to the bind function object.
+ * [TR1 3.6.3/5 bullet 3]
+ */
+ template<typename _Arg>
+ class _Mu<_Arg, false, true>
+ {
+ public:
+ template<typename _Signature> class result;
+
+ template<typename _CVMu, typename _CVArg, typename _Tuple>
+ class result<_CVMu(_CVArg, _Tuple)>
+ {
+ // Add a reference, if it hasn't already been done for us.
+ // This allows us to be a little bit sloppy in constructing
+ // the tuple that we pass to result_of<...>.
+ typedef typename _Safe_tuple_element<(is_placeholder<_Arg>::value
+ - 1), _Tuple>::type
+ __base_type;
+
+ public:
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ typedef typename add_lvalue_reference<__base_type>::type type;
+#else
+ typedef typename add_reference<__base_type>::type type;
+#endif
+ };
+
+ template<typename _Tuple>
+ typename result<_Mu(_Arg, _Tuple)>::type
+ operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile
+ {
+ return ::std::_GLIBCXX_TR1 get<(is_placeholder<_Arg>::value
+ - 1)>(__tuple);
+ }
+ };
+
+ /**
+ * If the argument is just a value, returns a reference to that
+ * value. The cv-qualifiers on the reference are the same as the
+ * cv-qualifiers on the _Mu object. [TR1 3.6.3/5 bullet 4]
+ */
+ template<typename _Arg>
+ class _Mu<_Arg, false, false>
+ {
+ public:
+ template<typename _Signature> struct result;
+
+ template<typename _CVMu, typename _CVArg, typename _Tuple>
+ struct result<_CVMu(_CVArg, _Tuple)>
+ {
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ typedef typename add_lvalue_reference<_CVArg>::type type;
+#else
+ typedef typename add_reference<_CVArg>::type type;
+#endif
+ };
+
+ // Pick up the cv-qualifiers of the argument
+ template<typename _CVArg, typename _Tuple>
+ _CVArg&
+ operator()(_CVArg& __arg, const _Tuple&) const volatile
+ { return __arg; }
+ };
+
+ /**
+ * Maps member pointers into instances of _Mem_fn but leaves all
+ * other function objects untouched. Used by tr1::bind(). The
+ * primary template handles the non--member-pointer case.
+ */
+ template<typename _Tp>
+ struct _Maybe_wrap_member_pointer
+ {
+ typedef _Tp type;
+
+ static const _Tp&
+ __do_wrap(const _Tp& __x)
+ { return __x; }
+ };
+
+ /**
+ * Maps member pointers into instances of _Mem_fn but leaves all
+ * other function objects untouched. Used by tr1::bind(). This
+ * partial specialization handles the member pointer case.
+ */
+ template<typename _Tp, typename _Class>
+ struct _Maybe_wrap_member_pointer<_Tp _Class::*>
+ {
+ typedef _Mem_fn<_Tp _Class::*> type;
+
+ static type
+ __do_wrap(_Tp _Class::* __pm)
+ { return type(__pm); }
+ };
+
+ /// Type of the function object returned from bind().
+ template<typename _Signature>
+ struct _Bind;
+
+ template<typename _Functor, typename... _Bound_args>
+ class _Bind<_Functor(_Bound_args...)>
+ : public _Weak_result_type<_Functor>
+ {
+ typedef _Bind __self_type;
+ typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
+ _Bound_indexes;
+
+ _Functor _M_f;
+ tuple<_Bound_args...> _M_bound_args;
+
+ // Call unqualified
+ template<typename... _Args, int... _Indexes>
+ typename result_of<
+ _Functor(typename result_of<_Mu<_Bound_args>
+ (_Bound_args, tuple<_Args...>)>::type...)
+ >::type
+ __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>)
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ // Call as const
+ template<typename... _Args, int... _Indexes>
+ typename result_of<
+ const _Functor(typename result_of<_Mu<_Bound_args>
+ (const _Bound_args, tuple<_Args...>)
+ >::type...)>::type
+ __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ // Call as volatile
+ template<typename... _Args, int... _Indexes>
+ typename result_of<
+ volatile _Functor(typename result_of<_Mu<_Bound_args>
+ (volatile _Bound_args, tuple<_Args...>)
+ >::type...)>::type
+ __call(const tuple<_Args...>& __args,
+ _Index_tuple<_Indexes...>) volatile
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ // Call as const volatile
+ template<typename... _Args, int... _Indexes>
+ typename result_of<
+ const volatile _Functor(typename result_of<_Mu<_Bound_args>
+ (const volatile _Bound_args,
+ tuple<_Args...>)
+ >::type...)>::type
+ __call(const tuple<_Args...>& __args,
+ _Index_tuple<_Indexes...>) const volatile
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ public:
+ explicit _Bind(_Functor __f, _Bound_args... __bound_args)
+ : _M_f(__f), _M_bound_args(__bound_args...) { }
+
+ // Call unqualified
+ template<typename... _Args>
+ typename result_of<
+ _Functor(typename result_of<_Mu<_Bound_args>
+ (_Bound_args, tuple<_Args...>)>::type...)
+ >::type
+ operator()(_Args&... __args)
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+
+ // Call as const
+ template<typename... _Args>
+ typename result_of<
+ const _Functor(typename result_of<_Mu<_Bound_args>
+ (const _Bound_args, tuple<_Args...>)>::type...)
+ >::type
+ operator()(_Args&... __args) const
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+
+
+ // Call as volatile
+ template<typename... _Args>
+ typename result_of<
+ volatile _Functor(typename result_of<_Mu<_Bound_args>
+ (volatile _Bound_args, tuple<_Args...>)>::type...)
+ >::type
+ operator()(_Args&... __args) volatile
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+
+
+ // Call as const volatile
+ template<typename... _Args>
+ typename result_of<
+ const volatile _Functor(typename result_of<_Mu<_Bound_args>
+ (const volatile _Bound_args,
+ tuple<_Args...>)>::type...)
+ >::type
+ operator()(_Args&... __args) const volatile
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+ };
+
+ /// Type of the function object returned from bind<R>().
+ template<typename _Result, typename _Signature>
+ struct _Bind_result;
+
+ template<typename _Result, typename _Functor, typename... _Bound_args>
+ class _Bind_result<_Result, _Functor(_Bound_args...)>
+ {
+ typedef _Bind_result __self_type;
+ typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
+ _Bound_indexes;
+
+ _Functor _M_f;
+ tuple<_Bound_args...> _M_bound_args;
+
+ // Call unqualified
+ template<typename... _Args, int... _Indexes>
+ _Result
+ __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>)
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ // Call as const
+ template<typename... _Args, int... _Indexes>
+ _Result
+ __call(const tuple<_Args...>& __args, _Index_tuple<_Indexes...>) const
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ // Call as volatile
+ template<typename... _Args, int... _Indexes>
+ _Result
+ __call(const tuple<_Args...>& __args,
+ _Index_tuple<_Indexes...>) volatile
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ // Call as const volatile
+ template<typename... _Args, int... _Indexes>
+ _Result
+ __call(const tuple<_Args...>& __args,
+ _Index_tuple<_Indexes...>) const volatile
+ {
+ return _M_f(_Mu<_Bound_args>()
+ (_GLIBCXX_TR1 get<_Indexes>(_M_bound_args), __args)...);
+ }
+
+ public:
+ typedef _Result result_type;
+
+ explicit
+ _Bind_result(_Functor __f, _Bound_args... __bound_args)
+ : _M_f(__f), _M_bound_args(__bound_args...) { }
+
+ // Call unqualified
+ template<typename... _Args>
+ result_type
+ operator()(_Args&... __args)
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+
+ // Call as const
+ template<typename... _Args>
+ result_type
+ operator()(_Args&... __args) const
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+
+ // Call as volatile
+ template<typename... _Args>
+ result_type
+ operator()(_Args&... __args) volatile
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+
+ // Call as const volatile
+ template<typename... _Args>
+ result_type
+ operator()(_Args&... __args) const volatile
+ {
+ return this->__call(_GLIBCXX_TR1 tie(__args...), _Bound_indexes());
+ }
+ };
+
+ /// Class template _Bind is always a bind expression.
+ template<typename _Signature>
+ struct is_bind_expression<_Bind<_Signature> >
+ { static const bool value = true; };
+
+ template<typename _Signature>
+ const bool is_bind_expression<_Bind<_Signature> >::value;
+
+ /// Class template _Bind_result is always a bind expression.
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<_Bind_result<_Result, _Signature> >
+ { static const bool value = true; };
+
+ template<typename _Result, typename _Signature>
+ const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value;
+
+ /// bind
+ template<typename _Functor, typename... _ArgTypes>
+ inline
+ _Bind<typename _Maybe_wrap_member_pointer<_Functor>::type(_ArgTypes...)>
+ bind(_Functor __f, _ArgTypes... __args)
+ {
+ typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type;
+ typedef typename __maybe_type::type __functor_type;
+ typedef _Bind<__functor_type(_ArgTypes...)> __result_type;
+ return __result_type(__maybe_type::__do_wrap(__f), __args...);
+ }
+
+ template<typename _Result, typename _Functor, typename... _ArgTypes>
+ inline
+ _Bind_result<_Result,
+ typename _Maybe_wrap_member_pointer<_Functor>::type
+ (_ArgTypes...)>
+ bind(_Functor __f, _ArgTypes... __args)
+ {
+ typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type;
+ typedef typename __maybe_type::type __functor_type;
+ typedef _Bind_result<_Result, __functor_type(_ArgTypes...)>
+ __result_type;
+ return __result_type(__maybe_type::__do_wrap(__f), __args...);
+ }
+
+ /**
+ * @brief Exception class thrown when class template function's
+ * operator() is called with an empty target.
+ *
+ */
+ class bad_function_call : public std::exception { };
+
+ /**
+ * The integral constant expression 0 can be converted into a
+ * pointer to this type. It is used by the function template to
+ * accept NULL pointers.
+ */
+ struct _M_clear_type;
+
+ /**
+ * Trait identifying "location-invariant" types, meaning that the
+ * address of the object (or any of its members) will not escape.
+ * Also implies a trivial copy constructor and assignment operator.
+ */
+ template<typename _Tp>
+ struct __is_location_invariant
+ : integral_constant<bool,
+ (is_pointer<_Tp>::value
+ || is_member_pointer<_Tp>::value)>
+ {
+ };
+
+ class _Undefined_class;
+
+ union _Nocopy_types
+ {
+ void* _M_object;
+ const void* _M_const_object;
+ void (*_M_function_pointer)();
+ void (_Undefined_class::*_M_member_pointer)();
+ };
+
+ union _Any_data
+ {
+ void* _M_access() { return &_M_pod_data[0]; }
+ const void* _M_access() const { return &_M_pod_data[0]; }
+
+ template<typename _Tp>
+ _Tp&
+ _M_access()
+ { return *static_cast<_Tp*>(_M_access()); }
+
+ template<typename _Tp>
+ const _Tp&
+ _M_access() const
+ { return *static_cast<const _Tp*>(_M_access()); }
+
+ _Nocopy_types _M_unused;
+ char _M_pod_data[sizeof(_Nocopy_types)];
+ };
+
+ enum _Manager_operation
+ {
+ __get_type_info,
+ __get_functor_ptr,
+ __clone_functor,
+ __destroy_functor
+ };
+
+ // Simple type wrapper that helps avoid annoying const problems
+ // when casting between void pointers and pointers-to-pointers.
+ template<typename _Tp>
+ struct _Simple_type_wrapper
+ {
+ _Simple_type_wrapper(_Tp __value) : __value(__value) { }
+
+ _Tp __value;
+ };
+
+ template<typename _Tp>
+ struct __is_location_invariant<_Simple_type_wrapper<_Tp> >
+ : __is_location_invariant<_Tp>
+ {
+ };
+
+ // Converts a reference to a function object into a callable
+ // function object.
+ template<typename _Functor>
+ inline _Functor&
+ __callable_functor(_Functor& __f)
+ { return __f; }
+
+ template<typename _Member, typename _Class>
+ inline _Mem_fn<_Member _Class::*>
+ __callable_functor(_Member _Class::* &__p)
+ { return mem_fn(__p); }
+
+ template<typename _Member, typename _Class>
+ inline _Mem_fn<_Member _Class::*>
+ __callable_functor(_Member _Class::* const &__p)
+ { return mem_fn(__p); }
+
+ template<typename _Signature>
+ class function;
+
+ /// Base class of all polymorphic function object wrappers.
+ class _Function_base
+ {
+ public:
+ static const std::size_t _M_max_size = sizeof(_Nocopy_types);
+ static const std::size_t _M_max_align = __alignof__(_Nocopy_types);
+
+ template<typename _Functor>
+ class _Base_manager
+ {
+ protected:
+ static const bool __stored_locally =
+ (__is_location_invariant<_Functor>::value
+ && sizeof(_Functor) <= _M_max_size
+ && __alignof__(_Functor) <= _M_max_align
+ && (_M_max_align % __alignof__(_Functor) == 0));
+
+ typedef integral_constant<bool, __stored_locally> _Local_storage;
+
+ // Retrieve a pointer to the function object
+ static _Functor*
+ _M_get_pointer(const _Any_data& __source)
+ {
+ const _Functor* __ptr =
+ __stored_locally? &__source._M_access<_Functor>()
+ /* have stored a pointer */ : __source._M_access<_Functor*>();
+ return const_cast<_Functor*>(__ptr);
+ }
+
+ // Clone a location-invariant function object that fits within
+ // an _Any_data structure.
+ static void
+ _M_clone(_Any_data& __dest, const _Any_data& __source, true_type)
+ {
+ new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
+ }
+
+ // Clone a function object that is not location-invariant or
+ // that cannot fit into an _Any_data structure.
+ static void
+ _M_clone(_Any_data& __dest, const _Any_data& __source, false_type)
+ {
+ __dest._M_access<_Functor*>() =
+ new _Functor(*__source._M_access<_Functor*>());
+ }
+
+ // Destroying a location-invariant object may still require
+ // destruction.
+ static void
+ _M_destroy(_Any_data& __victim, true_type)
+ {
+ __victim._M_access<_Functor>().~_Functor();
+ }
+
+ // Destroying an object located on the heap.
+ static void
+ _M_destroy(_Any_data& __victim, false_type)
+ {
+ delete __victim._M_access<_Functor*>();
+ }
+
+ public:
+ static bool
+ _M_manager(_Any_data& __dest, const _Any_data& __source,
+ _Manager_operation __op)
+ {
+ switch (__op)
+ {
+#ifdef __GXX_RTTI
+ case __get_type_info:
+ __dest._M_access<const type_info*>() = &typeid(_Functor);
+ break;
+#endif
+ case __get_functor_ptr:
+ __dest._M_access<_Functor*>() = _M_get_pointer(__source);
+ break;
+
+ case __clone_functor:
+ _M_clone(__dest, __source, _Local_storage());
+ break;
+
+ case __destroy_functor:
+ _M_destroy(__dest, _Local_storage());
+ break;
+ }
+ return false;
+ }
+
+ static void
+ _M_init_functor(_Any_data& __functor, const _Functor& __f)
+ { _M_init_functor(__functor, __f, _Local_storage()); }
+
+ template<typename _Signature>
+ static bool
+ _M_not_empty_function(const function<_Signature>& __f)
+ { return __f; }
+
+ template<typename _Tp>
+ static bool
+ _M_not_empty_function(const _Tp*& __fp)
+ { return __fp; }
+
+ template<typename _Class, typename _Tp>
+ static bool
+ _M_not_empty_function(_Tp _Class::* const& __mp)
+ { return __mp; }
+
+ template<typename _Tp>
+ static bool
+ _M_not_empty_function(const _Tp&)
+ { return true; }
+
+ private:
+ static void
+ _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type)
+ { new (__functor._M_access()) _Functor(__f); }
+
+ static void
+ _M_init_functor(_Any_data& __functor, const _Functor& __f, false_type)
+ { __functor._M_access<_Functor*>() = new _Functor(__f); }
+ };
+
+ template<typename _Functor>
+ class _Ref_manager : public _Base_manager<_Functor*>
+ {
+ typedef _Function_base::_Base_manager<_Functor*> _Base;
+
+ public:
+ static bool
+ _M_manager(_Any_data& __dest, const _Any_data& __source,
+ _Manager_operation __op)
+ {
+ switch (__op)
+ {
+#ifdef __GXX_RTTI
+ case __get_type_info:
+ __dest._M_access<const type_info*>() = &typeid(_Functor);
+ break;
+#endif
+ case __get_functor_ptr:
+ __dest._M_access<_Functor*>() = *_Base::_M_get_pointer(__source);
+ return is_const<_Functor>::value;
+ break;
+
+ default:
+ _Base::_M_manager(__dest, __source, __op);
+ }
+ return false;
+ }
+
+ static void
+ _M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f)
+ {
+ // TBD: Use address_of function instead.
+ _Base::_M_init_functor(__functor, &__f.get());
+ }
+ };
+
+ _Function_base() : _M_manager(0) { }
+
+ ~_Function_base()
+ {
+ if (_M_manager)
+ _M_manager(_M_functor, _M_functor, __destroy_functor);
+ }
+
+
+ bool _M_empty() const { return !_M_manager; }
+
+ typedef bool (*_Manager_type)(_Any_data&, const _Any_data&,
+ _Manager_operation);
+
+ _Any_data _M_functor;
+ _Manager_type _M_manager;
+ };
+
+ template<typename _Signature, typename _Functor>
+ class _Function_handler;
+
+ template<typename _Res, typename _Functor, typename... _ArgTypes>
+ class _Function_handler<_Res(_ArgTypes...), _Functor>
+ : public _Function_base::_Base_manager<_Functor>
+ {
+ typedef _Function_base::_Base_manager<_Functor> _Base;
+
+ public:
+ static _Res
+ _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
+ {
+ return (*_Base::_M_get_pointer(__functor))(__args...);
+ }
+ };
+
+ template<typename _Functor, typename... _ArgTypes>
+ class _Function_handler<void(_ArgTypes...), _Functor>
+ : public _Function_base::_Base_manager<_Functor>
+ {
+ typedef _Function_base::_Base_manager<_Functor> _Base;
+
+ public:
+ static void
+ _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
+ {
+ (*_Base::_M_get_pointer(__functor))(__args...);
+ }
+ };
+
+ template<typename _Res, typename _Functor, typename... _ArgTypes>
+ class _Function_handler<_Res(_ArgTypes...), reference_wrapper<_Functor> >
+ : public _Function_base::_Ref_manager<_Functor>
+ {
+ typedef _Function_base::_Ref_manager<_Functor> _Base;
+
+ public:
+ static _Res
+ _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
+ {
+ return
+ __callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
+ }
+ };
+
+ template<typename _Functor, typename... _ArgTypes>
+ class _Function_handler<void(_ArgTypes...), reference_wrapper<_Functor> >
+ : public _Function_base::_Ref_manager<_Functor>
+ {
+ typedef _Function_base::_Ref_manager<_Functor> _Base;
+
+ public:
+ static void
+ _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
+ {
+ __callable_functor(**_Base::_M_get_pointer(__functor))(__args...);
+ }
+ };
+
+ template<typename _Class, typename _Member, typename _Res,
+ typename... _ArgTypes>
+ class _Function_handler<_Res(_ArgTypes...), _Member _Class::*>
+ : public _Function_handler<void(_ArgTypes...), _Member _Class::*>
+ {
+ typedef _Function_handler<void(_ArgTypes...), _Member _Class::*>
+ _Base;
+
+ public:
+ static _Res
+ _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
+ {
+ return _GLIBCXX_TR1
+ mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
+ }
+ };
+
+ template<typename _Class, typename _Member, typename... _ArgTypes>
+ class _Function_handler<void(_ArgTypes...), _Member _Class::*>
+ : public _Function_base::_Base_manager<
+ _Simple_type_wrapper< _Member _Class::* > >
+ {
+ typedef _Member _Class::* _Functor;
+ typedef _Simple_type_wrapper<_Functor> _Wrapper;
+ typedef _Function_base::_Base_manager<_Wrapper> _Base;
+
+ public:
+ static bool
+ _M_manager(_Any_data& __dest, const _Any_data& __source,
+ _Manager_operation __op)
+ {
+ switch (__op)
+ {
+#ifdef __GXX_RTTI
+ case __get_type_info:
+ __dest._M_access<const type_info*>() = &typeid(_Functor);
+ break;
+#endif
+ case __get_functor_ptr:
+ __dest._M_access<_Functor*>() =
+ &_Base::_M_get_pointer(__source)->__value;
+ break;
+
+ default:
+ _Base::_M_manager(__dest, __source, __op);
+ }
+ return false;
+ }
+
+ static void
+ _M_invoke(const _Any_data& __functor, _ArgTypes... __args)
+ {
+ _GLIBCXX_TR1
+ mem_fn(_Base::_M_get_pointer(__functor)->__value)(__args...);
+ }
+ };
+
+ /// class function
+ template<typename _Res, typename... _ArgTypes>
+ class function<_Res(_ArgTypes...)>
+ : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>,
+ private _Function_base
+ {
+ /// This class is used to implement the safe_bool idiom.
+ struct _Hidden_type
+ {
+ _Hidden_type* _M_bool;
+ };
+
+ /// This typedef is used to implement the safe_bool idiom.
+ typedef _Hidden_type* _Hidden_type::* _Safe_bool;
+
+ typedef _Res _Signature_type(_ArgTypes...);
+
+ struct _Useless { };
+
+ public:
+ typedef _Res result_type;
+
+ // [3.7.2.1] construct/copy/destroy
+
+ /**
+ * @brief Default construct creates an empty function call wrapper.
+ * @post @c !(bool)*this
+ */
+ function() : _Function_base() { }
+
+ /**
+ * @brief Default construct creates an empty function call wrapper.
+ * @post @c !(bool)*this
+ */
+ function(_M_clear_type*) : _Function_base() { }
+
+ /**
+ * @brief %Function copy constructor.
+ * @param x A %function object with identical call signature.
+ * @pre @c (bool)*this == (bool)x
+ *
+ * The newly-created %function contains a copy of the target of @a
+ * x (if it has one).
+ */
+ function(const function& __x);
+
+ /**
+ * @brief Builds a %function that targets a copy of the incoming
+ * function object.
+ * @param f A %function object that is callable with parameters of
+ * type @c T1, @c T2, ..., @c TN and returns a value convertible
+ * to @c Res.
+ *
+ * The newly-created %function object will target a copy of @a
+ * f. If @a f is @c reference_wrapper<F>, then this function
+ * object will contain a reference to the function object @c
+ * f.get(). If @a f is a NULL function pointer or NULL
+ * pointer-to-member, the newly-created object will be empty.
+ *
+ * If @a f is a non-NULL function pointer or an object of type @c
+ * reference_wrapper<F>, this function will not throw.
+ */
+ template<typename _Functor>
+ function(_Functor __f,
+ typename __gnu_cxx::__enable_if<
+ !is_integral<_Functor>::value, _Useless>::__type
+ = _Useless());
+
+ /**
+ * @brief %Function assignment operator.
+ * @param x A %function with identical call signature.
+ * @post @c (bool)*this == (bool)x
+ * @returns @c *this
+ *
+ * The target of @a x is copied to @c *this. If @a x has no
+ * target, then @c *this will be empty.
+ *
+ * If @a x targets a function pointer or a reference to a function
+ * object, then this operation will not throw an exception.
+ */
+ function&
+ operator=(const function& __x)
+ {
+ function(__x).swap(*this);
+ return *this;
+ }
+
+ /**
+ * @brief %Function assignment to zero.
+ * @post @c !(bool)*this
+ * @returns @c *this
+ *
+ * The target of @a *this is deallocated, leaving it empty.
+ */
+ function&
+ operator=(_M_clear_type*)
+ {
+ if (_M_manager)
+ {
+ _M_manager(_M_functor, _M_functor, __destroy_functor);
+ _M_manager = 0;
+ _M_invoker = 0;
+ }
+ return *this;
+ }
+
+ /**
+ * @brief %Function assignment to a new target.
+ * @param f A %function object that is callable with parameters of
+ * type @c T1, @c T2, ..., @c TN and returns a value convertible
+ * to @c Res.
+ * @return @c *this
+ *
+ * This %function object wrapper will target a copy of @a
+ * f. If @a f is @c reference_wrapper<F>, then this function
+ * object will contain a reference to the function object @c
+ * f.get(). If @a f is a NULL function pointer or NULL
+ * pointer-to-member, @c this object will be empty.
+ *
+ * If @a f is a non-NULL function pointer or an object of type @c
+ * reference_wrapper<F>, this function will not throw.
+ */
+ template<typename _Functor>
+ typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value,
+ function&>::__type
+ operator=(_Functor __f)
+ {
+ function(__f).swap(*this);
+ return *this;
+ }
+
+ // [3.7.2.2] function modifiers
+
+ /**
+ * @brief Swap the targets of two %function objects.
+ * @param f A %function with identical call signature.
+ *
+ * Swap the targets of @c this function object and @a f. This
+ * function will not throw an exception.
+ */
+ void swap(function& __x)
+ {
+ _Any_data __old_functor = _M_functor;
+ _M_functor = __x._M_functor;
+ __x._M_functor = __old_functor;
+ _Manager_type __old_manager = _M_manager;
+ _M_manager = __x._M_manager;
+ __x._M_manager = __old_manager;
+ _Invoker_type __old_invoker = _M_invoker;
+ _M_invoker = __x._M_invoker;
+ __x._M_invoker = __old_invoker;
+ }
+
+ // [3.7.2.3] function capacity
+
+ /**
+ * @brief Determine if the %function wrapper has a target.
+ *
+ * @return @c true when this %function object contains a target,
+ * or @c false when it is empty.
+ *
+ * This function will not throw an exception.
+ */
+ operator _Safe_bool() const
+ {
+ if (_M_empty())
+ return 0;
+ else
+ return &_Hidden_type::_M_bool;
+ }
+
+ // [3.7.2.4] function invocation
+
+ /**
+ * @brief Invokes the function targeted by @c *this.
+ * @returns the result of the target.
+ * @throws bad_function_call when @c !(bool)*this
+ *
+ * The function call operator invokes the target function object
+ * stored by @c this.
+ */
+ _Res operator()(_ArgTypes... __args) const;
+
+#ifdef __GXX_RTTI
+ // [3.7.2.5] function target access
+ /**
+ * @brief Determine the type of the target of this function object
+ * wrapper.
+ *
+ * @returns the type identifier of the target function object, or
+ * @c typeid(void) if @c !(bool)*this.
+ *
+ * This function will not throw an exception.
+ */
+ const type_info& target_type() const;
+
+ /**
+ * @brief Access the stored target function object.
+ *
+ * @return Returns a pointer to the stored target function object,
+ * if @c typeid(Functor).equals(target_type()); otherwise, a NULL
+ * pointer.
+ *
+ * This function will not throw an exception.
+ */
+ template<typename _Functor> _Functor* target();
+
+ /// @overload
+ template<typename _Functor> const _Functor* target() const;
+#endif
+
+ private:
+ // [3.7.2.6] undefined operators
+ template<typename _Function>
+ void operator==(const function<_Function>&) const;
+ template<typename _Function>
+ void operator!=(const function<_Function>&) const;
+
+ typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
+ _Invoker_type _M_invoker;
+ };
+
+ template<typename _Res, typename... _ArgTypes>
+ function<_Res(_ArgTypes...)>::
+ function(const function& __x)
+ : _Function_base()
+ {
+ if (__x)
+ {
+ _M_invoker = __x._M_invoker;
+ _M_manager = __x._M_manager;
+ __x._M_manager(_M_functor, __x._M_functor, __clone_functor);
+ }
+ }
+
+ template<typename _Res, typename... _ArgTypes>
+ template<typename _Functor>
+ function<_Res(_ArgTypes...)>::
+ function(_Functor __f,
+ typename __gnu_cxx::__enable_if<
+ !is_integral<_Functor>::value, _Useless>::__type)
+ : _Function_base()
+ {
+ typedef _Function_handler<_Signature_type, _Functor> _My_handler;
+
+ if (_My_handler::_M_not_empty_function(__f))
+ {
+ _M_invoker = &_My_handler::_M_invoke;
+ _M_manager = &_My_handler::_M_manager;
+ _My_handler::_M_init_functor(_M_functor, __f);
+ }
+ }
+
+ template<typename _Res, typename... _ArgTypes>
+ _Res
+ function<_Res(_ArgTypes...)>::
+ operator()(_ArgTypes... __args) const
+ {
+ if (_M_empty())
+ {
+#if __EXCEPTIONS
+ throw bad_function_call();
+#else
+ __builtin_abort();
+#endif
+ }
+ return _M_invoker(_M_functor, __args...);
+ }
+
+#ifdef __GXX_RTTI
+ template<typename _Res, typename... _ArgTypes>
+ const type_info&
+ function<_Res(_ArgTypes...)>::
+ target_type() const
+ {
+ if (_M_manager)
+ {
+ _Any_data __typeinfo_result;
+ _M_manager(__typeinfo_result, _M_functor, __get_type_info);
+ return *__typeinfo_result._M_access<const type_info*>();
+ }
+ else
+ return typeid(void);
+ }
+
+ template<typename _Res, typename... _ArgTypes>
+ template<typename _Functor>
+ _Functor*
+ function<_Res(_ArgTypes...)>::
+ target()
+ {
+ if (typeid(_Functor) == target_type() && _M_manager)
+ {
+ _Any_data __ptr;
+ if (_M_manager(__ptr, _M_functor, __get_functor_ptr)
+ && !is_const<_Functor>::value)
+ return 0;
+ else
+ return __ptr._M_access<_Functor*>();
+ }
+ else
+ return 0;
+ }
+
+ template<typename _Res, typename... _ArgTypes>
+ template<typename _Functor>
+ const _Functor*
+ function<_Res(_ArgTypes...)>::
+ target() const
+ {
+ if (typeid(_Functor) == target_type() && _M_manager)
+ {
+ _Any_data __ptr;
+ _M_manager(__ptr, _M_functor, __get_functor_ptr);
+ return __ptr._M_access<const _Functor*>();
+ }
+ else
+ return 0;
+ }
+#endif
+
+ // [3.7.2.7] null pointer comparisons
+
+ /**
+ * @brief Compares a polymorphic function object wrapper against 0
+ * (the NULL pointer).
+ * @returns @c true if the wrapper has no target, @c false otherwise
+ *
+ * This function will not throw an exception.
+ */
+ template<typename _Signature>
+ inline bool
+ operator==(const function<_Signature>& __f, _M_clear_type*)
+ { return !__f; }
+
+ /// @overload
+ template<typename _Signature>
+ inline bool
+ operator==(_M_clear_type*, const function<_Signature>& __f)
+ { return !__f; }
+
+ /**
+ * @brief Compares a polymorphic function object wrapper against 0
+ * (the NULL pointer).
+ * @returns @c false if the wrapper has no target, @c true otherwise
+ *
+ * This function will not throw an exception.
+ */
+ template<typename _Signature>
+ inline bool
+ operator!=(const function<_Signature>& __f, _M_clear_type*)
+ { return __f; }
+
+ /// @overload
+ template<typename _Signature>
+ inline bool
+ operator!=(_M_clear_type*, const function<_Signature>& __f)
+ { return __f; }
+
+ // [3.7.2.8] specialized algorithms
+
+ /**
+ * @brief Swap the targets of two polymorphic function object wrappers.
+ *
+ * This function will not throw an exception.
+ */
+ template<typename _Signature>
+ inline void
+ swap(function<_Signature>& __x, function<_Signature>& __y)
+ { __x.swap(__y); }
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional_hash.h b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional_hash.h
new file mode 100644
index 000000000..665168c0f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/functional_hash.h
@@ -0,0 +1,183 @@
+// TR1 functional -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/functional_hash.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ /// Class template hash.
+ // Declaration of default hash functor std::tr1::hash. The types for
+ // which std::tr1::hash<T> is well-defined is in clause 6.3.3. of the PDTR.
+ template<typename _Tp>
+ struct hash : public std::unary_function<_Tp, size_t>
+ {
+ size_t
+ operator()(_Tp __val) const;
+ };
+
+ /// Partial specializations for pointer types.
+ template<typename _Tp>
+ struct hash<_Tp*> : public std::unary_function<_Tp*, size_t>
+ {
+ size_t
+ operator()(_Tp* __p) const
+ { return reinterpret_cast<size_t>(__p); }
+ };
+
+ /// Explicit specializations for integer types.
+#define _TR1_hashtable_define_trivial_hash(_Tp) \
+ template<> \
+ inline size_t \
+ hash<_Tp>::operator()(_Tp __val) const \
+ { return static_cast<size_t>(__val); }
+
+ _TR1_hashtable_define_trivial_hash(bool);
+ _TR1_hashtable_define_trivial_hash(char);
+ _TR1_hashtable_define_trivial_hash(signed char);
+ _TR1_hashtable_define_trivial_hash(unsigned char);
+ _TR1_hashtable_define_trivial_hash(wchar_t);
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ _TR1_hashtable_define_trivial_hash(char16_t);
+ _TR1_hashtable_define_trivial_hash(char32_t);
+#endif
+ _TR1_hashtable_define_trivial_hash(short);
+ _TR1_hashtable_define_trivial_hash(int);
+ _TR1_hashtable_define_trivial_hash(long);
+ _TR1_hashtable_define_trivial_hash(long long);
+ _TR1_hashtable_define_trivial_hash(unsigned short);
+ _TR1_hashtable_define_trivial_hash(unsigned int);
+ _TR1_hashtable_define_trivial_hash(unsigned long);
+ _TR1_hashtable_define_trivial_hash(unsigned long long);
+
+#undef _TR1_hashtable_define_trivial_hash
+
+ // Fowler / Noll / Vo (FNV) Hash (type FNV-1a)
+ // (Used by the next specializations of std::tr1::hash.)
+
+ /// Dummy generic implementation (for sizeof(size_t) != 4, 8).
+ template<size_t = sizeof(size_t)>
+ struct _Fnv_hash
+ {
+ static size_t
+ hash(const char* __first, size_t __length)
+ {
+ size_t __result = 0;
+ for (; __length > 0; --__length)
+ __result = (__result * 131) + *__first++;
+ return __result;
+ }
+ };
+
+ template<>
+ struct _Fnv_hash<4>
+ {
+ static size_t
+ hash(const char* __first, size_t __length)
+ {
+ size_t __result = static_cast<size_t>(2166136261UL);
+ for (; __length > 0; --__length)
+ {
+ __result ^= static_cast<size_t>(*__first++);
+ __result *= static_cast<size_t>(16777619UL);
+ }
+ return __result;
+ }
+ };
+
+ template<>
+ struct _Fnv_hash<8>
+ {
+ static size_t
+ hash(const char* __first, size_t __length)
+ {
+ size_t __result =
+ static_cast<size_t>(14695981039346656037ULL);
+ for (; __length > 0; --__length)
+ {
+ __result ^= static_cast<size_t>(*__first++);
+ __result *= static_cast<size_t>(1099511628211ULL);
+ }
+ return __result;
+ }
+ };
+
+ /// Explicit specializations for float.
+ template<>
+ inline size_t
+ hash<float>::operator()(float __val) const
+ {
+ size_t __result = 0;
+
+ // 0 and -0 both hash to zero.
+ if (__val != 0.0f)
+ __result = _Fnv_hash<>::hash(reinterpret_cast<const char*>(&__val),
+ sizeof(__val));
+ return __result;
+ };
+
+ /// Explicit specializations for double.
+ template<>
+ inline size_t
+ hash<double>::operator()(double __val) const
+ {
+ size_t __result = 0;
+
+ // 0 and -0 both hash to zero.
+ if (__val != 0.0)
+ __result = _Fnv_hash<>::hash(reinterpret_cast<const char*>(&__val),
+ sizeof(__val));
+ return __result;
+ };
+
+ /// Explicit specializations for long double.
+ template<>
+ size_t
+ hash<long double>::operator()(long double __val) const;
+
+ /// Explicit specialization of member operator for non-builtin types.
+ template<>
+ size_t
+ hash<string>::operator()(string) const;
+
+ template<>
+ size_t
+ hash<const string&>::operator()(const string&) const;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ size_t
+ hash<wstring>::operator()(wstring) const;
+
+ template<>
+ size_t
+ hash<const wstring&>::operator()(const wstring&) const;
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable
new file mode 100644
index 000000000..7c9098309
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable
@@ -0,0 +1,1266 @@
+// Internal header for TR1 unordered_set and unordered_map -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/hashtable
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+// This header file defines std::tr1::hashtable, which is used to
+// implement std::tr1::unordered_set, std::tr1::unordered_map,
+// std::tr1::unordered_multiset, and std::tr1::unordered_multimap.
+// hashtable has many template parameters, partly to accommodate
+// the differences between those four classes and partly to
+// accommodate policy choices that go beyond TR1 specifications.
+
+// Class template hashtable attempts to encapsulate all reasonable
+// variation among hash tables that use chaining. It does not handle
+// open addressing.
+
+// References:
+// M. Austern, "A Proposal to Add Hash Tables to the Standard
+// Library (revision 4)," WG21 Document N1456=03-0039, 2003.
+// D. E. Knuth, The Art of Computer Programming, v. 3, Sorting and Searching.
+// A. Tavori and V. Dreizin, "Policy-Based Data Structures", 2004.
+// http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html
+
+#include <tr1_impl/hashtable_policy.h>
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ // Class template _Hashtable, class definition.
+
+ // Meaning of class template _Hashtable's template parameters
+
+ // _Key and _Value: arbitrary CopyConstructible types.
+
+ // _Allocator: an allocator type ([lib.allocator.requirements]) whose
+ // value type is Value. As a conforming extension, we allow for
+ // value type != Value.
+
+ // _ExtractKey: function object that takes a object of type Value
+ // and returns a value of type _Key.
+
+ // _Equal: function object that takes two objects of type k and returns
+ // a bool-like value that is true if the two objects are considered equal.
+
+ // _H1: the hash function. A unary function object with argument type
+ // Key and result type size_t. Return values should be distributed
+ // over the entire range [0, numeric_limits<size_t>:::max()].
+
+ // _H2: the range-hashing function (in the terminology of Tavori and
+ // Dreizin). A binary function object whose argument types and result
+ // type are all size_t. Given arguments r and N, the return value is
+ // in the range [0, N).
+
+ // _Hash: the ranged hash function (Tavori and Dreizin). A binary function
+ // whose argument types are _Key and size_t and whose result type is
+ // size_t. Given arguments k and N, the return value is in the range
+ // [0, N). Default: hash(k, N) = h2(h1(k), N). If _Hash is anything other
+ // than the default, _H1 and _H2 are ignored.
+
+ // _RehashPolicy: Policy class with three members, all of which govern
+ // the bucket count. _M_next_bkt(n) returns a bucket count no smaller
+ // than n. _M_bkt_for_elements(n) returns a bucket count appropriate
+ // for an element count of n. _M_need_rehash(n_bkt, n_elt, n_ins)
+ // determines whether, if the current bucket count is n_bkt and the
+ // current element count is n_elt, we need to increase the bucket
+ // count. If so, returns make_pair(true, n), where n is the new
+ // bucket count. If not, returns make_pair(false, <anything>).
+
+ // ??? Right now it is hard-wired that the number of buckets never
+ // shrinks. Should we allow _RehashPolicy to change that?
+
+ // __cache_hash_code: bool. true if we store the value of the hash
+ // function along with the value. This is a time-space tradeoff.
+ // Storing it may improve lookup speed by reducing the number of times
+ // we need to call the Equal function.
+
+ // __constant_iterators: bool. true if iterator and const_iterator are
+ // both constant iterator types. This is true for unordered_set and
+ // unordered_multiset, false for unordered_map and unordered_multimap.
+
+ // __unique_keys: bool. true if the return value of _Hashtable::count(k)
+ // is always at most one, false if it may be an arbitrary number. This
+ // true for unordered_set and unordered_map, false for unordered_multiset
+ // and unordered_multimap.
+
+ template<typename _Key, typename _Value, typename _Allocator,
+ typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash,
+ typename _RehashPolicy,
+ bool __cache_hash_code,
+ bool __constant_iterators,
+ bool __unique_keys>
+ class _Hashtable
+ : public __detail::_Rehash_base<_RehashPolicy,
+ _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey,
+ _Equal, _H1, _H2, _Hash,
+ _RehashPolicy,
+ __cache_hash_code,
+ __constant_iterators,
+ __unique_keys> >,
+ public __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __cache_hash_code>,
+ public __detail::_Map_base<_Key, _Value, _ExtractKey, __unique_keys,
+ _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey,
+ _Equal, _H1, _H2, _Hash,
+ _RehashPolicy,
+ __cache_hash_code,
+ __constant_iterators,
+ __unique_keys> >
+ {
+ public:
+ typedef _Allocator allocator_type;
+ typedef _Value value_type;
+ typedef _Key key_type;
+ typedef _Equal key_equal;
+ // mapped_type, if present, comes from _Map_base.
+ // hasher, if present, comes from _Hash_code_base.
+ typedef typename _Allocator::difference_type difference_type;
+ typedef typename _Allocator::size_type size_type;
+ typedef typename _Allocator::pointer pointer;
+ typedef typename _Allocator::const_pointer const_pointer;
+ typedef typename _Allocator::reference reference;
+ typedef typename _Allocator::const_reference const_reference;
+
+ typedef __detail::_Node_iterator<value_type, __constant_iterators,
+ __cache_hash_code>
+ local_iterator;
+ typedef __detail::_Node_const_iterator<value_type,
+ __constant_iterators,
+ __cache_hash_code>
+ const_local_iterator;
+
+ typedef __detail::_Hashtable_iterator<value_type, __constant_iterators,
+ __cache_hash_code>
+ iterator;
+ typedef __detail::_Hashtable_const_iterator<value_type,
+ __constant_iterators,
+ __cache_hash_code>
+ const_iterator;
+
+ template<typename _Key2, typename _Value2, typename _Ex2, bool __unique2,
+ typename _Hashtable2>
+ friend struct __detail::_Map_base;
+
+ private:
+ typedef __detail::_Hash_node<_Value, __cache_hash_code> _Node;
+ typedef typename _Allocator::template rebind<_Node>::other
+ _Node_allocator_type;
+ typedef typename _Allocator::template rebind<_Node*>::other
+ _Bucket_allocator_type;
+
+ typedef typename _Allocator::template rebind<_Value>::other
+ _Value_allocator_type;
+
+ _Node_allocator_type _M_node_allocator;
+ _Node** _M_buckets;
+ size_type _M_bucket_count;
+ size_type _M_element_count;
+ _RehashPolicy _M_rehash_policy;
+
+ _Node*
+ _M_allocate_node(const value_type& __v);
+
+ void
+ _M_deallocate_node(_Node* __n);
+
+ void
+ _M_deallocate_nodes(_Node**, size_type);
+
+ _Node**
+ _M_allocate_buckets(size_type __n);
+
+ void
+ _M_deallocate_buckets(_Node**, size_type __n);
+
+ public:
+ // Constructor, destructor, assignment, swap
+ _Hashtable(size_type __bucket_hint,
+ const _H1&, const _H2&, const _Hash&,
+ const _Equal&, const _ExtractKey&,
+ const allocator_type&);
+
+ template<typename _InputIterator>
+ _Hashtable(_InputIterator __first, _InputIterator __last,
+ size_type __bucket_hint,
+ const _H1&, const _H2&, const _Hash&,
+ const _Equal&, const _ExtractKey&,
+ const allocator_type&);
+
+ _Hashtable(const _Hashtable&);
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ _Hashtable(_Hashtable&&);
+#endif
+
+ _Hashtable&
+ operator=(const _Hashtable&);
+
+ ~_Hashtable();
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ void swap(_Hashtable&&);
+#else
+ void swap(_Hashtable&);
+#endif
+
+ // Basic container operations
+ iterator
+ begin()
+ {
+ iterator __i(_M_buckets);
+ if (!__i._M_cur_node)
+ __i._M_incr_bucket();
+ return __i;
+ }
+
+ const_iterator
+ begin() const
+ {
+ const_iterator __i(_M_buckets);
+ if (!__i._M_cur_node)
+ __i._M_incr_bucket();
+ return __i;
+ }
+
+ iterator
+ end()
+ { return iterator(_M_buckets + _M_bucket_count); }
+
+ const_iterator
+ end() const
+ { return const_iterator(_M_buckets + _M_bucket_count); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ const_iterator
+ cbegin() const
+ {
+ const_iterator __i(_M_buckets);
+ if (!__i._M_cur_node)
+ __i._M_incr_bucket();
+ return __i;
+ }
+
+ const_iterator
+ cend() const
+ { return const_iterator(_M_buckets + _M_bucket_count); }
+#endif
+
+ size_type
+ size() const
+ { return _M_element_count; }
+
+ bool
+ empty() const
+ { return size() == 0; }
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_node_allocator); }
+
+ _Value_allocator_type
+ _M_get_Value_allocator() const
+ { return _Value_allocator_type(_M_node_allocator); }
+
+ size_type
+ max_size() const
+ { return _M_node_allocator.max_size(); }
+
+ // Observers
+ key_equal
+ key_eq() const
+ { return this->_M_eq; }
+
+ // hash_function, if present, comes from _Hash_code_base.
+
+ // Bucket operations
+ size_type
+ bucket_count() const
+ { return _M_bucket_count; }
+
+ size_type
+ max_bucket_count() const
+ { return max_size(); }
+
+ size_type
+ bucket_size(size_type __n) const
+ { return std::distance(begin(__n), end(__n)); }
+
+ size_type
+ bucket(const key_type& __k) const
+ {
+ return this->_M_bucket_index(__k, this->_M_hash_code(__k),
+ bucket_count());
+ }
+
+ local_iterator
+ begin(size_type __n)
+ { return local_iterator(_M_buckets[__n]); }
+
+ local_iterator
+ end(size_type)
+ { return local_iterator(0); }
+
+ const_local_iterator
+ begin(size_type __n) const
+ { return const_local_iterator(_M_buckets[__n]); }
+
+ const_local_iterator
+ end(size_type) const
+ { return const_local_iterator(0); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // DR 691.
+ const_local_iterator
+ cbegin(size_type __n) const
+ { return const_local_iterator(_M_buckets[__n]); }
+
+ const_local_iterator
+ cend(size_type) const
+ { return const_local_iterator(0); }
+#endif
+
+ float
+ load_factor() const
+ {
+ return static_cast<float>(size()) / static_cast<float>(bucket_count());
+ }
+
+ // max_load_factor, if present, comes from _Rehash_base.
+
+ // Generalization of max_load_factor. Extension, not found in TR1. Only
+ // useful if _RehashPolicy is something other than the default.
+ const _RehashPolicy&
+ __rehash_policy() const
+ { return _M_rehash_policy; }
+
+ void
+ __rehash_policy(const _RehashPolicy&);
+
+ // Lookup.
+ iterator
+ find(const key_type& __k);
+
+ const_iterator
+ find(const key_type& __k) const;
+
+ size_type
+ count(const key_type& __k) const;
+
+ std::pair<iterator, iterator>
+ equal_range(const key_type& __k);
+
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& __k) const;
+
+ private: // Find, insert and erase helper functions
+ // ??? This dispatching is a workaround for the fact that we don't
+ // have partial specialization of member templates; it would be
+ // better to just specialize insert on __unique_keys. There may be a
+ // cleaner workaround.
+ typedef typename __gnu_cxx::__conditional_type<__unique_keys,
+ std::pair<iterator, bool>, iterator>::__type
+ _Insert_Return_Type;
+
+ typedef typename __gnu_cxx::__conditional_type<__unique_keys,
+ std::_Select1st<_Insert_Return_Type>,
+ std::_Identity<_Insert_Return_Type>
+ >::__type
+ _Insert_Conv_Type;
+
+ _Node*
+ _M_find_node(_Node*, const key_type&,
+ typename _Hashtable::_Hash_code_type) const;
+
+ iterator
+ _M_insert_bucket(const value_type&, size_type,
+ typename _Hashtable::_Hash_code_type);
+
+ std::pair<iterator, bool>
+ _M_insert(const value_type&, std::_GLIBCXX_TR1 true_type);
+
+ iterator
+ _M_insert(const value_type&, std::_GLIBCXX_TR1 false_type);
+
+ void
+ _M_erase_node(_Node*, _Node**);
+
+ public:
+ // Insert and erase
+ _Insert_Return_Type
+ insert(const value_type& __v)
+ { return _M_insert(__v, std::_GLIBCXX_TR1 integral_constant<bool,
+ __unique_keys>()); }
+
+ iterator
+ insert(iterator, const value_type& __v)
+ { return iterator(_Insert_Conv_Type()(this->insert(__v))); }
+
+ const_iterator
+ insert(const_iterator, const value_type& __v)
+ { return const_iterator(_Insert_Conv_Type()(this->insert(__v))); }
+
+ template<typename _InputIterator>
+ void
+ insert(_InputIterator __first, _InputIterator __last);
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ void
+ insert(initializer_list<value_type> __l)
+ { this->insert(__l.begin(), __l.end()); }
+#endif
+
+ iterator
+ erase(iterator);
+
+ const_iterator
+ erase(const_iterator);
+
+ size_type
+ erase(const key_type&);
+
+ iterator
+ erase(iterator, iterator);
+
+ const_iterator
+ erase(const_iterator, const_iterator);
+
+ void
+ clear();
+
+ // Set number of buckets to be appropriate for container of n element.
+ void rehash(size_type __n);
+
+ private:
+ // Unconditionally change size of bucket array to n.
+ void _M_rehash(size_type __n);
+ };
+
+
+ // Definitions of class template _Hashtable's out-of-line member functions.
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::_Node*
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_allocate_node(const value_type& __v)
+ {
+ _Node* __n = _M_node_allocator.allocate(1);
+ __try
+ {
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ _M_node_allocator.construct(__n, __v);
+#else
+ _M_get_Value_allocator().construct(&__n->_M_v, __v);
+#endif
+ __n->_M_next = 0;
+ return __n;
+ }
+ __catch(...)
+ {
+ _M_node_allocator.deallocate(__n, 1);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_deallocate_node(_Node* __n)
+ {
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ _M_node_allocator.destroy(__n);
+#else
+ _M_get_Value_allocator().destroy(&__n->_M_v);
+#endif
+ _M_node_allocator.deallocate(__n, 1);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_deallocate_nodes(_Node** __array, size_type __n)
+ {
+ for (size_type __i = 0; __i < __n; ++__i)
+ {
+ _Node* __p = __array[__i];
+ while (__p)
+ {
+ _Node* __tmp = __p;
+ __p = __p->_M_next;
+ _M_deallocate_node(__tmp);
+ }
+ __array[__i] = 0;
+ }
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::_Node**
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_allocate_buckets(size_type __n)
+ {
+ _Bucket_allocator_type __alloc(_M_node_allocator);
+
+ // We allocate one extra bucket to hold a sentinel, an arbitrary
+ // non-null pointer. Iterator increment relies on this.
+ _Node** __p = __alloc.allocate(__n + 1);
+ std::fill(__p, __p + __n, (_Node*) 0);
+ __p[__n] = reinterpret_cast<_Node*>(0x1000);
+ return __p;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_deallocate_buckets(_Node** __p, size_type __n)
+ {
+ _Bucket_allocator_type __alloc(_M_node_allocator);
+ __alloc.deallocate(__p, __n + 1);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _Hashtable(size_type __bucket_hint,
+ const _H1& __h1, const _H2& __h2, const _Hash& __h,
+ const _Equal& __eq, const _ExtractKey& __exk,
+ const allocator_type& __a)
+ : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),
+ __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __chc>(__exk, __eq,
+ __h1, __h2, __h),
+ __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(),
+ _M_node_allocator(__a),
+ _M_bucket_count(0),
+ _M_element_count(0),
+ _M_rehash_policy()
+ {
+ _M_bucket_count = _M_rehash_policy._M_next_bkt(__bucket_hint);
+ _M_buckets = _M_allocate_buckets(_M_bucket_count);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ template<typename _InputIterator>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _Hashtable(_InputIterator __f, _InputIterator __l,
+ size_type __bucket_hint,
+ const _H1& __h1, const _H2& __h2, const _Hash& __h,
+ const _Equal& __eq, const _ExtractKey& __exk,
+ const allocator_type& __a)
+ : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),
+ __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __chc>(__exk, __eq,
+ __h1, __h2, __h),
+ __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(),
+ _M_node_allocator(__a),
+ _M_bucket_count(0),
+ _M_element_count(0),
+ _M_rehash_policy()
+ {
+ _M_bucket_count = std::max(_M_rehash_policy._M_next_bkt(__bucket_hint),
+ _M_rehash_policy.
+ _M_bkt_for_elements(__detail::
+ __distance_fw(__f,
+ __l)));
+ _M_buckets = _M_allocate_buckets(_M_bucket_count);
+ __try
+ {
+ for (; __f != __l; ++__f)
+ this->insert(*__f);
+ }
+ __catch(...)
+ {
+ clear();
+ _M_deallocate_buckets(_M_buckets, _M_bucket_count);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _Hashtable(const _Hashtable& __ht)
+ : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht),
+ __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __chc>(__ht),
+ __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht),
+ _M_node_allocator(__ht._M_node_allocator),
+ _M_bucket_count(__ht._M_bucket_count),
+ _M_element_count(__ht._M_element_count),
+ _M_rehash_policy(__ht._M_rehash_policy)
+ {
+ _M_buckets = _M_allocate_buckets(_M_bucket_count);
+ __try
+ {
+ for (size_type __i = 0; __i < __ht._M_bucket_count; ++__i)
+ {
+ _Node* __n = __ht._M_buckets[__i];
+ _Node** __tail = _M_buckets + __i;
+ while (__n)
+ {
+ *__tail = _M_allocate_node(__n->_M_v);
+ this->_M_copy_code(*__tail, __n);
+ __tail = &((*__tail)->_M_next);
+ __n = __n->_M_next;
+ }
+ }
+ }
+ __catch(...)
+ {
+ clear();
+ _M_deallocate_buckets(_M_buckets, _M_bucket_count);
+ __throw_exception_again;
+ }
+ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _Hashtable(_Hashtable&& __ht)
+ : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht),
+ __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __chc>(__ht),
+ __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht),
+ _M_node_allocator(__ht._M_node_allocator),
+ _M_bucket_count(__ht._M_bucket_count),
+ _M_element_count(__ht._M_element_count),
+ _M_rehash_policy(__ht._M_rehash_policy),
+ _M_buckets(__ht._M_buckets)
+ {
+ size_type __n_bkt = __ht._M_rehash_policy._M_next_bkt(0);
+ __ht._M_buckets = __ht._M_allocate_buckets(__n_bkt);
+ __ht._M_bucket_count = __n_bkt;
+ __ht._M_element_count = 0;
+ __ht._M_rehash_policy = _RehashPolicy();
+ }
+#endif
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>&
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ operator=(const _Hashtable& __ht)
+ {
+ _Hashtable __tmp(__ht);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ ~_Hashtable()
+ {
+ clear();
+ _M_deallocate_buckets(_M_buckets, _M_bucket_count);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ swap(_Hashtable&& __x)
+#else
+ swap(_Hashtable& __x)
+#endif
+ {
+ // The only base class with member variables is hash_code_base. We
+ // define _Hash_code_base::_M_swap because different specializations
+ // have different members.
+ __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, __chc>::_M_swap(__x);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 431. Swapping containers with unequal allocators.
+ std::__alloc_swap<_Node_allocator_type>::_S_do_it(_M_node_allocator,
+ __x._M_node_allocator);
+
+ std::swap(_M_rehash_policy, __x._M_rehash_policy);
+ std::swap(_M_buckets, __x._M_buckets);
+ std::swap(_M_bucket_count, __x._M_bucket_count);
+ std::swap(_M_element_count, __x._M_element_count);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ __rehash_policy(const _RehashPolicy& __pol)
+ {
+ _M_rehash_policy = __pol;
+ size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count);
+ if (__n_bkt > _M_bucket_count)
+ _M_rehash(__n_bkt);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ find(const key_type& __k)
+ {
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ _Node* __p = _M_find_node(_M_buckets[__n], __k, __code);
+ return __p ? iterator(__p, _M_buckets + __n) : this->end();
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::const_iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ find(const key_type& __k) const
+ {
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ _Node* __p = _M_find_node(_M_buckets[__n], __k, __code);
+ return __p ? const_iterator(__p, _M_buckets + __n) : this->end();
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::size_type
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ count(const key_type& __k) const
+ {
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ std::size_t __result = 0;
+ for (_Node* __p = _M_buckets[__n]; __p; __p = __p->_M_next)
+ if (this->_M_compare(__k, __code, __p))
+ ++__result;
+ return __result;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ std::pair<typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator,
+ typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ equal_range(const key_type& __k)
+ {
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ _Node** __head = _M_buckets + __n;
+ _Node* __p = _M_find_node(*__head, __k, __code);
+
+ if (__p)
+ {
+ _Node* __p1 = __p->_M_next;
+ for (; __p1; __p1 = __p1->_M_next)
+ if (!this->_M_compare(__k, __code, __p1))
+ break;
+
+ iterator __first(__p, __head);
+ iterator __last(__p1, __head);
+ if (!__p1)
+ __last._M_incr_bucket();
+ return std::make_pair(__first, __last);
+ }
+ else
+ return std::make_pair(this->end(), this->end());
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ std::pair<typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::const_iterator,
+ typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::const_iterator>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ equal_range(const key_type& __k) const
+ {
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ _Node** __head = _M_buckets + __n;
+ _Node* __p = _M_find_node(*__head, __k, __code);
+
+ if (__p)
+ {
+ _Node* __p1 = __p->_M_next;
+ for (; __p1; __p1 = __p1->_M_next)
+ if (!this->_M_compare(__k, __code, __p1))
+ break;
+
+ const_iterator __first(__p, __head);
+ const_iterator __last(__p1, __head);
+ if (!__p1)
+ __last._M_incr_bucket();
+ return std::make_pair(__first, __last);
+ }
+ else
+ return std::make_pair(this->end(), this->end());
+ }
+
+ // Find the node whose key compares equal to k, beginning the search
+ // at p (usually the head of a bucket). Return nil if no node is found.
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey,
+ _Equal, _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::_Node*
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_find_node(_Node* __p, const key_type& __k,
+ typename _Hashtable::_Hash_code_type __code) const
+ {
+ for (; __p; __p = __p->_M_next)
+ if (this->_M_compare(__k, __code, __p))
+ return __p;
+ return false;
+ }
+
+ // Insert v in bucket n (assumes no element with its key already present).
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert_bucket(const value_type& __v, size_type __n,
+ typename _Hashtable::_Hash_code_type __code)
+ {
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, 1);
+
+ // Allocate the new node before doing the rehash so that we don't
+ // do a rehash if the allocation throws.
+ _Node* __new_node = _M_allocate_node(__v);
+
+ __try
+ {
+ if (__do_rehash.first)
+ {
+ const key_type& __k = this->_M_extract(__v);
+ __n = this->_M_bucket_index(__k, __code, __do_rehash.second);
+ _M_rehash(__do_rehash.second);
+ }
+
+ __new_node->_M_next = _M_buckets[__n];
+ this->_M_store_code(__new_node, __code);
+ _M_buckets[__n] = __new_node;
+ ++_M_element_count;
+ return iterator(__new_node, _M_buckets + __n);
+ }
+ __catch(...)
+ {
+ _M_deallocate_node(__new_node);
+ __throw_exception_again;
+ }
+ }
+
+ // Insert v if no element with its key is already present.
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ std::pair<typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator, bool>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert(const value_type& __v, std::_GLIBCXX_TR1 true_type)
+ {
+ const key_type& __k = this->_M_extract(__v);
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+
+ if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))
+ return std::make_pair(iterator(__p, _M_buckets + __n), false);
+ return std::make_pair(_M_insert_bucket(__v, __n, __code), true);
+ }
+
+ // Insert v unconditionally.
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert(const value_type& __v, std::_GLIBCXX_TR1 false_type)
+ {
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, 1);
+ if (__do_rehash.first)
+ _M_rehash(__do_rehash.second);
+
+ const key_type& __k = this->_M_extract(__v);
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+
+ // First find the node, avoid leaking new_node if compare throws.
+ _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);
+ _Node* __new_node = _M_allocate_node(__v);
+
+ if (__prev)
+ {
+ __new_node->_M_next = __prev->_M_next;
+ __prev->_M_next = __new_node;
+ }
+ else
+ {
+ __new_node->_M_next = _M_buckets[__n];
+ _M_buckets[__n] = __new_node;
+ }
+ this->_M_store_code(__new_node, __code);
+
+ ++_M_element_count;
+ return iterator(__new_node, _M_buckets + __n);
+ }
+
+ // For erase(iterator) and erase(const_iterator).
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_erase_node(_Node* __p, _Node** __b)
+ {
+ _Node* __cur = *__b;
+ if (__cur == __p)
+ *__b = __cur->_M_next;
+ else
+ {
+ _Node* __next = __cur->_M_next;
+ while (__next != __p)
+ {
+ __cur = __next;
+ __next = __cur->_M_next;
+ }
+ __cur->_M_next = __next->_M_next;
+ }
+
+ _M_deallocate_node(__p);
+ --_M_element_count;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ template<typename _InputIterator>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ insert(_InputIterator __first, _InputIterator __last)
+ {
+ size_type __n_elt = __detail::__distance_fw(__first, __last);
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, __n_elt);
+ if (__do_rehash.first)
+ _M_rehash(__do_rehash.second);
+
+ for (; __first != __last; ++__first)
+ this->insert(*__first);
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ erase(iterator __it)
+ {
+ iterator __result = __it;
+ ++__result;
+ _M_erase_node(__it._M_cur_node, __it._M_cur_bucket);
+ return __result;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::const_iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ erase(const_iterator __it)
+ {
+ const_iterator __result = __it;
+ ++__result;
+ _M_erase_node(__it._M_cur_node, __it._M_cur_bucket);
+ return __result;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::size_type
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ erase(const key_type& __k)
+ {
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ size_type __result = 0;
+
+ _Node** __slot = _M_buckets + __n;
+ while (*__slot && !this->_M_compare(__k, __code, *__slot))
+ __slot = &((*__slot)->_M_next);
+
+ _Node** __saved_slot = 0;
+ while (*__slot && this->_M_compare(__k, __code, *__slot))
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 526. Is it undefined if a function in the standard changes
+ // in parameters?
+ if (&this->_M_extract((*__slot)->_M_v) != &__k)
+ {
+ _Node* __p = *__slot;
+ *__slot = __p->_M_next;
+ _M_deallocate_node(__p);
+ --_M_element_count;
+ ++__result;
+ }
+ else
+ {
+ __saved_slot = __slot;
+ __slot = &((*__slot)->_M_next);
+ }
+ }
+
+ if (__saved_slot)
+ {
+ _Node* __p = *__saved_slot;
+ *__saved_slot = __p->_M_next;
+ _M_deallocate_node(__p);
+ --_M_element_count;
+ ++__result;
+ }
+
+ return __result;
+ }
+
+ // ??? This could be optimized by taking advantage of the bucket
+ // structure, but it's not clear that it's worth doing. It probably
+ // wouldn't even be an optimization unless the load factor is large.
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ erase(iterator __first, iterator __last)
+ {
+ while (__first != __last)
+ __first = this->erase(__first);
+ return __last;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::const_iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ erase(const_iterator __first, const_iterator __last)
+ {
+ while (__first != __last)
+ __first = this->erase(__first);
+ return __last;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ clear()
+ {
+ _M_deallocate_nodes(_M_buckets, _M_bucket_count);
+ _M_element_count = 0;
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ rehash(size_type __n)
+ {
+ _M_rehash(std::max(_M_rehash_policy._M_next_bkt(__n),
+ _M_rehash_policy._M_bkt_for_elements(_M_element_count
+ + 1)));
+ }
+
+ template<typename _Key, typename _Value,
+ typename _Allocator, typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
+ bool __chc, bool __cit, bool __uk>
+ void
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_rehash(size_type __n)
+ {
+ _Node** __new_array = _M_allocate_buckets(__n);
+ __try
+ {
+ for (size_type __i = 0; __i < _M_bucket_count; ++__i)
+ while (_Node* __p = _M_buckets[__i])
+ {
+ std::size_t __new_index = this->_M_bucket_index(__p, __n);
+ _M_buckets[__i] = __p->_M_next;
+ __p->_M_next = __new_array[__new_index];
+ __new_array[__new_index] = __p;
+ }
+ _M_deallocate_buckets(_M_buckets, _M_bucket_count);
+ _M_bucket_count = __n;
+ _M_buckets = __new_array;
+ }
+ __catch(...)
+ {
+ // A failure here means that a hash function threw an exception.
+ // We can't restore the previous state without calling the hash
+ // function again, so the only sensible recovery is to delete
+ // everything.
+ _M_deallocate_nodes(__new_array, __n);
+ _M_deallocate_buckets(__new_array, __n);
+ _M_deallocate_nodes(_M_buckets, _M_bucket_count);
+ _M_element_count = 0;
+ __throw_exception_again;
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable_policy.h b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable_policy.h
new file mode 100644
index 000000000..8996d04d9
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/hashtable_policy.h
@@ -0,0 +1,865 @@
+// Internal policy header for TR1 unordered_set and unordered_map -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/hashtable_policy.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+namespace __detail
+{
+ // Helper function: return distance(first, last) for forward
+ // iterators, or 0 for input iterators.
+ template<class _Iterator>
+ inline typename std::iterator_traits<_Iterator>::difference_type
+ __distance_fw(_Iterator __first, _Iterator __last,
+ std::input_iterator_tag)
+ { return 0; }
+
+ template<class _Iterator>
+ inline typename std::iterator_traits<_Iterator>::difference_type
+ __distance_fw(_Iterator __first, _Iterator __last,
+ std::forward_iterator_tag)
+ { return std::distance(__first, __last); }
+
+ template<class _Iterator>
+ inline typename std::iterator_traits<_Iterator>::difference_type
+ __distance_fw(_Iterator __first, _Iterator __last)
+ {
+ typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag;
+ return __distance_fw(__first, __last, _Tag());
+ }
+
+ template<typename _RAIter, typename _Tp>
+ _RAIter
+ __lower_bound(_RAIter __first, _RAIter __last, const _Tp& __val)
+ {
+ typedef typename std::iterator_traits<_RAIter>::difference_type _DType;
+
+ _DType __len = __last - __first;
+ while (__len > 0)
+ {
+ _DType __half = __len >> 1;
+ _RAIter __middle = __first + __half;
+ if (*__middle < __val)
+ {
+ __first = __middle;
+ ++__first;
+ __len = __len - __half - 1;
+ }
+ else
+ __len = __half;
+ }
+ return __first;
+ }
+
+ // Auxiliary types used for all instantiations of _Hashtable: nodes
+ // and iterators.
+
+ // Nodes, used to wrap elements stored in the hash table. A policy
+ // template parameter of class template _Hashtable controls whether
+ // nodes also store a hash code. In some cases (e.g. strings) this
+ // may be a performance win.
+ template<typename _Value, bool __cache_hash_code>
+ struct _Hash_node;
+
+ template<typename _Value>
+ struct _Hash_node<_Value, true>
+ {
+ _Value _M_v;
+ std::size_t _M_hash_code;
+ _Hash_node* _M_next;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<typename... _Args>
+ _Hash_node(_Args&&... __args)
+ : _M_v(std::forward<_Args>(__args)...),
+ _M_hash_code(), _M_next() { }
+#endif
+ };
+
+ template<typename _Value>
+ struct _Hash_node<_Value, false>
+ {
+ _Value _M_v;
+ _Hash_node* _M_next;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<typename... _Args>
+ _Hash_node(_Args&&... __args)
+ : _M_v(std::forward<_Args>(__args)...),
+ _M_next() { }
+#endif
+ };
+
+ // Local iterators, used to iterate within a bucket but not between
+ // buckets.
+ template<typename _Value, bool __cache>
+ struct _Node_iterator_base
+ {
+ _Node_iterator_base(_Hash_node<_Value, __cache>* __p)
+ : _M_cur(__p) { }
+
+ void
+ _M_incr()
+ { _M_cur = _M_cur->_M_next; }
+
+ _Hash_node<_Value, __cache>* _M_cur;
+ };
+
+ template<typename _Value, bool __cache>
+ inline bool
+ operator==(const _Node_iterator_base<_Value, __cache>& __x,
+ const _Node_iterator_base<_Value, __cache>& __y)
+ { return __x._M_cur == __y._M_cur; }
+
+ template<typename _Value, bool __cache>
+ inline bool
+ operator!=(const _Node_iterator_base<_Value, __cache>& __x,
+ const _Node_iterator_base<_Value, __cache>& __y)
+ { return __x._M_cur != __y._M_cur; }
+
+ template<typename _Value, bool __constant_iterators, bool __cache>
+ struct _Node_iterator
+ : public _Node_iterator_base<_Value, __cache>
+ {
+ typedef _Value value_type;
+ typedef typename
+ __gnu_cxx::__conditional_type<__constant_iterators,
+ const _Value*, _Value*>::__type
+ pointer;
+ typedef typename
+ __gnu_cxx::__conditional_type<__constant_iterators,
+ const _Value&, _Value&>::__type
+ reference;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Node_iterator()
+ : _Node_iterator_base<_Value, __cache>(0) { }
+
+ explicit
+ _Node_iterator(_Hash_node<_Value, __cache>* __p)
+ : _Node_iterator_base<_Value, __cache>(__p) { }
+
+ reference
+ operator*() const
+ { return this->_M_cur->_M_v; }
+
+ pointer
+ operator->() const
+ { return &this->_M_cur->_M_v; }
+
+ _Node_iterator&
+ operator++()
+ {
+ this->_M_incr();
+ return *this;
+ }
+
+ _Node_iterator
+ operator++(int)
+ {
+ _Node_iterator __tmp(*this);
+ this->_M_incr();
+ return __tmp;
+ }
+ };
+
+ template<typename _Value, bool __constant_iterators, bool __cache>
+ struct _Node_const_iterator
+ : public _Node_iterator_base<_Value, __cache>
+ {
+ typedef _Value value_type;
+ typedef const _Value* pointer;
+ typedef const _Value& reference;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Node_const_iterator()
+ : _Node_iterator_base<_Value, __cache>(0) { }
+
+ explicit
+ _Node_const_iterator(_Hash_node<_Value, __cache>* __p)
+ : _Node_iterator_base<_Value, __cache>(__p) { }
+
+ _Node_const_iterator(const _Node_iterator<_Value, __constant_iterators,
+ __cache>& __x)
+ : _Node_iterator_base<_Value, __cache>(__x._M_cur) { }
+
+ reference
+ operator*() const
+ { return this->_M_cur->_M_v; }
+
+ pointer
+ operator->() const
+ { return &this->_M_cur->_M_v; }
+
+ _Node_const_iterator&
+ operator++()
+ {
+ this->_M_incr();
+ return *this;
+ }
+
+ _Node_const_iterator
+ operator++(int)
+ {
+ _Node_const_iterator __tmp(*this);
+ this->_M_incr();
+ return __tmp;
+ }
+ };
+
+ template<typename _Value, bool __cache>
+ struct _Hashtable_iterator_base
+ {
+ _Hashtable_iterator_base(_Hash_node<_Value, __cache>* __node,
+ _Hash_node<_Value, __cache>** __bucket)
+ : _M_cur_node(__node), _M_cur_bucket(__bucket) { }
+
+ void
+ _M_incr()
+ {
+ _M_cur_node = _M_cur_node->_M_next;
+ if (!_M_cur_node)
+ _M_incr_bucket();
+ }
+
+ void
+ _M_incr_bucket();
+
+ _Hash_node<_Value, __cache>* _M_cur_node;
+ _Hash_node<_Value, __cache>** _M_cur_bucket;
+ };
+
+ // Global iterators, used for arbitrary iteration within a hash
+ // table. Larger and more expensive than local iterators.
+ template<typename _Value, bool __cache>
+ void
+ _Hashtable_iterator_base<_Value, __cache>::
+ _M_incr_bucket()
+ {
+ ++_M_cur_bucket;
+
+ // This loop requires the bucket array to have a non-null sentinel.
+ while (!*_M_cur_bucket)
+ ++_M_cur_bucket;
+ _M_cur_node = *_M_cur_bucket;
+ }
+
+ template<typename _Value, bool __cache>
+ inline bool
+ operator==(const _Hashtable_iterator_base<_Value, __cache>& __x,
+ const _Hashtable_iterator_base<_Value, __cache>& __y)
+ { return __x._M_cur_node == __y._M_cur_node; }
+
+ template<typename _Value, bool __cache>
+ inline bool
+ operator!=(const _Hashtable_iterator_base<_Value, __cache>& __x,
+ const _Hashtable_iterator_base<_Value, __cache>& __y)
+ { return __x._M_cur_node != __y._M_cur_node; }
+
+ template<typename _Value, bool __constant_iterators, bool __cache>
+ struct _Hashtable_iterator
+ : public _Hashtable_iterator_base<_Value, __cache>
+ {
+ typedef _Value value_type;
+ typedef typename
+ __gnu_cxx::__conditional_type<__constant_iterators,
+ const _Value*, _Value*>::__type
+ pointer;
+ typedef typename
+ __gnu_cxx::__conditional_type<__constant_iterators,
+ const _Value&, _Value&>::__type
+ reference;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Hashtable_iterator()
+ : _Hashtable_iterator_base<_Value, __cache>(0, 0) { }
+
+ _Hashtable_iterator(_Hash_node<_Value, __cache>* __p,
+ _Hash_node<_Value, __cache>** __b)
+ : _Hashtable_iterator_base<_Value, __cache>(__p, __b) { }
+
+ explicit
+ _Hashtable_iterator(_Hash_node<_Value, __cache>** __b)
+ : _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { }
+
+ reference
+ operator*() const
+ { return this->_M_cur_node->_M_v; }
+
+ pointer
+ operator->() const
+ { return &this->_M_cur_node->_M_v; }
+
+ _Hashtable_iterator&
+ operator++()
+ {
+ this->_M_incr();
+ return *this;
+ }
+
+ _Hashtable_iterator
+ operator++(int)
+ {
+ _Hashtable_iterator __tmp(*this);
+ this->_M_incr();
+ return __tmp;
+ }
+ };
+
+ template<typename _Value, bool __constant_iterators, bool __cache>
+ struct _Hashtable_const_iterator
+ : public _Hashtable_iterator_base<_Value, __cache>
+ {
+ typedef _Value value_type;
+ typedef const _Value* pointer;
+ typedef const _Value& reference;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::forward_iterator_tag iterator_category;
+
+ _Hashtable_const_iterator()
+ : _Hashtable_iterator_base<_Value, __cache>(0, 0) { }
+
+ _Hashtable_const_iterator(_Hash_node<_Value, __cache>* __p,
+ _Hash_node<_Value, __cache>** __b)
+ : _Hashtable_iterator_base<_Value, __cache>(__p, __b) { }
+
+ explicit
+ _Hashtable_const_iterator(_Hash_node<_Value, __cache>** __b)
+ : _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { }
+
+ _Hashtable_const_iterator(const _Hashtable_iterator<_Value,
+ __constant_iterators, __cache>& __x)
+ : _Hashtable_iterator_base<_Value, __cache>(__x._M_cur_node,
+ __x._M_cur_bucket) { }
+
+ reference
+ operator*() const
+ { return this->_M_cur_node->_M_v; }
+
+ pointer
+ operator->() const
+ { return &this->_M_cur_node->_M_v; }
+
+ _Hashtable_const_iterator&
+ operator++()
+ {
+ this->_M_incr();
+ return *this;
+ }
+
+ _Hashtable_const_iterator
+ operator++(int)
+ {
+ _Hashtable_const_iterator __tmp(*this);
+ this->_M_incr();
+ return __tmp;
+ }
+ };
+
+
+ // Many of class template _Hashtable's template parameters are policy
+ // classes. These are defaults for the policies.
+
+ // Default range hashing function: use division to fold a large number
+ // into the range [0, N).
+ struct _Mod_range_hashing
+ {
+ typedef std::size_t first_argument_type;
+ typedef std::size_t second_argument_type;
+ typedef std::size_t result_type;
+
+ result_type
+ operator()(first_argument_type __num, second_argument_type __den) const
+ { return __num % __den; }
+ };
+
+ // Default ranged hash function H. In principle it should be a
+ // function object composed from objects of type H1 and H2 such that
+ // h(k, N) = h2(h1(k), N), but that would mean making extra copies of
+ // h1 and h2. So instead we'll just use a tag to tell class template
+ // hashtable to do that composition.
+ struct _Default_ranged_hash { };
+
+ // Default value for rehash policy. Bucket size is (usually) the
+ // smallest prime that keeps the load factor small enough.
+ struct _Prime_rehash_policy
+ {
+ _Prime_rehash_policy(float __z = 1.0)
+ : _M_max_load_factor(__z), _M_growth_factor(2.f), _M_next_resize(0) { }
+
+ float
+ max_load_factor() const
+ { return _M_max_load_factor; }
+
+ // Return a bucket size no smaller than n.
+ std::size_t
+ _M_next_bkt(std::size_t __n) const;
+
+ // Return a bucket count appropriate for n elements
+ std::size_t
+ _M_bkt_for_elements(std::size_t __n) const;
+
+ // __n_bkt is current bucket count, __n_elt is current element count,
+ // and __n_ins is number of elements to be inserted. Do we need to
+ // increase bucket count? If so, return make_pair(true, n), where n
+ // is the new bucket count. If not, return make_pair(false, 0).
+ std::pair<bool, std::size_t>
+ _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
+ std::size_t __n_ins) const;
+
+ enum { _S_n_primes = sizeof(unsigned long) != 8 ? 256 : 256 + 48 };
+
+ float _M_max_load_factor;
+ float _M_growth_factor;
+ mutable std::size_t _M_next_resize;
+ };
+
+ extern const unsigned long __prime_list[];
+
+ // XXX This is a hack. There's no good reason for any of
+ // _Prime_rehash_policy's member functions to be inline.
+
+ // Return a prime no smaller than n.
+ inline std::size_t
+ _Prime_rehash_policy::
+ _M_next_bkt(std::size_t __n) const
+ {
+ const unsigned long* __p = __lower_bound(__prime_list, __prime_list
+ + _S_n_primes, __n);
+ _M_next_resize =
+ static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
+ return *__p;
+ }
+
+ // Return the smallest prime p such that alpha p >= n, where alpha
+ // is the load factor.
+ inline std::size_t
+ _Prime_rehash_policy::
+ _M_bkt_for_elements(std::size_t __n) const
+ {
+ const float __min_bkts = __n / _M_max_load_factor;
+ const unsigned long* __p = __lower_bound(__prime_list, __prime_list
+ + _S_n_primes, __min_bkts);
+ _M_next_resize =
+ static_cast<std::size_t>(__builtin_ceil(*__p * _M_max_load_factor));
+ return *__p;
+ }
+
+ // Finds the smallest prime p such that alpha p > __n_elt + __n_ins.
+ // If p > __n_bkt, return make_pair(true, p); otherwise return
+ // make_pair(false, 0). In principle this isn't very different from
+ // _M_bkt_for_elements.
+
+ // The only tricky part is that we're caching the element count at
+ // which we need to rehash, so we don't have to do a floating-point
+ // multiply for every insertion.
+
+ inline std::pair<bool, std::size_t>
+ _Prime_rehash_policy::
+ _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
+ std::size_t __n_ins) const
+ {
+ if (__n_elt + __n_ins > _M_next_resize)
+ {
+ float __min_bkts = ((float(__n_ins) + float(__n_elt))
+ / _M_max_load_factor);
+ if (__min_bkts > __n_bkt)
+ {
+ __min_bkts = std::max(__min_bkts, _M_growth_factor * __n_bkt);
+ const unsigned long* __p =
+ __lower_bound(__prime_list, __prime_list + _S_n_primes,
+ __min_bkts);
+ _M_next_resize = static_cast<std::size_t>
+ (__builtin_ceil(*__p * _M_max_load_factor));
+ return std::make_pair(true, *__p);
+ }
+ else
+ {
+ _M_next_resize = static_cast<std::size_t>
+ (__builtin_ceil(__n_bkt * _M_max_load_factor));
+ return std::make_pair(false, 0);
+ }
+ }
+ else
+ return std::make_pair(false, 0);
+ }
+
+ // Base classes for std::tr1::_Hashtable. We define these base
+ // classes because in some cases we want to do different things
+ // depending on the value of a policy class. In some cases the
+ // policy class affects which member functions and nested typedefs
+ // are defined; we handle that by specializing base class templates.
+ // Several of the base class templates need to access other members
+ // of class template _Hashtable, so we use the "curiously recurring
+ // template pattern" for them.
+
+ // class template _Map_base. If the hashtable has a value type of the
+ // form pair<T1, T2> and a key extraction policy that returns the
+ // first part of the pair, the hashtable gets a mapped_type typedef.
+ // If it satisfies those criteria and also has unique keys, then it
+ // also gets an operator[].
+ template<typename _Key, typename _Value, typename _Ex, bool __unique,
+ typename _Hashtable>
+ struct _Map_base { };
+
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, false, _Hashtable>
+ {
+ typedef typename _Pair::second_type mapped_type;
+ };
+
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>
+ {
+ typedef typename _Pair::second_type mapped_type;
+
+ mapped_type&
+ operator[](const _Key& __k);
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 761. unordered_map needs an at() member function.
+ mapped_type&
+ at(const _Key& __k);
+
+ const mapped_type&
+ at(const _Key& __k) const;
+#endif
+ };
+
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
+ true, _Hashtable>::mapped_type&
+ _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
+ operator[](const _Key& __k)
+ {
+ _Hashtable* __h = static_cast<_Hashtable*>(this);
+ typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
+ std::size_t __n = __h->_M_bucket_index(__k, __code,
+ __h->_M_bucket_count);
+
+ typename _Hashtable::_Node* __p =
+ __h->_M_find_node(__h->_M_buckets[__n], __k, __code);
+ if (!__p)
+ return __h->_M_insert_bucket(std::make_pair(__k, mapped_type()),
+ __n, __code)->second;
+ return (__p->_M_v).second;
+ }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
+ true, _Hashtable>::mapped_type&
+ _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
+ at(const _Key& __k)
+ {
+ _Hashtable* __h = static_cast<_Hashtable*>(this);
+ typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
+ std::size_t __n = __h->_M_bucket_index(__k, __code,
+ __h->_M_bucket_count);
+
+ typename _Hashtable::_Node* __p =
+ __h->_M_find_node(__h->_M_buckets[__n], __k, __code);
+ if (!__p)
+ __throw_out_of_range(__N("_Map_base::at"));
+ return (__p->_M_v).second;
+ }
+
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ const typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
+ true, _Hashtable>::mapped_type&
+ _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
+ at(const _Key& __k) const
+ {
+ const _Hashtable* __h = static_cast<const _Hashtable*>(this);
+ typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
+ std::size_t __n = __h->_M_bucket_index(__k, __code,
+ __h->_M_bucket_count);
+
+ typename _Hashtable::_Node* __p =
+ __h->_M_find_node(__h->_M_buckets[__n], __k, __code);
+ if (!__p)
+ __throw_out_of_range(__N("_Map_base::at"));
+ return (__p->_M_v).second;
+ }
+#endif
+
+ // class template _Rehash_base. Give hashtable the max_load_factor
+ // functions iff the rehash policy is _Prime_rehash_policy.
+ template<typename _RehashPolicy, typename _Hashtable>
+ struct _Rehash_base { };
+
+ template<typename _Hashtable>
+ struct _Rehash_base<_Prime_rehash_policy, _Hashtable>
+ {
+ float
+ max_load_factor() const
+ {
+ const _Hashtable* __this = static_cast<const _Hashtable*>(this);
+ return __this->__rehash_policy().max_load_factor();
+ }
+
+ void
+ max_load_factor(float __z)
+ {
+ _Hashtable* __this = static_cast<_Hashtable*>(this);
+ __this->__rehash_policy(_Prime_rehash_policy(__z));
+ }
+ };
+
+ // Class template _Hash_code_base. Encapsulates two policy issues that
+ // aren't quite orthogonal.
+ // (1) the difference between using a ranged hash function and using
+ // the combination of a hash function and a range-hashing function.
+ // In the former case we don't have such things as hash codes, so
+ // we have a dummy type as placeholder.
+ // (2) Whether or not we cache hash codes. Caching hash codes is
+ // meaningless if we have a ranged hash function.
+ // We also put the key extraction and equality comparison function
+ // objects here, for convenience.
+
+ // Primary template: unused except as a hook for specializations.
+ template<typename _Key, typename _Value,
+ typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash,
+ bool __cache_hash_code>
+ struct _Hash_code_base;
+
+ // Specialization: ranged hash function, no caching hash codes. H1
+ // and H2 are provided but ignored. We define a dummy hash code type.
+ template<typename _Key, typename _Value,
+ typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash>
+ struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
+ _Hash, false>
+ {
+ protected:
+ _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,
+ const _H1&, const _H2&, const _Hash& __h)
+ : _M_extract(__ex), _M_eq(__eq), _M_ranged_hash(__h) { }
+
+ typedef void* _Hash_code_type;
+
+ _Hash_code_type
+ _M_hash_code(const _Key& __key) const
+ { return 0; }
+
+ std::size_t
+ _M_bucket_index(const _Key& __k, _Hash_code_type,
+ std::size_t __n) const
+ { return _M_ranged_hash(__k, __n); }
+
+ std::size_t
+ _M_bucket_index(const _Hash_node<_Value, false>* __p,
+ std::size_t __n) const
+ { return _M_ranged_hash(_M_extract(__p->_M_v), __n); }
+
+ bool
+ _M_compare(const _Key& __k, _Hash_code_type,
+ _Hash_node<_Value, false>* __n) const
+ { return _M_eq(__k, _M_extract(__n->_M_v)); }
+
+ void
+ _M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const
+ { }
+
+ void
+ _M_copy_code(_Hash_node<_Value, false>*,
+ const _Hash_node<_Value, false>*) const
+ { }
+
+ void
+ _M_swap(_Hash_code_base& __x)
+ {
+ std::swap(_M_extract, __x._M_extract);
+ std::swap(_M_eq, __x._M_eq);
+ std::swap(_M_ranged_hash, __x._M_ranged_hash);
+ }
+
+ protected:
+ _ExtractKey _M_extract;
+ _Equal _M_eq;
+ _Hash _M_ranged_hash;
+ };
+
+
+ // No specialization for ranged hash function while caching hash codes.
+ // That combination is meaningless, and trying to do it is an error.
+
+
+ // Specialization: ranged hash function, cache hash codes. This
+ // combination is meaningless, so we provide only a declaration
+ // and no definition.
+ template<typename _Key, typename _Value,
+ typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2, typename _Hash>
+ struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
+ _Hash, true>;
+
+ // Specialization: hash function and range-hashing function, no
+ // caching of hash codes. H is provided but ignored. Provides
+ // typedef and accessor required by TR1.
+ template<typename _Key, typename _Value,
+ typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2>
+ struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
+ _Default_ranged_hash, false>
+ {
+ typedef _H1 hasher;
+
+ hasher
+ hash_function() const
+ { return _M_h1; }
+
+ protected:
+ _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,
+ const _H1& __h1, const _H2& __h2,
+ const _Default_ranged_hash&)
+ : _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { }
+
+ typedef std::size_t _Hash_code_type;
+
+ _Hash_code_type
+ _M_hash_code(const _Key& __k) const
+ { return _M_h1(__k); }
+
+ std::size_t
+ _M_bucket_index(const _Key&, _Hash_code_type __c,
+ std::size_t __n) const
+ { return _M_h2(__c, __n); }
+
+ std::size_t
+ _M_bucket_index(const _Hash_node<_Value, false>* __p,
+ std::size_t __n) const
+ { return _M_h2(_M_h1(_M_extract(__p->_M_v)), __n); }
+
+ bool
+ _M_compare(const _Key& __k, _Hash_code_type,
+ _Hash_node<_Value, false>* __n) const
+ { return _M_eq(__k, _M_extract(__n->_M_v)); }
+
+ void
+ _M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const
+ { }
+
+ void
+ _M_copy_code(_Hash_node<_Value, false>*,
+ const _Hash_node<_Value, false>*) const
+ { }
+
+ void
+ _M_swap(_Hash_code_base& __x)
+ {
+ std::swap(_M_extract, __x._M_extract);
+ std::swap(_M_eq, __x._M_eq);
+ std::swap(_M_h1, __x._M_h1);
+ std::swap(_M_h2, __x._M_h2);
+ }
+
+ protected:
+ _ExtractKey _M_extract;
+ _Equal _M_eq;
+ _H1 _M_h1;
+ _H2 _M_h2;
+ };
+
+ // Specialization: hash function and range-hashing function,
+ // caching hash codes. H is provided but ignored. Provides
+ // typedef and accessor required by TR1.
+ template<typename _Key, typename _Value,
+ typename _ExtractKey, typename _Equal,
+ typename _H1, typename _H2>
+ struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,
+ _Default_ranged_hash, true>
+ {
+ typedef _H1 hasher;
+
+ hasher
+ hash_function() const
+ { return _M_h1; }
+
+ protected:
+ _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,
+ const _H1& __h1, const _H2& __h2,
+ const _Default_ranged_hash&)
+ : _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { }
+
+ typedef std::size_t _Hash_code_type;
+
+ _Hash_code_type
+ _M_hash_code(const _Key& __k) const
+ { return _M_h1(__k); }
+
+ std::size_t
+ _M_bucket_index(const _Key&, _Hash_code_type __c,
+ std::size_t __n) const
+ { return _M_h2(__c, __n); }
+
+ std::size_t
+ _M_bucket_index(const _Hash_node<_Value, true>* __p,
+ std::size_t __n) const
+ { return _M_h2(__p->_M_hash_code, __n); }
+
+ bool
+ _M_compare(const _Key& __k, _Hash_code_type __c,
+ _Hash_node<_Value, true>* __n) const
+ { return __c == __n->_M_hash_code && _M_eq(__k, _M_extract(__n->_M_v)); }
+
+ void
+ _M_store_code(_Hash_node<_Value, true>* __n, _Hash_code_type __c) const
+ { __n->_M_hash_code = __c; }
+
+ void
+ _M_copy_code(_Hash_node<_Value, true>* __to,
+ const _Hash_node<_Value, true>* __from) const
+ { __to->_M_hash_code = __from->_M_hash_code; }
+
+ void
+ _M_swap(_Hash_code_base& __x)
+ {
+ std::swap(_M_extract, __x._M_extract);
+ std::swap(_M_eq, __x._M_eq);
+ std::swap(_M_h1, __x._M_h1);
+ std::swap(_M_h2, __x._M_h2);
+ }
+
+ protected:
+ _ExtractKey _M_extract;
+ _Equal _M_eq;
+ _H1 _M_h1;
+ _H2 _M_h2;
+ };
+} // namespace __detail
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/random b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/random
new file mode 100644
index 000000000..0cf4dc4cd
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/random
@@ -0,0 +1,2407 @@
+// random number generation -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file tr1_impl/random
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ // [5.1] Random number generation
+
+ /**
+ * @defgroup tr1_random Random Number Generation
+ * @ingroup numerics
+ * A facility for generating random numbers on selected distributions.
+ * @{
+ */
+
+ /*
+ * Implementation-space details.
+ */
+ namespace __detail
+ {
+ template<typename _UIntType, int __w,
+ bool = __w < std::numeric_limits<_UIntType>::digits>
+ struct _Shift
+ { static const _UIntType __value = 0; };
+
+ template<typename _UIntType, int __w>
+ struct _Shift<_UIntType, __w, true>
+ { static const _UIntType __value = _UIntType(1) << __w; };
+
+ template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
+ struct _Mod;
+
+ // Dispatch based on modulus value to prevent divide-by-zero compile-time
+ // errors when m == 0.
+ template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
+ inline _Tp
+ __mod(_Tp __x)
+ { return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
+
+ typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4),
+ unsigned, unsigned long>::__type _UInt32Type;
+
+ /*
+ * An adaptor class for converting the output of any Generator into
+ * the input for a specific Distribution.
+ */
+ template<typename _Engine, typename _Distribution>
+ struct _Adaptor
+ {
+ typedef typename remove_reference<_Engine>::type _BEngine;
+ typedef typename _BEngine::result_type _Engine_result_type;
+ typedef typename _Distribution::input_type result_type;
+
+ public:
+ _Adaptor(const _Engine& __g)
+ : _M_g(__g) { }
+
+ result_type
+ min() const
+ {
+ result_type __return_value;
+ if (is_integral<_Engine_result_type>::value
+ && is_integral<result_type>::value)
+ __return_value = _M_g.min();
+ else
+ __return_value = result_type(0);
+ return __return_value;
+ }
+
+ result_type
+ max() const
+ {
+ result_type __return_value;
+ if (is_integral<_Engine_result_type>::value
+ && is_integral<result_type>::value)
+ __return_value = _M_g.max();
+ else if (!is_integral<result_type>::value)
+ __return_value = result_type(1);
+ else
+ __return_value = std::numeric_limits<result_type>::max() - 1;
+ return __return_value;
+ }
+
+ /*
+ * Converts a value generated by the adapted random number generator
+ * into a value in the input domain for the dependent random number
+ * distribution.
+ *
+ * Because the type traits are compile time constants only the
+ * appropriate clause of the if statements will actually be emitted
+ * by the compiler.
+ */
+ result_type
+ operator()()
+ {
+ result_type __return_value;
+ if (is_integral<_Engine_result_type>::value
+ && is_integral<result_type>::value)
+ __return_value = _M_g();
+ else if (!is_integral<_Engine_result_type>::value
+ && !is_integral<result_type>::value)
+ __return_value = result_type(_M_g() - _M_g.min())
+ / result_type(_M_g.max() - _M_g.min());
+ else if (is_integral<_Engine_result_type>::value
+ && !is_integral<result_type>::value)
+ __return_value = result_type(_M_g() - _M_g.min())
+ / result_type(_M_g.max() - _M_g.min() + result_type(1));
+ else
+ __return_value = (((_M_g() - _M_g.min())
+ / (_M_g.max() - _M_g.min()))
+ * std::numeric_limits<result_type>::max());
+ return __return_value;
+ }
+
+ private:
+ _Engine _M_g;
+ };
+
+ // Specialization for _Engine*.
+ template<typename _Engine, typename _Distribution>
+ struct _Adaptor<_Engine*, _Distribution>
+ {
+ typedef typename _Engine::result_type _Engine_result_type;
+ typedef typename _Distribution::input_type result_type;
+
+ public:
+ _Adaptor(_Engine* __g)
+ : _M_g(__g) { }
+
+ result_type
+ min() const
+ {
+ result_type __return_value;
+ if (is_integral<_Engine_result_type>::value
+ && is_integral<result_type>::value)
+ __return_value = _M_g->min();
+ else
+ __return_value = result_type(0);
+ return __return_value;
+ }
+
+ result_type
+ max() const
+ {
+ result_type __return_value;
+ if (is_integral<_Engine_result_type>::value
+ && is_integral<result_type>::value)
+ __return_value = _M_g->max();
+ else if (!is_integral<result_type>::value)
+ __return_value = result_type(1);
+ else
+ __return_value = std::numeric_limits<result_type>::max() - 1;
+ return __return_value;
+ }
+
+ result_type
+ operator()()
+ {
+ result_type __return_value;
+ if (is_integral<_Engine_result_type>::value
+ && is_integral<result_type>::value)
+ __return_value = (*_M_g)();
+ else if (!is_integral<_Engine_result_type>::value
+ && !is_integral<result_type>::value)
+ __return_value = result_type((*_M_g)() - _M_g->min())
+ / result_type(_M_g->max() - _M_g->min());
+ else if (is_integral<_Engine_result_type>::value
+ && !is_integral<result_type>::value)
+ __return_value = result_type((*_M_g)() - _M_g->min())
+ / result_type(_M_g->max() - _M_g->min() + result_type(1));
+ else
+ __return_value = ((((*_M_g)() - _M_g->min())
+ / (_M_g->max() - _M_g->min()))
+ * std::numeric_limits<result_type>::max());
+ return __return_value;
+ }
+
+ private:
+ _Engine* _M_g;
+ };
+ } // namespace __detail
+
+ /**
+ * Produces random numbers on a given distribution function using a
+ * non-uniform random number generation engine.
+ *
+ * @todo the engine_value_type needs to be studied more carefully.
+ */
+ template<typename _Engine, typename _Dist>
+ class variate_generator
+ {
+ // Concept requirements.
+ __glibcxx_class_requires(_Engine, _CopyConstructibleConcept)
+ // __glibcxx_class_requires(_Engine, _EngineConcept)
+ // __glibcxx_class_requires(_Dist, _EngineConcept)
+
+ public:
+ typedef _Engine engine_type;
+ typedef __detail::_Adaptor<_Engine, _Dist> engine_value_type;
+ typedef _Dist distribution_type;
+ typedef typename _Dist::result_type result_type;
+
+ // tr1:5.1.1 table 5.1 requirement
+ typedef typename __gnu_cxx::__enable_if<
+ is_arithmetic<result_type>::value, result_type>::__type _IsValidType;
+
+ /**
+ * Constructs a variate generator with the uniform random number
+ * generator @p __eng for the random distribution @p __dist.
+ *
+ * @throws Any exceptions which may thrown by the copy constructors of
+ * the @p _Engine or @p _Dist objects.
+ */
+ variate_generator(engine_type __eng, distribution_type __dist)
+ : _M_engine(__eng), _M_dist(__dist) { }
+
+ /**
+ * Gets the next generated value on the distribution.
+ */
+ result_type
+ operator()()
+ { return _M_dist(_M_engine); }
+
+ /**
+ * WTF?
+ */
+ template<typename _Tp>
+ result_type
+ operator()(_Tp __value)
+ { return _M_dist(_M_engine, __value); }
+
+ /**
+ * Gets a reference to the underlying uniform random number generator
+ * object.
+ */
+ engine_value_type&
+ engine()
+ { return _M_engine; }
+
+ /**
+ * Gets a const reference to the underlying uniform random number
+ * generator object.
+ */
+ const engine_value_type&
+ engine() const
+ { return _M_engine; }
+
+ /**
+ * Gets a reference to the underlying random distribution.
+ */
+ distribution_type&
+ distribution()
+ { return _M_dist; }
+
+ /**
+ * Gets a const reference to the underlying random distribution.
+ */
+ const distribution_type&
+ distribution() const
+ { return _M_dist; }
+
+ /**
+ * Gets the closed lower bound of the distribution interval.
+ */
+ result_type
+ min() const
+ { return this->distribution().min(); }
+
+ /**
+ * Gets the closed upper bound of the distribution interval.
+ */
+ result_type
+ max() const
+ { return this->distribution().max(); }
+
+ private:
+ engine_value_type _M_engine;
+ distribution_type _M_dist;
+ };
+
+
+ /**
+ * @defgroup tr1_random_generators Random Number Generators
+ * @ingroup tr1_random
+ *
+ * These classes define objects which provide random or pseudorandom
+ * numbers, either from a discrete or a continuous interval. The
+ * random number generator supplied as a part of this library are
+ * all uniform random number generators which provide a sequence of
+ * random number uniformly distributed over their range.
+ *
+ * A number generator is a function object with an operator() that
+ * takes zero arguments and returns a number.
+ *
+ * A compliant random number generator must satisfy the following
+ * requirements. <table border=1 cellpadding=10 cellspacing=0>
+ * <caption align=top>Random Number Generator Requirements</caption>
+ * <tr><td>To be documented.</td></tr> </table>
+ *
+ * @{
+ */
+
+ /**
+ * @brief A model of a linear congruential random number generator.
+ *
+ * A random number generator that produces pseudorandom numbers using the
+ * linear function @f$x_{i+1}\leftarrow(ax_{i} + c) \bmod m @f$.
+ *
+ * The template parameter @p _UIntType must be an unsigned integral type
+ * large enough to store values up to (__m-1). If the template parameter
+ * @p __m is 0, the modulus @p __m used is
+ * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template
+ * parameters @p __a and @p __c must be less than @p __m.
+ *
+ * The size of the state is @f$ 1 @f$.
+ */
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+ class linear_congruential
+ {
+ __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
+ // __glibcpp_class_requires(__a < __m && __c < __m)
+
+ public:
+ /** The type of the generated random value. */
+ typedef _UIntType result_type;
+
+ /** The multiplier. */
+ static const _UIntType multiplier = __a;
+ /** An increment. */
+ static const _UIntType increment = __c;
+ /** The modulus. */
+ static const _UIntType modulus = __m;
+
+ /**
+ * Constructs a %linear_congruential random number generator engine with
+ * seed @p __s. The default seed value is 1.
+ *
+ * @param __s The initial seed value.
+ */
+ explicit
+ linear_congruential(unsigned long __x0 = 1)
+ { this->seed(__x0); }
+
+ /**
+ * Constructs a %linear_congruential random number generator engine
+ * seeded from the generator function @p __g.
+ *
+ * @param __g The seed generator function.
+ */
+ template<class _Gen>
+ linear_congruential(_Gen& __g)
+ { this->seed(__g); }
+
+ /**
+ * Reseeds the %linear_congruential random number generator engine
+ * sequence to the seed @g __s.
+ *
+ * @param __s The new seed.
+ */
+ void
+ seed(unsigned long __s = 1);
+
+ /**
+ * Reseeds the %linear_congruential random number generator engine
+ * sequence using values from the generator function @p __g.
+ *
+ * @param __g the seed generator function.
+ */
+ template<class _Gen>
+ void
+ seed(_Gen& __g)
+ { seed(__g, typename is_fundamental<_Gen>::type()); }
+
+ /**
+ * Gets the smallest possible value in the output range.
+ *
+ * The minimum depends on the @p __c parameter: if it is zero, the
+ * minimum generated must be > 0, otherwise 0 is allowed.
+ */
+ result_type
+ min() const
+ { return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }
+
+ /**
+ * Gets the largest possible value in the output range.
+ */
+ result_type
+ max() const
+ { return __m - 1; }
+
+ /**
+ * Gets the next random number in the sequence.
+ */
+ result_type
+ operator()();
+
+ /**
+ * Compares two linear congruential random number generator
+ * objects of the same type for equality.
+ *
+ * @param __lhs A linear congruential random number generator object.
+ * @param __rhs Another linear congruential random number generator obj.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const linear_congruential& __lhs,
+ const linear_congruential& __rhs)
+ { return __lhs._M_x == __rhs._M_x; }
+
+ /**
+ * Compares two linear congruential random number generator
+ * objects of the same type for inequality.
+ *
+ * @param __lhs A linear congruential random number generator object.
+ * @param __rhs Another linear congruential random number generator obj.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const linear_congruential& __lhs,
+ const linear_congruential& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Writes the textual representation of the state x(i) of x to @p __os.
+ *
+ * @param __os The output stream.
+ * @param __lcr A % linear_congruential random number generator.
+ * @returns __os.
+ */
+ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+ _UIntType1 __m1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const linear_congruential<_UIntType1, __a1, __c1,
+ __m1>& __lcr);
+
+ /**
+ * Sets the state of the engine by reading its textual
+ * representation from @p __is.
+ *
+ * The textual representation must have been previously written using an
+ * output stream whose imbued locale and whose type's template
+ * specialization arguments _CharT and _Traits were the same as those of
+ * @p __is.
+ *
+ * @param __is The input stream.
+ * @param __lcr A % linear_congruential random number generator.
+ * @returns __is.
+ */
+ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+ _UIntType1 __m1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr);
+
+ private:
+ template<class _Gen>
+ void
+ seed(_Gen& __g, true_type)
+ { return seed(static_cast<unsigned long>(__g)); }
+
+ template<class _Gen>
+ void
+ seed(_Gen& __g, false_type);
+
+ _UIntType _M_x;
+ };
+
+ /**
+ * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.
+ */
+ typedef linear_congruential<unsigned long, 16807, 0, 2147483647> minstd_rand0;
+
+ /**
+ * An alternative LCR (Lehmer Generator function) .
+ */
+ typedef linear_congruential<unsigned long, 48271, 0, 2147483647> minstd_rand;
+
+
+ /**
+ * A generalized feedback shift register discrete random number generator.
+ *
+ * This algorithm avoids multiplication and division and is designed to be
+ * friendly to a pipelined architecture. If the parameters are chosen
+ * correctly, this generator will produce numbers with a very long period and
+ * fairly good apparent entropy, although still not cryptographically strong.
+ *
+ * The best way to use this generator is with the predefined mt19937 class.
+ *
+ * This algorithm was originally invented by Makoto Matsumoto and
+ * Takuji Nishimura.
+ *
+ * @var word_size The number of bits in each element of the state vector.
+ * @var state_size The degree of recursion.
+ * @var shift_size The period parameter.
+ * @var mask_bits The separation point bit index.
+ * @var parameter_a The last row of the twist matrix.
+ * @var output_u The first right-shift tempering matrix parameter.
+ * @var output_s The first left-shift tempering matrix parameter.
+ * @var output_b The first left-shift tempering matrix mask.
+ * @var output_t The second left-shift tempering matrix parameter.
+ * @var output_c The second left-shift tempering matrix mask.
+ * @var output_l The second right-shift tempering matrix parameter.
+ */
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l>
+ class mersenne_twister
+ {
+ __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
+
+ public:
+ // types
+ typedef _UIntType result_type;
+
+ // parameter values
+ static const int word_size = __w;
+ static const int state_size = __n;
+ static const int shift_size = __m;
+ static const int mask_bits = __r;
+ static const _UIntType parameter_a = __a;
+ static const int output_u = __u;
+ static const int output_s = __s;
+ static const _UIntType output_b = __b;
+ static const int output_t = __t;
+ static const _UIntType output_c = __c;
+ static const int output_l = __l;
+
+ // constructors and member function
+ mersenne_twister()
+ { seed(); }
+
+ explicit
+ mersenne_twister(unsigned long __value)
+ { seed(__value); }
+
+ template<class _Gen>
+ mersenne_twister(_Gen& __g)
+ { seed(__g); }
+
+ void
+ seed()
+ { seed(5489UL); }
+
+ void
+ seed(unsigned long __value);
+
+ template<class _Gen>
+ void
+ seed(_Gen& __g)
+ { seed(__g, typename is_fundamental<_Gen>::type()); }
+
+ result_type
+ min() const
+ { return 0; };
+
+ result_type
+ max() const
+ { return __detail::_Shift<_UIntType, __w>::__value - 1; }
+
+ result_type
+ operator()();
+
+ /**
+ * Compares two % mersenne_twister random number generator objects of
+ * the same type for equality.
+ *
+ * @param __lhs A % mersenne_twister random number generator object.
+ * @param __rhs Another % mersenne_twister random number generator
+ * object.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const mersenne_twister& __lhs,
+ const mersenne_twister& __rhs)
+ { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
+
+ /**
+ * Compares two % mersenne_twister random number generator objects of
+ * the same type for inequality.
+ *
+ * @param __lhs A % mersenne_twister random number generator object.
+ * @param __rhs Another % mersenne_twister random number generator
+ * object.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const mersenne_twister& __lhs,
+ const mersenne_twister& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Inserts the current state of a % mersenne_twister random number
+ * generator engine @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A % mersenne_twister random number generator engine.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
+ _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
+ _UIntType1 __c1, int __l1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
+ __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
+
+ /**
+ * Extracts the current state of a % mersenne_twister random number
+ * generator engine @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A % mersenne_twister random number generator engine.
+ *
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
+ */
+ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
+ _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
+ _UIntType1 __c1, int __l1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
+ __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
+
+ private:
+ template<class _Gen>
+ void
+ seed(_Gen& __g, true_type)
+ { return seed(static_cast<unsigned long>(__g)); }
+
+ template<class _Gen>
+ void
+ seed(_Gen& __g, false_type);
+
+ _UIntType _M_x[state_size];
+ int _M_p;
+ };
+
+ /**
+ * The classic Mersenne Twister.
+ *
+ * Reference:
+ * M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally
+ * Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions
+ * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.
+ */
+ typedef mersenne_twister<
+ unsigned long, 32, 624, 397, 31,
+ 0x9908b0dful, 11, 7,
+ 0x9d2c5680ul, 15,
+ 0xefc60000ul, 18
+ > mt19937;
+
+
+ /**
+ * @brief The Marsaglia-Zaman generator.
+ *
+ * This is a model of a Generalized Fibonacci discrete random number
+ * generator, sometimes referred to as the SWC generator.
+ *
+ * A discrete random number generator that produces pseudorandom
+ * numbers using @f$x_{i}\leftarrow(x_{i - s} - x_{i - r} -
+ * carry_{i-1}) \bmod m @f$.
+ *
+ * The size of the state is @f$ r @f$
+ * and the maximum period of the generator is @f$ m^r - m^s -1 @f$.
+ *
+ * N1688[4.13] says "the template parameter _IntType shall denote an integral
+ * type large enough to store values up to m."
+ *
+ * @var _M_x The state of the generator. This is a ring buffer.
+ * @var _M_carry The carry.
+ * @var _M_p Current index of x(i - r).
+ */
+ template<typename _IntType, _IntType __m, int __s, int __r>
+ class subtract_with_carry
+ {
+ __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+ public:
+ /** The type of the generated random value. */
+ typedef _IntType result_type;
+
+ // parameter values
+ static const _IntType modulus = __m;
+ static const int long_lag = __r;
+ static const int short_lag = __s;
+
+ /**
+ * Constructs a default-initialized % subtract_with_carry random number
+ * generator.
+ */
+ subtract_with_carry()
+ { this->seed(); }
+
+ /**
+ * Constructs an explicitly seeded % subtract_with_carry random number
+ * generator.
+ */
+ explicit
+ subtract_with_carry(unsigned long __value)
+ { this->seed(__value); }
+
+ /**
+ * Constructs a %subtract_with_carry random number generator engine
+ * seeded from the generator function @p __g.
+ *
+ * @param __g The seed generator function.
+ */
+ template<class _Gen>
+ subtract_with_carry(_Gen& __g)
+ { this->seed(__g); }
+
+ /**
+ * Seeds the initial state @f$ x_0 @f$ of the random number generator.
+ *
+ * N1688[4.19] modifies this as follows. If @p __value == 0,
+ * sets value to 19780503. In any case, with a linear
+ * congruential generator lcg(i) having parameters @f$ m_{lcg} =
+ * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value
+ * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m
+ * \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$
+ * set carry to 1, otherwise sets carry to 0.
+ */
+ void
+ seed(unsigned long __value = 19780503);
+
+ /**
+ * Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry
+ * random number generator.
+ */
+ template<class _Gen>
+ void
+ seed(_Gen& __g)
+ { seed(__g, typename is_fundamental<_Gen>::type()); }
+
+ /**
+ * Gets the inclusive minimum value of the range of random integers
+ * returned by this generator.
+ */
+ result_type
+ min() const
+ { return 0; }
+
+ /**
+ * Gets the inclusive maximum value of the range of random integers
+ * returned by this generator.
+ */
+ result_type
+ max() const
+ { return this->modulus - 1; }
+
+ /**
+ * Gets the next random number in the sequence.
+ */
+ result_type
+ operator()();
+
+ /**
+ * Compares two % subtract_with_carry random number generator objects of
+ * the same type for equality.
+ *
+ * @param __lhs A % subtract_with_carry random number generator object.
+ * @param __rhs Another % subtract_with_carry random number generator
+ * object.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const subtract_with_carry& __lhs,
+ const subtract_with_carry& __rhs)
+ { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
+
+ /**
+ * Compares two % subtract_with_carry random number generator objects of
+ * the same type for inequality.
+ *
+ * @param __lhs A % subtract_with_carry random number generator object.
+ * @param __rhs Another % subtract_with_carry random number generator
+ * object.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const subtract_with_carry& __lhs,
+ const subtract_with_carry& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Inserts the current state of a % subtract_with_carry random number
+ * generator engine @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A % subtract_with_carry random number generator engine.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry<_IntType1, __m1, __s1,
+ __r1>& __x);
+
+ /**
+ * Extracts the current state of a % subtract_with_carry random number
+ * generator engine @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A % subtract_with_carry random number generator engine.
+ *
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
+ */
+ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x);
+
+ private:
+ template<class _Gen>
+ void
+ seed(_Gen& __g, true_type)
+ { return seed(static_cast<unsigned long>(__g)); }
+
+ template<class _Gen>
+ void
+ seed(_Gen& __g, false_type);
+
+ typedef typename __gnu_cxx::__add_unsigned<_IntType>::__type _UIntType;
+
+ _UIntType _M_x[long_lag];
+ _UIntType _M_carry;
+ int _M_p;
+ };
+
+
+ /**
+ * @brief The Marsaglia-Zaman generator (floats version).
+ *
+ * @var _M_x The state of the generator. This is a ring buffer.
+ * @var _M_carry The carry.
+ * @var _M_p Current index of x(i - r).
+ * @var _M_npows Precomputed negative powers of 2.
+ */
+ template<typename _RealType, int __w, int __s, int __r>
+ class subtract_with_carry_01
+ {
+ public:
+ /** The type of the generated random value. */
+ typedef _RealType result_type;
+
+ // parameter values
+ static const int word_size = __w;
+ static const int long_lag = __r;
+ static const int short_lag = __s;
+
+ /**
+ * Constructs a default-initialized % subtract_with_carry_01 random
+ * number generator.
+ */
+ subtract_with_carry_01()
+ {
+ this->seed();
+ _M_initialize_npows();
+ }
+
+ /**
+ * Constructs an explicitly seeded % subtract_with_carry_01 random number
+ * generator.
+ */
+ explicit
+ subtract_with_carry_01(unsigned long __value)
+ {
+ this->seed(__value);
+ _M_initialize_npows();
+ }
+
+ /**
+ * Constructs a % subtract_with_carry_01 random number generator engine
+ * seeded from the generator function @p __g.
+ *
+ * @param __g The seed generator function.
+ */
+ template<class _Gen>
+ subtract_with_carry_01(_Gen& __g)
+ {
+ this->seed(__g);
+ _M_initialize_npows();
+ }
+
+ /**
+ * Seeds the initial state @f$ x_0 @f$ of the random number generator.
+ */
+ void
+ seed(unsigned long __value = 19780503);
+
+ /**
+ * Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry_01
+ * random number generator.
+ */
+ template<class _Gen>
+ void
+ seed(_Gen& __g)
+ { seed(__g, typename is_fundamental<_Gen>::type()); }
+
+ /**
+ * Gets the minimum value of the range of random floats
+ * returned by this generator.
+ */
+ result_type
+ min() const
+ { return 0.0; }
+
+ /**
+ * Gets the maximum value of the range of random floats
+ * returned by this generator.
+ */
+ result_type
+ max() const
+ { return 1.0; }
+
+ /**
+ * Gets the next random number in the sequence.
+ */
+ result_type
+ operator()();
+
+ /**
+ * Compares two % subtract_with_carry_01 random number generator objects
+ * of the same type for equality.
+ *
+ * @param __lhs A % subtract_with_carry_01 random number
+ * generator object.
+ * @param __rhs Another % subtract_with_carry_01 random number generator
+ * object.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const subtract_with_carry_01& __lhs,
+ const subtract_with_carry_01& __rhs)
+ {
+ for (int __i = 0; __i < long_lag; ++__i)
+ if (!std::equal(__lhs._M_x[__i], __lhs._M_x[__i] + __n,
+ __rhs._M_x[__i]))
+ return false;
+ return true;
+ }
+
+ /**
+ * Compares two % subtract_with_carry_01 random number generator objects
+ * of the same type for inequality.
+ *
+ * @param __lhs A % subtract_with_carry_01 random number
+ * generator object.
+ *
+ * @param __rhs Another % subtract_with_carry_01 random number generator
+ * object.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const subtract_with_carry_01& __lhs,
+ const subtract_with_carry_01& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Inserts the current state of a % subtract_with_carry_01 random number
+ * generator engine @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A % subtract_with_carry_01 random number generator engine.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, int __w1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry_01<_RealType1, __w1, __s1,
+ __r1>& __x);
+
+ /**
+ * Extracts the current state of a % subtract_with_carry_01 random number
+ * generator engine @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A % subtract_with_carry_01 random number generator engine.
+ *
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
+ */
+ template<typename _RealType1, int __w1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry_01<_RealType1, __w1, __s1, __r1>& __x);
+
+ private:
+ template<class _Gen>
+ void
+ seed(_Gen& __g, true_type)
+ { return seed(static_cast<unsigned long>(__g)); }
+
+ template<class _Gen>
+ void
+ seed(_Gen& __g, false_type);
+
+ void
+ _M_initialize_npows();
+
+ static const int __n = (__w + 31) / 32;
+
+ typedef __detail::_UInt32Type _UInt32Type;
+ _UInt32Type _M_x[long_lag][__n];
+ _RealType _M_npows[__n];
+ _UInt32Type _M_carry;
+ int _M_p;
+ };
+
+ typedef subtract_with_carry_01<float, 24, 10, 24> ranlux_base_01;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 508. Bad parameters for ranlux64_base_01.
+ typedef subtract_with_carry_01<double, 48, 5, 12> ranlux64_base_01;
+
+
+ /**
+ * Produces random numbers from some base engine by discarding blocks of
+ * data.
+ *
+ * 0 <= @p __r <= @p __p
+ */
+ template<class _UniformRandomNumberGenerator, int __p, int __r>
+ class discard_block
+ {
+ // __glibcxx_class_requires(typename base_type::result_type,
+ // ArithmeticTypeConcept)
+
+ public:
+ /** The type of the underlying generator engine. */
+ typedef _UniformRandomNumberGenerator base_type;
+ /** The type of the generated random value. */
+ typedef typename base_type::result_type result_type;
+
+ // parameter values
+ static const int block_size = __p;
+ static const int used_block = __r;
+
+ /**
+ * Constructs a default %discard_block engine.
+ *
+ * The underlying engine is default constructed as well.
+ */
+ discard_block()
+ : _M_n(0) { }
+
+ /**
+ * Copy constructs a %discard_block engine.
+ *
+ * Copies an existing base class random number generator.
+ * @param rng An existing (base class) engine object.
+ */
+ explicit
+ discard_block(const base_type& __rng)
+ : _M_b(__rng), _M_n(0) { }
+
+ /**
+ * Seed constructs a %discard_block engine.
+ *
+ * Constructs the underlying generator engine seeded with @p __s.
+ * @param __s A seed value for the base class engine.
+ */
+ explicit
+ discard_block(unsigned long __s)
+ : _M_b(__s), _M_n(0) { }
+
+ /**
+ * Generator construct a %discard_block engine.
+ *
+ * @param __g A seed generator function.
+ */
+ template<class _Gen>
+ discard_block(_Gen& __g)
+ : _M_b(__g), _M_n(0) { }
+
+ /**
+ * Reseeds the %discard_block object with the default seed for the
+ * underlying base class generator engine.
+ */
+ void seed()
+ {
+ _M_b.seed();
+ _M_n = 0;
+ }
+
+ /**
+ * Reseeds the %discard_block object with the given seed generator
+ * function.
+ * @param __g A seed generator function.
+ */
+ template<class _Gen>
+ void seed(_Gen& __g)
+ {
+ _M_b.seed(__g);
+ _M_n = 0;
+ }
+
+ /**
+ * Gets a const reference to the underlying generator engine object.
+ */
+ const base_type&
+ base() const
+ { return _M_b; }
+
+ /**
+ * Gets the minimum value in the generated random number range.
+ */
+ result_type
+ min() const
+ { return _M_b.min(); }
+
+ /**
+ * Gets the maximum value in the generated random number range.
+ */
+ result_type
+ max() const
+ { return _M_b.max(); }
+
+ /**
+ * Gets the next value in the generated random number sequence.
+ */
+ result_type
+ operator()();
+
+ /**
+ * Compares two %discard_block random number generator objects of
+ * the same type for equality.
+ *
+ * @param __lhs A %discard_block random number generator object.
+ * @param __rhs Another %discard_block random number generator
+ * object.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const discard_block& __lhs, const discard_block& __rhs)
+ { return (__lhs._M_b == __rhs._M_b) && (__lhs._M_n == __rhs._M_n); }
+
+ /**
+ * Compares two %discard_block random number generator objects of
+ * the same type for inequality.
+ *
+ * @param __lhs A %discard_block random number generator object.
+ * @param __rhs Another %discard_block random number generator
+ * object.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const discard_block& __lhs, const discard_block& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Inserts the current state of a %discard_block random number
+ * generator engine @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %discard_block random number generator engine.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const discard_block<_UniformRandomNumberGenerator1,
+ __p1, __r1>& __x);
+
+ /**
+ * Extracts the current state of a % subtract_with_carry random number
+ * generator engine @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %discard_block random number generator engine.
+ *
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
+ */
+ template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ discard_block<_UniformRandomNumberGenerator1,
+ __p1, __r1>& __x);
+
+ private:
+ base_type _M_b;
+ int _M_n;
+ };
+
+
+ /**
+ * James's luxury-level-3 integer adaptation of Luescher's generator.
+ */
+ typedef discard_block<
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24>,
+ 223,
+ 24
+ > ranlux3;
+
+ /**
+ * James's luxury-level-4 integer adaptation of Luescher's generator.
+ */
+ typedef discard_block<
+ subtract_with_carry<unsigned long, (1UL << 24), 10, 24>,
+ 389,
+ 24
+ > ranlux4;
+
+ typedef discard_block<
+ subtract_with_carry_01<float, 24, 10, 24>,
+ 223,
+ 24
+ > ranlux3_01;
+
+ typedef discard_block<
+ subtract_with_carry_01<float, 24, 10, 24>,
+ 389,
+ 24
+ > ranlux4_01;
+
+
+ /**
+ * A random number generator adaptor class that combines two random number
+ * generator engines into a single output sequence.
+ */
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2>
+ class xor_combine
+ {
+ // __glibcxx_class_requires(typename _UniformRandomNumberGenerator1::
+ // result_type, ArithmeticTypeConcept)
+ // __glibcxx_class_requires(typename _UniformRandomNumberGenerator2::
+ // result_type, ArithmeticTypeConcept)
+
+ public:
+ /** The type of the first underlying generator engine. */
+ typedef _UniformRandomNumberGenerator1 base1_type;
+ /** The type of the second underlying generator engine. */
+ typedef _UniformRandomNumberGenerator2 base2_type;
+
+ private:
+ typedef typename base1_type::result_type _Result_type1;
+ typedef typename base2_type::result_type _Result_type2;
+
+ public:
+ /** The type of the generated random value. */
+ typedef typename __gnu_cxx::__conditional_type<(sizeof(_Result_type1)
+ > sizeof(_Result_type2)),
+ _Result_type1, _Result_type2>::__type result_type;
+
+ // parameter values
+ static const int shift1 = __s1;
+ static const int shift2 = __s2;
+
+ // constructors and member function
+ xor_combine()
+ : _M_b1(), _M_b2()
+ { _M_initialize_max(); }
+
+ xor_combine(const base1_type& __rng1, const base2_type& __rng2)
+ : _M_b1(__rng1), _M_b2(__rng2)
+ { _M_initialize_max(); }
+
+ xor_combine(unsigned long __s)
+ : _M_b1(__s), _M_b2(__s + 1)
+ { _M_initialize_max(); }
+
+ template<class _Gen>
+ xor_combine(_Gen& __g)
+ : _M_b1(__g), _M_b2(__g)
+ { _M_initialize_max(); }
+
+ void
+ seed()
+ {
+ _M_b1.seed();
+ _M_b2.seed();
+ }
+
+ template<class _Gen>
+ void
+ seed(_Gen& __g)
+ {
+ _M_b1.seed(__g);
+ _M_b2.seed(__g);
+ }
+
+ const base1_type&
+ base1() const
+ { return _M_b1; }
+
+ const base2_type&
+ base2() const
+ { return _M_b2; }
+
+ result_type
+ min() const
+ { return 0; }
+
+ result_type
+ max() const
+ { return _M_max; }
+
+ /**
+ * Gets the next random number in the sequence.
+ */
+ // NB: Not exactly the TR1 formula, per N2079 instead.
+ result_type
+ operator()()
+ {
+ return ((result_type(_M_b1() - _M_b1.min()) << shift1)
+ ^ (result_type(_M_b2() - _M_b2.min()) << shift2));
+ }
+
+ /**
+ * Compares two %xor_combine random number generator objects of
+ * the same type for equality.
+ *
+ * @param __lhs A %xor_combine random number generator object.
+ * @param __rhs Another %xor_combine random number generator
+ * object.
+ *
+ * @returns true if the two objects are equal, false otherwise.
+ */
+ friend bool
+ operator==(const xor_combine& __lhs, const xor_combine& __rhs)
+ {
+ return (__lhs.base1() == __rhs.base1())
+ && (__lhs.base2() == __rhs.base2());
+ }
+
+ /**
+ * Compares two %xor_combine random number generator objects of
+ * the same type for inequality.
+ *
+ * @param __lhs A %xor_combine random number generator object.
+ * @param __rhs Another %xor_combine random number generator
+ * object.
+ *
+ * @returns true if the two objects are not equal, false otherwise.
+ */
+ friend bool
+ operator!=(const xor_combine& __lhs, const xor_combine& __rhs)
+ { return !(__lhs == __rhs); }
+
+ /**
+ * Inserts the current state of a %xor_combine random number
+ * generator engine @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %xor_combine random number generator engine.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<class _UniformRandomNumberGenerator11, int __s11,
+ class _UniformRandomNumberGenerator21, int __s21,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const xor_combine<_UniformRandomNumberGenerator11, __s11,
+ _UniformRandomNumberGenerator21, __s21>& __x);
+
+ /**
+ * Extracts the current state of a %xor_combine random number
+ * generator engine @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %xor_combine random number generator engine.
+ *
+ * @returns The input stream with the state of @p __x extracted or in
+ * an error state.
+ */
+ template<class _UniformRandomNumberGenerator11, int __s11,
+ class _UniformRandomNumberGenerator21, int __s21,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ xor_combine<_UniformRandomNumberGenerator11, __s11,
+ _UniformRandomNumberGenerator21, __s21>& __x);
+
+ private:
+ void
+ _M_initialize_max();
+
+ result_type
+ _M_initialize_max_aux(result_type, result_type, int);
+
+ base1_type _M_b1;
+ base2_type _M_b2;
+ result_type _M_max;
+ };
+
+
+ /**
+ * A standard interface to a platform-specific non-deterministic
+ * random number generator (if any are available).
+ */
+ class random_device
+ {
+ public:
+ // types
+ typedef unsigned int result_type;
+
+ // constructors, destructors and member functions
+
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+
+ explicit
+ random_device(const std::string& __token = "/dev/urandom")
+ {
+ if ((__token != "/dev/urandom" && __token != "/dev/random")
+ || !(_M_file = std::fopen(__token.c_str(), "rb")))
+ std::__throw_runtime_error(__N("random_device::"
+ "random_device(const std::string&)"));
+ }
+
+ ~random_device()
+ { std::fclose(_M_file); }
+
+#else
+
+ explicit
+ random_device(const std::string& __token = "mt19937")
+ : _M_mt(_M_strtoul(__token)) { }
+
+ private:
+ static unsigned long
+ _M_strtoul(const std::string& __str)
+ {
+ unsigned long __ret = 5489UL;
+ if (__str != "mt19937")
+ {
+ const char* __nptr = __str.c_str();
+ char* __endptr;
+ __ret = std::strtoul(__nptr, &__endptr, 0);
+ if (*__nptr == '\0' || *__endptr != '\0')
+ std::__throw_runtime_error(__N("random_device::_M_strtoul"
+ "(const std::string&)"));
+ }
+ return __ret;
+ }
+
+ public:
+
+#endif
+
+ result_type
+ min() const
+ { return std::numeric_limits<result_type>::min(); }
+
+ result_type
+ max() const
+ { return std::numeric_limits<result_type>::max(); }
+
+ double
+ entropy() const
+ { return 0.0; }
+
+ result_type
+ operator()()
+ {
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+ result_type __ret;
+ std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),
+ 1, _M_file);
+ return __ret;
+#else
+ return _M_mt();
+#endif
+ }
+
+ private:
+ random_device(const random_device&);
+ void operator=(const random_device&);
+
+#ifdef _GLIBCXX_USE_RANDOM_TR1
+ FILE* _M_file;
+#else
+ mt19937 _M_mt;
+#endif
+ };
+
+ /* @} */ // group tr1_random_generators
+
+ /**
+ * @defgroup tr1_random_distributions Random Number Distributions
+ * @ingroup tr1_random
+ * @{
+ */
+
+ /**
+ * @defgroup tr1_random_distributions_discrete Discrete Distributions
+ * @ingroup tr1_random_distributions
+ * @{
+ */
+
+ /**
+ * @brief Uniform discrete distribution for random numbers.
+ * A discrete random distribution on the range @f$[min, max]@f$ with equal
+ * probability throughout the range.
+ */
+ template<typename _IntType = int>
+ class uniform_int
+ {
+ __glibcxx_class_requires(_IntType, _IntegerConcept)
+
+ public:
+ /** The type of the parameters of the distribution. */
+ typedef _IntType input_type;
+ /** The type of the range of the distribution. */
+ typedef _IntType result_type;
+
+ public:
+ /**
+ * Constructs a uniform distribution object.
+ */
+ explicit
+ uniform_int(_IntType __min = 0, _IntType __max = 9)
+ : _M_min(__min), _M_max(__max)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max);
+ }
+
+ /**
+ * Gets the inclusive lower bound of the distribution range.
+ */
+ result_type
+ min() const
+ { return _M_min; }
+
+ /**
+ * Gets the inclusive upper bound of the distribution range.
+ */
+ result_type
+ max() const
+ { return _M_max; }
+
+ /**
+ * Resets the distribution state.
+ *
+ * Does nothing for the uniform integer distribution.
+ */
+ void
+ reset() { }
+
+ /**
+ * Gets a uniformly distributed random number in the range
+ * @f$(min, max)@f$.
+ */
+ template<typename _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ typedef typename _UniformRandomNumberGenerator::result_type
+ _UResult_type;
+ return _M_call(__urng, _M_min, _M_max,
+ typename is_integral<_UResult_type>::type());
+ }
+
+ /**
+ * Gets a uniform random number in the range @f$[0, n)@f$.
+ *
+ * This function is aimed at use with std::random_shuffle.
+ */
+ template<typename _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng, result_type __n)
+ {
+ typedef typename _UniformRandomNumberGenerator::result_type
+ _UResult_type;
+ return _M_call(__urng, 0, __n - 1,
+ typename is_integral<_UResult_type>::type());
+ }
+
+ /**
+ * Inserts a %uniform_int random number distribution @p __x into the
+ * output stream @p os.
+ *
+ * @param __os An output stream.
+ * @param __x A %uniform_int random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _IntType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_int<_IntType1>& __x);
+
+ /**
+ * Extracts a %uniform_int random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %uniform_int random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _IntType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType1>& __x);
+
+ private:
+ template<typename _UniformRandomNumberGenerator>
+ result_type
+ _M_call(_UniformRandomNumberGenerator& __urng,
+ result_type __min, result_type __max, true_type);
+
+ template<typename _UniformRandomNumberGenerator>
+ result_type
+ _M_call(_UniformRandomNumberGenerator& __urng,
+ result_type __min, result_type __max, false_type)
+ {
+ return result_type((__urng() - __urng.min())
+ / (__urng.max() - __urng.min())
+ * (__max - __min + 1)) + __min;
+ }
+
+ _IntType _M_min;
+ _IntType _M_max;
+ };
+
+
+ /**
+ * @brief A Bernoulli random number distribution.
+ *
+ * Generates a sequence of true and false values with likelihood @f$ p @f$
+ * that true will come up and @f$ (1 - p) @f$ that false will appear.
+ */
+ class bernoulli_distribution
+ {
+ public:
+ typedef int input_type;
+ typedef bool result_type;
+
+ public:
+ /**
+ * Constructs a Bernoulli distribution with likelihood @p p.
+ *
+ * @param __p [IN] The likelihood of a true result being returned. Must
+ * be in the interval @f$ [0, 1] @f$.
+ */
+ explicit
+ bernoulli_distribution(double __p = 0.5)
+ : _M_p(__p)
+ {
+ _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));
+ }
+
+ /**
+ * Gets the @p p parameter of the distribution.
+ */
+ double
+ p() const
+ { return _M_p; }
+
+ /**
+ * Resets the distribution state.
+ *
+ * Does nothing for a Bernoulli distribution.
+ */
+ void
+ reset() { }
+
+ /**
+ * Gets the next value in the Bernoullian sequence.
+ */
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ if ((__urng() - __urng.min()) < _M_p * (__urng.max() - __urng.min()))
+ return true;
+ return false;
+ }
+
+ /**
+ * Inserts a %bernoulli_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %bernoulli_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bernoulli_distribution& __x);
+
+ /**
+ * Extracts a %bernoulli_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %bernoulli_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ bernoulli_distribution& __x)
+ { return __is >> __x._M_p; }
+
+ private:
+ double _M_p;
+ };
+
+
+ /**
+ * @brief A discrete geometric random number distribution.
+ *
+ * The formula for the geometric probability mass function is
+ * @f$ p(i) = (1 - p)p^{i-1} @f$ where @f$ p @f$ is the parameter of the
+ * distribution.
+ */
+ template<typename _IntType = int, typename _RealType = double>
+ class geometric_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _IntType result_type;
+
+ // constructors and member function
+ explicit
+ geometric_distribution(const _RealType& __p = _RealType(0.5))
+ : _M_p(__p)
+ {
+ _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0));
+ _M_initialize();
+ }
+
+ /**
+ * Gets the distribution parameter @p p.
+ */
+ _RealType
+ p() const
+ { return _M_p; }
+
+ void
+ reset() { }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %geometric_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %geometric_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const geometric_distribution<_IntType1, _RealType1>& __x);
+
+ /**
+ * Extracts a %geometric_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %geometric_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ geometric_distribution& __x)
+ {
+ __is >> __x._M_p;
+ __x._M_initialize();
+ return __is;
+ }
+
+ private:
+ void
+ _M_initialize()
+ { _M_log_p = std::log(_M_p); }
+
+ _RealType _M_p;
+ _RealType _M_log_p;
+ };
+
+
+ template<typename _RealType>
+ class normal_distribution;
+
+ /**
+ * @brief A discrete Poisson random number distribution.
+ *
+ * The formula for the Poisson probability mass function is
+ * @f$ p(i) = \frac{mean^i}{i!} e^{-mean} @f$ where @f$ mean @f$ is the
+ * parameter of the distribution.
+ */
+ template<typename _IntType = int, typename _RealType = double>
+ class poisson_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _IntType result_type;
+
+ // constructors and member function
+ explicit
+ poisson_distribution(const _RealType& __mean = _RealType(1))
+ : _M_mean(__mean), _M_nd()
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);
+ _M_initialize();
+ }
+
+ /**
+ * Gets the distribution parameter @p mean.
+ */
+ _RealType
+ mean() const
+ { return _M_mean; }
+
+ void
+ reset()
+ { _M_nd.reset(); }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %poisson_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %poisson_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const poisson_distribution<_IntType1, _RealType1>& __x);
+
+ /**
+ * Extracts a %poisson_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %poisson_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ poisson_distribution<_IntType1, _RealType1>& __x);
+
+ private:
+ void
+ _M_initialize();
+
+ // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+ normal_distribution<_RealType> _M_nd;
+
+ _RealType _M_mean;
+
+ // Hosts either log(mean) or the threshold of the simple method.
+ _RealType _M_lm_thr;
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _RealType _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
+#endif
+ };
+
+
+ /**
+ * @brief A discrete binomial random number distribution.
+ *
+ * The formula for the binomial probability mass function is
+ * @f$ p(i) = \binom{n}{i} p^i (1 - p)^{t - i} @f$ where @f$ t @f$
+ * and @f$ p @f$ are the parameters of the distribution.
+ */
+ template<typename _IntType = int, typename _RealType = double>
+ class binomial_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _IntType result_type;
+
+ // constructors and member function
+ explicit
+ binomial_distribution(_IntType __t = 1,
+ const _RealType& __p = _RealType(0.5))
+ : _M_t(__t), _M_p(__p), _M_nd()
+ {
+ _GLIBCXX_DEBUG_ASSERT((_M_t >= 0) && (_M_p >= 0.0) && (_M_p <= 1.0));
+ _M_initialize();
+ }
+
+ /**
+ * Gets the distribution @p t parameter.
+ */
+ _IntType
+ t() const
+ { return _M_t; }
+
+ /**
+ * Gets the distribution @p p parameter.
+ */
+ _RealType
+ p() const
+ { return _M_p; }
+
+ void
+ reset()
+ { _M_nd.reset(); }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %binomial_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %binomial_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const binomial_distribution<_IntType1, _RealType1>& __x);
+
+ /**
+ * Extracts a %binomial_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %binomial_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ binomial_distribution<_IntType1, _RealType1>& __x);
+
+ private:
+ void
+ _M_initialize();
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t);
+
+ // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.
+ normal_distribution<_RealType> _M_nd;
+
+ _RealType _M_q;
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _RealType _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
+ _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
+#endif
+ _RealType _M_p;
+ _IntType _M_t;
+
+ bool _M_easy;
+ };
+
+ /* @} */ // group tr1_random_distributions_discrete
+
+ /**
+ * @defgroup tr1_random_distributions_continuous Continuous Distributions
+ * @ingroup tr1_random_distributions
+ * @{
+ */
+
+ /**
+ * @brief Uniform continuous distribution for random numbers.
+ *
+ * A continuous random distribution on the range [min, max) with equal
+ * probability throughout the range. The URNG should be real-valued and
+ * deliver number in the range [0, 1).
+ */
+ template<typename _RealType = double>
+ class uniform_real
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _RealType result_type;
+
+ public:
+ /**
+ * Constructs a uniform_real object.
+ *
+ * @param __min [IN] The lower bound of the distribution.
+ * @param __max [IN] The upper bound of the distribution.
+ */
+ explicit
+ uniform_real(_RealType __min = _RealType(0),
+ _RealType __max = _RealType(1))
+ : _M_min(__min), _M_max(__max)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max);
+ }
+
+ result_type
+ min() const
+ { return _M_min; }
+
+ result_type
+ max() const
+ { return _M_max; }
+
+ void
+ reset() { }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng)
+ { return (__urng() * (_M_max - _M_min)) + _M_min; }
+
+ /**
+ * Inserts a %uniform_real random number distribution @p __x into the
+ * output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %uniform_real random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_real<_RealType1>& __x);
+
+ /**
+ * Extracts a %uniform_real random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %uniform_real random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_real<_RealType1>& __x);
+
+ private:
+ _RealType _M_min;
+ _RealType _M_max;
+ };
+
+
+ /**
+ * @brief An exponential continuous distribution for random numbers.
+ *
+ * The formula for the exponential probability mass function is
+ * @f$ p(x) = \lambda e^{-\lambda x} @f$.
+ *
+ * <table border=1 cellpadding=10 cellspacing=0>
+ * <caption align=top>Distribution Statistics</caption>
+ * <tr><td>Mean</td><td>@f$ \frac{1}{\lambda} @f$</td></tr>
+ * <tr><td>Median</td><td>@f$ \frac{\ln 2}{\lambda} @f$</td></tr>
+ * <tr><td>Mode</td><td>@f$ zero @f$</td></tr>
+ * <tr><td>Range</td><td>@f$[0, \infty]@f$</td></tr>
+ * <tr><td>Standard Deviation</td><td>@f$ \frac{1}{\lambda} @f$</td></tr>
+ * </table>
+ */
+ template<typename _RealType = double>
+ class exponential_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _RealType result_type;
+
+ public:
+ /**
+ * Constructs an exponential distribution with inverse scale parameter
+ * @f$ \lambda @f$.
+ */
+ explicit
+ exponential_distribution(const result_type& __lambda = result_type(1))
+ : _M_lambda(__lambda)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_lambda > 0);
+ }
+
+ /**
+ * Gets the inverse scale parameter of the distribution.
+ */
+ _RealType
+ lambda() const
+ { return _M_lambda; }
+
+ /**
+ * Resets the distribution.
+ *
+ * Has no effect on exponential distributions.
+ */
+ void
+ reset() { }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng)
+ { return -std::log(__urng()) / _M_lambda; }
+
+ /**
+ * Inserts a %exponential_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %exponential_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const exponential_distribution<_RealType1>& __x);
+
+ /**
+ * Extracts a %exponential_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %exponential_distribution random number
+ * generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ exponential_distribution& __x)
+ { return __is >> __x._M_lambda; }
+
+ private:
+ result_type _M_lambda;
+ };
+
+
+ /**
+ * @brief A normal continuous distribution for random numbers.
+ *
+ * The formula for the normal probability mass function is
+ * @f$ p(x) = \frac{1}{\sigma \sqrt{2 \pi}}
+ * e^{- \frac{{x - mean}^ {2}}{2 \sigma ^ {2}} } @f$.
+ */
+ template<typename _RealType = double>
+ class normal_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _RealType result_type;
+
+ public:
+ /**
+ * Constructs a normal distribution with parameters @f$ mean @f$ and
+ * @f$ \sigma @f$.
+ */
+ explicit
+ normal_distribution(const result_type& __mean = result_type(0),
+ const result_type& __sigma = result_type(1))
+ : _M_mean(__mean), _M_sigma(__sigma), _M_saved_available(false)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_sigma > 0);
+ }
+
+ /**
+ * Gets the mean of the distribution.
+ */
+ _RealType
+ mean() const
+ { return _M_mean; }
+
+ /**
+ * Gets the @f$ \sigma @f$ of the distribution.
+ */
+ _RealType
+ sigma() const
+ { return _M_sigma; }
+
+ /**
+ * Resets the distribution.
+ */
+ void
+ reset()
+ { _M_saved_available = false; }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %normal_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %normal_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType1>& __x);
+
+ /**
+ * Extracts a %normal_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %normal_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType1>& __x);
+
+ private:
+ result_type _M_mean;
+ result_type _M_sigma;
+ result_type _M_saved;
+ bool _M_saved_available;
+ };
+
+
+ /**
+ * @brief A gamma continuous distribution for random numbers.
+ *
+ * The formula for the gamma probability mass function is
+ * @f$ p(x) = \frac{1}{\Gamma(\alpha)} x^{\alpha - 1} e^{-x} @f$.
+ */
+ template<typename _RealType = double>
+ class gamma_distribution
+ {
+ public:
+ // types
+ typedef _RealType input_type;
+ typedef _RealType result_type;
+
+ public:
+ /**
+ * Constructs a gamma distribution with parameters @f$ \alpha @f$.
+ */
+ explicit
+ gamma_distribution(const result_type& __alpha_val = result_type(1))
+ : _M_alpha(__alpha_val)
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_alpha > 0);
+ _M_initialize();
+ }
+
+ /**
+ * Gets the @f$ \alpha @f$ of the distribution.
+ */
+ _RealType
+ alpha() const
+ { return _M_alpha; }
+
+ /**
+ * Resets the distribution.
+ */
+ void
+ reset() { }
+
+ template<class _UniformRandomNumberGenerator>
+ result_type
+ operator()(_UniformRandomNumberGenerator& __urng);
+
+ /**
+ * Inserts a %gamma_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %gamma_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const gamma_distribution<_RealType1>& __x);
+
+ /**
+ * Extracts a %gamma_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %gamma_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ gamma_distribution& __x)
+ {
+ __is >> __x._M_alpha;
+ __x._M_initialize();
+ return __is;
+ }
+
+ private:
+ void
+ _M_initialize();
+
+ result_type _M_alpha;
+
+ // Hosts either lambda of GB or d of modified Vaduva's.
+ result_type _M_l_d;
+ };
+
+ /* @} */ // group tr1_random_distributions_continuous
+ /* @} */ // group tr1_random_distributions
+ /* @} */ // group tr1_random
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+
+#include <tr1_impl/random.tcc>
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/random.tcc b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/random.tcc
new file mode 100644
index 000000000..4c78ce644
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/random.tcc
@@ -0,0 +1,1577 @@
+// random number generation (out of line) -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/random.tcc
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ /*
+ * (Further) implementation-space details.
+ */
+ namespace __detail
+ {
+ // General case for x = (ax + c) mod m -- use Schrage's algorithm to avoid
+ // integer overflow.
+ //
+ // Because a and c are compile-time integral constants the compiler kindly
+ // elides any unreachable paths.
+ //
+ // Preconditions: a > 0, m > 0.
+ //
+ template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>
+ struct _Mod
+ {
+ static _Tp
+ __calc(_Tp __x)
+ {
+ if (__a == 1)
+ __x %= __m;
+ else
+ {
+ static const _Tp __q = __m / __a;
+ static const _Tp __r = __m % __a;
+
+ _Tp __t1 = __a * (__x % __q);
+ _Tp __t2 = __r * (__x / __q);
+ if (__t1 >= __t2)
+ __x = __t1 - __t2;
+ else
+ __x = __m - __t2 + __t1;
+ }
+
+ if (__c != 0)
+ {
+ const _Tp __d = __m - __x;
+ if (__d > __c)
+ __x += __c;
+ else
+ __x = __c - __d;
+ }
+ return __x;
+ }
+ };
+
+ // Special case for m == 0 -- use unsigned integer overflow as modulo
+ // operator.
+ template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>
+ struct _Mod<_Tp, __a, __c, __m, true>
+ {
+ static _Tp
+ __calc(_Tp __x)
+ { return __a * __x + __c; }
+ };
+ } // namespace __detail
+
+ /**
+ * Seeds the LCR with integral value @p __x0, adjusted so that the
+ * ring identity is never a member of the convergence set.
+ */
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+ void
+ linear_congruential<_UIntType, __a, __c, __m>::
+ seed(unsigned long __x0)
+ {
+ if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0)
+ && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0))
+ _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1);
+ else
+ _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0);
+ }
+
+ /**
+ * Seeds the LCR engine with a value generated by @p __g.
+ */
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+ template<class _Gen>
+ void
+ linear_congruential<_UIntType, __a, __c, __m>::
+ seed(_Gen& __g, false_type)
+ {
+ _UIntType __x0 = __g();
+ if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0)
+ && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0))
+ _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1);
+ else
+ _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0);
+ }
+
+ /**
+ * Gets the next generated value in sequence.
+ */
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+ typename linear_congruential<_UIntType, __a, __c, __m>::result_type
+ linear_congruential<_UIntType, __a, __c, __m>::
+ operator()()
+ {
+ _M_x = __detail::__mod<_UIntType, __a, __c, __m>(_M_x);
+ return _M_x;
+ }
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const linear_congruential<_UIntType, __a, __c, __m>& __lcr)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
+ __os.fill(__os.widen(' '));
+
+ __os << __lcr._M_x;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ linear_congruential<_UIntType, __a, __c, __m>& __lcr)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec);
+
+ __is >> __lcr._M_x;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s,
+ _UIntType __b, int __t, _UIntType __c, int __l>
+ void
+ mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+ __b, __t, __c, __l>::
+ seed(unsigned long __value)
+ {
+ _M_x[0] = __detail::__mod<_UIntType, 1, 0,
+ __detail::_Shift<_UIntType, __w>::__value>(__value);
+
+ for (int __i = 1; __i < state_size; ++__i)
+ {
+ _UIntType __x = _M_x[__i - 1];
+ __x ^= __x >> (__w - 2);
+ __x *= 1812433253ul;
+ __x += __i;
+ _M_x[__i] = __detail::__mod<_UIntType, 1, 0,
+ __detail::_Shift<_UIntType, __w>::__value>(__x);
+ }
+ _M_p = state_size;
+ }
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s,
+ _UIntType __b, int __t, _UIntType __c, int __l>
+ template<class _Gen>
+ void
+ mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+ __b, __t, __c, __l>::
+ seed(_Gen& __gen, false_type)
+ {
+ for (int __i = 0; __i < state_size; ++__i)
+ _M_x[__i] = __detail::__mod<_UIntType, 1, 0,
+ __detail::_Shift<_UIntType, __w>::__value>(__gen());
+ _M_p = state_size;
+ }
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s,
+ _UIntType __b, int __t, _UIntType __c, int __l>
+ typename
+ mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+ __b, __t, __c, __l>::result_type
+ mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,
+ __b, __t, __c, __l>::
+ operator()()
+ {
+ // Reload the vector - cost is O(n) amortized over n calls.
+ if (_M_p >= state_size)
+ {
+ const _UIntType __upper_mask = (~_UIntType()) << __r;
+ const _UIntType __lower_mask = ~__upper_mask;
+
+ for (int __k = 0; __k < (__n - __m); ++__k)
+ {
+ _UIntType __y = ((_M_x[__k] & __upper_mask)
+ | (_M_x[__k + 1] & __lower_mask));
+ _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
+ ^ ((__y & 0x01) ? __a : 0));
+ }
+
+ for (int __k = (__n - __m); __k < (__n - 1); ++__k)
+ {
+ _UIntType __y = ((_M_x[__k] & __upper_mask)
+ | (_M_x[__k + 1] & __lower_mask));
+ _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)
+ ^ ((__y & 0x01) ? __a : 0));
+ }
+
+ _UIntType __y = ((_M_x[__n - 1] & __upper_mask)
+ | (_M_x[0] & __lower_mask));
+ _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
+ ^ ((__y & 0x01) ? __a : 0));
+ _M_p = 0;
+ }
+
+ // Calculate o(x(i)).
+ result_type __z = _M_x[_M_p++];
+ __z ^= (__z >> __u);
+ __z ^= (__z << __s) & __b;
+ __z ^= (__z << __t) & __c;
+ __z ^= (__z >> __l);
+
+ return __z;
+ }
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __n - 1; ++__i)
+ __os << __x._M_x[__i] << __space;
+ __os << __x._M_x[__n - 1];
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ for (int __i = 0; __i < __n; ++__i)
+ __is >> __x._M_x[__i];
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _IntType, _IntType __m, int __s, int __r>
+ void
+ subtract_with_carry<_IntType, __m, __s, __r>::
+ seed(unsigned long __value)
+ {
+ if (__value == 0)
+ __value = 19780503;
+
+ std::_GLIBCXX_TR1 linear_congruential<unsigned long, 40014, 0, 2147483563>
+ __lcg(__value);
+
+ for (int __i = 0; __i < long_lag; ++__i)
+ _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__lcg());
+
+ _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
+ _M_p = 0;
+ }
+
+ template<typename _IntType, _IntType __m, int __s, int __r>
+ template<class _Gen>
+ void
+ subtract_with_carry<_IntType, __m, __s, __r>::
+ seed(_Gen& __gen, false_type)
+ {
+ const int __n = (std::numeric_limits<_UIntType>::digits + 31) / 32;
+
+ for (int __i = 0; __i < long_lag; ++__i)
+ {
+ _UIntType __tmp = 0;
+ _UIntType __factor = 1;
+ for (int __j = 0; __j < __n; ++__j)
+ {
+ __tmp += __detail::__mod<__detail::_UInt32Type, 1, 0, 0>
+ (__gen()) * __factor;
+ __factor *= __detail::_Shift<_UIntType, 32>::__value;
+ }
+ _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__tmp);
+ }
+ _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
+ _M_p = 0;
+ }
+
+ template<typename _IntType, _IntType __m, int __s, int __r>
+ typename subtract_with_carry<_IntType, __m, __s, __r>::result_type
+ subtract_with_carry<_IntType, __m, __s, __r>::
+ operator()()
+ {
+ // Derive short lag index from current index.
+ int __ps = _M_p - short_lag;
+ if (__ps < 0)
+ __ps += long_lag;
+
+ // Calculate new x(i) without overflow or division.
+ // NB: Thanks to the requirements for _IntType, _M_x[_M_p] + _M_carry
+ // cannot overflow.
+ _UIntType __xi;
+ if (_M_x[__ps] >= _M_x[_M_p] + _M_carry)
+ {
+ __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;
+ _M_carry = 0;
+ }
+ else
+ {
+ __xi = modulus - _M_x[_M_p] - _M_carry + _M_x[__ps];
+ _M_carry = 1;
+ }
+ _M_x[_M_p] = __xi;
+
+ // Adjust current index to loop around in ring buffer.
+ if (++_M_p >= long_lag)
+ _M_p = 0;
+
+ return __xi;
+ }
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry<_IntType, __m, __s, __r>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __r; ++__i)
+ __os << __x._M_x[__i] << __space;
+ __os << __x._M_carry;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry<_IntType, __m, __s, __r>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ for (int __i = 0; __i < __r; ++__i)
+ __is >> __x._M_x[__i];
+ __is >> __x._M_carry;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _RealType, int __w, int __s, int __r>
+ void
+ subtract_with_carry_01<_RealType, __w, __s, __r>::
+ _M_initialize_npows()
+ {
+ for (int __j = 0; __j < __n; ++__j)
+#if _GLIBCXX_USE_C99_MATH_TR1
+ _M_npows[__j] = std::_GLIBCXX_TR1 ldexp(_RealType(1), -__w + __j * 32);
+#else
+ _M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32);
+#endif
+ }
+
+ template<typename _RealType, int __w, int __s, int __r>
+ void
+ subtract_with_carry_01<_RealType, __w, __s, __r>::
+ seed(unsigned long __value)
+ {
+ if (__value == 0)
+ __value = 19780503;
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 512. Seeding subtract_with_carry_01 from a single unsigned long.
+ std::_GLIBCXX_TR1 linear_congruential<unsigned long, 40014, 0, 2147483563>
+ __lcg(__value);
+
+ this->seed(__lcg);
+ }
+
+ template<typename _RealType, int __w, int __s, int __r>
+ template<class _Gen>
+ void
+ subtract_with_carry_01<_RealType, __w, __s, __r>::
+ seed(_Gen& __gen, false_type)
+ {
+ for (int __i = 0; __i < long_lag; ++__i)
+ {
+ for (int __j = 0; __j < __n - 1; ++__j)
+ _M_x[__i][__j] = __detail::__mod<_UInt32Type, 1, 0, 0>(__gen());
+ _M_x[__i][__n - 1] = __detail::__mod<_UInt32Type, 1, 0,
+ __detail::_Shift<_UInt32Type, __w % 32>::__value>(__gen());
+ }
+
+ _M_carry = 1;
+ for (int __j = 0; __j < __n; ++__j)
+ if (_M_x[long_lag - 1][__j] != 0)
+ {
+ _M_carry = 0;
+ break;
+ }
+
+ _M_p = 0;
+ }
+
+ template<typename _RealType, int __w, int __s, int __r>
+ typename subtract_with_carry_01<_RealType, __w, __s, __r>::result_type
+ subtract_with_carry_01<_RealType, __w, __s, __r>::
+ operator()()
+ {
+ // Derive short lag index from current index.
+ int __ps = _M_p - short_lag;
+ if (__ps < 0)
+ __ps += long_lag;
+
+ _UInt32Type __new_carry;
+ for (int __j = 0; __j < __n - 1; ++__j)
+ {
+ if (_M_x[__ps][__j] > _M_x[_M_p][__j]
+ || (_M_x[__ps][__j] == _M_x[_M_p][__j] && _M_carry == 0))
+ __new_carry = 0;
+ else
+ __new_carry = 1;
+
+ _M_x[_M_p][__j] = _M_x[__ps][__j] - _M_x[_M_p][__j] - _M_carry;
+ _M_carry = __new_carry;
+ }
+
+ if (_M_x[__ps][__n - 1] > _M_x[_M_p][__n - 1]
+ || (_M_x[__ps][__n - 1] == _M_x[_M_p][__n - 1] && _M_carry == 0))
+ __new_carry = 0;
+ else
+ __new_carry = 1;
+
+ _M_x[_M_p][__n - 1] = __detail::__mod<_UInt32Type, 1, 0,
+ __detail::_Shift<_UInt32Type, __w % 32>::__value>
+ (_M_x[__ps][__n - 1] - _M_x[_M_p][__n - 1] - _M_carry);
+ _M_carry = __new_carry;
+
+ result_type __ret = 0.0;
+ for (int __j = 0; __j < __n; ++__j)
+ __ret += _M_x[_M_p][__j] * _M_npows[__j];
+
+ // Adjust current index to loop around in ring buffer.
+ if (++_M_p >= long_lag)
+ _M_p = 0;
+
+ return __ret;
+ }
+
+ template<typename _RealType, int __w, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry_01<_RealType, __w, __s, __r>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __r; ++__i)
+ for (int __j = 0; __j < __x.__n; ++__j)
+ __os << __x._M_x[__i][__j] << __space;
+ __os << __x._M_carry;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _RealType, int __w, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry_01<_RealType, __w, __s, __r>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ for (int __i = 0; __i < __r; ++__i)
+ for (int __j = 0; __j < __x.__n; ++__j)
+ __is >> __x._M_x[__i][__j];
+ __is >> __x._M_carry;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r>
+ typename discard_block<_UniformRandomNumberGenerator,
+ __p, __r>::result_type
+ discard_block<_UniformRandomNumberGenerator, __p, __r>::
+ operator()()
+ {
+ if (_M_n >= used_block)
+ {
+ while (_M_n < block_size)
+ {
+ _M_b();
+ ++_M_n;
+ }
+ _M_n = 0;
+ }
+ ++_M_n;
+ return _M_b();
+ }
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const discard_block<_UniformRandomNumberGenerator,
+ __p, __r>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::dec | __ios_base::fixed
+ | __ios_base::left);
+ __os.fill(__space);
+
+ __os << __x._M_b << __space << __x._M_n;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ discard_block<_UniformRandomNumberGenerator, __p, __r>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ __is >> __x._M_b >> __x._M_n;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2>
+ void
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>::
+ _M_initialize_max()
+ {
+ const int __w = std::numeric_limits<result_type>::digits;
+
+ const result_type __m1 =
+ std::min(result_type(_M_b1.max() - _M_b1.min()),
+ __detail::_Shift<result_type, __w - __s1>::__value - 1);
+
+ const result_type __m2 =
+ std::min(result_type(_M_b2.max() - _M_b2.min()),
+ __detail::_Shift<result_type, __w - __s2>::__value - 1);
+
+ // NB: In TR1 s1 is not required to be >= s2.
+ if (__s1 < __s2)
+ _M_max = _M_initialize_max_aux(__m2, __m1, __s2 - __s1) << __s1;
+ else
+ _M_max = _M_initialize_max_aux(__m1, __m2, __s1 - __s2) << __s2;
+ }
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2>
+ typename xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>::result_type
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>::
+ _M_initialize_max_aux(result_type __a, result_type __b, int __d)
+ {
+ const result_type __two2d = result_type(1) << __d;
+ const result_type __c = __a * __two2d;
+
+ if (__a == 0 || __b < __two2d)
+ return __c + __b;
+
+ const result_type __t = std::max(__c, __b);
+ const result_type __u = std::min(__c, __b);
+
+ result_type __ub = __u;
+ result_type __p;
+ for (__p = 0; __ub != 1; __ub >>= 1)
+ ++__p;
+
+ const result_type __two2p = result_type(1) << __p;
+ const result_type __k = __t / __two2p;
+
+ if (__k & 1)
+ return (__k + 1) * __two2p - 1;
+
+ if (__c >= __b)
+ return (__k + 1) * __two2p + _M_initialize_max_aux((__t % __two2p)
+ / __two2d,
+ __u % __two2p, __d);
+ else
+ return (__k + 1) * __two2p + _M_initialize_max_aux((__u % __two2p)
+ / __two2d,
+ __t % __two2p, __d);
+ }
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
+ __os.fill(__space);
+
+ __os << __x.base1() << __space << __x.base2();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::skipws);
+
+ __is >> __x._M_b1 >> __x._M_b2;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _IntType>
+ template<typename _UniformRandomNumberGenerator>
+ typename uniform_int<_IntType>::result_type
+ uniform_int<_IntType>::
+ _M_call(_UniformRandomNumberGenerator& __urng,
+ result_type __min, result_type __max, true_type)
+ {
+ // XXX Must be fixed to work well for *arbitrary* __urng.max(),
+ // __urng.min(), __max, __min. Currently works fine only in the
+ // most common case __urng.max() - __urng.min() >= __max - __min,
+ // with __urng.max() > __urng.min() >= 0.
+ typedef typename __gnu_cxx::__add_unsigned<typename
+ _UniformRandomNumberGenerator::result_type>::__type __urntype;
+ typedef typename __gnu_cxx::__add_unsigned<result_type>::__type
+ __utype;
+ typedef typename __gnu_cxx::__conditional_type<(sizeof(__urntype)
+ > sizeof(__utype)),
+ __urntype, __utype>::__type __uctype;
+
+ result_type __ret;
+
+ const __urntype __urnmin = __urng.min();
+ const __urntype __urnmax = __urng.max();
+ const __urntype __urnrange = __urnmax - __urnmin;
+ const __uctype __urange = __max - __min;
+ const __uctype __udenom = (__urnrange <= __urange
+ ? 1 : __urnrange / (__urange + 1));
+ do
+ __ret = (__urntype(__urng()) - __urnmin) / __udenom;
+ while (__ret > __max - __min);
+
+ return __ret + __min;
+ }
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_int<_IntType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__space);
+
+ __os << __x.min() << __space << __x.max();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ __is >> __x._M_min >> __x._M_max;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bernoulli_distribution& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(__gnu_cxx::__numeric_traits<double>::__max_digits10);
+
+ __os << __x.p();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ template<typename _IntType, typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename geometric_distribution<_IntType, _RealType>::result_type
+ geometric_distribution<_IntType, _RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ // About the epsilon thing see this thread:
+ // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html
+ const _RealType __naf =
+ (1 - std::numeric_limits<_RealType>::epsilon()) / 2;
+ // The largest _RealType convertible to _IntType.
+ const _RealType __thr =
+ std::numeric_limits<_IntType>::max() + __naf;
+
+ _RealType __cand;
+ do
+ __cand = std::ceil(std::log(__urng()) / _M_log_p);
+ while (__cand >= __thr);
+
+ return result_type(__cand + __naf);
+ }
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const geometric_distribution<_IntType, _RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x.p();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ template<typename _IntType, typename _RealType>
+ void
+ poisson_distribution<_IntType, _RealType>::
+ _M_initialize()
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ if (_M_mean >= 12)
+ {
+ const _RealType __m = std::floor(_M_mean);
+ _M_lm_thr = std::log(_M_mean);
+ _M_lfm = std::_GLIBCXX_TR1 lgamma(__m + 1);
+ _M_sm = std::sqrt(__m);
+
+ const _RealType __pi_4 = 0.7853981633974483096156608458198757L;
+ const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m
+ / __pi_4));
+ _M_d = std::_GLIBCXX_TR1 round(std::max(_RealType(6),
+ std::min(__m, __dx)));
+ const _RealType __cx = 2 * __m + _M_d;
+ _M_scx = std::sqrt(__cx / 2);
+ _M_1cx = 1 / __cx;
+
+ _M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx);
+ _M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2)) / _M_d;
+ }
+ else
+#endif
+ _M_lm_thr = std::exp(-_M_mean);
+ }
+
+ /**
+ * A rejection algorithm when mean >= 12 and a simple method based
+ * upon the multiplication of uniform random variates otherwise.
+ * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
+ * is defined.
+ *
+ * Reference:
+ * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+ * New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!).
+ */
+ template<typename _IntType, typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename poisson_distribution<_IntType, _RealType>::result_type
+ poisson_distribution<_IntType, _RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+#if _GLIBCXX_USE_C99_MATH_TR1
+ if (_M_mean >= 12)
+ {
+ _RealType __x;
+
+ // See comments above...
+ const _RealType __naf =
+ (1 - std::numeric_limits<_RealType>::epsilon()) / 2;
+ const _RealType __thr =
+ std::numeric_limits<_IntType>::max() + __naf;
+
+ const _RealType __m = std::floor(_M_mean);
+ // sqrt(pi / 2)
+ const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
+ const _RealType __c1 = _M_sm * __spi_2;
+ const _RealType __c2 = _M_c2b + __c1;
+ const _RealType __c3 = __c2 + 1;
+ const _RealType __c4 = __c3 + 1;
+ // e^(1 / 78)
+ const _RealType __e178 = 1.0129030479320018583185514777512983L;
+ const _RealType __c5 = __c4 + __e178;
+ const _RealType __c = _M_cb + __c5;
+ const _RealType __2cx = 2 * (2 * __m + _M_d);
+
+ bool __reject = true;
+ do
+ {
+ const _RealType __u = __c * __urng();
+ const _RealType __e = -std::log(__urng());
+
+ _RealType __w = 0.0;
+
+ if (__u <= __c1)
+ {
+ const _RealType __n = _M_nd(__urng);
+ const _RealType __y = -std::abs(__n) * _M_sm - 1;
+ __x = std::floor(__y);
+ __w = -__n * __n / 2;
+ if (__x < -__m)
+ continue;
+ }
+ else if (__u <= __c2)
+ {
+ const _RealType __n = _M_nd(__urng);
+ const _RealType __y = 1 + std::abs(__n) * _M_scx;
+ __x = std::ceil(__y);
+ __w = __y * (2 - __y) * _M_1cx;
+ if (__x > _M_d)
+ continue;
+ }
+ else if (__u <= __c3)
+ // NB: This case not in the book, nor in the Errata,
+ // but should be ok...
+ __x = -1;
+ else if (__u <= __c4)
+ __x = 0;
+ else if (__u <= __c5)
+ __x = 1;
+ else
+ {
+ const _RealType __v = -std::log(__urng());
+ const _RealType __y = _M_d + __v * __2cx / _M_d;
+ __x = std::ceil(__y);
+ __w = -_M_d * _M_1cx * (1 + __y / 2);
+ }
+
+ __reject = (__w - __e - __x * _M_lm_thr
+ > _M_lfm - std::_GLIBCXX_TR1 lgamma(__x + __m + 1));
+
+ __reject |= __x + __m >= __thr;
+
+ } while (__reject);
+
+ return result_type(__x + __m + __naf);
+ }
+ else
+#endif
+ {
+ _IntType __x = 0;
+ _RealType __prod = 1.0;
+
+ do
+ {
+ __prod *= __urng();
+ __x += 1;
+ }
+ while (__prod > _M_lm_thr);
+
+ return __x - 1;
+ }
+ }
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const poisson_distribution<_IntType, _RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__space);
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x.mean() << __space << __x._M_nd;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ poisson_distribution<_IntType, _RealType>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::skipws);
+
+ __is >> __x._M_mean >> __x._M_nd;
+ __x._M_initialize();
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _IntType, typename _RealType>
+ void
+ binomial_distribution<_IntType, _RealType>::
+ _M_initialize()
+ {
+ const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
+
+ _M_easy = true;
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+ if (_M_t * __p12 >= 8)
+ {
+ _M_easy = false;
+ const _RealType __np = std::floor(_M_t * __p12);
+ const _RealType __pa = __np / _M_t;
+ const _RealType __1p = 1 - __pa;
+
+ const _RealType __pi_4 = 0.7853981633974483096156608458198757L;
+ const _RealType __d1x =
+ std::sqrt(__np * __1p * std::log(32 * __np
+ / (81 * __pi_4 * __1p)));
+ _M_d1 = std::_GLIBCXX_TR1 round(std::max(_RealType(1), __d1x));
+ const _RealType __d2x =
+ std::sqrt(__np * __1p * std::log(32 * _M_t * __1p
+ / (__pi_4 * __pa)));
+ _M_d2 = std::_GLIBCXX_TR1 round(std::max(_RealType(1), __d2x));
+
+ // sqrt(pi / 2)
+ const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
+ _M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));
+ _M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p));
+ _M_c = 2 * _M_d1 / __np;
+ _M_a1 = std::exp(_M_c) * _M_s1 * __spi_2;
+ const _RealType __a12 = _M_a1 + _M_s2 * __spi_2;
+ const _RealType __s1s = _M_s1 * _M_s1;
+ _M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p))
+ * 2 * __s1s / _M_d1
+ * std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));
+ const _RealType __s2s = _M_s2 * _M_s2;
+ _M_s = (_M_a123 + 2 * __s2s / _M_d2
+ * std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
+ _M_lf = (std::_GLIBCXX_TR1 lgamma(__np + 1)
+ + std::_GLIBCXX_TR1 lgamma(_M_t - __np + 1));
+ _M_lp1p = std::log(__pa / __1p);
+
+ _M_q = -std::log(1 - (__p12 - __pa) / __1p);
+ }
+ else
+#endif
+ _M_q = -std::log(1 - __p12);
+ }
+
+ template<typename _IntType, typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename binomial_distribution<_IntType, _RealType>::result_type
+ binomial_distribution<_IntType, _RealType>::
+ _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)
+ {
+ _IntType __x = 0;
+ _RealType __sum = 0;
+
+ do
+ {
+ const _RealType __e = -std::log(__urng());
+ __sum += __e / (__t - __x);
+ __x += 1;
+ }
+ while (__sum <= _M_q);
+
+ return __x - 1;
+ }
+
+ /**
+ * A rejection algorithm when t * p >= 8 and a simple waiting time
+ * method - the second in the referenced book - otherwise.
+ * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1
+ * is defined.
+ *
+ * Reference:
+ * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+ * New York, 1986, Ch. X, Sect. 4 (+ Errata!).
+ */
+ template<typename _IntType, typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename binomial_distribution<_IntType, _RealType>::result_type
+ binomial_distribution<_IntType, _RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ result_type __ret;
+ const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
+
+#if _GLIBCXX_USE_C99_MATH_TR1
+ if (!_M_easy)
+ {
+ _RealType __x;
+
+ // See comments above...
+ const _RealType __naf =
+ (1 - std::numeric_limits<_RealType>::epsilon()) / 2;
+ const _RealType __thr =
+ std::numeric_limits<_IntType>::max() + __naf;
+
+ const _RealType __np = std::floor(_M_t * __p12);
+ const _RealType __pa = __np / _M_t;
+
+ // sqrt(pi / 2)
+ const _RealType __spi_2 = 1.2533141373155002512078826424055226L;
+ const _RealType __a1 = _M_a1;
+ const _RealType __a12 = __a1 + _M_s2 * __spi_2;
+ const _RealType __a123 = _M_a123;
+ const _RealType __s1s = _M_s1 * _M_s1;
+ const _RealType __s2s = _M_s2 * _M_s2;
+
+ bool __reject;
+ do
+ {
+ const _RealType __u = _M_s * __urng();
+
+ _RealType __v;
+
+ if (__u <= __a1)
+ {
+ const _RealType __n = _M_nd(__urng);
+ const _RealType __y = _M_s1 * std::abs(__n);
+ __reject = __y >= _M_d1;
+ if (!__reject)
+ {
+ const _RealType __e = -std::log(__urng());
+ __x = std::floor(__y);
+ __v = -__e - __n * __n / 2 + _M_c;
+ }
+ }
+ else if (__u <= __a12)
+ {
+ const _RealType __n = _M_nd(__urng);
+ const _RealType __y = _M_s2 * std::abs(__n);
+ __reject = __y >= _M_d2;
+ if (!__reject)
+ {
+ const _RealType __e = -std::log(__urng());
+ __x = std::floor(-__y);
+ __v = -__e - __n * __n / 2;
+ }
+ }
+ else if (__u <= __a123)
+ {
+ const _RealType __e1 = -std::log(__urng());
+ const _RealType __e2 = -std::log(__urng());
+
+ const _RealType __y = _M_d1 + 2 * __s1s * __e1 / _M_d1;
+ __x = std::floor(__y);
+ __v = (-__e2 + _M_d1 * (1 / (_M_t - __np)
+ -__y / (2 * __s1s)));
+ __reject = false;
+ }
+ else
+ {
+ const _RealType __e1 = -std::log(__urng());
+ const _RealType __e2 = -std::log(__urng());
+
+ const _RealType __y = _M_d2 + 2 * __s2s * __e1 / _M_d2;
+ __x = std::floor(-__y);
+ __v = -__e2 - _M_d2 * __y / (2 * __s2s);
+ __reject = false;
+ }
+
+ __reject = __reject || __x < -__np || __x > _M_t - __np;
+ if (!__reject)
+ {
+ const _RealType __lfx =
+ std::_GLIBCXX_TR1 lgamma(__np + __x + 1)
+ + std::_GLIBCXX_TR1 lgamma(_M_t - (__np + __x) + 1);
+ __reject = __v > _M_lf - __lfx + __x * _M_lp1p;
+ }
+
+ __reject |= __x + __np >= __thr;
+ }
+ while (__reject);
+
+ __x += __np + __naf;
+
+ const _IntType __z = _M_waiting(__urng, _M_t - _IntType(__x));
+ __ret = _IntType(__x) + __z;
+ }
+ else
+#endif
+ __ret = _M_waiting(__urng, _M_t);
+
+ if (__p12 != _M_p)
+ __ret = _M_t - __ret;
+ return __ret;
+ }
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const binomial_distribution<_IntType, _RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__space);
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x.t() << __space << __x.p()
+ << __space << __x._M_nd;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ binomial_distribution<_IntType, _RealType>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ __is >> __x._M_t >> __x._M_p >> __x._M_nd;
+ __x._M_initialize();
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_real<_RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__space);
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x.min() << __space << __x.max();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_real<_RealType>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::skipws);
+
+ __is >> __x._M_min >> __x._M_max;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const exponential_distribution<_RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x.lambda();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ /**
+ * Polar method due to Marsaglia.
+ *
+ * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+ * New York, 1986, Ch. V, Sect. 4.4.
+ */
+ template<typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename normal_distribution<_RealType>::result_type
+ normal_distribution<_RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ result_type __ret;
+
+ if (_M_saved_available)
+ {
+ _M_saved_available = false;
+ __ret = _M_saved;
+ }
+ else
+ {
+ result_type __x, __y, __r2;
+ do
+ {
+ __x = result_type(2.0) * __urng() - 1.0;
+ __y = result_type(2.0) * __urng() - 1.0;
+ __r2 = __x * __x + __y * __y;
+ }
+ while (__r2 > 1.0 || __r2 == 0.0);
+
+ const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);
+ _M_saved = __x * __mult;
+ _M_saved_available = true;
+ __ret = __y * __mult;
+ }
+
+ __ret = __ret * _M_sigma + _M_mean;
+ return __ret;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__space);
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x._M_saved_available << __space
+ << __x.mean() << __space
+ << __x.sigma();
+ if (__x._M_saved_available)
+ __os << __space << __x._M_saved;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType>& __x)
+ {
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __is.flags();
+ __is.flags(__ios_base::dec | __ios_base::skipws);
+
+ __is >> __x._M_saved_available >> __x._M_mean
+ >> __x._M_sigma;
+ if (__x._M_saved_available)
+ __is >> __x._M_saved;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _RealType>
+ void
+ gamma_distribution<_RealType>::
+ _M_initialize()
+ {
+ if (_M_alpha >= 1)
+ _M_l_d = std::sqrt(2 * _M_alpha - 1);
+ else
+ _M_l_d = (std::pow(_M_alpha, _M_alpha / (1 - _M_alpha))
+ * (1 - _M_alpha));
+ }
+
+ /**
+ * Cheng's rejection algorithm GB for alpha >= 1 and a modification
+ * of Vaduva's rejection from Weibull algorithm due to Devroye for
+ * alpha < 1.
+ *
+ * References:
+ * Cheng, R. C. "The Generation of Gamma Random Variables with Non-integral
+ * Shape Parameter." Applied Statistics, 26, 71-75, 1977.
+ *
+ * Vaduva, I. "Computer Generation of Gamma Gandom Variables by Rejection
+ * and Composition Procedures." Math. Operationsforschung and Statistik,
+ * Series in Statistics, 8, 545-576, 1977.
+ *
+ * Devroye, L. "Non-Uniform Random Variates Generation." Springer-Verlag,
+ * New York, 1986, Ch. IX, Sect. 3.4 (+ Errata!).
+ */
+ template<typename _RealType>
+ template<class _UniformRandomNumberGenerator>
+ typename gamma_distribution<_RealType>::result_type
+ gamma_distribution<_RealType>::
+ operator()(_UniformRandomNumberGenerator& __urng)
+ {
+ result_type __x;
+
+ bool __reject;
+ if (_M_alpha >= 1)
+ {
+ // alpha - log(4)
+ const result_type __b = _M_alpha
+ - result_type(1.3862943611198906188344642429163531L);
+ const result_type __c = _M_alpha + _M_l_d;
+ const result_type __1l = 1 / _M_l_d;
+
+ // 1 + log(9 / 2)
+ const result_type __k = 2.5040773967762740733732583523868748L;
+
+ do
+ {
+ const result_type __u = __urng();
+ const result_type __v = __urng();
+
+ const result_type __y = __1l * std::log(__v / (1 - __v));
+ __x = _M_alpha * std::exp(__y);
+
+ const result_type __z = __u * __v * __v;
+ const result_type __r = __b + __c * __y - __x;
+
+ __reject = __r < result_type(4.5) * __z - __k;
+ if (__reject)
+ __reject = __r < std::log(__z);
+ }
+ while (__reject);
+ }
+ else
+ {
+ const result_type __c = 1 / _M_alpha;
+
+ do
+ {
+ const result_type __z = -std::log(__urng());
+ const result_type __e = -std::log(__urng());
+
+ __x = std::pow(__z, __c);
+
+ __reject = __z + __e < _M_l_d + __x;
+ }
+ while (__reject);
+ }
+
+ return __x;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const gamma_distribution<_RealType>& __x)
+ {
+ typedef std::basic_ostream<_CharT, _Traits> __ostream_type;
+ typedef typename __ostream_type::ios_base __ios_base;
+
+ const typename __ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(__ios_base::scientific | __ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);
+
+ __os << __x.alpha();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/regex b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/regex
new file mode 100644
index 000000000..9352bc137
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/regex
@@ -0,0 +1,2708 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file tr1_impl/regex
+ * @brief The common implementation file for tr1 and std regular expressions.
+ *
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+/**
+ * @defgroup tr1_regex Regular Expressions
+ * A facility for performing regular expression pattern matching.
+ */
+ //@{
+
+/** @namespace std::regex_constants
+ * @brief ISO C++ 0x entities sub namespace for regex.
+ */
+namespace regex_constants
+{
+ /**
+ * @name 5.1 Regular Expression Syntax Options
+ */
+ //@{
+ enum __syntax_option
+ {
+ _S_icase,
+ _S_nosubs,
+ _S_optimize,
+ _S_collate,
+ _S_ECMAScript,
+ _S_basic,
+ _S_extended,
+ _S_awk,
+ _S_grep,
+ _S_egrep,
+ _S_syntax_last
+ };
+
+ /**
+ * @brief This is a bitmask type indicating how to interpret the regex.
+ *
+ * The @c syntax_option_type is implementation defined but it is valid to
+ * perform bitwise operations on these values and expect the right thing to
+ * happen.
+ *
+ * A valid value of type syntax_option_type shall have exactly one of the
+ * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
+ * %set.
+ */
+ typedef unsigned int syntax_option_type;
+
+ /**
+ * Specifies that the matching of regular expressions against a character
+ * sequence shall be performed without regard to case.
+ */
+ static const syntax_option_type icase = 1 << _S_icase;
+
+ /**
+ * Specifies that when a regular expression is matched against a character
+ * container sequence, no sub-expression matches are to be stored in the
+ * supplied match_results structure.
+ */
+ static const syntax_option_type nosubs = 1 << _S_nosubs;
+
+ /**
+ * Specifies that the regular expression engine should pay more attention to
+ * the speed with which regular expressions are matched, and less to the
+ * speed with which regular expression objects are constructed. Otherwise
+ * it has no detectable effect on the program output.
+ */
+ static const syntax_option_type optimize = 1 << _S_optimize;
+
+ /**
+ * Specifies that character ranges of the form [a-b] should be locale
+ * sensitive.
+ */
+ static const syntax_option_type collate = 1 << _S_collate;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
+ * Language Specification, Standard Ecma-262, third edition, 1999], as
+ * modified in tr1 section [7.13]. This grammar is similar to that defined
+ * in the PERL scripting language but extended with elements found in the
+ * POSIX regular expression grammar.
+ */
+ static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
+ * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ static const syntax_option_type basic = 1 << _S_basic;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and Headers,
+ * Section 9, Regular Expressions.
+ */
+ static const syntax_option_type extended = 1 << _S_extended;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type extended, except that C-style escape
+ * sequences are supported. These sequences are, explicitly, "\\", "\a",
+ * "\b", "\f", "\n", "\r", "\t" , "\v", "\"", "'",
+ * and "\ddd" (where ddd is one, two, or three octal digits).
+ */
+ static const syntax_option_type awk = 1 << _S_awk;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type basic, except that newlines are treated
+ * as whitespace.
+ */
+ static const syntax_option_type grep = 1 << _S_grep;
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep when given the -E option in
+ * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
+ * extended, except that newlines are treated as whitespace.
+ */
+ static const syntax_option_type egrep = 1 << _S_egrep;
+
+ //@}
+
+ /**
+ * @name 5.2 Matching Rules
+ *
+ * Matching a regular expression against a sequence of characters [first,
+ * last) proceeds according to the rules of the grammar specified for the
+ * regular expression object, modified according to the effects listed
+ * below for any bitmask elements set.
+ *
+ */
+ //@{
+
+ enum __match_flag
+ {
+ _S_not_bol,
+ _S_not_eol,
+ _S_not_bow,
+ _S_not_eow,
+ _S_any,
+ _S_not_null,
+ _S_continuous,
+ _S_prev_avail,
+ _S_sed,
+ _S_no_copy,
+ _S_first_only,
+ _S_match_flag_last
+ };
+
+ /**
+ * @brief This is a bitmask type indicating regex matching rules.
+ *
+ * The @c match_flag_type is implementation defined but it is valid to
+ * perform bitwise operations on these values and expect the right thing to
+ * happen.
+ */
+ typedef std::bitset<_S_match_flag_last> match_flag_type;
+
+ /**
+ * The default matching rules.
+ */
+ static const match_flag_type match_default = 0;
+
+ /**
+ * The first character in the sequence [first, last) is treated as though it
+ * is not at the beginning of a line, so the character "^" in the regular
+ * expression shall not match [first, first).
+ */
+ static const match_flag_type match_not_bol = 1 << _S_not_bol;
+
+ /**
+ * The last character in the sequence [first, last) is treated as though it
+ * is not at the end of a line, so the character "$" in the regular
+ * expression shall not match [last, last).
+ */
+ static const match_flag_type match_not_eol = 1 << _S_not_eol;
+
+ /**
+ * The expression "\b" is not matched against the sub-sequence
+ * [first,first).
+ */
+ static const match_flag_type match_not_bow = 1 << _S_not_bow;
+
+ /**
+ * The expression "\b" should not be matched against the sub-sequence
+ * [last,last).
+ */
+ static const match_flag_type match_not_eow = 1 << _S_not_eow;
+
+ /**
+ * If more than one match is possible then any match is an acceptable
+ * result.
+ */
+ static const match_flag_type match_any = 1 << _S_any;
+
+ /**
+ * The expression does not match an empty sequence.
+ */
+ static const match_flag_type match_not_null = 1 << _S_not_null;
+
+ /**
+ * The expression only matches a sub-sequence that begins at first .
+ */
+ static const match_flag_type match_continuous = 1 << _S_continuous;
+
+ /**
+ * --first is a valid iterator position. When this flag is set then the
+ * flags match_not_bol and match_not_bow are ignored by the regular
+ * expression algorithms 7.11 and iterators 7.12.
+ */
+ static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the ECMAScript replace
+ * function in ECMA- 262 [Ecma International, ECMAScript Language
+ * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
+ * String.prototype.replace. In addition, during search and replace
+ * operations all non-overlapping occurrences of the regular expression
+ * are located and replaced, and sections of the input that did not match
+ * the expression are copied unchanged to the output string.
+ *
+ * Format strings (from ECMA-262 [15.5.4.11]):
+ * @li $$ The dollar-sign itself ($)
+ * @li $& The matched substring.
+ * @li $` The portion of <em>string</em> that precedes the matched substring.
+ * This would be match_results::prefix().
+ * @li $' The portion of <em>string</em> that follows the matched substring.
+ * This would be match_results::suffix().
+ * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
+ * decimal digit. If n <= match_results::size() and the nth capture
+ * is undefined, use the empty string instead. If n >
+ * match_results::size(), the result is implementation-defined.
+ * @li $nn The nnth capture, where nn is a two-digit decimal number on
+ * [01, 99]. If nn <= match_results::size() and the nth capture is
+ * undefined, use the empty string instead. If
+ * nn > match_results::size(), the result is implementation-defined.
+ */
+ static const match_flag_type format_default = 0;
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the POSIX sed utility
+ * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
+ * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ static const match_flag_type format_sed = 1 << _S_sed;
+
+ /**
+ * During a search and replace operation, sections of the character
+ * container sequence being searched that do not match the regular
+ * expression shall not be copied to the output string.
+ */
+ static const match_flag_type format_no_copy = 1 << _S_no_copy;
+
+ /**
+ * When specified during a search and replace operation, only the first
+ * occurrence of the regular expression shall be replaced.
+ */
+ static const match_flag_type format_first_only = 1 << _S_first_only;
+
+ //@}
+
+ /**
+ * @name 5.3 Error Types
+ */
+ //@{
+
+ enum error_type
+ {
+ _S_error_collate,
+ _S_error_ctype,
+ _S_error_escape,
+ _S_error_backref,
+ _S_error_brack,
+ _S_error_paren,
+ _S_error_brace,
+ _S_error_badbrace,
+ _S_error_range,
+ _S_error_space,
+ _S_error_badrepeat,
+ _S_error_complexity,
+ _S_error_stack,
+ _S_error_last
+ };
+
+ /** The expression contained an invalid collating element name. */
+ static const error_type error_collate(_S_error_collate);
+
+ /** The expression contained an invalid character class name. */
+ static const error_type error_ctype(_S_error_ctype);
+
+ /**
+ * The expression contained an invalid escaped character, or a trailing
+ * escape.
+ */
+ static const error_type error_escape(_S_error_escape);
+
+ /** The expression contained an invalid back reference. */
+ static const error_type error_backref(_S_error_backref);
+
+ /** The expression contained mismatched [ and ]. */
+ static const error_type error_brack(_S_error_brack);
+
+ /** The expression contained mismatched ( and ). */
+ static const error_type error_paren(_S_error_paren);
+
+ /** The expression contained mismatched { and } */
+ static const error_type error_brace(_S_error_brace);
+
+ /** The expression contained an invalid range in a {} expression. */
+ static const error_type error_badbrace(_S_error_badbrace);
+
+ /**
+ * The expression contained an invalid character range,
+ * such as [b-a] in most encodings.
+ */
+ static const error_type error_range(_S_error_range);
+
+ /**
+ * There was insufficient memory to convert the expression into a
+ * finite state machine.
+ */
+ static const error_type error_space(_S_error_space);
+
+ /**
+ * One of "*?+{" was not preceded by a valid regular expression.
+ */
+ static const error_type error_badrepeat(_S_error_badrepeat);
+
+ /**
+ * The complexity of an attempted match against a regular expression
+ * exceeded a pre-set level.
+ */
+ static const error_type error_complexity(_S_error_complexity);
+
+ /**
+ * There was insufficient memory to determine whether the
+ * regular expression could match the specified character sequence.
+ */
+ static const error_type error_stack(_S_error_stack);
+
+ //@}
+}
+
+
+ // [7.8] Class regex_error
+ /**
+ * @brief A regular expression exception class.
+ * @ingroup exceptions
+ *
+ * The regular expression library throws objects of this class on error.
+ */
+ class regex_error
+ : public std::runtime_error
+ {
+ public:
+ /**
+ * @brief Constructs a regex_error object.
+ *
+ * @param ecode the regex error code.
+ */
+ explicit
+ regex_error(regex_constants::error_type __ecode)
+ : std::runtime_error("regex_error"), _M_code(__ecode)
+ { }
+
+ /**
+ * @brief Gets the regex error code.
+ *
+ * @returns the regex error code.
+ */
+ regex_constants::error_type
+ code() const
+ { return _M_code; }
+
+ protected:
+ regex_constants::error_type _M_code;
+ };
+
+ // [7.7] Class regex_traits
+ /**
+ * @brief Describes aspects of a regular expression.
+ *
+ * A regular expression traits class that satisfies the requirements of tr1
+ * section [7.2].
+ *
+ * The class %regex is parameterized around a set of related types and
+ * functions used to complete the definition of its semantics. This class
+ * satisfies the requirements of such a traits class.
+ */
+ template<typename _Ch_type>
+ struct regex_traits
+ {
+ public:
+ typedef _Ch_type char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::locale locale_type;
+ typedef std::ctype_base::mask char_class_type;
+
+ public:
+ /**
+ * @brief Constructs a default traits object.
+ */
+ regex_traits()
+ { }
+
+ /**
+ * @brief Gives the length of a C-style string starting at @p __p.
+ *
+ * @param __p a pointer to the start of a character sequence.
+ *
+ * @returns the number of characters between @p *__p and the first
+ * default-initialized value of type @p char_type. In other words, uses
+ * the C-string algorithm for determining the length of a sequence of
+ * characters.
+ */
+ static std::size_t
+ length(const char_type* __p)
+ { return string_type::traits_type::length(__p); }
+
+ /**
+ * @brief Performs the identity translation.
+ *
+ * @param c A character to the locale-specific character set.
+ *
+ * @returns c.
+ */
+ char_type
+ translate(char_type __c) const
+ { return __c; }
+
+ /**
+ * @brief Translates a character into a case-insensitive equivalent.
+ *
+ * @param c A character to the locale-specific character set.
+ *
+ * @returns the locale-specific lower-case equivalent of c.
+ * @throws std::bad_cast if the imbued locale does not support the ctype
+ * facet.
+ */
+ char_type
+ translate_nocase(char_type __c) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
+ }
+
+ /**
+ * @brief Gets a sort key for a character sequence.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * Returns a sort key for the character sequence designated by the
+ * iterator range [F1, F2) such that if the character sequence [G1, G2)
+ * sorts before the character sequence [H1, H2) then
+ * v.transform(G1, G2) < v.transform(H1, H2).
+ *
+ * What this really does is provide a more efficient way to compare a
+ * string to multiple other strings in locales with fancy collation
+ * rules and equivalence classes.
+ *
+ * @returns a locale-specific sort key equivalent to the input range.
+ *
+ * @throws std::bad_cast if the current locale does not have a collate
+ * facet.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ transform(_Fwd_iter __first, _Fwd_iter __last) const
+ {
+ using std::collate;
+ using std::use_facet;
+ const collate<_Ch_type>& __c(use_facet<
+ collate<_Ch_type> >(_M_locale));
+ string_type __s(__first, __last);
+ return __c.transform(__s.data(), __s.data() + __s.size());
+ }
+
+ /**
+ * @brief Dunno.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * Effects: if typeid(use_facet<collate<_Ch_type> >) ==
+ * typeid(collate_byname<_Ch_type>) and the form of the sort key
+ * returned by collate_byname<_Ch_type>::transform(first, last) is known
+ * and can be converted into a primary sort key then returns that key,
+ * otherwise returns an empty string. WTF??
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ transform_primary(_Fwd_iter __first, _Fwd_iter __last) const;
+
+ /**
+ * @brief Gets a collation element by name.
+ *
+ * @param first beginning of the collation element name.
+ * @param last one-past-the-end of the collation element name.
+ *
+ * @returns a sequence of one or more characters that represents the
+ * collating element consisting of the character sequence designated by
+ * the iterator range [first, last). Returns an empty string if the
+ * character sequence is not a valid collating element.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ string_type
+ lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const;
+
+ /**
+ * @brief Maps one or more characters to a named character
+ * classification.
+ *
+ * @param first beginning of the character sequence.
+ * @param last one-past-the-end of the character sequence.
+ *
+ * @returns an unspecified value that represents the character
+ * classification named by the character sequence designated by the
+ * iterator range [first, last). The value returned shall be independent
+ * of the case of the characters in the character sequence. If the name
+ * is not recognized then returns a value that compares equal to 0.
+ *
+ * At least the following names (or their wide-character equivalent) are
+ * supported.
+ * - d
+ * - w
+ * - s
+ * - alnum
+ * - alpha
+ * - blank
+ * - cntrl
+ * - digit
+ * - graph
+ * - lower
+ * - print
+ * - punct
+ * - space
+ * - upper
+ * - xdigit
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Fwd_iter>
+ char_class_type
+ lookup_classname(_Fwd_iter __first, _Fwd_iter __last) const;
+
+ /**
+ * @brief Determines if @p c is a member of an identified class.
+ *
+ * @param c a character.
+ * @param f a class type (as returned from lookup_classname).
+ *
+ * @returns true if the character @p c is a member of the classification
+ * represented by @p f, false otherwise.
+ *
+ * @throws std::bad_cast if the current locale does not have a ctype
+ * facet.
+ */
+ bool
+ isctype(_Ch_type __c, char_class_type __f) const;
+
+ /**
+ * @brief Converts a digit to an int.
+ *
+ * @param ch a character representing a digit.
+ * @param radix the radix if the numeric conversion (limited to 8, 10,
+ * or 16).
+ *
+ * @returns the value represented by the digit ch in base radix if the
+ * character ch is a valid digit in base radix; otherwise returns -1.
+ */
+ int
+ value(_Ch_type __ch, int __radix) const;
+
+ /**
+ * @brief Imbues the regex_traits object with a copy of a new locale.
+ *
+ * @param loc A locale.
+ *
+ * @returns a copy of the previous locale in use by the regex_traits
+ * object.
+ *
+ * @note Calling imbue with a different locale than the one currently in
+ * use invalidates all cached data held by *this.
+ */
+ locale_type
+ imbue(locale_type __loc)
+ {
+ std::swap(_M_locale, __loc);
+ return __loc;
+ }
+
+ /**
+ * @brief Gets a copy of the current locale in use by the regex_traits
+ * object.
+ */
+ locale_type
+ getloc() const
+ { return _M_locale; }
+
+ protected:
+ locale_type _M_locale;
+ };
+
+ template<typename _Ch_type>
+ bool regex_traits<_Ch_type>::
+ isctype(_Ch_type __c, char_class_type __f) const
+ {
+ using std::ctype;
+ using std::use_facet;
+ const ctype<_Ch_type>& __ctype(use_facet<
+ ctype<_Ch_type> >(_M_locale));
+
+ if (__ctype.is(__c, __f))
+ return true;
+
+ // special case of underscore in [[:w:]]
+ if (__c == __ctype.widen('_'))
+ {
+ const char* const __wb[] = "w";
+ char_class_type __wt = this->lookup_classname(__wb,
+ __wb + sizeof(__wb));
+ if (__f | __wt)
+ return true;
+ }
+
+ // special case of [[:space:]] in [[:blank:]]
+ if (__c == __ctype.isspace(__c))
+ {
+ const char* const __bb[] = "blank";
+ char_class_type __bt = this->lookup_classname(__bb,
+ __bb + sizeof(__bb));
+ if (__f | __bt)
+ return true;
+ }
+
+ return false;
+ }
+
+ template<typename _Ch_type>
+ int regex_traits<_Ch_type>::
+ value(_Ch_type __ch, int __radix) const
+ {
+ std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
+ int __v = -1;
+ if (__radix == 8)
+ __is >> std::oct;
+ else if (__radix == 16)
+ __is >> std::hex;
+ __is >> __v;
+ return __v;
+ }
+
+ // [7.8] Class basic_regex
+ /**
+ * Objects of specializations of this class represent regular expressions
+ * constructed from sequences of character type @p _Ch_type.
+ *
+ * Storage for the regular expression is allocated and deallocated as
+ * necessary by the member functions of this class.
+ */
+ template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
+ class basic_regex
+ {
+ public:
+ // types:
+ typedef _Ch_type value_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef typename _Rx_traits::locale_type locale_type;
+ typedef typename _Rx_traits::string_type string_type;
+
+ /**
+ * @name Constants
+ * tr1 [7.8.1] std [28.8.1]
+ */
+ //@{
+ static const regex_constants::syntax_option_type icase
+ = regex_constants::icase;
+ static const regex_constants::syntax_option_type nosubs
+ = regex_constants::nosubs;
+ static const regex_constants::syntax_option_type optimize
+ = regex_constants::optimize;
+ static const regex_constants::syntax_option_type collate
+ = regex_constants::collate;
+ static const regex_constants::syntax_option_type ECMAScript
+ = regex_constants::ECMAScript;
+ static const regex_constants::syntax_option_type basic
+ = regex_constants::basic;
+ static const regex_constants::syntax_option_type extended
+ = regex_constants::extended;
+ static const regex_constants::syntax_option_type awk
+ = regex_constants::awk;
+ static const regex_constants::syntax_option_type grep
+ = regex_constants::grep;
+ static const regex_constants::syntax_option_type egrep
+ = regex_constants::egrep;
+ //@}
+
+ // [7.8.2] construct/copy/destroy
+ /**
+ * Constructs a basic regular expression that does not match any
+ * character sequence.
+ */
+ basic_regex()
+ : _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the sequence
+ * [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the
+ * flags in @p f.
+ *
+ * @param p A pointer to the start of a C-style null-terminated string
+ * containing a regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p p is not a valid regular expression.
+ */
+ explicit
+ basic_regex(const _Ch_type* __p,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__p), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the sequence
+ * [p, p + len) interpreted according to the flags in @p f.
+ *
+ * @param p A pointer to the start of a string containing a regular
+ * expression.
+ * @param len The length of the string containing the regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p p is not a valid regular expression.
+ */
+ basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
+ : _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Copy-constructs a basic regular expression.
+ *
+ * @param rhs A @p regex object.
+ */
+ basic_regex(const basic_regex& __rhs)
+ : _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern),
+ _M_mark_count(__rhs._M_mark_count)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the string
+ * @p s interpreted according to the flags in @p f.
+ *
+ * @param s A string containing a regular expression.
+ * @param f Flags indicating the syntax rules and options.
+ *
+ * @throws regex_error if @p s is not a valid regular expression.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc>
+ explicit
+ basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
+ { _M_compile(); }
+
+ /**
+ * @brief Constructs a basic regular expression from the range
+ * [first, last) interpreted according to the flags in @p f.
+ *
+ * @param first The start of a range containing a valid regular
+ * expression.
+ * @param last The end of a range containing a valid regular
+ * expression.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p [first, last) is not a valid regular
+ * expression.
+ */
+ template<typename _InputIterator>
+ basic_regex(_InputIterator __first, _InputIterator __last,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
+ { _M_compile(); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Constructs a basic regular expression from an initializer list.
+ *
+ * @param l The initializer list.
+ * @param f The format flags of the regular expression.
+ *
+ * @throws regex_error if @p l is not a valid regular expression.
+ */
+ basic_regex(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
+ { _M_compile(); }
+#endif
+
+ /**
+ * @brief Destroys a basic regular expression.
+ */
+ ~basic_regex()
+ { }
+
+ /**
+ * @brief Assigns one regular expression to another.
+ */
+ basic_regex&
+ operator=(const basic_regex& __rhs)
+ { return this->assign(__rhs); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * a C-style null-terminated string.
+ *
+ * @param A pointer to the start of a null-terminated C-style string
+ * containing a regular expression.
+ */
+ basic_regex&
+ operator=(const _Ch_type* __p)
+ { return this->assign(__p, flags()); }
+
+ /**
+ * @brief Replaces a regular expression with a new one constructed from
+ * a string.
+ *
+ * @param A pointer to a string containing a regular expression.
+ */
+ template<typename _Ch_typeraits, typename _Allocator>
+ basic_regex&
+ operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
+ { return this->assign(__s, flags()); }
+
+ // [7.8.3] assign
+ /**
+ * @brief the real assignment operator.
+ *
+ * @param that Another regular expression object.
+ */
+ basic_regex&
+ assign(const basic_regex& __that)
+ {
+ basic_regex __tmp(__that);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * C-style null-terminated string containing a regular expression
+ * pattern.
+ *
+ * @param p A pointer to a C-style null-terminated string containing
+ * a regular expression pattern.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ basic_regex&
+ assign(const _Ch_type* __p,
+ flag_type __flags = regex_constants::ECMAScript)
+ { return this->assign(string_type(__p), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * C-style string containing a regular expression pattern.
+ *
+ * @param p A pointer to a C-style string containing a
+ * regular expression pattern.
+ * @param len The length of the regular expression pattern string.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ basic_regex&
+ assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
+ { return this->assign(string_type(__p, __len), __flags); }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object from a
+ * string containing a regular expression pattern.
+ *
+ * @param s A string containing a regular expression pattern.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * *this remains unchanged.
+ */
+ template<typename _Ch_typeraits, typename _Allocator>
+ basic_regex&
+ assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
+ flag_type __f = regex_constants::ECMAScript)
+ {
+ basic_regex __tmp(__s, __f);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param first The start of a range containing a valid regular
+ * expression.
+ * @param last The end of a range containing a valid regular
+ * expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if p does not contain a valid regular expression
+ * pattern interpreted according to @p flags. If regex_error is thrown,
+ * the object remains unchanged.
+ */
+ template<typename _InputIterator>
+ basic_regex&
+ assign(_InputIterator __first, _InputIterator __last,
+ flag_type __flags = regex_constants::ECMAScript)
+ { return this->assign(string_type(__first, __last), __flags); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Assigns a new regular expression to a regex object.
+ *
+ * @param l An initializer list representing a regular expression.
+ * @param flags Syntax option flags.
+ *
+ * @throws regex_error if @p l does not contain a valid regular
+ * expression pattern interpreted according to @p flags. If regex_error
+ * is thrown, the object remains unchanged.
+ */
+ basic_regex&
+ assign(initializer_list<_Ch_type> __l,
+ flag_type __f = regex_constants::ECMAScript)
+ { return this->assign(__l.begin(), __l.end(), __f); }
+#endif
+
+ // [7.8.4] const operations
+ /**
+ * @brief Gets the number of marked subexpressions within the regular
+ * expression.
+ */
+ unsigned int
+ mark_count() const
+ { return _M_mark_count; }
+
+ /**
+ * @brief Gets the flags used to construct the regular expression
+ * or in the last call to assign().
+ */
+ flag_type
+ flags() const
+ { return _M_flags; }
+
+ // [7.8.5] locale
+ /**
+ * @brief Imbues the regular expression object with the given locale.
+ *
+ * @param loc A locale.
+ */
+ locale_type
+ imbue(locale_type __loc)
+ { return _M_traits.imbue(__loc); }
+
+ /**
+ * @brief Gets the locale currently imbued in the regular expression
+ * object.
+ */
+ locale_type
+ getloc() const
+ { return _M_traits.getloc(); }
+
+ // [7.8.6] swap
+ /**
+ * @brief Swaps the contents of two regular expression objects.
+ *
+ * @param rhs Another regular expression object.
+ */
+ void
+ swap(basic_regex& __rhs)
+ {
+ std::swap(_M_flags, __rhs._M_flags);
+ std::swap(_M_pattern, __rhs._M_pattern);
+ std::swap(_M_mark_count, __rhs._M_mark_count);
+ std::swap(_M_traits, __rhs._M_traits);
+ }
+
+ private:
+ /**
+ * @brief Compiles a regular expression pattern into a NFA.
+ * @todo Implement this function.
+ */
+ void _M_compile();
+
+ protected:
+ flag_type _M_flags;
+ string_type _M_pattern;
+ unsigned int _M_mark_count;
+ _Rx_traits _M_traits;
+ };
+
+ /** @brief Standard regular expressions. */
+ typedef basic_regex<char> regex;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Standard wide-character regular expressions. */
+ typedef basic_regex<wchar_t> wregex;
+#endif
+
+
+ // [7.8.6] basic_regex swap
+ /**
+ * @brief Swaps the contents of two regular expression objects.
+ * @param lhs First regular expression.
+ * @param rhs Second regular expression.
+ */
+ template<typename _Ch_type, typename _Rx_traits>
+ inline void
+ swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
+ basic_regex<_Ch_type, _Rx_traits>& __rhs)
+ { __lhs.swap(__rhs); }
+
+
+ // [7.9] Class template sub_match
+ /**
+ * A sequence of characters matched by a particular marked sub-expression.
+ *
+ * An object of this class is essentially a pair of iterators marking a
+ * matched subexpression within a regular expression pattern match. Such
+ * objects can be converted to and compared with std::basic_string objects
+ * of a similar base character type as the pattern matched by the regular
+ * expression.
+ *
+ * The iterators that make up the pair are the usual half-open interval
+ * referencing the actual original pattern matched.
+ */
+ template<typename _BiIter>
+ class sub_match : public std::pair<_BiIter, _BiIter>
+ {
+ public:
+ typedef typename iterator_traits<_BiIter>::value_type value_type;
+ typedef typename iterator_traits<_BiIter>::difference_type
+ difference_type;
+ typedef _BiIter iterator;
+
+ public:
+ bool matched;
+
+ /**
+ * Gets the length of the matching sequence.
+ */
+ difference_type
+ length() const
+ { return this->matched ? std::distance(this->first, this->second) : 0; }
+
+ /**
+ * @brief Gets the matching sequence as a string.
+ *
+ * @returns the matching sequence as a string.
+ *
+ * This is the implicit conversion operator. It is identical to the
+ * str() member function except that it will want to pop up in
+ * unexpected places and cause a great deal of confusion and cursing
+ * from the unwary.
+ */
+ operator basic_string<value_type>() const
+ {
+ return this->matched
+ ? std::basic_string<value_type>(this->first, this->second)
+ : std::basic_string<value_type>();
+ }
+
+ /**
+ * @brief Gets the matching sequence as a string.
+ *
+ * @returns the matching sequence as a string.
+ */
+ basic_string<value_type>
+ str() const
+ {
+ return this->matched
+ ? std::basic_string<value_type>(this->first, this->second)
+ : std::basic_string<value_type>();
+ }
+
+ /**
+ * @brief Compares this and another matched sequence.
+ *
+ * @param s Another matched sequence to compare to this one.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const sub_match& __s) const
+ { return this->str().compare(__s.str()); }
+
+ /**
+ * @brief Compares this sub_match to a string.
+ *
+ * @param s A string to compare to this sub_match.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const basic_string<value_type>& __s) const
+ { return this->str().compare(__s); }
+
+ /**
+ * @brief Compares this sub_match to a C-style string.
+ *
+ * @param s A C-style string to compare to this sub_match.
+ *
+ * @retval <0 this matched sequence will collate before @p s.
+ * @retval =0 this matched sequence is equivalent to @p s.
+ * @retval <0 this matched sequence will collate after @p s.
+ */
+ int
+ compare(const value_type* __s) const
+ { return this->str().compare(__s); }
+ };
+
+
+ /** @brief Standard regex submatch over a C-style null-terminated string. */
+ typedef sub_match<const char*> csub_match;
+ /** @brief Standard regex submatch over a standard string. */
+ typedef sub_match<string::const_iterator> ssub_match;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Regex submatch over a C-style null-terminated wide string. */
+ typedef sub_match<const wchar_t*> wcsub_match;
+ /** @brief Regex submatch over a standard wide string. */
+ typedef sub_match<wstring::const_iterator> wssub_match;
+#endif
+
+ // [7.9.2] sub_match non-member operators
+
+ /**
+ * @brief Tests the equivalence of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator==(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) == 0; }
+
+ /**
+ * @brief Tests the inequivalence of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator!=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) != 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator<(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) < 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator<=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) <= 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator>=(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) >= 0; }
+
+ /**
+ * @brief Tests the ordering of two regular expression submatches.
+ * @param lhs First regular expression submatch.
+ * @param rhs Second regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _BiIter>
+ inline bool
+ operator>(const sub_match<_BiIter>& __lhs,
+ const sub_match<_BiIter>& __rhs)
+ { return __lhs.compare(__rhs) > 0; }
+
+ /**
+ * @brief Tests the equivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator==(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator!=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator<(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator>(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator>=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator<=(const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ const basic_string<
+ typename iterator_traits<_Bi_iter>::value_type,
+ _Ch_traits, _Ch_alloc>& __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Tests the equivalence of a C string and a regular expression
+ * submatch.
+ * @param lhs A C string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of an iterator value and a regular
+ * expression submatch.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A pointer to a string?
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A pointer to a string.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A string.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const* __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Tests the equivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs == __rhs.str(); }
+
+ /**
+ * @brief Tests the inequivalence of a string and a regular expression
+ * submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs != __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs < __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs > __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs >= __rhs.str(); }
+
+ /**
+ * @brief Tests the ordering of a string and a regular expression submatch.
+ * @param lhs A string.
+ * @param rhs A regular expression submatch.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
+ const sub_match<_Bi_iter>& __rhs)
+ { return __lhs <= __rhs.str(); }
+
+ /**
+ * @brief Tests the equivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator==(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() == __rhs; }
+
+ /**
+ * @brief Tests the inequivalence of a regular expression submatch and a
+ * string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator!=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() != __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs precedes @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() < __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs succeeds @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() > __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs does not precede @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator>=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() >= __rhs; }
+
+ /**
+ * @brief Tests the ordering of a regular expression submatch and a string.
+ * @param lhs A regular expression submatch.
+ * @param rhs A const string reference.
+ * @returns true if @a lhs does not succeed @a rhs, false otherwise.
+ */
+ template<typename _Bi_iter>
+ inline bool
+ operator<=(const sub_match<_Bi_iter>& __lhs,
+ typename iterator_traits<_Bi_iter>::value_type const& __rhs)
+ { return __lhs.str() <= __rhs; }
+
+ /**
+ * @brief Inserts a matched string into an output stream.
+ *
+ * @param os The output stream.
+ * @param m A submatch string.
+ *
+ * @returns the output stream with the submatch string inserted.
+ */
+ template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
+ inline
+ basic_ostream<_Ch_type, _Ch_traits>&
+ operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
+ const sub_match<_Bi_iter>& __m)
+ { return __os << __m.str(); }
+
+ // [7.10] Class template match_results
+ /**
+ * @brief The results of a match or search operation.
+ *
+ * A collection of character sequences representing the result of a regular
+ * expression match. Storage for the collection is allocated and freed as
+ * necessary by the member functions of class template match_results.
+ *
+ * This class satisfies the Sequence requirements, with the exception that
+ * only the operations defined for a const-qualified Sequence are supported.
+ *
+ * The sub_match object stored at index 0 represents sub-expression 0, i.e.
+ * the whole match. In this case the sub_match member matched is always true.
+ * The sub_match object stored at index n denotes what matched the marked
+ * sub-expression n within the matched expression. If the sub-expression n
+ * participated in a regular expression match then the sub_match member
+ * matched evaluates to true, and members first and second denote the range
+ * of characters [first, second) which formed that match. Otherwise matched
+ * is false, and members first and second point to the end of the sequence
+ * that was searched.
+ *
+ * @nosubgrouping
+ */
+ template<typename _Bi_iter,
+ typename _Allocator = allocator<sub_match<_Bi_iter> > >
+ class match_results
+ : private std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
+ {
+ private:
+ typedef std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
+ _Base_type;
+
+ public:
+ /**
+ * @name 10.? Public Types
+ */
+ //@{
+ typedef sub_match<_Bi_iter> value_type;
+ typedef typename _Allocator::const_reference const_reference;
+ typedef const_reference reference;
+ typedef typename _Base_type::const_iterator const_iterator;
+ typedef const_iterator iterator;
+ typedef typename iterator_traits<_Bi_iter>::difference_type
+ difference_type;
+ typedef typename _Allocator::size_type size_type;
+ typedef _Allocator allocator_type;
+ typedef typename iterator_traits<_Bi_iter>::value_type char_type;
+ typedef basic_string<char_type> string_type;
+ //@}
+
+ public:
+ /**
+ * @name 10.1 Construction, Copying, and Destruction
+ */
+ //@{
+
+ /**
+ * @brief Constructs a default %match_results container.
+ * @post size() returns 0 and str() returns an empty string.
+ */
+ explicit
+ match_results(const _Allocator& __a = _Allocator())
+ : _Base_type(__a), _M_matched(false)
+ { }
+
+ /**
+ * @brief Copy constructs a %match_results.
+ */
+ match_results(const match_results& __rhs)
+ : _Base_type(__rhs), _M_matched(__rhs._M_matched),
+ _M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix)
+ { }
+
+ /**
+ * @brief Assigns rhs to *this.
+ */
+ match_results&
+ operator=(const match_results& __rhs)
+ {
+ match_results __tmp(__rhs);
+ this->swap(__tmp);
+ return *this;
+ }
+
+ /**
+ * @brief Destroys a %match_results object.
+ */
+ ~match_results()
+ { }
+
+ //@}
+
+ /**
+ * @name 10.2 Size
+ */
+ //@{
+
+ /**
+ * @brief Gets the number of matches and submatches.
+ *
+ * The number of matches for a given regular expression will be either 0
+ * if there was no match or mark_count() + 1 if a match was successful.
+ * Some matches may be empty.
+ *
+ * @returns the number of matches found.
+ */
+ size_type
+ size() const
+ { return _M_matched ? _Base_type::size() + 1 : 0; }
+
+ //size_type
+ //max_size() const;
+ using _Base_type::max_size;
+
+ /**
+ * @brief Indicates if the %match_results contains no results.
+ * @retval true The %match_results object is empty.
+ * @retval false The %match_results object is not empty.
+ */
+ bool
+ empty() const
+ { return size() == 0; }
+
+ //@}
+
+ /**
+ * @name 10.3 Element Access
+ */
+ //@{
+
+ /**
+ * @brief Gets the length of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the length of the indicated submatch, or the
+ * length of the entire match if @p sub is zero (the default).
+ */
+ difference_type
+ length(size_type __sub = 0) const
+ { return _M_matched ? this->str(__sub).length() : 0; }
+
+ /**
+ * @brief Gets the offset of the beginning of the indicated submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function returns the offset from the beginning of the target
+ * sequence to the beginning of the submatch, unless the value of @p sub
+ * is zero (the default), in which case this function returns the offset
+ * from the beginning of the target sequence to the beginning of the
+ * match.
+ */
+ difference_type
+ position(size_type __sub = 0) const
+ {
+ return _M_matched ? std::distance(this->prefix().first,
+ (*this)[__sub].first) : 0;
+ }
+
+ /**
+ * @brief Gets the match or submatch converted to a string type.
+ * @param sub indicates the submatch.
+ *
+ * This function gets the submatch (or match, if @p sub is zero) extracted
+ * from the target range and converted to the associated string type.
+ */
+ string_type
+ str(size_type __sub = 0) const
+ { return _M_matched ? (*this)[__sub].str() : string_type(); }
+
+ /**
+ * @brief Gets a %sub_match reference for the match or submatch.
+ * @param sub indicates the submatch.
+ *
+ * This function gets a reference to the indicated submatch, or the entire
+ * match if @p sub is zero.
+ *
+ * If @p sub >= size() then this function returns a %sub_match with a
+ * special value indicating no submatch.
+ */
+ const_reference
+ operator[](size_type __sub) const
+ { return _Base_type::operator[](__sub); }
+
+ /**
+ * @brief Gets a %sub_match representing the match prefix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the start of the target range and the
+ * start of the match.
+ */
+ const_reference
+ prefix() const
+ { return _M_prefix; }
+
+ /**
+ * @brief Gets a %sub_match representing the match suffix.
+ *
+ * This function gets a reference to a %sub_match object representing the
+ * part of the target range between the end of the match and the end of
+ * the target range.
+ */
+ const_reference
+ suffix() const
+ { return _M_suffix; }
+
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ begin() const
+ { return _Base_type::begin(); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Gets an iterator to the start of the %sub_match collection.
+ */
+ const_iterator
+ cbegin() const
+ { return _Base_type::begin(); }
+#endif
+
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ end() const
+ { return _Base_type::end(); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ /**
+ * @brief Gets an iterator to one-past-the-end of the collection.
+ */
+ const_iterator
+ cend() const
+ { return _Base_type::end(); }
+#endif
+
+ //@}
+
+ /**
+ * @name 10.4 Formatting
+ *
+ * These functions perform formatted substitution of the matched character
+ * sequences into their target. The format specifiers and escape sequences
+ * accepted by these functions are determined by their @p flags parameter
+ * as documented above.
+ */
+ //@{
+
+ /**
+ * @todo Implement this function.
+ */
+ template<typename _Out_iter>
+ _Out_iter
+ format(_Out_iter __out, const string_type& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::format_default) const;
+
+ /**
+ * @todo Implement this function.
+ */
+ string_type
+ format(const string_type& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::format_default) const;
+
+ //@}
+
+ /**
+ * @name 10.5 Allocator
+ */
+ //@{
+
+ /**
+ * @brief Gets a copy of the allocator.
+ */
+ //allocator_type
+ //get_allocator() const;
+ using _Base_type::get_allocator;
+
+ //@}
+
+ /**
+ * @name 10.6 Swap
+ */
+ //@{
+
+ /**
+ * @brief Swaps the contents of two match_results.
+ */
+ void
+ swap(match_results& __that)
+ {
+ _Base_type::swap(__that);
+ std::swap(_M_matched, __that._M_matched);
+ std::swap(_M_prefix, __that._M_prefix);
+ std::swap(_M_suffix, __that._M_suffix);
+ }
+ //@}
+
+ private:
+ bool _M_matched;
+ value_type _M_prefix;
+ value_type _M_suffix;
+ };
+
+ typedef match_results<const char*> cmatch;
+ typedef match_results<string::const_iterator> smatch;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef match_results<const wchar_t*> wcmatch;
+ typedef match_results<wstring::const_iterator> wsmatch;
+#endif
+
+ // match_results comparisons
+ /**
+ * @brief Compares two match_results for equality.
+ * @returns true if the two objects refer to the same match,
+ * false otherwise.
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator>
+ inline bool
+ operator==(const match_results<_Bi_iter, _Allocator>& __m1,
+ const match_results<_Bi_iter, _Allocator>& __m2);
+
+ /**
+ * @brief Compares two match_results for inequality.
+ * @returns true if the two objects do not refer to the same match,
+ * false otherwise.
+ */
+ template<typename _Bi_iter, class _Allocator>
+ inline bool
+ operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
+ const match_results<_Bi_iter, _Allocator>& __m2)
+ { return !(__m1 == __m2); }
+
+ // [7.10.6] match_results swap
+ /**
+ * @brief Swaps two match results.
+ * @param lhs A match result.
+ * @param rhs A match result.
+ *
+ * The contents of the two match_results objects are swapped.
+ */
+ template<typename _Bi_iter, typename _Allocator>
+ inline void
+ swap(match_results<_Bi_iter, _Allocator>& __lhs,
+ match_results<_Bi_iter, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ // [7.11.2] Function template regex_match
+ /**
+ * @name Matching, Searching, and Replacing
+ */
+ //@{
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and all of the character sequence [first, last).
+ *
+ * @param first Beginning of the character sequence to match.
+ * @param last One-past-the-end of the character sequence to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator,
+ typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __first, _Bi_iter __last,
+ match_results<_Bi_iter, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and all of the character sequence [first, last).
+ *
+ * @param first Beginning of the character sequence to match.
+ * @param last One-past-the-end of the character sequence to match.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ match_results<_Bi_iter> __what;
+ return regex_match(__first, __last, __what, __re, __flags);
+ }
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and a C-style null-terminated string.
+ *
+ * @param s The C-style null-terminated string to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param f Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
+ inline bool
+ regex_match(const _Ch_type* __s,
+ match_results<const _Ch_type*, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
+
+ /**
+ * @brief Determines if there is a match between the regular expression @p e
+ * and a string.
+ *
+ * @param s The string to match.
+ * @param m The match results.
+ * @param re The regular expression.
+ * @param flags Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc,
+ typename _Allocator, typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ match_results<typename basic_string<_Ch_type,
+ _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and a C-style null-terminated string.
+ *
+ * @param s The C-style null-terminated string to match.
+ * @param re The regular expression.
+ * @param f Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, class _Rx_traits>
+ inline bool
+ regex_match(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
+
+ /**
+ * @brief Indicates if there is a match between the regular expression @p e
+ * and a string.
+ *
+ * @param s [IN] The string to match.
+ * @param re [IN] The regular expression.
+ * @param flags [IN] Controls how the regular expression is matched.
+ *
+ * @retval true A match exists.
+ * @retval false Otherwise.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Str_allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_match(__s.begin(), __s.end(), __re, __flags); }
+
+ // [7.11.3] Function template regex_search
+ /**
+ * Searches for a regular expression within a range.
+ * @param first [IN] The start of the string to search.
+ * @param last [IN] One-past-the-end of the string to search.
+ * @param m [OUT] The match results.
+ * @param re [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ *
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Bi_iter, typename _Allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ match_results<_Bi_iter, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * Searches for a regular expression within a range.
+ * @param first [IN] The start of the string to search.
+ * @param last [IN] One-past-the-end of the string to search.
+ * @param re [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ match_results<_Bi_iter> __what;
+ return regex_search(__first, __last, __what, __re, __flags);
+ }
+
+ /**
+ * @brief Searches for a regular expression within a C-string.
+ * @param s [IN] A C-string to search for the regex.
+ * @param m [OUT] The set of regex matches.
+ * @param e [IN] The regex to search for in @p s.
+ * @param f [IN] The search flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, class _Allocator, class _Rx_traits>
+ inline bool
+ regex_search(const _Ch_type* __s,
+ match_results<const _Ch_type*, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
+
+ /**
+ * @brief Searches for a regular expression within a C-string.
+ * @param s [IN] The C-string to search.
+ * @param e [IN] The regular expression to search for.
+ * @param f [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
+
+ /**
+ * @brief Searches for a regular expression within a string.
+ * @param s [IN] The string to search.
+ * @param e [IN] The regular expression to search for.
+ * @param flags [IN] Search policy flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string.
+ * @doctodo
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _String_allocator,
+ typename _Ch_type, typename _Rx_traits>
+ inline bool
+ regex_search(const basic_string<_Ch_type, _Ch_traits,
+ _String_allocator>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ { return regex_search(__s.begin(), __s.end(), __e, __flags); }
+
+ /**
+ * @brief Searches for a regular expression within a string.
+ * @param s [IN] A C++ string to search for the regex.
+ * @param m [OUT] The set of regex matches.
+ * @param e [IN] The regex to search for in @p s.
+ * @param f [IN] The search flags.
+ * @retval true A match was found within the string.
+ * @retval false No match was found within the string, the content of %m is
+ * undefined.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Ch_traits, typename _Ch_alloc,
+ typename _Allocator, typename _Ch_type,
+ typename _Rx_traits>
+ inline bool
+ regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
+ match_results<typename basic_string<_Ch_type,
+ _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ regex_constants::match_flag_type __f
+ = regex_constants::match_default)
+ { return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
+
+ // tr1 [7.11.4] std [28.11.4] Function template regex_replace
+ /**
+ * @doctodo
+ * @param out
+ * @param first
+ * @param last
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns out
+ * @throws an exception of type regex_error.
+ *
+ * @todo Implement this function.
+ */
+ template<typename _Out_iter, typename _Bi_iter,
+ typename _Rx_traits, typename _Ch_type>
+ inline _Out_iter
+ regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * @doctodo
+ * @param s
+ * @param e
+ * @param fmt
+ * @param flags
+ *
+ * @returns a copy of string @p s with replacements.
+ *
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Rx_traits, typename _Ch_type>
+ inline basic_string<_Ch_type>
+ regex_replace(const basic_string<_Ch_type>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ std::string __result;
+ regex_replace(std::back_inserter(__result),
+ __s.begin(), __s.end(), __e, __fmt, __flags);
+ return __result;
+ }
+
+ //@}
+
+ // tr1 [7.12.1] std [28.12] Class template regex_iterator
+ /**
+ * An iterator adaptor that will provide repeated calls of regex_search over
+ * a range until no more matches remain.
+ */
+ template<typename _Bi_iter,
+ typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
+ typename _Rx_traits = regex_traits<_Ch_type> >
+ class regex_iterator
+ {
+ public:
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef match_results<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ public:
+ /**
+ * @brief Provides a singular iterator, useful for indicating
+ * one-past-the-end of a range.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator();
+
+ /**
+ * Constructs a %regex_iterator...
+ * @param a [IN] The start of a text range to search.
+ * @param b [IN] One-past-the-end of the text range to search.
+ * @param re [IN] The regular expression to match.
+ * @param m [IN] Policy flags for match rules.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Copy constructs a %regex_iterator.
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator&
+ operator=(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ bool
+ operator==(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ bool
+ operator!=(const regex_iterator& __rhs);
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ const value_type&
+ operator*();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ const value_type*
+ operator->();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator&
+ operator++();
+
+ /**
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_iterator
+ operator++(int);
+
+ private:
+ // these members are shown for exposition only:
+ _Bi_iter begin;
+ _Bi_iter end;
+ const regex_type* pregex;
+ regex_constants::match_flag_type flags;
+ match_results<_Bi_iter> match;
+ };
+
+ typedef regex_iterator<const char*> cregex_iterator;
+ typedef regex_iterator<string::const_iterator> sregex_iterator;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef regex_iterator<const wchar_t*> wcregex_iterator;
+ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+#endif
+
+ // [7.12.2] Class template regex_token_iterator
+ /**
+ * Iterates over submatches in a range (or "splits" a text string).
+ *
+ * The purpose of this iterator is to enumerate all, or all specified,
+ * matches of a regular expression within a text range. The dereferenced
+ * value of an iterator of this class is a std::tr1::sub_match object.
+ */
+ template<typename _Bi_iter,
+ typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
+ typename _Rx_traits = regex_traits<_Ch_type> >
+ class regex_token_iterator
+ {
+ public:
+ typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
+ typedef sub_match<_Bi_iter> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ public:
+ /**
+ * @brief Default constructs a %regex_token_iterator.
+ * @todo Implement this function.
+ *
+ * A default-constructed %regex_token_iterator is a singular iterator
+ * that will compare equal to the one-past-the-end value for any
+ * iterator of the same type.
+ */
+ regex_token_iterator();
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatch [IN] Which submatch to return. There are some
+ * special values for this parameter:
+ * - -1 each enumerated subexpression does NOT
+ * match the regular expression (aka field
+ * splitting)
+ * - 0 the entire string matching the
+ * subexpression is returned for each match
+ * within the text.
+ * - >0 enumerates only the indicated
+ * subexpression from a match within the text.
+ * @param m [IN] Policy flags for match rules.
+ *
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
+ int __submatch = 0,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatches [IN] A list of subexpressions to return for each
+ * regular expression match within the text.
+ * @param m [IN] Policy flags for match rules.
+ *
+ * @todo Implement this function.
+ * @doctodo
+ */
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
+ const regex_type& __re,
+ const std::vector<int>& __submatches,
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * Constructs a %regex_token_iterator...
+ * @param a [IN] The start of the text to search.
+ * @param b [IN] One-past-the-end of the text to search.
+ * @param re [IN] The regular expression to search for.
+ * @param submatches [IN] A list of subexpressions to return for each
+ * regular expression match within the text.
+ * @param m [IN] Policy flags for match rules.
+
+ * @todo Implement this function.
+ * @doctodo
+ */
+ template<std::size_t _Nm>
+ regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
+ const regex_type& __re,
+ const int (&__submatches)[_Nm],
+ regex_constants::match_flag_type __m
+ = regex_constants::match_default);
+
+ /**
+ * @brief Copy constructs a %regex_token_iterator.
+ * @param rhs [IN] A %regex_token_iterator to copy.
+ * @todo Implement this function.
+ */
+ regex_token_iterator(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Assigns a %regex_token_iterator to another.
+ * @param rhs [IN] A %regex_token_iterator to copy.
+ * @todo Implement this function.
+ */
+ regex_token_iterator&
+ operator=(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Compares a %regex_token_iterator to another for equality.
+ * @todo Implement this function.
+ */
+ bool
+ operator==(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Compares a %regex_token_iterator to another for inequality.
+ * @todo Implement this function.
+ */
+ bool
+ operator!=(const regex_token_iterator& __rhs);
+
+ /**
+ * @brief Dereferences a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ const value_type&
+ operator*();
+
+ /**
+ * @brief Selects a %regex_token_iterator member.
+ * @todo Implement this function.
+ */
+ const value_type*
+ operator->();
+
+ /**
+ * @brief Increments a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ regex_token_iterator&
+ operator++();
+
+ /**
+ * @brief Postincrements a %regex_token_iterator.
+ * @todo Implement this function.
+ */
+ regex_token_iterator
+ operator++(int);
+
+ private: // data members for exposition only:
+ typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
+
+ position_iterator __position;
+ const value_type* __result;
+ value_type __suffix;
+ std::size_t __n;
+ std::vector<int> __subs;
+ };
+
+ /** @brief Token iterator for C-style NULL-terminated strings. */
+ typedef regex_token_iterator<const char*> cregex_token_iterator;
+ /** @brief Token iterator for standard strings. */
+ typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ /** @brief Token iterator for C-style NULL-terminated wide strings. */
+ typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+ /** @brief Token iterator for standard wide-character strings. */
+ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
+#endif
+
+ //@}
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/type_traits b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/type_traits
new file mode 100644
index 000000000..75b85ea2f
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/type_traits
@@ -0,0 +1,501 @@
+// TR1 type_traits -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/type_traits
+* This is an internal header file, included by other library headers.
+* You should not attempt to use it directly.
+*/
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ /**
+ * @defgroup metaprogramming Type Traits
+ * @ingroup utilities
+ *
+ * Compile time type transformation and information.
+ * @{
+ */
+
+ // For use in __is_convertible_simple.
+ struct __sfinae_types
+ {
+ typedef char __one;
+ typedef struct { char __arr[2]; } __two;
+ };
+
+#define _DEFINE_SPEC_0_HELPER \
+ template<>
+
+#define _DEFINE_SPEC_1_HELPER \
+ template<typename _Tp>
+
+#define _DEFINE_SPEC_2_HELPER \
+ template<typename _Tp, typename _Cp>
+
+#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) \
+ _DEFINE_SPEC_##_Order##_HELPER \
+ struct _Trait<_Type> \
+ : public integral_constant<bool, _Value> { };
+
+ // helper classes [4.3].
+
+ /// integral_constant
+ template<typename _Tp, _Tp __v>
+ struct integral_constant
+ {
+ static const _Tp value = __v;
+ typedef _Tp value_type;
+ typedef integral_constant<_Tp, __v> type;
+ };
+
+ /// typedef for true_type
+ typedef integral_constant<bool, true> true_type;
+
+ /// typedef for false_type
+ typedef integral_constant<bool, false> false_type;
+
+ template<typename _Tp, _Tp __v>
+ const _Tp integral_constant<_Tp, __v>::value;
+
+ /// remove_cv
+ template<typename>
+ struct remove_cv;
+
+ template<typename>
+ struct __is_void_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_void_helper, void, true)
+
+ // primary type categories [4.5.1].
+
+ /// is_void
+ template<typename _Tp>
+ struct is_void
+ : public integral_constant<bool, (__is_void_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_integral_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_integral_helper, bool, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, signed char, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
+#endif
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ _DEFINE_SPEC(0, __is_integral_helper, char16_t, true)
+ _DEFINE_SPEC(0, __is_integral_helper, char32_t, true)
+#endif
+ _DEFINE_SPEC(0, __is_integral_helper, short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
+ _DEFINE_SPEC(0, __is_integral_helper, int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, long long, true)
+ _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
+
+ /// is_integral
+ template<typename _Tp>
+ struct is_integral
+ : public integral_constant<bool, (__is_integral_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_floating_point_helper
+ : public false_type { };
+ _DEFINE_SPEC(0, __is_floating_point_helper, float, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, double, true)
+ _DEFINE_SPEC(0, __is_floating_point_helper, long double, true)
+
+ /// is_floating_point
+ template<typename _Tp>
+ struct is_floating_point
+ : public integral_constant<bool, (__is_floating_point_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_array
+ template<typename>
+ struct is_array
+ : public false_type { };
+
+ template<typename _Tp, std::size_t _Size>
+ struct is_array<_Tp[_Size]>
+ : public true_type { };
+
+ template<typename _Tp>
+ struct is_array<_Tp[]>
+ : public true_type { };
+
+ template<typename>
+ struct __is_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(1, __is_pointer_helper, _Tp*, true)
+
+ /// is_pointer
+ template<typename _Tp>
+ struct is_pointer
+ : public integral_constant<bool, (__is_pointer_helper<typename
+ remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_reference
+ template<typename _Tp>
+ struct is_reference;
+
+ /// is_function
+ template<typename _Tp>
+ struct is_function;
+
+ template<typename>
+ struct __is_member_object_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_object_pointer_helper, _Tp _Cp::*,
+ !is_function<_Tp>::value)
+
+ /// is_member_object_pointer
+ template<typename _Tp>
+ struct is_member_object_pointer
+ : public integral_constant<bool, (__is_member_object_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ template<typename>
+ struct __is_member_function_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_function_pointer_helper, _Tp _Cp::*,
+ is_function<_Tp>::value)
+
+ /// is_member_function_pointer
+ template<typename _Tp>
+ struct is_member_function_pointer
+ : public integral_constant<bool, (__is_member_function_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ /// is_enum
+ template<typename _Tp>
+ struct is_enum
+ : public integral_constant<bool, __is_enum(_Tp)>
+ { };
+
+ /// is_union
+ template<typename _Tp>
+ struct is_union
+ : public integral_constant<bool, __is_union(_Tp)>
+ { };
+
+ /// is_class
+ template<typename _Tp>
+ struct is_class
+ : public integral_constant<bool, __is_class(_Tp)>
+ { };
+
+ /// is_function
+ template<typename>
+ struct is_function
+ : public false_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...)>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......)>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) const>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) const>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes...) const volatile>
+ : public true_type { };
+ template<typename _Res, typename... _ArgTypes>
+ struct is_function<_Res(_ArgTypes......) const volatile>
+ : public true_type { };
+
+ // composite type traits [4.5.2].
+
+ /// is_arithmetic
+ template<typename _Tp>
+ struct is_arithmetic
+ : public integral_constant<bool, (is_integral<_Tp>::value
+ || is_floating_point<_Tp>::value)>
+ { };
+
+ /// is_fundamental
+ template<typename _Tp>
+ struct is_fundamental
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_void<_Tp>::value)>
+ { };
+
+ /// is_object
+ template<typename _Tp>
+ struct is_object
+ : public integral_constant<bool, !(is_function<_Tp>::value
+ || is_reference<_Tp>::value
+ || is_void<_Tp>::value)>
+ { };
+
+ /// is_member_pointer
+ template<typename _Tp>
+ struct is_member_pointer;
+
+ /// is_scalar
+ template<typename _Tp>
+ struct is_scalar
+ : public integral_constant<bool, (is_arithmetic<_Tp>::value
+ || is_enum<_Tp>::value
+ || is_pointer<_Tp>::value
+ || is_member_pointer<_Tp>::value)>
+ { };
+
+ /// is_compound
+ template<typename _Tp>
+ struct is_compound
+ : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
+
+ /// is_member_pointer
+ template<typename _Tp>
+ struct __is_member_pointer_helper
+ : public false_type { };
+ _DEFINE_SPEC(2, __is_member_pointer_helper, _Tp _Cp::*, true)
+
+ template<typename _Tp>
+ struct is_member_pointer
+ : public integral_constant<bool, (__is_member_pointer_helper<
+ typename remove_cv<_Tp>::type>::value)>
+ { };
+
+ // type properties [4.5.3].
+ /// is_const
+ template<typename>
+ struct is_const
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_const<_Tp const>
+ : public true_type { };
+
+ /// is_volatile
+ template<typename>
+ struct is_volatile
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_volatile<_Tp volatile>
+ : public true_type { };
+
+ /// is_empty
+ template<typename _Tp>
+ struct is_empty
+ : public integral_constant<bool, __is_empty(_Tp)>
+ { };
+
+ /// is_polymorphic
+ template<typename _Tp>
+ struct is_polymorphic
+ : public integral_constant<bool, __is_polymorphic(_Tp)>
+ { };
+
+ /// is_abstract
+ template<typename _Tp>
+ struct is_abstract
+ : public integral_constant<bool, __is_abstract(_Tp)>
+ { };
+
+ /// has_virtual_destructor
+ template<typename _Tp>
+ struct has_virtual_destructor
+ : public integral_constant<bool, __has_virtual_destructor(_Tp)>
+ { };
+
+ /// alignment_of
+ template<typename _Tp>
+ struct alignment_of
+ : public integral_constant<std::size_t, __alignof__(_Tp)> { };
+
+ /// rank
+ template<typename>
+ struct rank
+ : public integral_constant<std::size_t, 0> { };
+
+ template<typename _Tp, std::size_t _Size>
+ struct rank<_Tp[_Size]>
+ : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
+ template<typename _Tp>
+ struct rank<_Tp[]>
+ : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
+ /// extent
+ template<typename, unsigned _Uint = 0>
+ struct extent
+ : public integral_constant<std::size_t, 0> { };
+
+ template<typename _Tp, unsigned _Uint, std::size_t _Size>
+ struct extent<_Tp[_Size], _Uint>
+ : public integral_constant<std::size_t,
+ _Uint == 0 ? _Size : extent<_Tp,
+ _Uint - 1>::value>
+ { };
+
+ template<typename _Tp, unsigned _Uint>
+ struct extent<_Tp[], _Uint>
+ : public integral_constant<std::size_t,
+ _Uint == 0 ? 0 : extent<_Tp,
+ _Uint - 1>::value>
+ { };
+
+ // relationships between types [4.6].
+
+ /// is_same
+ template<typename, typename>
+ struct is_same
+ : public false_type { };
+
+ template<typename _Tp>
+ struct is_same<_Tp, _Tp>
+ : public true_type { };
+
+ // const-volatile modifications [4.7.1].
+
+ /// remove_const
+ template<typename _Tp>
+ struct remove_const
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_const<_Tp const>
+ { typedef _Tp type; };
+
+ /// remove_volatile
+ template<typename _Tp>
+ struct remove_volatile
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_volatile<_Tp volatile>
+ { typedef _Tp type; };
+
+ /// remove_cv
+ template<typename _Tp>
+ struct remove_cv
+ {
+ typedef typename
+ remove_const<typename remove_volatile<_Tp>::type>::type type;
+ };
+
+ /// add_const
+ template<typename _Tp>
+ struct add_const
+ { typedef _Tp const type; };
+
+ /// add_volatile
+ template<typename _Tp>
+ struct add_volatile
+ { typedef _Tp volatile type; };
+
+ /// add_cv
+ template<typename _Tp>
+ struct add_cv
+ {
+ typedef typename
+ add_const<typename add_volatile<_Tp>::type>::type type;
+ };
+
+ // array modifications [4.7.3].
+
+ /// remove_extent
+ template<typename _Tp>
+ struct remove_extent
+ { typedef _Tp type; };
+
+ template<typename _Tp, std::size_t _Size>
+ struct remove_extent<_Tp[_Size]>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_extent<_Tp[]>
+ { typedef _Tp type; };
+
+ /// remove_all_extents
+ template<typename _Tp>
+ struct remove_all_extents
+ { typedef _Tp type; };
+
+ template<typename _Tp, std::size_t _Size>
+ struct remove_all_extents<_Tp[_Size]>
+ { typedef typename remove_all_extents<_Tp>::type type; };
+
+ template<typename _Tp>
+ struct remove_all_extents<_Tp[]>
+ { typedef typename remove_all_extents<_Tp>::type type; };
+
+ // pointer modifications [4.7.4].
+
+ template<typename _Tp, typename>
+ struct __remove_pointer_helper
+ { typedef _Tp type; };
+
+ template<typename _Tp, typename _Up>
+ struct __remove_pointer_helper<_Tp, _Up*>
+ { typedef _Up type; };
+
+ /// remove_pointer
+ template<typename _Tp>
+ struct remove_pointer
+ : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
+ { };
+
+ template<typename>
+ struct remove_reference;
+
+ /// add_pointer
+ template<typename _Tp>
+ struct add_pointer
+ { typedef typename remove_reference<_Tp>::type* type; };
+
+#undef _DEFINE_SPEC_0_HELPER
+#undef _DEFINE_SPEC_1_HELPER
+#undef _DEFINE_SPEC_2_HELPER
+#undef _DEFINE_SPEC
+
+ // @} group metaprogramming
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_map b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_map
new file mode 100644
index 000000000..cef649042
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_map
@@ -0,0 +1,370 @@
+// TR1 unordered_map -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/unordered_map
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ // XXX When we get typedef templates these class definitions
+ // will be unnecessary.
+ template<class _Key, class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
+ class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
+ bool __cache_hash_code = false>
+ class __unordered_map
+ : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
+ std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, false, true>
+ {
+ typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
+ std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, false, true>
+ _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ __unordered_map(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(),
+ __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
+ { }
+
+ template<typename _InputIterator>
+ __unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(),
+ __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_map(__unordered_map&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
+ };
+
+ template<class _Key, class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
+ class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,
+ bool __cache_hash_code = false>
+ class __unordered_multimap
+ : public _Hashtable<_Key, std::pair<const _Key, _Tp>,
+ _Alloc,
+ std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, false, false>
+ {
+ typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
+ _Alloc,
+ std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, false, false>
+ _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ __unordered_multimap(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(),
+ __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
+ { }
+
+
+ template<typename _InputIterator>
+ __unordered_multimap(_InputIterator __f, _InputIterator __l,
+ typename _Base::size_type __n = 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(),
+ __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_multimap(__unordered_multimap&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
+ };
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
+ bool __cache_hash_code>
+ inline void
+ swap(__unordered_map<_Key, _Tp, _Hash, _Pred,
+ _Alloc, __cache_hash_code>& __x,
+ __unordered_map<_Key, _Tp, _Hash, _Pred,
+ _Alloc, __cache_hash_code>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,
+ bool __cache_hash_code>
+ inline void
+ swap(__unordered_multimap<_Key, _Tp, _Hash, _Pred,
+ _Alloc, __cache_hash_code>& __x,
+ __unordered_multimap<_Key, _Tp, _Hash, _Pred,
+ _Alloc, __cache_hash_code>& __y)
+ { __x.swap(__y); }
+
+
+ /**
+ * @brief A standard container composed of unique keys (containing
+ * at most one of each key value) that associates values of another type
+ * with the keys.
+ *
+ * @ingroup unordered_associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, and
+ * <a href="tables.html#xx">unordered associative container</a>
+ *
+ * @param Key Type of key objects.
+ * @param Tp Type of mapped objects.
+ * @param Hash Hashing function object type, defaults to hash<Value>.
+ * @param Pred Predicate function object type, defaults to equal_to<Value>.
+ * @param Alloc Allocator type, defaults to allocator<Key>.
+ *
+ * The resulting value type of the container is std::pair<const Key, Tp>.
+ */
+ template<class _Key, class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
+ class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class unordered_map
+ : public __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
+ {
+ typedef __unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
+
+ public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ unordered_map(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ { }
+
+ template<typename _InputIterator>
+ unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_map(unordered_map&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_map(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
+ unordered_map&
+ operator=(unordered_map&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ unordered_map&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+ };
+
+ /**
+ * @brief A standard container composed of equivalent keys
+ * (possibly containing multiple of each key value) that associates
+ * values of another type with the keys.
+ *
+ * @ingroup unordered_associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, and
+ * <a href="tables.html#xx">unordered associative container</a>
+ *
+ * @param Key Type of key objects.
+ * @param Tp Type of mapped objects.
+ * @param Hash Hashing function object type, defaults to hash<Value>.
+ * @param Pred Predicate function object type, defaults to equal_to<Value>.
+ * @param Alloc Allocator type, defaults to allocator<Key>.
+ *
+ * The resulting value type of the container is std::pair<const Key, Tp>.
+ */
+ template<class _Key, class _Tp,
+ class _Hash = hash<_Key>,
+ class _Pred = std::equal_to<_Key>,
+ class _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class unordered_multimap
+ : public __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
+ {
+ typedef __unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> _Base;
+
+ public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ unordered_multimap(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ { }
+
+
+ template<typename _InputIterator>
+ unordered_multimap(_InputIterator __f, _InputIterator __l,
+ typename _Base::size_type __n = 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_multimap(unordered_multimap&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_multimap(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
+ unordered_multimap&
+ operator=(unordered_multimap&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ unordered_multimap&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+ };
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_set b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_set
new file mode 100644
index 000000000..fc2ce2b1e
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/unordered_set
@@ -0,0 +1,360 @@
+// TR1 unordered_set -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/unordered_set
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ // XXX When we get typedef templates these class definitions
+ // will be unnecessary.
+ template<class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
+ class _Alloc = std::allocator<_Value>,
+ bool __cache_hash_code = false>
+ class __unordered_set
+ : public _Hashtable<_Value, _Value, _Alloc,
+ std::_Identity<_Value>, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, true, true>
+ {
+ typedef _Hashtable<_Value, _Value, _Alloc,
+ std::_Identity<_Value>, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, true, true>
+ _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ __unordered_set(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(), __eql,
+ std::_Identity<_Value>(), __a)
+ { }
+
+ template<typename _InputIterator>
+ __unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(), __eql,
+ std::_Identity<_Value>(), __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_set(__unordered_set&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
+ };
+
+ template<class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
+ class _Alloc = std::allocator<_Value>,
+ bool __cache_hash_code = false>
+ class __unordered_multiset
+ : public _Hashtable<_Value, _Value, _Alloc,
+ std::_Identity<_Value>, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, true, false>
+ {
+ typedef _Hashtable<_Value, _Value, _Alloc,
+ std::_Identity<_Value>, _Pred,
+ _Hash, __detail::_Mod_range_hashing,
+ __detail::_Default_ranged_hash,
+ __detail::_Prime_rehash_policy,
+ __cache_hash_code, true, false>
+ _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ __unordered_multiset(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(), __eql,
+ std::_Identity<_Value>(), __a)
+ { }
+
+
+ template<typename _InputIterator>
+ __unordered_multiset(_InputIterator __f, _InputIterator __l,
+ typename _Base::size_type __n = 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
+ __detail::_Default_ranged_hash(), __eql,
+ std::_Identity<_Value>(), __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ __unordered_multiset(__unordered_multiset&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+#endif
+ };
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc,
+ bool __cache_hash_code>
+ inline void
+ swap(__unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __x,
+ __unordered_set<_Value, _Hash, _Pred, _Alloc, __cache_hash_code>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc,
+ bool __cache_hash_code>
+ inline void
+ swap(__unordered_multiset<_Value, _Hash, _Pred,
+ _Alloc, __cache_hash_code>& __x,
+ __unordered_multiset<_Value, _Hash, _Pred,
+ _Alloc, __cache_hash_code>& __y)
+ { __x.swap(__y); }
+
+
+ /**
+ * @brief A standard container composed of unique keys (containing
+ * at most one of each key value) in which the elements' keys are
+ * the elements themselves.
+ *
+ * @ingroup unordered_associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, and
+ * <a href="tables.html#xx">unordered associative container</a>
+ *
+ * @param Value Type of key objects.
+ * @param Hash Hashing function object type, defaults to hash<Value>.
+ * @param Pred Predicate function object type, defaults to equal_to<Value>.
+ * @param Alloc Allocator type, defaults to allocator<Key>.
+ */
+ template<class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
+ class _Alloc = std::allocator<_Value> >
+ class unordered_set
+ : public __unordered_set<_Value, _Hash, _Pred, _Alloc>
+ {
+ typedef __unordered_set<_Value, _Hash, _Pred, _Alloc> _Base;
+
+ public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ unordered_set(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ { }
+
+ template<typename _InputIterator>
+ unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_set(unordered_set&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_set(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
+ unordered_set&
+ operator=(unordered_set&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ unordered_set&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+ };
+
+ /**
+ * @brief A standard container composed of equivalent keys
+ * (possibly containing multiple of each key value) in which the
+ * elements' keys are the elements themselves.
+ *
+ * @ingroup unordered_associative_containers
+ *
+ * Meets the requirements of a <a href="tables.html#65">container</a>, and
+ * <a href="tables.html#xx">unordered associative container</a>
+ *
+ * @param Value Type of key objects.
+ * @param Hash Hashing function object type, defaults to hash<Value>.
+ * @param Pred Predicate function object type, defaults to equal_to<Value>.
+ * @param Alloc Allocator type, defaults to allocator<Key>.
+ */
+ template<class _Value,
+ class _Hash = hash<_Value>,
+ class _Pred = std::equal_to<_Value>,
+ class _Alloc = std::allocator<_Value> >
+ class unordered_multiset
+ : public __unordered_multiset<_Value, _Hash, _Pred, _Alloc>
+ {
+ typedef __unordered_multiset<_Value, _Hash, _Pred, _Alloc> _Base;
+
+ public:
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+
+ explicit
+ unordered_multiset(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ { }
+
+
+ template<typename _InputIterator>
+ unordered_multiset(_InputIterator __f, _InputIterator __l,
+ typename _Base::size_type __n = 0,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ { }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ unordered_multiset(unordered_multiset&& __x)
+ : _Base(std::forward<_Base>(__x)) { }
+
+ unordered_multiset(initializer_list<value_type> __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a)
+ { }
+
+ unordered_multiset&
+ operator=(unordered_multiset&& __x)
+ {
+ // NB: DR 675.
+ this->clear();
+ this->swap(__x);
+ return *this;
+ }
+
+ unordered_multiset&
+ operator=(initializer_list<value_type> __l)
+ {
+ this->clear();
+ this->insert(__l.begin(), __l.end());
+ return *this;
+ }
+#endif
+ };
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<class _Value, class _Hash, class _Pred, class _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+#endif
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
diff --git a/gcc-4.4.0/libstdc++-v3/include/tr1_impl/utility b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/utility
new file mode 100644
index 000000000..a31c4da87
--- /dev/null
+++ b/gcc-4.4.0/libstdc++-v3/include/tr1_impl/utility
@@ -0,0 +1,120 @@
+// TR1 utility -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file tr1_impl/utility
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE_TR1
+
+ template<class _Tp>
+ class tuple_size;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, class _Tp>
+#else
+ template<int _Int, class _Tp>
+#endif
+ class tuple_element;
+
+ // Various functions which give std::pair a tuple-like interface.
+ template<class _Tp1, class _Tp2>
+ struct tuple_size<std::pair<_Tp1, _Tp2> >
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ { static const std::size_t value = 2; };
+#else
+ { static const int value = 2; };
+#endif
+
+ template<class _Tp1, class _Tp2>
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ const std::size_t
+#else
+ const int
+#endif
+ tuple_size<std::pair<_Tp1, _Tp2> >::value;
+
+ template<class _Tp1, class _Tp2>
+ struct tuple_element<0, std::pair<_Tp1, _Tp2> >
+ { typedef _Tp1 type; };
+
+ template<class _Tp1, class _Tp2>
+ struct tuple_element<1, std::pair<_Tp1, _Tp2> >
+ { typedef _Tp2 type; };
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int>
+#else
+ template<int _Int>
+#endif
+ struct __pair_get;
+
+ template<>
+ struct __pair_get<0>
+ {
+ template<typename _Tp1, typename _Tp2>
+ static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.first; }
+
+ template<typename _Tp1, typename _Tp2>
+ static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.first; }
+ };
+
+ template<>
+ struct __pair_get<1>
+ {
+ template<typename _Tp1, typename _Tp2>
+ static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.second; }
+
+ template<typename _Tp1, typename _Tp2>
+ static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
+ { return __pair.second; }
+ };
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, class _Tp1, class _Tp2>
+#else
+ template<int _Int, class _Tp1, class _Tp2>
+#endif
+ inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__get(__in); }
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ template<std::size_t _Int, class _Tp1, class _Tp2>
+#else
+ template<int _Int, class _Tp1, class _Tp2>
+#endif
+ inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
+ get(const std::pair<_Tp1, _Tp2>& __in)
+ { return __pair_get<_Int>::__const_get(__in); }
+
+_GLIBCXX_END_NAMESPACE_TR1
+}
+